From fae271186c05eebb43980c25dbf95cfb31a878ee Mon Sep 17 00:00:00 2001 From: CarlosDerSeher Date: Fri, 31 May 2024 20:38:09 +0200 Subject: [PATCH] Sync with sample stuffing (#69) * upgrade to IDF v5.1.1 * add new synchronization implementation, use sample stuffing / removal to keep up sync * use big DMA buffer for I2S and improve sync * Add DAC TAS5805M as custom board * add wifi credential reset o press reset button (nRESET pin) 3 times but wait about 1s between button presses the button press counter is reset 5s after boot * Add support for PT8211 DAC (#78) * upgrade ethernet interface to IDF v5 (#84) * port official example of ethernet for IDF v5.x * Fix cmake if guard for ethernet Signed-off-by: Karl Osterseher Co-authored-by: DerPicknicker <64746593+DerPicknicker@users.noreply.github.com> Co-authored-by: whc2001 --- .cproject | 5 +- .gitignore | 145 + .project | 3321 +++++++--------- README.md | 41 +- components/audio_board/CMakeLists.txt | 68 +- components/audio_board/Kconfig.projbuild | 381 +- .../audio_board/ai_thinker_es8388/board_def.h | 91 +- .../ai_thinker_es8388/board_pins_config.c | 199 +- components/audio_board/component.mk | 10 + .../esp32_c3_lyra/C3_lyra_sys_pattern.c | 305 ++ components/audio_board/esp32_c3_lyra/board.c | 121 + components/audio_board/esp32_c3_lyra/board.h | 129 + .../audio_board/esp32_c3_lyra/board_def.h | 126 + .../esp32_c3_lyra/board_pins_config.c | 107 + .../audio_board/esp32_c6_devkit/board.c | 109 + .../audio_board/esp32_c6_devkit/board.h | 129 + .../audio_board/esp32_c6_devkit/board_def.h | 138 + .../esp32_c6_devkit/board_pins_config.c | 106 + .../audio_board/esp32_korvo_du1906/board.c | 160 + .../audio_board/esp32_korvo_du1906/board.h | 142 + .../esp32_korvo_du1906/board_def.h | 116 + .../esp32_korvo_du1906/board_pins_config.c | 117 + .../esp32_korvo_du1906/du1906_bar_pattern.c | 507 +++ .../esp32_s2_kaluga_1_v1_2/board.c | 149 + .../esp32_s2_kaluga_1_v1_2/board.h | 127 + .../esp32_s2_kaluga_1_v1_2/board_def.h | 143 + .../board_pins_config.c | 115 + components/audio_board/esp32_s3_box/board.c | 187 + components/audio_board/esp32_s3_box/board.h | 135 + .../audio_board/esp32_s3_box/board_def.h | 136 + .../esp32_s3_box/board_pins_config.c | 129 + .../audio_board/esp32_s3_box_lite/board.c | 187 + .../audio_board/esp32_s3_box_lite/board.h | 135 + .../audio_board/esp32_s3_box_lite/board_def.h | 127 + .../esp32_s3_box_lite/board_pins_config.c | 129 + .../audio_board/esp32_s3_korvo2_v3/board.c | 201 + .../audio_board/esp32_s3_korvo2_v3/board.h | 142 + .../esp32_s3_korvo2_v3/board_def.h | 182 + .../esp32_s3_korvo2_v3/board_pins_config.c | 127 + .../audio_board/esp32_s3_korvo2l_v1/board.c | 206 + .../audio_board/esp32_s3_korvo2l_v1/board.h | 143 + .../esp32_s3_korvo2l_v1/board_def.h | 186 + .../esp32_s3_korvo2l_v1/board_pins_config.c | 127 + .../audio_board/include/board_pins_config.h | 394 +- .../lyrat_mini_v1_1/board_pins_config.c | 45 +- components/audio_board/lyrat_v4_2/board.c | 66 + components/audio_board/lyrat_v4_2/board.h | 115 + components/audio_board/lyrat_v4_2/board_def.h | 123 + .../lyrat_v4_2/board_pins_config.c | 119 + components/audio_board/lyrat_v4_3/board.c | 220 +- components/audio_board/lyrat_v4_3/board.h | 150 +- components/audio_board/lyrat_v4_3/board_def.h | 145 +- .../lyrat_v4_3/board_pins_config.c | 215 +- .../audio_board/lyratd_msc_v2_1/board.c | 131 + .../audio_board/lyratd_msc_v2_1/board.h | 115 + .../audio_board/lyratd_msc_v2_1/board_def.h | 119 + .../lyratd_msc_v2_1/board_pins_config.c | 114 + .../audio_board/lyratd_msc_v2_2/board.c | 131 + .../audio_board/lyratd_msc_v2_2/board.h | 115 + .../audio_board/lyratd_msc_v2_2/board_def.h | 120 + .../lyratd_msc_v2_2/board_pins_config.c | 116 + components/audio_hal/CMakeLists.txt | 47 +- components/audio_hal/audio_hal.c | 178 +- components/audio_hal/audio_volume.c | 195 + components/audio_hal/component.mk | 4 +- components/audio_hal/driver/es7148/es7148.c | 83 +- components/audio_hal/driver/es7148/es7148.h | 175 +- components/audio_hal/driver/es7210/es7210.c | 729 ++-- components/audio_hal/driver/es7210/es7210.h | 332 +- components/audio_hal/driver/es7243/es7243.c | 214 +- components/audio_hal/driver/es7243/es7243.h | 181 +- components/audio_hal/driver/es7243e/es7243e.c | 167 + components/audio_hal/driver/es7243e/es7243e.h | 120 + components/audio_hal/driver/es8156/es8156.c | 248 ++ components/audio_hal/driver/es8156/es8156.h | 190 + components/audio_hal/driver/es8311/es8311.c | 1074 +++--- components/audio_hal/driver/es8311/es8311.h | 337 +- components/audio_hal/driver/es8374/es8374.c | 928 ++--- components/audio_hal/driver/es8374/es8374.h | 404 +- components/audio_hal/driver/es8388/es8388.c | 791 ++-- components/audio_hal/driver/es8388/es8388.h | 402 +- .../driver/es8388/headphone_detect.c | 89 +- .../driver/es8388/headphone_detect.h | 69 +- .../audio_hal/driver/include/esxxx_common.h | 330 +- .../audio_hal/driver/tas5805m/tas5805m.c | 395 +- .../audio_hal/driver/tas5805m/tas5805m.h | 187 +- .../driver/tas5805m/tas5805m_reg_cfg.h | 3392 ++++++++--------- .../audio_hal/driver/zl38063/LICENSE.txt | 9 + .../audio_hal/driver/zl38063/Readme_twolf.txt | 36 + .../zl38063/api_lib/vprocTwolf_access.c | 1061 ++++++ .../zl38063/api_lib/vprocTwolf_access.h | 85 + .../driver/zl38063/api_lib/vproc_common.c | 165 + .../driver/zl38063/api_lib/vproc_common.h | 129 + .../driver/zl38063/api_lib/vproc_data_types.h | 124 + .../zl38063/example_apps/tw_hal_verify.c | 307 ++ .../driver/zl38063/example_apps/tw_ldcfg.c | 161 + .../driver/zl38063/example_apps/tw_ldfw.c | 118 + .../driver/zl38063/example_apps/tw_ldfwcfg.c | 222 ++ .../zl38063/example_apps/tw_spi_access.c | 458 +++ .../zl38063/example_apps/tw_spi_access.h | 10 + .../driver/zl38063/firmware/libfirmware.a | Bin 0 -> 114686 bytes .../driver/zl38063/firmware/zl38063_config.h | 44 + .../zl38063/firmware/zl38063_firmware.h | 48 + components/audio_hal/driver/zl38063/zl38063.c | 153 + components/audio_hal/driver/zl38063/zl38063.h | 123 + components/audio_hal/include/audio_hal.h | 432 ++- components/audio_hal/include/audio_volume.h | 99 + components/audio_hal/test/test_audio_hal.c | 221 +- components/audio_sal/CMakeLists.txt | 7 +- components/audio_sal/audio_mem.c | 205 +- components/audio_sal/audio_mutex.c | 72 + components/audio_sal/audio_queue.c | 79 + components/audio_sal/audio_sys.c | 220 +- components/audio_sal/audio_thread.c | 155 +- components/audio_sal/audio_url.c | 79 +- components/audio_sal/include/audio_error.h | 69 +- .../audio_sal/include/audio_idf_version.h | 44 + components/audio_sal/include/audio_mem.h | 207 +- components/audio_sal/include/audio_mutex.h | 63 +- components/audio_sal/include/audio_queue.h | 131 + components/audio_sal/include/audio_sys.h | 99 +- components/audio_sal/include/audio_thread.h | 118 +- components/audio_sal/include/audio_url.h | 73 +- components/audio_sal/include/media_os_ctype.h | 199 + components/audio_sal/media_os_ctype.c | 55 + components/audio_sal/test/audio_mem_test.c | 108 +- components/custom_board/CMakeLists.txt | 14 +- components/custom_board/Kconfig.projbuild | 184 +- components/custom_board/component.mk | 10 + components/custom_board/generic_board/board.c | 6 + .../generic_board/board_pins_config.c | 36 +- .../generic_board/include/board_def.h | 2 + components/custom_board/ma120/ma120.c | 27 +- components/custom_board/ma120x0/MerusAudio.c | 14 +- .../custom_board/ma120x0/include/MerusAudio.h | 4 + components/custom_board/max98357/max98357.c | 2 +- components/custom_board/pcm5102a/pcm5102a.c | 45 +- .../custom_board/pt8211/include/pt8211.h | 49 + components/custom_board/pt8211/pt8211.c | 90 + .../custom_board/tas5805m/include/tas5805m.h | 146 + .../tas5805m/include/tas5805m_reg_cfg.h | 100 + components/custom_board/tas5805m/tas5805m.c | 291 ++ components/custom_driver/CMakeLists.txt | 2 - components/custom_driver/component.mk | 2 - components/custom_driver/i2s.c | 1290 ------- components/custom_driver/include/i2s.h | 379 -- components/esp-dsp/.gitignore | 54 - components/esp-dsp/.gitlab-ci.yml | 98 - components/esp-dsp/CMakeLists.txt | 108 - components/esp-dsp/Kconfig | 53 - components/esp-dsp/LICENSE | 202 - components/esp-dsp/README.md | 71 - components/esp-dsp/build_examples.sh | 52 - components/esp-dsp/component.mk | 87 - components/esp-dsp/docs/Doxyfile | 109 - components/esp-dsp/docs/Makefile | 2 - components/esp-dsp/docs/check_doc_warnings.sh | 46 - components/esp-dsp/docs/conf.py | 19 - components/esp-dsp/docs/conf_common.py | 317 -- components/esp-dsp/docs/docs_common.mk | 214 -- components/esp-dsp/docs/esp-dsp-apis.rst | 108 - .../esp-dsp/docs/esp-dsp-benchmarks.rst | 66 - components/esp-dsp/docs/esp-dsp-library.rst | 78 - components/esp-dsp/docs/gen-dxd.py | 318 -- components/esp-dsp/docs/index.rst | 9 - components/esp-dsp/docs/issue_template.md | 80 - components/esp-dsp/docs/link-roles.py | 46 - components/esp-dsp/docs/local_util.py | 57 - components/esp-dsp/docs/requirements.txt | 8 - .../esp-dsp/docs/sphinx-known-warnings.txt | 0 components/esp-dsp/examples/README.md | 18 - .../examples/basic_math/CMakeLists.txt | 9 - .../esp-dsp/examples/basic_math/Makefile | 16 - .../esp-dsp/examples/basic_math/README.md | 83 - .../examples/basic_math/main/CMakeLists.txt | 4 - .../examples/basic_math/main/component.mk | 8 - .../examples/basic_math/main/dsps_math_main.c | 93 - .../esp-dsp/examples/dotprod/CMakeLists.txt | 9 - components/esp-dsp/examples/dotprod/Makefile | 16 - components/esp-dsp/examples/dotprod/README.md | 50 - .../examples/dotprod/main/CMakeLists.txt | 4 - .../examples/dotprod/main/component.mk | 8 - .../dotprod/main/dsps_dotproduct_main.c | 63 - .../esp-dsp/examples/fft/CMakeLists.txt | 9 - components/esp-dsp/examples/fft/Makefile | 16 - components/esp-dsp/examples/fft/README.md | 99 - .../esp-dsp/examples/fft/main/CMakeLists.txt | 4 - .../esp-dsp/examples/fft/main/component.mk | 8 - .../esp-dsp/examples/fft/main/dsps_fft_main.c | 101 - .../esp-dsp/examples/fft4real/CMakeLists.txt | 9 - components/esp-dsp/examples/fft4real/Makefile | 16 - .../esp-dsp/examples/fft4real/README.md | 99 - .../examples/fft4real/main/CMakeLists.txt | 4 - .../examples/fft4real/main/component.mk | 8 - .../fft4real/main/dsps_fft4real_main.c | 114 - .../esp-dsp/examples/fft4real/main/linker.ld | 9 - .../examples/fft_window/CMakeLists.txt | 9 - .../esp-dsp/examples/fft_window/Makefile | 16 - .../esp-dsp/examples/fft_window/README.md | 142 - .../examples/fft_window/main/CMakeLists.txt | 4 - .../examples/fft_window/main/component.mk | 8 - .../fft_window/main/dsps_window_main.c | 141 - .../esp-dsp/examples/iir/CMakeLists.txt | 9 - components/esp-dsp/examples/iir/Makefile | 16 - components/esp-dsp/examples/iir/README.md | 115 - .../esp-dsp/examples/iir/main/CMakeLists.txt | 4 - .../esp-dsp/examples/iir/main/component.mk | 8 - .../esp-dsp/examples/iir/main/dsps_iir_main.c | 112 - .../esp-dsp/examples/matrix/CMakeLists.txt | 9 - components/esp-dsp/examples/matrix/Makefile | 16 - components/esp-dsp/examples/matrix/README.md | 62 - .../examples/matrix/main/CMakeLists.txt | 4 - .../esp-dsp/examples/matrix/main/component.mk | 8 - .../examples/matrix/main/dspm_matrix_main.cpp | 62 - .../modules/common/include/dsp_common.h | 53 - .../esp-dsp/modules/common/include/dsp_err.h | 23 - .../modules/common/include/dsp_err_codes.h | 27 - .../modules/common/include/dsp_platform.h | 25 - .../modules/common/include/dsp_tests.h | 29 - .../esp-dsp/modules/common/include/esp_dsp.h | 61 - .../modules/common/misc/dsps_pwroftwo.cpp | 30 - .../common/private_include/dsp_types.h | 27 - .../modules/conv/float/dsps_ccorr_f32_ae32.S | 144 - .../modules/conv/float/dsps_ccorr_f32_ansi.c | 81 - .../modules/conv/float/dsps_conv_f32_ae32.S | 147 - .../modules/conv/float/dsps_conv_f32_ansi.c | 81 - .../modules/conv/float/dsps_conv_f32_m_ae32.S | 39 - .../modules/conv/float/dsps_corr_f32_ae32.S | 76 - .../modules/conv/float/dsps_corr_f32_ansi.c | 40 - .../esp-dsp/modules/conv/include/dsps_ccorr.h | 63 - .../esp-dsp/modules/conv/include/dsps_conv.h | 65 - .../modules/conv/include/dsps_conv_platform.h | 16 - .../esp-dsp/modules/conv/include/dsps_corr.h | 63 - .../conv/test/test_dsps_ccorr_f32_ae32.c | 78 - .../conv/test/test_dsps_ccorr_f32_ansi.c | 110 - .../conv/test/test_dsps_conv_f32_ae32.c | 120 - .../conv/test/test_dsps_conv_f32_ansi.c | 140 - .../conv/test/test_dsps_corr_f32_ae32.c | 79 - .../conv/test/test_dsps_corr_f32_ansi.c | 79 - .../esp-dsp/modules/dct/float/dsps_dct_f32.c | 106 - .../esp-dsp/modules/dct/include/dsps_dct.h | 95 - .../modules/dct/test/test_dsps_dct_f32.c | 160 - .../dotprod/fixed/dsps_dotprod_s16_ae32.S | 80 - .../dotprod/fixed/dsps_dotprod_s16_ansi.c | 34 - .../dotprod/fixed/dsps_dotprod_s16_m_ae32.S | 104 - .../dotprod/float/dsps_dotprod_f32_ae32.S | 60 - .../dotprod/float/dsps_dotprod_f32_ansi.c | 25 - .../dotprod/float/dsps_dotprod_f32_m_ae32.S | 42 - .../dotprod/float/dsps_dotprode_f32_ae32.S | 64 - .../dotprod/float/dsps_dotprode_f32_ansi.c | 25 - .../dotprod/float/dsps_dotprode_f32_m_ae32.S | 41 - .../modules/dotprod/include/dsps_dotprod.h | 117 - .../dotprod/include/dsps_dotprod_platform.h | 21 - .../modules/dotprod/test/test_dotprod_f32.c | 164 - .../modules/dotprod/test/test_dotprod_s16.c | 220 -- .../modules/dotprod/test/test_dotprode_f32.c | 164 - .../modules/fft/fixed/dsps_fft2r_sc16_ae32.S | 180 - .../modules/fft/fixed/dsps_fft2r_sc16_ansi.c | 320 -- .../fft/float/dsps_fft2r_bitrev_tables_fc32.c | 590 --- .../modules/fft/float/dsps_fft2r_fc32_ae32.c | 63 - .../modules/fft/float/dsps_fft2r_fc32_ae32_.S | 149 - .../modules/fft/float/dsps_fft2r_fc32_ansi.c | 346 -- .../fft/float/dsps_fft4r_bitrev_tables_fc32.c | 407 -- .../modules/fft/float/dsps_fft4r_fc32_ae32.c | 251 -- .../modules/fft/float/dsps_fft4r_fc32_ansi.c | 331 -- .../esp-dsp/modules/fft/include/dsps_fft2r.h | 233 -- .../modules/fft/include/dsps_fft2r_platform.h | 28 - .../esp-dsp/modules/fft/include/dsps_fft4r.h | 174 - .../modules/fft/include/dsps_fft4r_platform.h | 30 - .../modules/fft/include/dsps_fft_tables.h | 89 - .../fft/test/test_dsps_fft2r_fc32_ae32.c | 162 - .../fft/test/test_dsps_fft2r_fc32_ansi.c | 122 - .../fft/test/test_dsps_fft2r_sc16_ae32.c | 191 - .../fft/test/test_dsps_fft2r_sc16_ansi.c | 120 - .../fft/test/test_dsps_fft4r_fc32_ae32.c | 198 - .../fft/test/test_dsps_fft4r_fc32_ansi.c | 236 -- .../modules/fir/float/dsps_fir_f32_ae32.S | 95 - .../modules/fir/float/dsps_fir_f32_ansi.c | 37 - .../modules/fir/float/dsps_fir_init_f32.c | 29 - .../modules/fir/float/dsps_fird_f32_ae32.S | 104 - .../modules/fir/float/dsps_fird_f32_ansi.c | 40 - .../modules/fir/float/dsps_fird_init_f32.c | 34 - .../esp-dsp/modules/fir/include/dsps_fir.h | 146 - .../modules/fir/include/dsps_fir_platform.h | 15 - .../modules/fir/test/test_dsps_fir_f32_ae32.c | 128 - .../modules/fir/test/test_dsps_fir_f32_ansi.c | 118 - .../fir/test/test_dsps_fird_f32_ae32.c | 112 - .../fir/test/test_dsps_fird_f32_ansi.c | 103 - .../modules/iir/biquad/dsps_biquad_f32_ae32.S | 89 - .../modules/iir/biquad/dsps_biquad_f32_ansi.c | 28 - .../modules/iir/biquad/dsps_biquad_gen_f32.c | 290 -- .../esp-dsp/modules/iir/include/dsps_biquad.h | 66 - .../modules/iir/include/dsps_biquad_gen.h | 200 - .../iir/include/dsps_biquad_platform.h | 14 - .../modules/iir/test/test_bq_f32_ae32.c | 102 - .../modules/iir/test/test_bq_f32_ansi.c | 63 - .../math/add/fixed/dsps_add_s16_ae32.S | 82 - .../math/add/fixed/dsps_add_s16_ansi.c | 28 - .../math/add/float/dsps_add_f32_ae32.S | 64 - .../math/add/float/dsps_add_f32_ansi.c | 27 - .../modules/math/add/include/dsps_add.h | 78 - .../math/add/include/dsps_add_platform.h | 19 - .../math/add/test/test_dsps_add_f32_ansi.c | 70 - .../math/add/test/test_dsps_add_s16_ae32.c | 68 - .../math/add/test/test_dsps_add_s16_ansi.c | 67 - .../math/addc/float/dsps_addc_f32_ae32.S | 57 - .../math/addc/float/dsps_addc_f32_ansi.c | 26 - .../modules/math/addc/include/dsps_addc.h | 65 - .../math/addc/include/dsps_addc_platform.h | 15 - .../math/addc/test/test_dsps_addc_f32_ansi.c | 70 - .../esp-dsp/modules/math/include/dsps_math.h | 25 - .../math/mul/fixed/dsps_mul_s16_ansi.c | 28 - .../math/mul/float/dsps_mul_f32_ae32.S | 64 - .../math/mul/float/dsps_mul_f32_ansi.c | 27 - .../modules/math/mul/include/dsps_mul.h | 92 - .../math/mul/include/dsps_mul_platform.h | 14 - .../math/mul/test/test_dsps_mul_f32_ansi.c | 70 - .../math/mulc/fixed/dsps_mulc_s16_ae32.S | 77 - .../math/mulc/fixed/dsps_mulc_s16_ansi.c | 27 - .../math/mulc/float/dsps_mulc_f32_ae32.S | 57 - .../math/mulc/float/dsps_mulc_f32_ansi.c | 26 - .../modules/math/mulc/include/dsps_mulc.h | 75 - .../math/mulc/include/dsps_mulc_platform.h | 21 - .../math/mulc/test/test_dsps_mulc_f32_ansi.c | 69 - .../math/mulc/test/test_dsps_mulc_s16_ae32.c | 67 - .../math/mulc/test/test_dsps_mulc_s16_ansi.c | 67 - .../math/sqrt/float/dsps_sqrt_f32_ansi.c | 55 - .../modules/math/sqrt/include/dsps_sqrt.h | 91 - .../math/sqrt/test/test_dsps_sqrt_f32_ansi.c | 83 - .../math/sub/float/dsps_sub_f32_ae32.S | 64 - .../math/sub/float/dsps_sub_f32_ansi.c | 27 - .../modules/math/sub/include/dsps_sub.h | 67 - .../math/sub/include/dsps_sub_platform.h | 14 - .../math/sub/test/test_dsps_sub_f32_ansi.c | 68 - .../modules/matrix/fixed/dspm_mult_s16_ae32.S | 172 - .../modules/matrix/fixed/dspm_mult_s16_ansi.c | 40 - .../matrix/fixed/dspm_mult_s16_m_ae32.S | 58 - .../fixed/dspm_mult_s16_m_ae32_vector.S | 105 - .../matrix/float/dspm_mult_3x3x1_f32_ae32.S | 75 - .../matrix/float/dspm_mult_3x3x3_f32_ae32.S | 85 - .../matrix/float/dspm_mult_4x4x1_f32_ae32.S | 77 - .../matrix/float/dspm_mult_4x4x4_f32_ae32.S | 88 - .../modules/matrix/float/dspm_mult_f32_ae32.S | 103 - .../modules/matrix/float/dspm_mult_f32_ansi.c | 33 - .../modules/matrix/include/dspm_mult.h | 182 - .../matrix/include/dspm_mult_platform.h | 26 - .../esp-dsp/modules/matrix/include/mat.h | 504 --- components/esp-dsp/modules/matrix/mat/mat.cpp | 713 ---- .../modules/matrix/test/test_mat_f32.cpp | 280 -- .../matrix/test/test_mmult_3x3xx_f32_ae32.c | 190 - .../matrix/test/test_mmult_4x4xx_f32_ae32.c | 188 - .../modules/matrix/test/test_mmult_f32_ae32.c | 108 - .../modules/matrix/test/test_mmult_f32_ansi.c | 119 - .../modules/matrix/test/test_mmult_s16_ae32.c | 104 - .../modules/matrix/test/test_mmult_s16_ansi.c | 111 - .../modules/support/include/dsps_d_gen.h | 47 - .../modules/support/include/dsps_h_gen.h | 48 - .../modules/support/include/dsps_sfdr.h | 51 - .../modules/support/include/dsps_snr.h | 51 - .../modules/support/include/dsps_tone_gen.h | 48 - .../modules/support/include/dsps_view.h | 64 - .../esp-dsp/modules/support/misc/dsps_d_gen.c | 30 - .../esp-dsp/modules/support/misc/dsps_h_gen.c | 32 - .../modules/support/misc/dsps_tone_gen.c | 39 - .../support/sfdr/float/dsps_sfdr_f32.cpp | 74 - .../support/sfdr/test/test_dsps_sfdr_f32.c | 43 - .../support/snr/float/dsps_snr_f32.cpp | 78 - .../support/snr/test/test_dsps_snr_f32.c | 43 - .../modules/support/view/dsps_view.cpp | 119 - .../support/view/test/test_dsps_view.c | 36 - .../blackman/float/dsps_wind_blackman_f32.c | 29 - .../blackman/include/dsps_wind_blackman.h | 38 - .../float/dsps_wind_blackman_harris_f32.c | 33 - .../include/dsps_wind_blackman_harris.h | 38 - .../float/dsps_wind_blackman_nuttall_f32.c | 33 - .../include/dsps_wind_blackman_nuttall.h | 38 - .../flat_top/float/dsps_wind_flat_top_f32.c | 35 - .../flat_top/include/dsps_wind_flat_top.h | 38 - .../windows/hann/float/dsps_wind_hann_f32.c | 25 - .../windows/hann/include/dsps_wind_hann.h | 38 - .../modules/windows/include/dsps_wind.h | 26 - .../nuttall/float/dsps_wind_nuttall_f32.c | 33 - .../nuttall/include/dsps_wind_nuttall.h | 38 - .../modules/windows/test/test_wind_f32.c | 102 - components/esp-dsp/test/CMakeLists.txt | 25 - components/esp-dsp/test/component.mk | 23 - components/esp-dsp/test/linker.lf | 20 - components/esp-dsp/test/report.inc | 97 - components/esp-dsp/test/test_dsp.c | 228 -- components/esp-dsp/test_app/CMakeLists.txt | 12 - components/esp-dsp/test_app/Makefile | 13 - .../esp-dsp/test_app/main/CMakeLists.txt | 4 - components/esp-dsp/test_app/main/component.mk | 0 .../esp-dsp/test_app/main/test_app_main.c | 6 - .../esp-dsp/test_app/sdkconfig.defaults | 2 - .../esp_peripherals/driver/i2c_bus/i2c_bus.c | 291 +- .../esp_peripherals/driver/i2c_bus/i2c_bus.h | 189 +- components/esp_peripherals/esp_peripherals.c | 608 ++- .../esp_peripherals/include/esp_peripherals.h | 943 ++--- .../include/periph_adc_button.h | 119 +- .../esp_peripherals/include/periph_aw2013.h | 188 +- .../esp_peripherals/include/periph_button.h | 86 +- .../esp_peripherals/include/periph_console.h | 88 +- .../esp_peripherals/include/periph_gpio_isr.h | 105 +- .../include/periph_is31fl3216.h | 309 +- .../esp_peripherals/include/periph_lcd.h | 97 + .../esp_peripherals/include/periph_led.h | 169 +- .../esp_peripherals/include/periph_sdcard.h | 122 +- .../esp_peripherals/include/periph_spiffs.h | 106 +- .../esp_peripherals/include/periph_touch.h | 124 +- .../esp_peripherals/include/periph_wifi.h | 252 +- .../esp_peripherals/include/periph_ws2812.h | 169 +- .../lib/IS31FL3216/IS31FL3216.c | 506 ++- .../lib/IS31FL3216/IS31FL3216.h | 780 ++-- .../lib/adc_button/adc_button.c | 683 ++-- .../lib/adc_button/adc_button.h | 137 +- .../esp_peripherals/lib/aw2013/aw2013.c | 398 +- .../esp_peripherals/lib/aw2013/aw2013.h | 280 +- .../lib/blufi/blufi_security.c | 273 +- .../lib/blufi/blufi_security.h | 145 +- .../esp_peripherals/lib/blufi/wifibleconfig.c | 340 +- .../esp_peripherals/lib/blufi/wifibleconfig.h | 53 +- .../esp_peripherals/lib/button/button.c | 207 +- .../esp_peripherals/lib/button/button.h | 130 +- .../esp_peripherals/lib/gpio_isr/gpio_isr.c | 54 +- .../esp_peripherals/lib/gpio_isr/gpio_isr.h | 61 +- .../esp_peripherals/lib/sdcard/sdcard.c | 311 +- .../esp_peripherals/lib/sdcard/sdcard.h | 130 +- .../esp_peripherals/lib/tca9554/tca9554.c | 198 + .../esp_peripherals/lib/tca9554/tca9554.h | 165 + components/esp_peripherals/lib/touch/touch.c | 347 +- components/esp_peripherals/lib/touch/touch.h | 132 +- .../esp_peripherals/periph_adc_button.c | 108 +- components/esp_peripherals/periph_aw2013.c | 173 +- components/esp_peripherals/periph_button.c | 146 +- components/esp_peripherals/periph_console.c | 440 +-- components/esp_peripherals/periph_gpio_isr.c | 178 +- .../esp_peripherals/periph_is31fl3216.c | 643 ++-- components/esp_peripherals/periph_lcd.c | 154 + components/esp_peripherals/periph_led.c | 352 +- components/esp_peripherals/periph_sdcard.c | 278 +- components/esp_peripherals/periph_spiffs.c | 281 +- components/esp_peripherals/periph_touch.c | 149 +- components/esp_peripherals/periph_wifi.c | 826 ++-- components/esp_peripherals/periph_ws2812.c | 606 ++- .../test/esp_peripherals_test.c | 1063 +++--- components/eth_interface/CMakeLists.txt | 12 +- components/eth_interface/Kconfig.projbuild | 259 +- components/eth_interface/eth_interface.c | 477 ++- .../eth_interface/include/eth_interface.h | 13 +- components/flac/CMakeLists.txt | 3 + components/lightsnapcast/CMakeLists.txt | 2 +- components/lightsnapcast/include/player.h | 4 +- components/lightsnapcast/player.c | 590 +-- components/net_functions/CMakeLists.txt | 2 +- components/net_functions/net_functions.c | 181 +- components/opus/CMakeLists.txt | 2 + components/ota_server/ota_server.c | 8 +- components/protocol/CMakeLists.txt | 6 +- components/rtprx/CMakeLists.txt | 6 +- components/ui_http_server/CMakeLists.txt | 2 +- components/websocket_if/CMakeLists.txt | 7 +- components/websocket_if/websocket_if.c | 137 +- components/wifi_interface/CMakeLists.txt | 2 +- .../wifi_interface/include/wifi_interface.h | 6 +- components/wifi_interface/wifi_interface.c | 97 +- dependencies.lock | 21 + doc/docker_build.md | 23 +- main/CMakeLists.txt | 5 +- main/Kconfig.projbuild | 11 + main/idf_component.yml | 18 + main/main.c | 290 +- partitions.csv | 5 +- sdkconfig | 1345 +++++-- sdkconfig.old | 1431 +++++-- sdkconfig_PSRAM_lyrat_v4.3 | 1512 +++++--- sdkconfig_TAS5805M | 2038 ++++++++++ 477 files changed, 34562 insertions(+), 40950 deletions(-) create mode 100644 components/audio_board/esp32_c3_lyra/C3_lyra_sys_pattern.c create mode 100644 components/audio_board/esp32_c3_lyra/board.c create mode 100644 components/audio_board/esp32_c3_lyra/board.h create mode 100644 components/audio_board/esp32_c3_lyra/board_def.h create mode 100644 components/audio_board/esp32_c3_lyra/board_pins_config.c create mode 100644 components/audio_board/esp32_c6_devkit/board.c create mode 100644 components/audio_board/esp32_c6_devkit/board.h create mode 100644 components/audio_board/esp32_c6_devkit/board_def.h create mode 100644 components/audio_board/esp32_c6_devkit/board_pins_config.c create mode 100644 components/audio_board/esp32_korvo_du1906/board.c create mode 100644 components/audio_board/esp32_korvo_du1906/board.h create mode 100644 components/audio_board/esp32_korvo_du1906/board_def.h create mode 100644 components/audio_board/esp32_korvo_du1906/board_pins_config.c create mode 100644 components/audio_board/esp32_korvo_du1906/du1906_bar_pattern.c create mode 100644 components/audio_board/esp32_s2_kaluga_1_v1_2/board.c create mode 100644 components/audio_board/esp32_s2_kaluga_1_v1_2/board.h create mode 100644 components/audio_board/esp32_s2_kaluga_1_v1_2/board_def.h create mode 100644 components/audio_board/esp32_s2_kaluga_1_v1_2/board_pins_config.c create mode 100644 components/audio_board/esp32_s3_box/board.c create mode 100644 components/audio_board/esp32_s3_box/board.h create mode 100644 components/audio_board/esp32_s3_box/board_def.h create mode 100644 components/audio_board/esp32_s3_box/board_pins_config.c create mode 100644 components/audio_board/esp32_s3_box_lite/board.c create mode 100644 components/audio_board/esp32_s3_box_lite/board.h create mode 100644 components/audio_board/esp32_s3_box_lite/board_def.h create mode 100644 components/audio_board/esp32_s3_box_lite/board_pins_config.c create mode 100644 components/audio_board/esp32_s3_korvo2_v3/board.c create mode 100644 components/audio_board/esp32_s3_korvo2_v3/board.h create mode 100644 components/audio_board/esp32_s3_korvo2_v3/board_def.h create mode 100644 components/audio_board/esp32_s3_korvo2_v3/board_pins_config.c create mode 100644 components/audio_board/esp32_s3_korvo2l_v1/board.c create mode 100644 components/audio_board/esp32_s3_korvo2l_v1/board.h create mode 100644 components/audio_board/esp32_s3_korvo2l_v1/board_def.h create mode 100644 components/audio_board/esp32_s3_korvo2l_v1/board_pins_config.c create mode 100644 components/audio_board/lyrat_v4_2/board.c create mode 100644 components/audio_board/lyrat_v4_2/board.h create mode 100644 components/audio_board/lyrat_v4_2/board_def.h create mode 100644 components/audio_board/lyrat_v4_2/board_pins_config.c create mode 100644 components/audio_board/lyratd_msc_v2_1/board.c create mode 100644 components/audio_board/lyratd_msc_v2_1/board.h create mode 100644 components/audio_board/lyratd_msc_v2_1/board_def.h create mode 100644 components/audio_board/lyratd_msc_v2_1/board_pins_config.c create mode 100644 components/audio_board/lyratd_msc_v2_2/board.c create mode 100644 components/audio_board/lyratd_msc_v2_2/board.h create mode 100644 components/audio_board/lyratd_msc_v2_2/board_def.h create mode 100644 components/audio_board/lyratd_msc_v2_2/board_pins_config.c create mode 100644 components/audio_hal/audio_volume.c create mode 100644 components/audio_hal/driver/es7243e/es7243e.c create mode 100644 components/audio_hal/driver/es7243e/es7243e.h create mode 100644 components/audio_hal/driver/es8156/es8156.c create mode 100644 components/audio_hal/driver/es8156/es8156.h create mode 100644 components/audio_hal/driver/zl38063/LICENSE.txt create mode 100644 components/audio_hal/driver/zl38063/Readme_twolf.txt create mode 100644 components/audio_hal/driver/zl38063/api_lib/vprocTwolf_access.c create mode 100644 components/audio_hal/driver/zl38063/api_lib/vprocTwolf_access.h create mode 100644 components/audio_hal/driver/zl38063/api_lib/vproc_common.c create mode 100644 components/audio_hal/driver/zl38063/api_lib/vproc_common.h create mode 100644 components/audio_hal/driver/zl38063/api_lib/vproc_data_types.h create mode 100644 components/audio_hal/driver/zl38063/example_apps/tw_hal_verify.c create mode 100644 components/audio_hal/driver/zl38063/example_apps/tw_ldcfg.c create mode 100644 components/audio_hal/driver/zl38063/example_apps/tw_ldfw.c create mode 100644 components/audio_hal/driver/zl38063/example_apps/tw_ldfwcfg.c create mode 100644 components/audio_hal/driver/zl38063/example_apps/tw_spi_access.c create mode 100644 components/audio_hal/driver/zl38063/example_apps/tw_spi_access.h create mode 100644 components/audio_hal/driver/zl38063/firmware/libfirmware.a create mode 100644 components/audio_hal/driver/zl38063/firmware/zl38063_config.h create mode 100644 components/audio_hal/driver/zl38063/firmware/zl38063_firmware.h create mode 100644 components/audio_hal/driver/zl38063/zl38063.c create mode 100644 components/audio_hal/driver/zl38063/zl38063.h create mode 100644 components/audio_hal/include/audio_volume.h create mode 100644 components/audio_sal/audio_mutex.c create mode 100644 components/audio_sal/audio_queue.c create mode 100644 components/audio_sal/include/audio_idf_version.h create mode 100644 components/audio_sal/include/audio_queue.h create mode 100644 components/audio_sal/include/media_os_ctype.h create mode 100644 components/audio_sal/media_os_ctype.c create mode 100644 components/custom_board/pt8211/include/pt8211.h create mode 100644 components/custom_board/pt8211/pt8211.c create mode 100644 components/custom_board/tas5805m/include/tas5805m.h create mode 100644 components/custom_board/tas5805m/include/tas5805m_reg_cfg.h create mode 100644 components/custom_board/tas5805m/tas5805m.c delete mode 100644 components/custom_driver/CMakeLists.txt delete mode 100644 components/custom_driver/component.mk delete mode 100644 components/custom_driver/i2s.c delete mode 100644 components/custom_driver/include/i2s.h delete mode 100644 components/esp-dsp/.gitignore delete mode 100644 components/esp-dsp/.gitlab-ci.yml delete mode 100644 components/esp-dsp/CMakeLists.txt delete mode 100644 components/esp-dsp/Kconfig delete mode 100644 components/esp-dsp/LICENSE delete mode 100644 components/esp-dsp/README.md delete mode 100644 components/esp-dsp/build_examples.sh delete mode 100644 components/esp-dsp/component.mk delete mode 100644 components/esp-dsp/docs/Doxyfile delete mode 100644 components/esp-dsp/docs/Makefile delete mode 100644 components/esp-dsp/docs/check_doc_warnings.sh delete mode 100644 components/esp-dsp/docs/conf.py delete mode 100644 components/esp-dsp/docs/conf_common.py delete mode 100644 components/esp-dsp/docs/docs_common.mk delete mode 100644 components/esp-dsp/docs/esp-dsp-apis.rst delete mode 100644 components/esp-dsp/docs/esp-dsp-benchmarks.rst delete mode 100644 components/esp-dsp/docs/esp-dsp-library.rst delete mode 100644 components/esp-dsp/docs/gen-dxd.py delete mode 100644 components/esp-dsp/docs/index.rst delete mode 100644 components/esp-dsp/docs/issue_template.md delete mode 100644 components/esp-dsp/docs/link-roles.py delete mode 100644 components/esp-dsp/docs/local_util.py delete mode 100644 components/esp-dsp/docs/requirements.txt delete mode 100644 components/esp-dsp/docs/sphinx-known-warnings.txt delete mode 100644 components/esp-dsp/examples/README.md delete mode 100644 components/esp-dsp/examples/basic_math/CMakeLists.txt delete mode 100644 components/esp-dsp/examples/basic_math/Makefile delete mode 100644 components/esp-dsp/examples/basic_math/README.md delete mode 100644 components/esp-dsp/examples/basic_math/main/CMakeLists.txt delete mode 100644 components/esp-dsp/examples/basic_math/main/component.mk delete mode 100644 components/esp-dsp/examples/basic_math/main/dsps_math_main.c delete mode 100644 components/esp-dsp/examples/dotprod/CMakeLists.txt delete mode 100644 components/esp-dsp/examples/dotprod/Makefile delete mode 100644 components/esp-dsp/examples/dotprod/README.md delete mode 100644 components/esp-dsp/examples/dotprod/main/CMakeLists.txt delete mode 100644 components/esp-dsp/examples/dotprod/main/component.mk delete mode 100644 components/esp-dsp/examples/dotprod/main/dsps_dotproduct_main.c delete mode 100644 components/esp-dsp/examples/fft/CMakeLists.txt delete mode 100644 components/esp-dsp/examples/fft/Makefile delete mode 100644 components/esp-dsp/examples/fft/README.md delete mode 100644 components/esp-dsp/examples/fft/main/CMakeLists.txt delete mode 100644 components/esp-dsp/examples/fft/main/component.mk delete mode 100644 components/esp-dsp/examples/fft/main/dsps_fft_main.c delete mode 100644 components/esp-dsp/examples/fft4real/CMakeLists.txt delete mode 100644 components/esp-dsp/examples/fft4real/Makefile delete mode 100644 components/esp-dsp/examples/fft4real/README.md delete mode 100644 components/esp-dsp/examples/fft4real/main/CMakeLists.txt delete mode 100644 components/esp-dsp/examples/fft4real/main/component.mk delete mode 100644 components/esp-dsp/examples/fft4real/main/dsps_fft4real_main.c delete mode 100644 components/esp-dsp/examples/fft4real/main/linker.ld delete mode 100644 components/esp-dsp/examples/fft_window/CMakeLists.txt delete mode 100644 components/esp-dsp/examples/fft_window/Makefile delete mode 100644 components/esp-dsp/examples/fft_window/README.md delete mode 100644 components/esp-dsp/examples/fft_window/main/CMakeLists.txt delete mode 100644 components/esp-dsp/examples/fft_window/main/component.mk delete mode 100644 components/esp-dsp/examples/fft_window/main/dsps_window_main.c delete mode 100644 components/esp-dsp/examples/iir/CMakeLists.txt delete mode 100644 components/esp-dsp/examples/iir/Makefile delete mode 100644 components/esp-dsp/examples/iir/README.md delete mode 100644 components/esp-dsp/examples/iir/main/CMakeLists.txt delete mode 100644 components/esp-dsp/examples/iir/main/component.mk delete mode 100644 components/esp-dsp/examples/iir/main/dsps_iir_main.c delete mode 100644 components/esp-dsp/examples/matrix/CMakeLists.txt delete mode 100644 components/esp-dsp/examples/matrix/Makefile delete mode 100644 components/esp-dsp/examples/matrix/README.md delete mode 100644 components/esp-dsp/examples/matrix/main/CMakeLists.txt delete mode 100644 components/esp-dsp/examples/matrix/main/component.mk delete mode 100644 components/esp-dsp/examples/matrix/main/dspm_matrix_main.cpp delete mode 100644 components/esp-dsp/modules/common/include/dsp_common.h delete mode 100644 components/esp-dsp/modules/common/include/dsp_err.h delete mode 100644 components/esp-dsp/modules/common/include/dsp_err_codes.h delete mode 100644 components/esp-dsp/modules/common/include/dsp_platform.h delete mode 100644 components/esp-dsp/modules/common/include/dsp_tests.h delete mode 100644 components/esp-dsp/modules/common/include/esp_dsp.h delete mode 100644 components/esp-dsp/modules/common/misc/dsps_pwroftwo.cpp delete mode 100644 components/esp-dsp/modules/common/private_include/dsp_types.h delete mode 100644 components/esp-dsp/modules/conv/float/dsps_ccorr_f32_ae32.S delete mode 100644 components/esp-dsp/modules/conv/float/dsps_ccorr_f32_ansi.c delete mode 100644 components/esp-dsp/modules/conv/float/dsps_conv_f32_ae32.S delete mode 100644 components/esp-dsp/modules/conv/float/dsps_conv_f32_ansi.c delete mode 100644 components/esp-dsp/modules/conv/float/dsps_conv_f32_m_ae32.S delete mode 100644 components/esp-dsp/modules/conv/float/dsps_corr_f32_ae32.S delete mode 100644 components/esp-dsp/modules/conv/float/dsps_corr_f32_ansi.c delete mode 100644 components/esp-dsp/modules/conv/include/dsps_ccorr.h delete mode 100644 components/esp-dsp/modules/conv/include/dsps_conv.h delete mode 100644 components/esp-dsp/modules/conv/include/dsps_conv_platform.h delete mode 100644 components/esp-dsp/modules/conv/include/dsps_corr.h delete mode 100644 components/esp-dsp/modules/conv/test/test_dsps_ccorr_f32_ae32.c delete mode 100644 components/esp-dsp/modules/conv/test/test_dsps_ccorr_f32_ansi.c delete mode 100644 components/esp-dsp/modules/conv/test/test_dsps_conv_f32_ae32.c delete mode 100644 components/esp-dsp/modules/conv/test/test_dsps_conv_f32_ansi.c delete mode 100644 components/esp-dsp/modules/conv/test/test_dsps_corr_f32_ae32.c delete mode 100644 components/esp-dsp/modules/conv/test/test_dsps_corr_f32_ansi.c delete mode 100644 components/esp-dsp/modules/dct/float/dsps_dct_f32.c delete mode 100644 components/esp-dsp/modules/dct/include/dsps_dct.h delete mode 100644 components/esp-dsp/modules/dct/test/test_dsps_dct_f32.c delete mode 100644 components/esp-dsp/modules/dotprod/fixed/dsps_dotprod_s16_ae32.S delete mode 100644 components/esp-dsp/modules/dotprod/fixed/dsps_dotprod_s16_ansi.c delete mode 100644 components/esp-dsp/modules/dotprod/fixed/dsps_dotprod_s16_m_ae32.S delete mode 100644 components/esp-dsp/modules/dotprod/float/dsps_dotprod_f32_ae32.S delete mode 100644 components/esp-dsp/modules/dotprod/float/dsps_dotprod_f32_ansi.c delete mode 100644 components/esp-dsp/modules/dotprod/float/dsps_dotprod_f32_m_ae32.S delete mode 100644 components/esp-dsp/modules/dotprod/float/dsps_dotprode_f32_ae32.S delete mode 100644 components/esp-dsp/modules/dotprod/float/dsps_dotprode_f32_ansi.c delete mode 100644 components/esp-dsp/modules/dotprod/float/dsps_dotprode_f32_m_ae32.S delete mode 100644 components/esp-dsp/modules/dotprod/include/dsps_dotprod.h delete mode 100644 components/esp-dsp/modules/dotprod/include/dsps_dotprod_platform.h delete mode 100644 components/esp-dsp/modules/dotprod/test/test_dotprod_f32.c delete mode 100644 components/esp-dsp/modules/dotprod/test/test_dotprod_s16.c delete mode 100644 components/esp-dsp/modules/dotprod/test/test_dotprode_f32.c delete mode 100644 components/esp-dsp/modules/fft/fixed/dsps_fft2r_sc16_ae32.S delete mode 100644 components/esp-dsp/modules/fft/fixed/dsps_fft2r_sc16_ansi.c delete mode 100644 components/esp-dsp/modules/fft/float/dsps_fft2r_bitrev_tables_fc32.c delete mode 100644 components/esp-dsp/modules/fft/float/dsps_fft2r_fc32_ae32.c delete mode 100644 components/esp-dsp/modules/fft/float/dsps_fft2r_fc32_ae32_.S delete mode 100644 components/esp-dsp/modules/fft/float/dsps_fft2r_fc32_ansi.c delete mode 100644 components/esp-dsp/modules/fft/float/dsps_fft4r_bitrev_tables_fc32.c delete mode 100644 components/esp-dsp/modules/fft/float/dsps_fft4r_fc32_ae32.c delete mode 100644 components/esp-dsp/modules/fft/float/dsps_fft4r_fc32_ansi.c delete mode 100644 components/esp-dsp/modules/fft/include/dsps_fft2r.h delete mode 100644 components/esp-dsp/modules/fft/include/dsps_fft2r_platform.h delete mode 100644 components/esp-dsp/modules/fft/include/dsps_fft4r.h delete mode 100644 components/esp-dsp/modules/fft/include/dsps_fft4r_platform.h delete mode 100644 components/esp-dsp/modules/fft/include/dsps_fft_tables.h delete mode 100644 components/esp-dsp/modules/fft/test/test_dsps_fft2r_fc32_ae32.c delete mode 100644 components/esp-dsp/modules/fft/test/test_dsps_fft2r_fc32_ansi.c delete mode 100644 components/esp-dsp/modules/fft/test/test_dsps_fft2r_sc16_ae32.c delete mode 100644 components/esp-dsp/modules/fft/test/test_dsps_fft2r_sc16_ansi.c delete mode 100644 components/esp-dsp/modules/fft/test/test_dsps_fft4r_fc32_ae32.c delete mode 100644 components/esp-dsp/modules/fft/test/test_dsps_fft4r_fc32_ansi.c delete mode 100644 components/esp-dsp/modules/fir/float/dsps_fir_f32_ae32.S delete mode 100644 components/esp-dsp/modules/fir/float/dsps_fir_f32_ansi.c delete mode 100644 components/esp-dsp/modules/fir/float/dsps_fir_init_f32.c delete mode 100644 components/esp-dsp/modules/fir/float/dsps_fird_f32_ae32.S delete mode 100644 components/esp-dsp/modules/fir/float/dsps_fird_f32_ansi.c delete mode 100644 components/esp-dsp/modules/fir/float/dsps_fird_init_f32.c delete mode 100644 components/esp-dsp/modules/fir/include/dsps_fir.h delete mode 100644 components/esp-dsp/modules/fir/include/dsps_fir_platform.h delete mode 100644 components/esp-dsp/modules/fir/test/test_dsps_fir_f32_ae32.c delete mode 100644 components/esp-dsp/modules/fir/test/test_dsps_fir_f32_ansi.c delete mode 100644 components/esp-dsp/modules/fir/test/test_dsps_fird_f32_ae32.c delete mode 100644 components/esp-dsp/modules/fir/test/test_dsps_fird_f32_ansi.c delete mode 100644 components/esp-dsp/modules/iir/biquad/dsps_biquad_f32_ae32.S delete mode 100644 components/esp-dsp/modules/iir/biquad/dsps_biquad_f32_ansi.c delete mode 100644 components/esp-dsp/modules/iir/biquad/dsps_biquad_gen_f32.c delete mode 100644 components/esp-dsp/modules/iir/include/dsps_biquad.h delete mode 100644 components/esp-dsp/modules/iir/include/dsps_biquad_gen.h delete mode 100644 components/esp-dsp/modules/iir/include/dsps_biquad_platform.h delete mode 100644 components/esp-dsp/modules/iir/test/test_bq_f32_ae32.c delete mode 100644 components/esp-dsp/modules/iir/test/test_bq_f32_ansi.c delete mode 100644 components/esp-dsp/modules/math/add/fixed/dsps_add_s16_ae32.S delete mode 100644 components/esp-dsp/modules/math/add/fixed/dsps_add_s16_ansi.c delete mode 100644 components/esp-dsp/modules/math/add/float/dsps_add_f32_ae32.S delete mode 100644 components/esp-dsp/modules/math/add/float/dsps_add_f32_ansi.c delete mode 100644 components/esp-dsp/modules/math/add/include/dsps_add.h delete mode 100644 components/esp-dsp/modules/math/add/include/dsps_add_platform.h delete mode 100644 components/esp-dsp/modules/math/add/test/test_dsps_add_f32_ansi.c delete mode 100644 components/esp-dsp/modules/math/add/test/test_dsps_add_s16_ae32.c delete mode 100644 components/esp-dsp/modules/math/add/test/test_dsps_add_s16_ansi.c delete mode 100644 components/esp-dsp/modules/math/addc/float/dsps_addc_f32_ae32.S delete mode 100644 components/esp-dsp/modules/math/addc/float/dsps_addc_f32_ansi.c delete mode 100644 components/esp-dsp/modules/math/addc/include/dsps_addc.h delete mode 100644 components/esp-dsp/modules/math/addc/include/dsps_addc_platform.h delete mode 100644 components/esp-dsp/modules/math/addc/test/test_dsps_addc_f32_ansi.c delete mode 100644 components/esp-dsp/modules/math/include/dsps_math.h delete mode 100644 components/esp-dsp/modules/math/mul/fixed/dsps_mul_s16_ansi.c delete mode 100644 components/esp-dsp/modules/math/mul/float/dsps_mul_f32_ae32.S delete mode 100644 components/esp-dsp/modules/math/mul/float/dsps_mul_f32_ansi.c delete mode 100644 components/esp-dsp/modules/math/mul/include/dsps_mul.h delete mode 100644 components/esp-dsp/modules/math/mul/include/dsps_mul_platform.h delete mode 100644 components/esp-dsp/modules/math/mul/test/test_dsps_mul_f32_ansi.c delete mode 100644 components/esp-dsp/modules/math/mulc/fixed/dsps_mulc_s16_ae32.S delete mode 100644 components/esp-dsp/modules/math/mulc/fixed/dsps_mulc_s16_ansi.c delete mode 100644 components/esp-dsp/modules/math/mulc/float/dsps_mulc_f32_ae32.S delete mode 100644 components/esp-dsp/modules/math/mulc/float/dsps_mulc_f32_ansi.c delete mode 100644 components/esp-dsp/modules/math/mulc/include/dsps_mulc.h delete mode 100644 components/esp-dsp/modules/math/mulc/include/dsps_mulc_platform.h delete mode 100644 components/esp-dsp/modules/math/mulc/test/test_dsps_mulc_f32_ansi.c delete mode 100644 components/esp-dsp/modules/math/mulc/test/test_dsps_mulc_s16_ae32.c delete mode 100644 components/esp-dsp/modules/math/mulc/test/test_dsps_mulc_s16_ansi.c delete mode 100644 components/esp-dsp/modules/math/sqrt/float/dsps_sqrt_f32_ansi.c delete mode 100644 components/esp-dsp/modules/math/sqrt/include/dsps_sqrt.h delete mode 100644 components/esp-dsp/modules/math/sqrt/test/test_dsps_sqrt_f32_ansi.c delete mode 100644 components/esp-dsp/modules/math/sub/float/dsps_sub_f32_ae32.S delete mode 100644 components/esp-dsp/modules/math/sub/float/dsps_sub_f32_ansi.c delete mode 100644 components/esp-dsp/modules/math/sub/include/dsps_sub.h delete mode 100644 components/esp-dsp/modules/math/sub/include/dsps_sub_platform.h delete mode 100644 components/esp-dsp/modules/math/sub/test/test_dsps_sub_f32_ansi.c delete mode 100644 components/esp-dsp/modules/matrix/fixed/dspm_mult_s16_ae32.S delete mode 100644 components/esp-dsp/modules/matrix/fixed/dspm_mult_s16_ansi.c delete mode 100644 components/esp-dsp/modules/matrix/fixed/dspm_mult_s16_m_ae32.S delete mode 100644 components/esp-dsp/modules/matrix/fixed/dspm_mult_s16_m_ae32_vector.S delete mode 100644 components/esp-dsp/modules/matrix/float/dspm_mult_3x3x1_f32_ae32.S delete mode 100644 components/esp-dsp/modules/matrix/float/dspm_mult_3x3x3_f32_ae32.S delete mode 100644 components/esp-dsp/modules/matrix/float/dspm_mult_4x4x1_f32_ae32.S delete mode 100644 components/esp-dsp/modules/matrix/float/dspm_mult_4x4x4_f32_ae32.S delete mode 100644 components/esp-dsp/modules/matrix/float/dspm_mult_f32_ae32.S delete mode 100644 components/esp-dsp/modules/matrix/float/dspm_mult_f32_ansi.c delete mode 100644 components/esp-dsp/modules/matrix/include/dspm_mult.h delete mode 100644 components/esp-dsp/modules/matrix/include/dspm_mult_platform.h delete mode 100644 components/esp-dsp/modules/matrix/include/mat.h delete mode 100644 components/esp-dsp/modules/matrix/mat/mat.cpp delete mode 100644 components/esp-dsp/modules/matrix/test/test_mat_f32.cpp delete mode 100644 components/esp-dsp/modules/matrix/test/test_mmult_3x3xx_f32_ae32.c delete mode 100644 components/esp-dsp/modules/matrix/test/test_mmult_4x4xx_f32_ae32.c delete mode 100644 components/esp-dsp/modules/matrix/test/test_mmult_f32_ae32.c delete mode 100644 components/esp-dsp/modules/matrix/test/test_mmult_f32_ansi.c delete mode 100644 components/esp-dsp/modules/matrix/test/test_mmult_s16_ae32.c delete mode 100644 components/esp-dsp/modules/matrix/test/test_mmult_s16_ansi.c delete mode 100644 components/esp-dsp/modules/support/include/dsps_d_gen.h delete mode 100644 components/esp-dsp/modules/support/include/dsps_h_gen.h delete mode 100644 components/esp-dsp/modules/support/include/dsps_sfdr.h delete mode 100644 components/esp-dsp/modules/support/include/dsps_snr.h delete mode 100644 components/esp-dsp/modules/support/include/dsps_tone_gen.h delete mode 100644 components/esp-dsp/modules/support/include/dsps_view.h delete mode 100644 components/esp-dsp/modules/support/misc/dsps_d_gen.c delete mode 100644 components/esp-dsp/modules/support/misc/dsps_h_gen.c delete mode 100644 components/esp-dsp/modules/support/misc/dsps_tone_gen.c delete mode 100644 components/esp-dsp/modules/support/sfdr/float/dsps_sfdr_f32.cpp delete mode 100644 components/esp-dsp/modules/support/sfdr/test/test_dsps_sfdr_f32.c delete mode 100644 components/esp-dsp/modules/support/snr/float/dsps_snr_f32.cpp delete mode 100644 components/esp-dsp/modules/support/snr/test/test_dsps_snr_f32.c delete mode 100644 components/esp-dsp/modules/support/view/dsps_view.cpp delete mode 100644 components/esp-dsp/modules/support/view/test/test_dsps_view.c delete mode 100644 components/esp-dsp/modules/windows/blackman/float/dsps_wind_blackman_f32.c delete mode 100644 components/esp-dsp/modules/windows/blackman/include/dsps_wind_blackman.h delete mode 100644 components/esp-dsp/modules/windows/blackman_harris/float/dsps_wind_blackman_harris_f32.c delete mode 100644 components/esp-dsp/modules/windows/blackman_harris/include/dsps_wind_blackman_harris.h delete mode 100644 components/esp-dsp/modules/windows/blackman_nuttall/float/dsps_wind_blackman_nuttall_f32.c delete mode 100644 components/esp-dsp/modules/windows/blackman_nuttall/include/dsps_wind_blackman_nuttall.h delete mode 100644 components/esp-dsp/modules/windows/flat_top/float/dsps_wind_flat_top_f32.c delete mode 100644 components/esp-dsp/modules/windows/flat_top/include/dsps_wind_flat_top.h delete mode 100644 components/esp-dsp/modules/windows/hann/float/dsps_wind_hann_f32.c delete mode 100644 components/esp-dsp/modules/windows/hann/include/dsps_wind_hann.h delete mode 100644 components/esp-dsp/modules/windows/include/dsps_wind.h delete mode 100644 components/esp-dsp/modules/windows/nuttall/float/dsps_wind_nuttall_f32.c delete mode 100644 components/esp-dsp/modules/windows/nuttall/include/dsps_wind_nuttall.h delete mode 100644 components/esp-dsp/modules/windows/test/test_wind_f32.c delete mode 100644 components/esp-dsp/test/CMakeLists.txt delete mode 100644 components/esp-dsp/test/component.mk delete mode 100644 components/esp-dsp/test/linker.lf delete mode 100644 components/esp-dsp/test/report.inc delete mode 100644 components/esp-dsp/test/test_dsp.c delete mode 100644 components/esp-dsp/test_app/CMakeLists.txt delete mode 100644 components/esp-dsp/test_app/Makefile delete mode 100644 components/esp-dsp/test_app/main/CMakeLists.txt delete mode 100644 components/esp-dsp/test_app/main/component.mk delete mode 100644 components/esp-dsp/test_app/main/test_app_main.c delete mode 100644 components/esp-dsp/test_app/sdkconfig.defaults create mode 100644 components/esp_peripherals/include/periph_lcd.h create mode 100644 components/esp_peripherals/lib/tca9554/tca9554.c create mode 100644 components/esp_peripherals/lib/tca9554/tca9554.h create mode 100644 components/esp_peripherals/periph_lcd.c create mode 100644 dependencies.lock create mode 100644 main/idf_component.yml create mode 100644 sdkconfig_TAS5805M diff --git a/.cproject b/.cproject index 856c3b1e..e757dfcd 100644 --- a/.cproject +++ b/.cproject @@ -9,10 +9,9 @@ + + - - - diff --git a/.gitignore b/.gitignore index cfcb4208..bd6fdc8b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,147 @@ build libopus +managed_components + +# Created by https://www.toptal.com/developers/gitignore/api/c,c++,eclipse +# Edit at https://www.toptal.com/developers/gitignore?templates=c,c++,eclipse + +### C ### +# Prerequisites +*.d + +# Object files +*.o +*.ko +*.obj +*.elf + +# Linker output +*.ilk +*.map +*.exp + +# Precompiled Headers +*.gch +*.pch + +# Libraries +#*.lib +#*.a +#*.la +#*.lo + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + +# Debug files +*.dSYM/ +*.su +*.idb +*.pdb + +# Kernel Module Compile Results +*.mod* +*.cmd +.tmp_versions/ +modules.order +Module.symvers +Mkfile.old +dkms.conf + +### C++ ### +# Prerequisites + +# Compiled Object files +*.slo + +# Precompiled Headers + +# Compiled Dynamic libraries + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai + +# Executables + +### Eclipse ### +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath +.recommenders + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# PyDev specific (Python IDE for Eclipse) +*.pydevproject + +# CDT-specific (C/C++ Development Tooling) +.cproject + +# CDT- autotools +.autotools + +# Java annotation processor (APT) +.factorypath + +# PDT-specific (PHP Development Tools) +.buildpath + +# sbteclipse plugin +.target + +# Tern plugin +.tern-project + +# TeXlipse plugin +.texlipse + +# STS (Spring Tool Suite) +.springBeans + +# Code Recommenders +.recommenders/ + +# Annotation Processing +.apt_generated/ +.apt_generated_test/ + +# Scala IDE specific (Scala & Java development for Eclipse) +.cache-main +.scala_dependencies +.worksheet + +# Uncomment this line if you wish to ignore the project description file. +# Typically, this file would be tracked if it contains build/dependency configurations: +#.project + +### Eclipse Patch ### +# Spring Boot Tooling +.sts4-cache/ + +# End of https://www.toptal.com/developers/gitignore/api/c,c++,eclipse diff --git a/.project b/.project index 967646e5..dec61686 100644 --- a/.project +++ b/.project @@ -21,4517 +21,4032 @@ build/ide/esp_idf_components/app_trace/app_trace.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/app_trace/app_trace.c + /home/karl/espressif/esp-idf-v5.1.1/components/app_trace/app_trace.c build/ide/esp_idf_components/app_trace/app_trace_util.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/app_trace/app_trace_util.c + /home/karl/espressif/esp-idf-v5.1.1/components/app_trace/app_trace_util.c build/ide/esp_idf_components/app_trace/host_file_io.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/app_trace/host_file_io.c + /home/karl/espressif/esp-idf-v5.1.1/components/app_trace/host_file_io.c - build/ide/esp_idf_components/app_update/esp_app_desc.c + build/ide/esp_idf_components/app_update/esp_ota_app_desc.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/app_update/esp_app_desc.c + /home/karl/espressif/esp-idf-v5.1.1/components/app_update/esp_ota_app_desc.c build/ide/esp_idf_components/app_update/esp_ota_ops.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/app_update/esp_ota_ops.c + /home/karl/espressif/esp-idf-v5.1.1/components/app_update/esp_ota_ops.c build/ide/esp_idf_components/console/commands.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/console/commands.c + /home/karl/espressif/esp-idf-v5.1.1/components/console/commands.c build/ide/esp_idf_components/console/esp_console_repl.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/console/esp_console_repl.c + /home/karl/espressif/esp-idf-v5.1.1/components/console/esp_console_repl.c build/ide/esp_idf_components/console/split_argv.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/console/split_argv.c + /home/karl/espressif/esp-idf-v5.1.1/components/console/split_argv.c build/ide/esp_idf_components/cxx/cxx_exception_stubs.cpp 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/cxx/cxx_exception_stubs.cpp + /home/karl/espressif/esp-idf-v5.1.1/components/cxx/cxx_exception_stubs.cpp build/ide/esp_idf_components/cxx/cxx_guards.cpp 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/cxx/cxx_guards.cpp + /home/karl/espressif/esp-idf-v5.1.1/components/cxx/cxx_guards.cpp - build/ide/esp_idf_components/driver/adc_common.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/adc_common.c - - - build/ide/esp_idf_components/driver/dac_common.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/dac_common.c - - - build/ide/esp_idf_components/driver/gpio.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/gpio.c - - - build/ide/esp_idf_components/driver/i2c.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/i2c.c - - - build/ide/esp_idf_components/driver/i2s.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/i2s.c - - - build/ide/esp_idf_components/driver/ledc.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/ledc.c - - - build/ide/esp_idf_components/driver/mcpwm.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/mcpwm.c - - - build/ide/esp_idf_components/driver/pcnt.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/pcnt.c - - - build/ide/esp_idf_components/driver/periph_ctrl.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/periph_ctrl.c - - - build/ide/esp_idf_components/driver/rmt.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/rmt.c - - - build/ide/esp_idf_components/driver/rtc_io.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/rtc_io.c - - - build/ide/esp_idf_components/driver/rtc_module.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/rtc_module.c - - - build/ide/esp_idf_components/driver/sdio_slave.c + build/ide/esp_idf_components/esp-tls/esp_tls.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/sdio_slave.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp-tls/esp_tls.c - build/ide/esp_idf_components/driver/sdmmc_host.c + build/ide/esp_idf_components/esp-tls/esp_tls_error_capture.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/sdmmc_host.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp-tls/esp_tls_error_capture.c - build/ide/esp_idf_components/driver/sdmmc_transaction.c + build/ide/esp_idf_components/esp-tls/esp_tls_mbedtls.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/sdmmc_transaction.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp-tls/esp_tls_mbedtls.c - build/ide/esp_idf_components/driver/sdspi_crc.c + build/ide/esp_idf_components/esp_adc/adc_cali.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/sdspi_crc.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_adc/adc_cali.c - build/ide/esp_idf_components/driver/sdspi_host.c + build/ide/esp_idf_components/esp_adc/adc_cali_curve_fitting.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/sdspi_host.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_adc/adc_cali_curve_fitting.c - build/ide/esp_idf_components/driver/sdspi_transaction.c + build/ide/esp_idf_components/esp_adc/adc_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/sdspi_transaction.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_adc/adc_common.c - build/ide/esp_idf_components/driver/sigmadelta.c + build/ide/esp_idf_components/esp_adc/adc_continuous.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/sigmadelta.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_adc/adc_continuous.c - build/ide/esp_idf_components/driver/spi_bus_lock.c + build/ide/esp_idf_components/esp_adc/adc_oneshot.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/spi_bus_lock.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_adc/adc_oneshot.c - build/ide/esp_idf_components/driver/spi_common.c + build/ide/esp_idf_components/esp_app_format/esp_app_desc.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/spi_common.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_app_format/esp_app_desc.c - build/ide/esp_idf_components/driver/spi_master.c + build/ide/esp_idf_components/esp_event/default_event_loop.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/spi_master.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_event/default_event_loop.c - build/ide/esp_idf_components/driver/spi_slave.c + build/ide/esp_idf_components/esp_event/esp_event.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/spi_slave.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_event/esp_event.c - build/ide/esp_idf_components/driver/timer.c + build/ide/esp_idf_components/esp_event/esp_event_private.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/timer.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_event/esp_event_private.c - build/ide/esp_idf_components/driver/touch_sensor_common.c + build/ide/esp_idf_components/esp_http_client/esp_http_client.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/touch_sensor_common.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_http_client/esp_http_client.c - build/ide/esp_idf_components/driver/twai.c + build/ide/esp_idf_components/esp_hw_support/adc_share_hw_ctrl.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/twai.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/adc_share_hw_ctrl.c - build/ide/esp_idf_components/driver/uart.c + build/ide/esp_idf_components/esp_hw_support/clk_ctrl_os.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/uart.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/clk_ctrl_os.c - build/ide/esp_idf_components/esp-tls/esp_tls.c + build/ide/esp_idf_components/esp_hw_support/cpu.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp-tls/esp_tls.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/cpu.c - build/ide/esp_idf_components/esp-tls/esp_tls_error_capture.c + build/ide/esp_idf_components/esp_hw_support/esp_clk.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp-tls/esp_tls_error_capture.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/esp_clk.c - build/ide/esp_idf_components/esp-tls/esp_tls_mbedtls.c + build/ide/esp_idf_components/esp_hw_support/esp_gpio_reserve.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp-tls/esp_tls_mbedtls.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/esp_gpio_reserve.c - build/ide/esp_idf_components/esp32/cache_err_int.c + build/ide/esp_idf_components/esp_hw_support/esp_memory_utils.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp32/cache_err_int.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/esp_memory_utils.c - build/ide/esp_idf_components/esp32/cache_sram_mmu.c + build/ide/esp_idf_components/esp_hw_support/hw_random.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp32/cache_sram_mmu.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/hw_random.c - build/ide/esp_idf_components/esp32/clk.c + build/ide/esp_idf_components/esp_hw_support/intr_alloc.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp32/clk.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/intr_alloc.c - build/ide/esp_idf_components/esp32/crosscore_int.c + build/ide/esp_idf_components/esp_hw_support/mac_addr.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp32/crosscore_int.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/mac_addr.c - build/ide/esp_idf_components/esp32/dport_access.c + build/ide/esp_idf_components/esp_hw_support/periph_ctrl.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp32/dport_access.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/periph_ctrl.c - build/ide/esp_idf_components/esp32/esp_himem.c + build/ide/esp_idf_components/esp_hw_support/regi2c_ctrl.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp32/esp_himem.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/regi2c_ctrl.c - build/ide/esp_idf_components/esp32/hw_random.c + build/ide/esp_idf_components/esp_hw_support/rtc_module.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp32/hw_random.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/rtc_module.c - build/ide/esp_idf_components/esp32/spiram.c + build/ide/esp_idf_components/esp_hw_support/rtc_wdt.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp32/spiram.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/rtc_wdt.c - build/ide/esp_idf_components/esp32/spiram_psram.c + build/ide/esp_idf_components/esp_hw_support/sar_periph_ctrl_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp32/spiram_psram.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/sar_periph_ctrl_common.c - build/ide/esp_idf_components/esp32/system_api_esp32.c + build/ide/esp_idf_components/esp_hw_support/sleep_gpio.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp32/system_api_esp32.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/sleep_gpio.c - build/ide/esp_idf_components/esp_adc_cal/esp_adc_cal_common.c + build/ide/esp_idf_components/esp_hw_support/sleep_modem.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_adc_cal/esp_adc_cal_common.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/sleep_modem.c - build/ide/esp_idf_components/esp_event/default_event_loop.c + build/ide/esp_idf_components/esp_hw_support/sleep_modes.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_event/default_event_loop.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/sleep_modes.c - build/ide/esp_idf_components/esp_event/esp_event.c + build/ide/esp_idf_components/esp_hw_support/sleep_wake_stub.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_event/esp_event.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/sleep_wake_stub.c - build/ide/esp_idf_components/esp_event/esp_event_private.c + build/ide/esp_idf_components/esp_mm/cache_esp32.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_event/esp_event_private.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_mm/cache_esp32.c - build/ide/esp_idf_components/esp_event/event_loop_legacy.c + build/ide/esp_idf_components/esp_mm/esp_cache.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_event/event_loop_legacy.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_mm/esp_cache.c - build/ide/esp_idf_components/esp_event/event_send.c + build/ide/esp_idf_components/esp_mm/esp_mmu_map.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_event/event_send.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_mm/esp_mmu_map.c - build/ide/esp_idf_components/esp_http_client/esp_http_client.c + build/ide/esp_idf_components/esp_netif/esp_netif_defaults.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_http_client/esp_http_client.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_netif/esp_netif_defaults.c - build/ide/esp_idf_components/esp_hw_support/clk_ctrl_os.c + build/ide/esp_idf_components/esp_netif/esp_netif_handlers.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_hw_support/clk_ctrl_os.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_netif/esp_netif_handlers.c - build/ide/esp_idf_components/esp_hw_support/compare_set.c + build/ide/esp_idf_components/esp_netif/esp_netif_objects.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_hw_support/compare_set.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_netif/esp_netif_objects.c - build/ide/esp_idf_components/esp_hw_support/cpu_util.c + build/ide/esp_idf_components/esp_partition/partition.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_hw_support/cpu_util.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_partition/partition.c - build/ide/esp_idf_components/esp_hw_support/regi2c_ctrl.c + build/ide/esp_idf_components/esp_partition/partition_target.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_hw_support/regi2c_ctrl.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_partition/partition_target.c - build/ide/esp_idf_components/esp_ipc/ipc.c + build/ide/esp_idf_components/esp_pm/pm_impl.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_ipc/ipc.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_pm/pm_impl.c - build/ide/esp_idf_components/esp_netif/esp_netif_defaults.c + build/ide/esp_idf_components/esp_pm/pm_locks.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_netif/esp_netif_defaults.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_pm/pm_locks.c - build/ide/esp_idf_components/esp_netif/esp_netif_handlers.c + build/ide/esp_idf_components/esp_pm/pm_trace.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_netif/esp_netif_handlers.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_pm/pm_trace.c - build/ide/esp_idf_components/esp_netif/esp_netif_objects.c + build/ide/esp_idf_components/esp_psram/esp_psram.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_netif/esp_netif_objects.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_psram/esp_psram.c - build/ide/esp_idf_components/esp_pm/pm_impl.c + build/ide/esp_idf_components/esp_psram/mmu_psram_flash.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_pm/pm_impl.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_psram/mmu_psram_flash.c - build/ide/esp_idf_components/esp_pm/pm_locks.c + build/ide/esp_idf_components/esp_ringbuf/ringbuf.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_pm/pm_locks.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_ringbuf/ringbuf.c - build/ide/esp_idf_components/esp_pm/pm_trace.c + build/ide/esp_idf_components/esp_system/crosscore_int.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_pm/pm_trace.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/crosscore_int.c - build/ide/esp_idf_components/esp_ringbuf/ringbuf.c + build/ide/esp_idf_components/esp_system/debug_stubs.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_ringbuf/ringbuf.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/debug_stubs.c - build/ide/esp_idf_components/esp_serial_slave_link/essl.c + build/ide/esp_idf_components/esp_system/esp_err.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_serial_slave_link/essl.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/esp_err.c - build/ide/esp_idf_components/esp_serial_slave_link/essl_sdio.c + build/ide/esp_idf_components/esp_system/esp_ipc.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_serial_slave_link/essl_sdio.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/esp_ipc.c - build/ide/esp_idf_components/esp_serial_slave_link/essl_spi.c + build/ide/esp_idf_components/esp_system/esp_system.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_serial_slave_link/essl_spi.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/esp_system.c - build/ide/esp_idf_components/esp_system/esp_async_memcpy.c + build/ide/esp_idf_components/esp_system/freertos_hooks.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_system/esp_async_memcpy.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/freertos_hooks.c - build/ide/esp_idf_components/esp_system/intr_alloc.c + build/ide/esp_idf_components/esp_system/int_wdt.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_system/intr_alloc.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/int_wdt.c build/ide/esp_idf_components/esp_system/panic.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_system/panic.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/panic.c - build/ide/esp_idf_components/esp_system/sleep_modes.c + build/ide/esp_idf_components/esp_system/stack_check.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_system/sleep_modes.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/stack_check.c build/ide/esp_idf_components/esp_system/startup.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_system/startup.c - - - build/ide/esp_idf_components/esp_system/system_api.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_system/system_api.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/startup.c build/ide/esp_idf_components/esp_system/system_time.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_system/system_time.c - - - build/ide/esp_idf_components/esp_websocket_client/esp_websocket_client.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_websocket_client/esp_websocket_client.c - - - build/ide/esp_idf_components/freertos/FreeRTOS-openocd.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freertos/FreeRTOS-openocd.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/system_time.c - build/ide/esp_idf_components/freertos/croutine.c + build/ide/esp_idf_components/esp_system/ubsan.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freertos/croutine.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/ubsan.c - build/ide/esp_idf_components/freertos/event_groups.c + build/ide/esp_idf_components/esp_system/xt_wdt.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freertos/event_groups.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/xt_wdt.c - build/ide/esp_idf_components/freertos/freertos_v8_compat.c + build/ide/esp_idf_components/freertos/FreeRTOS-openocd.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freertos/freertos_v8_compat.c + /home/karl/espressif/esp-idf-v5.1.1/components/freertos/FreeRTOS-openocd.c - build/ide/esp_idf_components/freertos/list.c + build/ide/esp_idf_components/freertos/app_startup.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freertos/list.c + /home/karl/espressif/esp-idf-v5.1.1/components/freertos/app_startup.c - build/ide/esp_idf_components/freertos/queue.c + build/ide/esp_idf_components/freertos/heap_idf.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freertos/queue.c + /home/karl/espressif/esp-idf-v5.1.1/components/freertos/heap_idf.c - build/ide/esp_idf_components/freertos/stream_buffer.c + build/ide/esp_idf_components/freertos/port_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freertos/stream_buffer.c + /home/karl/espressif/esp-idf-v5.1.1/components/freertos/port_common.c - build/ide/esp_idf_components/freertos/tasks.c + build/ide/esp_idf_components/hal/adc_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freertos/tasks.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/adc_hal.c - build/ide/esp_idf_components/freertos/timers.c + build/ide/esp_idf_components/hal/adc_hal_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freertos/timers.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/adc_hal_common.c - build/ide/esp_idf_components/hal/adc_hal.c + build/ide/esp_idf_components/hal/adc_oneshot_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/adc_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/adc_oneshot_hal.c build/ide/esp_idf_components/hal/aes_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/aes_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/aes_hal.c - build/ide/esp_idf_components/hal/cpu_hal.c + build/ide/esp_idf_components/hal/brownout_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/cpu_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/brownout_hal.c - build/ide/esp_idf_components/hal/dac_hal.c + build/ide/esp_idf_components/hal/efuse_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/dac_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/efuse_hal.c - build/ide/esp_idf_components/hal/efuse_hal.c + build/ide/esp_idf_components/hal/emac_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/efuse_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/emac_hal.c build/ide/esp_idf_components/hal/gpio_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/gpio_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/gpio_hal.c build/ide/esp_idf_components/hal/i2c_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/i2c_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/i2c_hal.c build/ide/esp_idf_components/hal/i2c_hal_iram.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/i2c_hal_iram.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/i2c_hal_iram.c build/ide/esp_idf_components/hal/i2s_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/i2s_hal.c - - - build/ide/esp_idf_components/hal/interrupt_controller_hal.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/interrupt_controller_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/i2s_hal.c build/ide/esp_idf_components/hal/ledc_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/ledc_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/ledc_hal.c build/ide/esp_idf_components/hal/ledc_hal_iram.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/ledc_hal_iram.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/ledc_hal_iram.c build/ide/esp_idf_components/hal/mcpwm_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/mcpwm_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/mcpwm_hal.c + + + build/ide/esp_idf_components/hal/mmu_hal.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/hal/mmu_hal.c build/ide/esp_idf_components/hal/mpu_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/mpu_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/mpu_hal.c build/ide/esp_idf_components/hal/pcnt_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/pcnt_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/pcnt_hal.c build/ide/esp_idf_components/hal/rmt_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/rmt_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/rmt_hal.c build/ide/esp_idf_components/hal/rtc_io_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/rtc_io_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/rtc_io_hal.c build/ide/esp_idf_components/hal/sdio_slave_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/sdio_slave_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/sdio_slave_hal.c - build/ide/esp_idf_components/hal/sha_hal.c + build/ide/esp_idf_components/hal/sdm_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/sha_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/sdm_hal.c - build/ide/esp_idf_components/hal/sigmadelta_hal.c + build/ide/esp_idf_components/hal/sha_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/sigmadelta_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/sha_hal.c - build/ide/esp_idf_components/hal/soc_hal.c + build/ide/esp_idf_components/hal/spi_flash_encrypt_hal_iram.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/soc_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/spi_flash_encrypt_hal_iram.c build/ide/esp_idf_components/hal/spi_flash_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/spi_flash_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/spi_flash_hal.c build/ide/esp_idf_components/hal/spi_flash_hal_iram.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/spi_flash_hal_iram.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/spi_flash_hal_iram.c build/ide/esp_idf_components/hal/spi_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/spi_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/spi_hal.c build/ide/esp_idf_components/hal/spi_hal_iram.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/spi_hal_iram.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/spi_hal_iram.c build/ide/esp_idf_components/hal/spi_slave_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/spi_slave_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/spi_slave_hal.c build/ide/esp_idf_components/hal/spi_slave_hal_iram.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/spi_slave_hal_iram.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/spi_slave_hal_iram.c build/ide/esp_idf_components/hal/timer_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/timer_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/timer_hal.c + + + build/ide/esp_idf_components/hal/timer_hal_iram.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/hal/timer_hal_iram.c build/ide/esp_idf_components/hal/touch_sensor_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/touch_sensor_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/touch_sensor_hal.c build/ide/esp_idf_components/hal/twai_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/twai_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/twai_hal.c build/ide/esp_idf_components/hal/twai_hal_iram.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/twai_hal_iram.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/twai_hal_iram.c build/ide/esp_idf_components/hal/uart_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/uart_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/uart_hal.c build/ide/esp_idf_components/hal/uart_hal_iram.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/uart_hal_iram.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/uart_hal_iram.c build/ide/esp_idf_components/hal/wdt_hal_iram.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/wdt_hal_iram.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/wdt_hal_iram.c build/ide/esp_idf_components/heap/heap_caps.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/heap/heap_caps.c + /home/karl/espressif/esp-idf-v5.1.1/components/heap/heap_caps.c build/ide/esp_idf_components/heap/heap_caps_init.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/heap/heap_caps_init.c + /home/karl/espressif/esp-idf-v5.1.1/components/heap/heap_caps_init.c - build/ide/esp_idf_components/heap/heap_tlsf.c + build/ide/esp_idf_components/heap/multi_heap.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/heap/heap_tlsf.c + /home/karl/espressif/esp-idf-v5.1.1/components/heap/multi_heap.c - build/ide/esp_idf_components/heap/multi_heap.c + build/ide/esp_idf_components/http_parser/http_parser.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/heap/multi_heap.c + /home/karl/espressif/esp-idf-v5.1.1/components/http_parser/http_parser.c build/ide/esp_idf_components/log/log.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/log/log.c + /home/karl/espressif/esp-idf-v5.1.1/components/log/log.c build/ide/esp_idf_components/log/log_buffers.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/log/log_buffers.c + /home/karl/espressif/esp-idf-v5.1.1/components/log/log_buffers.c build/ide/esp_idf_components/log/log_freertos.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/log/log_freertos.c - - - build/ide/esp_idf_components/mdns/mdns.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mdns/mdns.c - - - build/ide/esp_idf_components/mdns/mdns_console.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mdns/mdns_console.c - - - build/ide/esp_idf_components/mdns/mdns_networking.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mdns/mdns_networking.c + /home/karl/espressif/esp-idf-v5.1.1/components/log/log_freertos.c build/ide/esp_idf_components/newlib/abort.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/newlib/abort.c + /home/karl/espressif/esp-idf-v5.1.1/components/newlib/abort.c build/ide/esp_idf_components/newlib/assert.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/newlib/assert.c + /home/karl/espressif/esp-idf-v5.1.1/components/newlib/assert.c build/ide/esp_idf_components/newlib/heap.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/newlib/heap.c + /home/karl/espressif/esp-idf-v5.1.1/components/newlib/heap.c build/ide/esp_idf_components/newlib/locks.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/newlib/locks.c + /home/karl/espressif/esp-idf-v5.1.1/components/newlib/locks.c build/ide/esp_idf_components/newlib/newlib_init.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/newlib/newlib_init.c + /home/karl/espressif/esp-idf-v5.1.1/components/newlib/newlib_init.c build/ide/esp_idf_components/newlib/poll.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/newlib/poll.c + /home/karl/espressif/esp-idf-v5.1.1/components/newlib/poll.c build/ide/esp_idf_components/newlib/pthread.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/newlib/pthread.c + /home/karl/espressif/esp-idf-v5.1.1/components/newlib/pthread.c build/ide/esp_idf_components/newlib/random.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/newlib/random.c + /home/karl/espressif/esp-idf-v5.1.1/components/newlib/random.c + + + build/ide/esp_idf_components/newlib/realpath.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/newlib/realpath.c build/ide/esp_idf_components/newlib/reent_init.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/newlib/reent_init.c + /home/karl/espressif/esp-idf-v5.1.1/components/newlib/reent_init.c build/ide/esp_idf_components/newlib/stdatomic.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/newlib/stdatomic.c + /home/karl/espressif/esp-idf-v5.1.1/components/newlib/stdatomic.c build/ide/esp_idf_components/newlib/syscalls.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/newlib/syscalls.c + /home/karl/espressif/esp-idf-v5.1.1/components/newlib/syscalls.c + + + build/ide/esp_idf_components/newlib/sysconf.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/newlib/sysconf.c build/ide/esp_idf_components/newlib/termios.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/newlib/termios.c + /home/karl/espressif/esp-idf-v5.1.1/components/newlib/termios.c build/ide/esp_idf_components/newlib/time.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/newlib/time.c + /home/karl/espressif/esp-idf-v5.1.1/components/newlib/time.c build/ide/esp_idf_components/perfmon/xtensa_perfmon_access.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/perfmon/xtensa_perfmon_access.c + /home/karl/espressif/esp-idf-v5.1.1/components/perfmon/xtensa_perfmon_access.c build/ide/esp_idf_components/perfmon/xtensa_perfmon_apis.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/perfmon/xtensa_perfmon_apis.c + /home/karl/espressif/esp-idf-v5.1.1/components/perfmon/xtensa_perfmon_apis.c build/ide/esp_idf_components/perfmon/xtensa_perfmon_masks.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/perfmon/xtensa_perfmon_masks.c + /home/karl/espressif/esp-idf-v5.1.1/components/perfmon/xtensa_perfmon_masks.c build/ide/esp_idf_components/pthread/pthread.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/pthread/pthread.c + /home/karl/espressif/esp-idf-v5.1.1/components/pthread/pthread.c build/ide/esp_idf_components/pthread/pthread_cond_var.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/pthread/pthread_cond_var.c + /home/karl/espressif/esp-idf-v5.1.1/components/pthread/pthread_cond_var.c build/ide/esp_idf_components/pthread/pthread_local_storage.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/pthread/pthread_local_storage.c + /home/karl/espressif/esp-idf-v5.1.1/components/pthread/pthread_local_storage.c + + + build/ide/esp_idf_components/pthread/pthread_rwlock.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/pthread/pthread_rwlock.c + + + build/ide/esp_idf_components/pthread/pthread_semaphore.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/pthread/pthread_semaphore.c build/ide/esp_idf_components/sdmmc/sdmmc_cmd.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/sdmmc/sdmmc_cmd.c + /home/karl/espressif/esp-idf-v5.1.1/components/sdmmc/sdmmc_cmd.c build/ide/esp_idf_components/sdmmc/sdmmc_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/sdmmc/sdmmc_common.c + /home/karl/espressif/esp-idf-v5.1.1/components/sdmmc/sdmmc_common.c build/ide/esp_idf_components/sdmmc/sdmmc_init.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/sdmmc/sdmmc_init.c + /home/karl/espressif/esp-idf-v5.1.1/components/sdmmc/sdmmc_init.c build/ide/esp_idf_components/sdmmc/sdmmc_io.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/sdmmc/sdmmc_io.c + /home/karl/espressif/esp-idf-v5.1.1/components/sdmmc/sdmmc_io.c build/ide/esp_idf_components/sdmmc/sdmmc_mmc.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/sdmmc/sdmmc_mmc.c + /home/karl/espressif/esp-idf-v5.1.1/components/sdmmc/sdmmc_mmc.c build/ide/esp_idf_components/sdmmc/sdmmc_sd.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/sdmmc/sdmmc_sd.c - - - build/ide/esp_idf_components/soc/lldesc.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/soc/lldesc.c + /home/karl/espressif/esp-idf-v5.1.1/components/sdmmc/sdmmc_sd.c - build/ide/esp_idf_components/soc/memory_layout_utils.c + build/ide/esp_idf_components/soc/dport_access_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/soc/memory_layout_utils.c + /home/karl/espressif/esp-idf-v5.1.1/components/soc/dport_access_common.c - build/ide/esp_idf_components/soc/soc_include_legacy_warn.c + build/ide/esp_idf_components/soc/lldesc.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/soc/soc_include_legacy_warn.c + /home/karl/espressif/esp-idf-v5.1.1/components/soc/lldesc.c build/ide/esp_idf_components/spi_flash/cache_utils.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/spi_flash/cache_utils.c + /home/karl/espressif/esp-idf-v5.1.1/components/spi_flash/cache_utils.c build/ide/esp_idf_components/spi_flash/esp_flash_api.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/spi_flash/esp_flash_api.c + /home/karl/espressif/esp-idf-v5.1.1/components/spi_flash/esp_flash_api.c build/ide/esp_idf_components/spi_flash/esp_flash_spi_init.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/spi_flash/esp_flash_spi_init.c + /home/karl/espressif/esp-idf-v5.1.1/components/spi_flash/esp_flash_spi_init.c - build/ide/esp_idf_components/spi_flash/flash_mmap.c + build/ide/esp_idf_components/spi_flash/flash_brownout_hook.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/spi_flash/flash_mmap.c + /home/karl/espressif/esp-idf-v5.1.1/components/spi_flash/flash_brownout_hook.c - build/ide/esp_idf_components/spi_flash/flash_ops.c + build/ide/esp_idf_components/spi_flash/flash_mmap.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/spi_flash/flash_ops.c + /home/karl/espressif/esp-idf-v5.1.1/components/spi_flash/flash_mmap.c - build/ide/esp_idf_components/spi_flash/memspi_host_driver.c + build/ide/esp_idf_components/spi_flash/flash_ops.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/spi_flash/memspi_host_driver.c + /home/karl/espressif/esp-idf-v5.1.1/components/spi_flash/flash_ops.c - build/ide/esp_idf_components/spi_flash/partition.c + build/ide/esp_idf_components/spi_flash/memspi_host_driver.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/spi_flash/partition.c + /home/karl/espressif/esp-idf-v5.1.1/components/spi_flash/memspi_host_driver.c build/ide/esp_idf_components/spi_flash/spi_flash_chip_boya.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/spi_flash/spi_flash_chip_boya.c + /home/karl/espressif/esp-idf-v5.1.1/components/spi_flash/spi_flash_chip_boya.c build/ide/esp_idf_components/spi_flash/spi_flash_chip_drivers.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/spi_flash/spi_flash_chip_drivers.c + /home/karl/espressif/esp-idf-v5.1.1/components/spi_flash/spi_flash_chip_drivers.c build/ide/esp_idf_components/spi_flash/spi_flash_chip_gd.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/spi_flash/spi_flash_chip_gd.c + /home/karl/espressif/esp-idf-v5.1.1/components/spi_flash/spi_flash_chip_gd.c build/ide/esp_idf_components/spi_flash/spi_flash_chip_generic.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/spi_flash/spi_flash_chip_generic.c + /home/karl/espressif/esp-idf-v5.1.1/components/spi_flash/spi_flash_chip_generic.c build/ide/esp_idf_components/spi_flash/spi_flash_chip_issi.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/spi_flash/spi_flash_chip_issi.c + /home/karl/espressif/esp-idf-v5.1.1/components/spi_flash/spi_flash_chip_issi.c build/ide/esp_idf_components/spi_flash/spi_flash_chip_mxic.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/spi_flash/spi_flash_chip_mxic.c + /home/karl/espressif/esp-idf-v5.1.1/components/spi_flash/spi_flash_chip_mxic.c + + + build/ide/esp_idf_components/spi_flash/spi_flash_chip_mxic_opi.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/spi_flash/spi_flash_chip_mxic_opi.c build/ide/esp_idf_components/spi_flash/spi_flash_chip_th.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/spi_flash/spi_flash_chip_th.c + /home/karl/espressif/esp-idf-v5.1.1/components/spi_flash/spi_flash_chip_th.c build/ide/esp_idf_components/spi_flash/spi_flash_chip_winbond.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/spi_flash/spi_flash_chip_winbond.c + /home/karl/espressif/esp-idf-v5.1.1/components/spi_flash/spi_flash_chip_winbond.c build/ide/esp_idf_components/spi_flash/spi_flash_os_func_app.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/spi_flash/spi_flash_os_func_app.c + /home/karl/espressif/esp-idf-v5.1.1/components/spi_flash/spi_flash_os_func_app.c build/ide/esp_idf_components/spi_flash/spi_flash_os_func_noos.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/spi_flash/spi_flash_os_func_noos.c + /home/karl/espressif/esp-idf-v5.1.1/components/spi_flash/spi_flash_os_func_noos.c + + + build/ide/esp_idf_components/spi_flash/spi_flash_wrap.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/spi_flash/spi_flash_wrap.c build/ide/esp_idf_components/spiffs/esp_spiffs.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/spiffs/esp_spiffs.c + /home/karl/espressif/esp-idf-v5.1.1/components/spiffs/esp_spiffs.c build/ide/esp_idf_components/spiffs/spiffs_api.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/spiffs/spiffs_api.c + /home/karl/espressif/esp-idf-v5.1.1/components/spiffs/spiffs_api.c build/ide/esp_idf_components/tcp_transport/transport.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/tcp_transport/transport.c + /home/karl/espressif/esp-idf-v5.1.1/components/tcp_transport/transport.c - build/ide/esp_idf_components/tcp_transport/transport_ssl.c + build/ide/esp_idf_components/tcp_transport/transport_internal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/tcp_transport/transport_ssl.c + /home/karl/espressif/esp-idf-v5.1.1/components/tcp_transport/transport_internal.c - build/ide/esp_idf_components/tcp_transport/transport_tcp.c + build/ide/esp_idf_components/tcp_transport/transport_socks_proxy.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/tcp_transport/transport_tcp.c + /home/karl/espressif/esp-idf-v5.1.1/components/tcp_transport/transport_socks_proxy.c - build/ide/esp_idf_components/tcp_transport/transport_utils.c + build/ide/esp_idf_components/tcp_transport/transport_ssl.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/tcp_transport/transport_utils.c + /home/karl/espressif/esp-idf-v5.1.1/components/tcp_transport/transport_ssl.c build/ide/esp_idf_components/tcp_transport/transport_ws.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/tcp_transport/transport_ws.c + /home/karl/espressif/esp-idf-v5.1.1/components/tcp_transport/transport_ws.c - build/ide/esp_idf_components/tcpip_adapter/tcpip_adapter_compat.c + build/ide/esp_idf_components/unity/unity_port_esp32.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/tcpip_adapter/tcpip_adapter_compat.c + /home/karl/espressif/esp-idf-v5.1.1/components/unity/unity_port_esp32.c - build/ide/esp_idf_components/ulp/ulp.c + build/ide/esp_idf_components/unity/unity_runner.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/ulp/ulp.c + /home/karl/espressif/esp-idf-v5.1.1/components/unity/unity_runner.c - build/ide/esp_idf_components/ulp/ulp_macro.c + build/ide/esp_idf_components/unity/unity_utils_cache.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/ulp/ulp_macro.c + /home/karl/espressif/esp-idf-v5.1.1/components/unity/unity_utils_cache.c - build/ide/esp_idf_components/unity/unity_port_esp32.c + build/ide/esp_idf_components/unity/unity_utils_freertos.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/unity/unity_port_esp32.c + /home/karl/espressif/esp-idf-v5.1.1/components/unity/unity_utils_freertos.c - build/ide/esp_idf_components/unity/unity_runner.c + build/ide/esp_idf_components/unity/unity_utils_memory.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/unity/unity_runner.c + /home/karl/espressif/esp-idf-v5.1.1/components/unity/unity_utils_memory.c build/ide/esp_idf_components/vfs/vfs.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/vfs/vfs.c + /home/karl/espressif/esp-idf-v5.1.1/components/vfs/vfs.c build/ide/esp_idf_components/vfs/vfs_console.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/vfs/vfs_console.c + /home/karl/espressif/esp-idf-v5.1.1/components/vfs/vfs_console.c + + + build/ide/esp_idf_components/vfs/vfs_eventfd.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/vfs/vfs_eventfd.c build/ide/esp_idf_components/vfs/vfs_semihost.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/vfs/vfs_semihost.c + /home/karl/espressif/esp-idf-v5.1.1/components/vfs/vfs_semihost.c build/ide/esp_idf_components/vfs/vfs_uart.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/vfs/vfs_uart.c + /home/karl/espressif/esp-idf-v5.1.1/components/vfs/vfs_uart.c build/ide/esp_idf_components/wear_levelling/Partition.cpp 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wear_levelling/Partition.cpp + /home/karl/espressif/esp-idf-v5.1.1/components/wear_levelling/Partition.cpp build/ide/esp_idf_components/wear_levelling/SPI_Flash.cpp 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wear_levelling/SPI_Flash.cpp + /home/karl/espressif/esp-idf-v5.1.1/components/wear_levelling/SPI_Flash.cpp build/ide/esp_idf_components/wear_levelling/WL_Ext_Perf.cpp 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wear_levelling/WL_Ext_Perf.cpp + /home/karl/espressif/esp-idf-v5.1.1/components/wear_levelling/WL_Ext_Perf.cpp build/ide/esp_idf_components/wear_levelling/WL_Ext_Safe.cpp 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wear_levelling/WL_Ext_Safe.cpp + /home/karl/espressif/esp-idf-v5.1.1/components/wear_levelling/WL_Ext_Safe.cpp build/ide/esp_idf_components/wear_levelling/WL_Flash.cpp 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wear_levelling/WL_Flash.cpp + /home/karl/espressif/esp-idf-v5.1.1/components/wear_levelling/WL_Flash.cpp build/ide/esp_idf_components/wear_levelling/crc32.cpp 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wear_levelling/crc32.cpp + /home/karl/espressif/esp-idf-v5.1.1/components/wear_levelling/crc32.cpp build/ide/esp_idf_components/wear_levelling/wear_levelling.cpp 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wear_levelling/wear_levelling.cpp - - - build/ide/esp_idf_components/xtensa/debug_helpers.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/xtensa/debug_helpers.c - - - build/ide/esp_idf_components/xtensa/debug_helpers_asm.S - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/xtensa/debug_helpers_asm.S + /home/karl/espressif/esp-idf-v5.1.1/components/wear_levelling/wear_levelling.cpp build/ide/esp_idf_components/xtensa/eri.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/xtensa/eri.c - - - build/ide/esp_idf_components/xtensa/expression_with_stack_xtensa.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/xtensa/expression_with_stack_xtensa.c + /home/karl/espressif/esp-idf-v5.1.1/components/xtensa/eri.c - build/ide/esp_idf_components/xtensa/expression_with_stack_xtensa_asm.S + build/ide/esp_idf_components/xtensa/xt_trax.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/xtensa/expression_with_stack_xtensa_asm.S - - - build/ide/esp_idf_components/xtensa/trax.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/xtensa/trax.c + /home/karl/espressif/esp-idf-v5.1.1/components/xtensa/xt_trax.c build/ide/esp_idf_components/xtensa/xtensa_intr.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/xtensa/xtensa_intr.c + /home/karl/espressif/esp-idf-v5.1.1/components/xtensa/xtensa_intr.c build/ide/esp_idf_components/xtensa/xtensa_intr_asm.S 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/xtensa/xtensa_intr_asm.S + /home/karl/espressif/esp-idf-v5.1.1/components/xtensa/xtensa_intr_asm.S - build/ide/esp_idf_components/app_trace/gcov/gcov_rtio.c + build/ide/esp_idf_components/app_trace/port/port_uart.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/app_trace/gcov/gcov_rtio.c + /home/karl/espressif/esp-idf-v5.1.1/components/app_trace/port/port_uart.c build/ide/esp_idf_components/bootloader_support/src/bootloader_clock_init.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/bootloader_support/src/bootloader_clock_init.c + /home/karl/espressif/esp-idf-v5.1.1/components/bootloader_support/src/bootloader_clock_init.c build/ide/esp_idf_components/bootloader_support/src/bootloader_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/bootloader_support/src/bootloader_common.c + /home/karl/espressif/esp-idf-v5.1.1/components/bootloader_support/src/bootloader_common.c build/ide/esp_idf_components/bootloader_support/src/bootloader_common_loader.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/bootloader_support/src/bootloader_common_loader.c + /home/karl/espressif/esp-idf-v5.1.1/components/bootloader_support/src/bootloader_common_loader.c build/ide/esp_idf_components/bootloader_support/src/bootloader_efuse.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/bootloader_support/src/bootloader_efuse.c - - - build/ide/esp_idf_components/bootloader_support/src/bootloader_flash.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/bootloader_support/src/bootloader_flash.c - - - build/ide/esp_idf_components/bootloader_support/src/bootloader_flash_config_esp32.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/bootloader_support/src/bootloader_flash_config_esp32.c + /home/karl/espressif/esp-idf-v5.1.1/components/bootloader_support/src/bootloader_efuse.c build/ide/esp_idf_components/bootloader_support/src/bootloader_mem.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/bootloader_support/src/bootloader_mem.c + /home/karl/espressif/esp-idf-v5.1.1/components/bootloader_support/src/bootloader_mem.c build/ide/esp_idf_components/bootloader_support/src/bootloader_random.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/bootloader_support/src/bootloader_random.c + /home/karl/espressif/esp-idf-v5.1.1/components/bootloader_support/src/bootloader_random.c build/ide/esp_idf_components/bootloader_support/src/bootloader_random_esp32.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/bootloader_support/src/bootloader_random_esp32.c + /home/karl/espressif/esp-idf-v5.1.1/components/bootloader_support/src/bootloader_random_esp32.c build/ide/esp_idf_components/bootloader_support/src/bootloader_utility.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/bootloader_support/src/bootloader_utility.c + /home/karl/espressif/esp-idf-v5.1.1/components/bootloader_support/src/bootloader_utility.c build/ide/esp_idf_components/bootloader_support/src/esp_image_format.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/bootloader_support/src/esp_image_format.c + /home/karl/espressif/esp-idf-v5.1.1/components/bootloader_support/src/esp_image_format.c build/ide/esp_idf_components/bootloader_support/src/flash_encrypt.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/bootloader_support/src/flash_encrypt.c + /home/karl/espressif/esp-idf-v5.1.1/components/bootloader_support/src/flash_encrypt.c build/ide/esp_idf_components/bootloader_support/src/flash_partitions.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/bootloader_support/src/flash_partitions.c + /home/karl/espressif/esp-idf-v5.1.1/components/bootloader_support/src/flash_partitions.c - build/ide/esp_idf_components/bootloader_support/src/flash_qio_mode.c + build/ide/esp_idf_components/bootloader_support/src/secure_boot.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/bootloader_support/src/flash_qio_mode.c + /home/karl/espressif/esp-idf-v5.1.1/components/bootloader_support/src/secure_boot.c - build/ide/esp_idf_components/bootloader_support/src/secure_boot.c + build/ide/esp_idf_components/console/argtable3/arg_cmd.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/bootloader_support/src/secure_boot.c + /home/karl/espressif/esp-idf-v5.1.1/components/console/argtable3/arg_cmd.c - build/ide/esp_idf_components/coap/port/coap_debug.c + build/ide/esp_idf_components/console/argtable3/arg_date.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/coap/port/coap_debug.c + /home/karl/espressif/esp-idf-v5.1.1/components/console/argtable3/arg_date.c - build/ide/esp_idf_components/coap/port/coap_mbedtls.c + build/ide/esp_idf_components/console/argtable3/arg_dbl.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/coap/port/coap_mbedtls.c + /home/karl/espressif/esp-idf-v5.1.1/components/console/argtable3/arg_dbl.c - build/ide/esp_idf_components/coap/port/coap_notls.c + build/ide/esp_idf_components/console/argtable3/arg_dstr.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/coap/port/coap_notls.c + /home/karl/espressif/esp-idf-v5.1.1/components/console/argtable3/arg_dstr.c - build/ide/esp_idf_components/console/argtable3/argtable3.c + build/ide/esp_idf_components/console/argtable3/arg_end.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/console/argtable3/argtable3.c + /home/karl/espressif/esp-idf-v5.1.1/components/console/argtable3/arg_end.c - build/ide/esp_idf_components/console/linenoise/linenoise.c + build/ide/esp_idf_components/console/argtable3/arg_file.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/console/linenoise/linenoise.c + /home/karl/espressif/esp-idf-v5.1.1/components/console/argtable3/arg_file.c - build/ide/esp_idf_components/driver/esp32/adc.c + build/ide/esp_idf_components/console/argtable3/arg_hashtable.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/esp32/adc.c + /home/karl/espressif/esp-idf-v5.1.1/components/console/argtable3/arg_hashtable.c - build/ide/esp_idf_components/driver/esp32/dac.c + build/ide/esp_idf_components/console/argtable3/arg_int.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/esp32/dac.c + /home/karl/espressif/esp-idf-v5.1.1/components/console/argtable3/arg_int.c - build/ide/esp_idf_components/driver/esp32/touch_sensor.c + build/ide/esp_idf_components/console/argtable3/arg_lit.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/driver/esp32/touch_sensor.c + /home/karl/espressif/esp-idf-v5.1.1/components/console/argtable3/arg_lit.c - build/ide/esp_idf_components/efuse/esp32/esp_efuse_table.c + build/ide/esp_idf_components/console/argtable3/arg_rem.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/efuse/esp32/esp_efuse_table.c + /home/karl/espressif/esp-idf-v5.1.1/components/console/argtable3/arg_rem.c - build/ide/esp_idf_components/efuse/src/esp_efuse_api.c + build/ide/esp_idf_components/console/argtable3/arg_rex.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/efuse/src/esp_efuse_api.c + /home/karl/espressif/esp-idf-v5.1.1/components/console/argtable3/arg_rex.c - build/ide/esp_idf_components/efuse/src/esp_efuse_fields.c + build/ide/esp_idf_components/console/argtable3/arg_str.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/efuse/src/esp_efuse_fields.c + /home/karl/espressif/esp-idf-v5.1.1/components/console/argtable3/arg_str.c - build/ide/esp_idf_components/efuse/src/esp_efuse_utility.c + build/ide/esp_idf_components/console/argtable3/arg_utils.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/efuse/src/esp_efuse_utility.c + /home/karl/espressif/esp-idf-v5.1.1/components/console/argtable3/arg_utils.c - build/ide/esp_idf_components/esp-tls/esp-tls-crypto/esp_tls_crypto.c + build/ide/esp_idf_components/console/argtable3/argtable3.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp-tls/esp-tls-crypto/esp_tls_crypto.c + /home/karl/espressif/esp-idf-v5.1.1/components/console/argtable3/argtable3.c - build/ide/esp_idf_components/esp_adc_cal/esp32/esp_adc_cal.c + build/ide/esp_idf_components/console/linenoise/linenoise.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_adc_cal/esp32/esp_adc_cal.c + /home/karl/espressif/esp-idf-v5.1.1/components/console/linenoise/linenoise.c - build/ide/esp_idf_components/esp_common/src/brownout.c + build/ide/esp_idf_components/driver/dac/dac_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_common/src/brownout.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/dac/dac_common.c - build/ide/esp_idf_components/esp_common/src/dbg_stubs.c + build/ide/esp_idf_components/driver/dac/dac_continuous.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_common/src/dbg_stubs.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/dac/dac_continuous.c - build/ide/esp_idf_components/esp_common/src/esp_err.c + build/ide/esp_idf_components/driver/dac/dac_cosine.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_common/src/esp_err.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/dac/dac_cosine.c - build/ide/esp_idf_components/esp_common/src/esp_err_to_name.c + build/ide/esp_idf_components/driver/dac/dac_oneshot.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_common/src/esp_err_to_name.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/dac/dac_oneshot.c - build/ide/esp_idf_components/esp_common/src/freertos_hooks.c + build/ide/esp_idf_components/driver/deprecated/adc_dma_legacy.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_common/src/freertos_hooks.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/deprecated/adc_dma_legacy.c - build/ide/esp_idf_components/esp_common/src/int_wdt.c + build/ide/esp_idf_components/driver/deprecated/adc_i2s_deprecated.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_common/src/int_wdt.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/deprecated/adc_i2s_deprecated.c - build/ide/esp_idf_components/esp_common/src/mac_addr.c + build/ide/esp_idf_components/driver/deprecated/adc_legacy.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_common/src/mac_addr.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/deprecated/adc_legacy.c - build/ide/esp_idf_components/esp_common/src/stack_check.c + build/ide/esp_idf_components/driver/deprecated/dac_common_legacy.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_common/src/stack_check.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/deprecated/dac_common_legacy.c - build/ide/esp_idf_components/esp_common/src/task_wdt.c + build/ide/esp_idf_components/driver/deprecated/i2s_legacy.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_common/src/task_wdt.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/deprecated/i2s_legacy.c - build/ide/esp_idf_components/esp_eth/src/esp_eth.c + build/ide/esp_idf_components/driver/deprecated/mcpwm_legacy.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_eth/src/esp_eth.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/deprecated/mcpwm_legacy.c - build/ide/esp_idf_components/esp_eth/src/esp_eth_mac_esp32.c + build/ide/esp_idf_components/driver/deprecated/pcnt_legacy.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_eth/src/esp_eth_mac_esp32.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/deprecated/pcnt_legacy.c - build/ide/esp_idf_components/esp_eth/src/esp_eth_netif_glue.c + build/ide/esp_idf_components/driver/deprecated/rmt_legacy.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_eth/src/esp_eth_netif_glue.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/deprecated/rmt_legacy.c - build/ide/esp_idf_components/esp_eth/src/esp_eth_phy.c + build/ide/esp_idf_components/driver/deprecated/sigma_delta_legacy.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_eth/src/esp_eth_phy.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/deprecated/sigma_delta_legacy.c - build/ide/esp_idf_components/esp_eth/src/esp_eth_phy_dp83848.c + build/ide/esp_idf_components/driver/deprecated/timer_legacy.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_eth/src/esp_eth_phy_dp83848.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/deprecated/timer_legacy.c - build/ide/esp_idf_components/esp_eth/src/esp_eth_phy_ip101.c + build/ide/esp_idf_components/driver/gpio/gpio.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_eth/src/esp_eth_phy_ip101.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/gpio/gpio.c - build/ide/esp_idf_components/esp_eth/src/esp_eth_phy_ksz8041.c + build/ide/esp_idf_components/driver/gpio/gpio_glitch_filter_ops.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_eth/src/esp_eth_phy_ksz8041.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/gpio/gpio_glitch_filter_ops.c - build/ide/esp_idf_components/esp_eth/src/esp_eth_phy_lan8720.c + build/ide/esp_idf_components/driver/gpio/rtc_io.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_eth/src/esp_eth_phy_lan8720.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/gpio/rtc_io.c - build/ide/esp_idf_components/esp_eth/src/esp_eth_phy_rtl8201.c + build/ide/esp_idf_components/driver/gptimer/gptimer.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_eth/src/esp_eth_phy_rtl8201.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/gptimer/gptimer.c - build/ide/esp_idf_components/esp_gdbstub/esp32/gdbstub_esp32.c + build/ide/esp_idf_components/driver/gptimer/gptimer_priv.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_gdbstub/esp32/gdbstub_esp32.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/gptimer/gptimer_priv.c - build/ide/esp_idf_components/esp_gdbstub/src/gdbstub.c + build/ide/esp_idf_components/driver/i2c/i2c.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_gdbstub/src/gdbstub.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/i2c/i2c.c - build/ide/esp_idf_components/esp_gdbstub/src/packet.c + build/ide/esp_idf_components/driver/i2s/i2s_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_gdbstub/src/packet.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/i2s/i2s_common.c - build/ide/esp_idf_components/esp_gdbstub/xtensa/gdbstub_xtensa.c + build/ide/esp_idf_components/driver/i2s/i2s_pdm.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_gdbstub/xtensa/gdbstub_xtensa.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/i2s/i2s_pdm.c - build/ide/esp_idf_components/esp_hid/src/esp_hid_common.c + build/ide/esp_idf_components/driver/i2s/i2s_std.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_hid/src/esp_hid_common.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/i2s/i2s_std.c - build/ide/esp_idf_components/esp_hid/src/esp_hidd.c + build/ide/esp_idf_components/driver/ledc/ledc.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_hid/src/esp_hidd.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/ledc/ledc.c - build/ide/esp_idf_components/esp_hid/src/esp_hidh.c + build/ide/esp_idf_components/driver/mcpwm/mcpwm_cap.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_hid/src/esp_hidh.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/mcpwm/mcpwm_cap.c - build/ide/esp_idf_components/esp_http_client/lib/http_auth.c + build/ide/esp_idf_components/driver/mcpwm/mcpwm_cmpr.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_http_client/lib/http_auth.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/mcpwm/mcpwm_cmpr.c - build/ide/esp_idf_components/esp_http_client/lib/http_header.c + build/ide/esp_idf_components/driver/mcpwm/mcpwm_com.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_http_client/lib/http_header.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/mcpwm/mcpwm_com.c - build/ide/esp_idf_components/esp_http_client/lib/http_utils.c + build/ide/esp_idf_components/driver/mcpwm/mcpwm_fault.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_http_client/lib/http_utils.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/mcpwm/mcpwm_fault.c - build/ide/esp_idf_components/esp_http_server/src/httpd_main.c + build/ide/esp_idf_components/driver/mcpwm/mcpwm_gen.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_http_server/src/httpd_main.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/mcpwm/mcpwm_gen.c - build/ide/esp_idf_components/esp_http_server/src/httpd_parse.c + build/ide/esp_idf_components/driver/mcpwm/mcpwm_oper.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_http_server/src/httpd_parse.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/mcpwm/mcpwm_oper.c - build/ide/esp_idf_components/esp_http_server/src/httpd_sess.c + build/ide/esp_idf_components/driver/mcpwm/mcpwm_sync.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_http_server/src/httpd_sess.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/mcpwm/mcpwm_sync.c - build/ide/esp_idf_components/esp_http_server/src/httpd_txrx.c + build/ide/esp_idf_components/driver/mcpwm/mcpwm_timer.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_http_server/src/httpd_txrx.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/mcpwm/mcpwm_timer.c - build/ide/esp_idf_components/esp_http_server/src/httpd_uri.c + build/ide/esp_idf_components/driver/pcnt/pulse_cnt.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_http_server/src/httpd_uri.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/pcnt/pulse_cnt.c - build/ide/esp_idf_components/esp_http_server/src/httpd_ws.c + build/ide/esp_idf_components/driver/rmt/rmt_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_http_server/src/httpd_ws.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/rmt/rmt_common.c - build/ide/esp_idf_components/esp_https_ota/src/esp_https_ota.c + build/ide/esp_idf_components/driver/rmt/rmt_encoder.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_https_ota/src/esp_https_ota.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/rmt/rmt_encoder.c - build/ide/esp_idf_components/esp_local_ctrl/proto-c/esp_local_ctrl.pb-c.c + build/ide/esp_idf_components/driver/rmt/rmt_rx.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_local_ctrl/proto-c/esp_local_ctrl.pb-c.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/rmt/rmt_rx.c - build/ide/esp_idf_components/esp_local_ctrl/src/esp_local_ctrl.c + build/ide/esp_idf_components/driver/rmt/rmt_tx.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_local_ctrl/src/esp_local_ctrl.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/rmt/rmt_tx.c - build/ide/esp_idf_components/esp_local_ctrl/src/esp_local_ctrl_handler.c + build/ide/esp_idf_components/driver/sdio_slave/sdio_slave.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_local_ctrl/src/esp_local_ctrl_handler.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/sdio_slave/sdio_slave.c - build/ide/esp_idf_components/esp_netif/loopback/esp_netif_loopback.c + build/ide/esp_idf_components/driver/sdmmc/sdmmc_host.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_netif/loopback/esp_netif_loopback.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/sdmmc/sdmmc_host.c - build/ide/esp_idf_components/esp_netif/lwip/esp_netif_lwip.c + build/ide/esp_idf_components/driver/sdmmc/sdmmc_transaction.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_netif/lwip/esp_netif_lwip.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/sdmmc/sdmmc_transaction.c - build/ide/esp_idf_components/esp_netif/lwip/esp_netif_lwip_defaults.c + build/ide/esp_idf_components/driver/sigma_delta/sdm.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_netif/lwip/esp_netif_lwip_defaults.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/sigma_delta/sdm.c - build/ide/esp_idf_components/esp_netif/lwip/esp_netif_sta_list.c + build/ide/esp_idf_components/driver/spi/spi_bus_lock.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_netif/lwip/esp_netif_sta_list.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/spi/spi_bus_lock.c - build/ide/esp_idf_components/esp_rom/patches/esp_rom_crc.c + build/ide/esp_idf_components/driver/touch_sensor/touch_sensor_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_rom/patches/esp_rom_crc.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/touch_sensor/touch_sensor_common.c - build/ide/esp_idf_components/esp_rom/patches/esp_rom_longjmp.S + build/ide/esp_idf_components/driver/twai/twai.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_rom/patches/esp_rom_longjmp.S + /home/karl/espressif/esp-idf-v5.1.1/components/driver/twai/twai.c - build/ide/esp_idf_components/esp_rom/patches/esp_rom_sys.c + build/ide/esp_idf_components/driver/uart/uart.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_rom/patches/esp_rom_sys.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/uart/uart.c - build/ide/esp_idf_components/esp_rom/patches/esp_rom_uart.c + build/ide/esp_idf_components/efuse/esp32/esp_efuse_fields.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_rom/patches/esp_rom_uart.c + /home/karl/espressif/esp-idf-v5.1.1/components/efuse/esp32/esp_efuse_fields.c - build/ide/esp_idf_components/esp_system/port/cpu_start.c + build/ide/esp_idf_components/efuse/esp32/esp_efuse_table.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_system/port/cpu_start.c + /home/karl/espressif/esp-idf-v5.1.1/components/efuse/esp32/esp_efuse_table.c - build/ide/esp_idf_components/esp_system/port/panic_handler.c + build/ide/esp_idf_components/efuse/esp32/esp_efuse_utility.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_system/port/panic_handler.c + /home/karl/espressif/esp-idf-v5.1.1/components/efuse/esp32/esp_efuse_utility.c - build/ide/esp_idf_components/esp_timer/src/esp_timer.c + build/ide/esp_idf_components/efuse/src/esp_efuse_api.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_timer/src/esp_timer.c + /home/karl/espressif/esp-idf-v5.1.1/components/efuse/src/esp_efuse_api.c - build/ide/esp_idf_components/esp_timer/src/esp_timer_impl_lac.c + build/ide/esp_idf_components/efuse/src/esp_efuse_fields.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_timer/src/esp_timer_impl_lac.c + /home/karl/espressif/esp-idf-v5.1.1/components/efuse/src/esp_efuse_fields.c - build/ide/esp_idf_components/esp_timer/src/ets_timer_legacy.c + build/ide/esp_idf_components/efuse/src/esp_efuse_utility.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_timer/src/ets_timer_legacy.c + /home/karl/espressif/esp-idf-v5.1.1/components/efuse/src/esp_efuse_utility.c - build/ide/esp_idf_components/esp_timer/src/system_time.c + build/ide/esp_idf_components/esp-tls/esp-tls-crypto/esp_tls_crypto.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_timer/src/system_time.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp-tls/esp-tls-crypto/esp_tls_crypto.c - build/ide/esp_idf_components/esp_wifi/esp32/esp_adapter.c + build/ide/esp_idf_components/esp_adc/deprecated/esp_adc_cal_common_legacy.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_wifi/esp32/esp_adapter.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_adc/deprecated/esp_adc_cal_common_legacy.c - build/ide/esp_idf_components/esp_wifi/src/coexist.c + build/ide/esp_idf_components/esp_adc/esp32/adc_cali_line_fitting.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_wifi/src/coexist.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_adc/esp32/adc_cali_line_fitting.c - build/ide/esp_idf_components/esp_wifi/src/lib_printf.c + build/ide/esp_idf_components/esp_coex/esp32/esp_coex_adapter.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_wifi/src/lib_printf.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_coex/esp32/esp_coex_adapter.c - build/ide/esp_idf_components/esp_wifi/src/mesh_event.c + build/ide/esp_idf_components/esp_common/src/esp_err_to_name.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_wifi/src/mesh_event.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_common/src/esp_err_to_name.c - build/ide/esp_idf_components/esp_wifi/src/phy_init.c + build/ide/esp_idf_components/esp_eth/src/esp_eth.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_wifi/src/phy_init.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_eth/src/esp_eth.c - build/ide/esp_idf_components/esp_wifi/src/phy_override.c + build/ide/esp_idf_components/esp_eth/src/esp_eth_mac_esp.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_wifi/src/phy_override.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_eth/src/esp_eth_mac_esp.c - build/ide/esp_idf_components/esp_wifi/src/smartconfig.c + build/ide/esp_idf_components/esp_eth/src/esp_eth_netif_glue.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_wifi/src/smartconfig.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_eth/src/esp_eth_netif_glue.c - build/ide/esp_idf_components/esp_wifi/src/smartconfig_ack.c + build/ide/esp_idf_components/esp_eth/src/esp_eth_phy_802_3.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_wifi/src/smartconfig_ack.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_eth/src/esp_eth_phy_802_3.c - build/ide/esp_idf_components/esp_wifi/src/wifi_default.c + build/ide/esp_idf_components/esp_eth/src/esp_eth_phy_dp83848.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_wifi/src/wifi_default.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_eth/src/esp_eth_phy_dp83848.c - build/ide/esp_idf_components/esp_wifi/src/wifi_init.c + build/ide/esp_idf_components/esp_eth/src/esp_eth_phy_ip101.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_wifi/src/wifi_init.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_eth/src/esp_eth_phy_ip101.c - build/ide/esp_idf_components/esp_wifi/src/wifi_netif.c + build/ide/esp_idf_components/esp_eth/src/esp_eth_phy_ksz80xx.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_wifi/src/wifi_netif.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_eth/src/esp_eth_phy_ksz80xx.c - build/ide/esp_idf_components/espcoredump/src/core_dump_binary.c + build/ide/esp_idf_components/esp_eth/src/esp_eth_phy_lan87xx.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/espcoredump/src/core_dump_binary.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_eth/src/esp_eth_phy_lan87xx.c - build/ide/esp_idf_components/espcoredump/src/core_dump_checksum.c + build/ide/esp_idf_components/esp_eth/src/esp_eth_phy_rtl8201.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/espcoredump/src/core_dump_checksum.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_eth/src/esp_eth_phy_rtl8201.c - build/ide/esp_idf_components/espcoredump/src/core_dump_common.c + build/ide/esp_idf_components/esp_gdbstub/src/gdbstub.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/espcoredump/src/core_dump_common.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_gdbstub/src/gdbstub.c - build/ide/esp_idf_components/espcoredump/src/core_dump_elf.c + build/ide/esp_idf_components/esp_gdbstub/src/gdbstub_transport.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/espcoredump/src/core_dump_elf.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_gdbstub/src/gdbstub_transport.c - build/ide/esp_idf_components/espcoredump/src/core_dump_flash.c + build/ide/esp_idf_components/esp_gdbstub/src/packet.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/espcoredump/src/core_dump_flash.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_gdbstub/src/packet.c - build/ide/esp_idf_components/espcoredump/src/core_dump_uart.c + build/ide/esp_idf_components/esp_hid/src/esp_hid_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/espcoredump/src/core_dump_uart.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hid/src/esp_hid_common.c - build/ide/esp_idf_components/fatfs/diskio/diskio.c + build/ide/esp_idf_components/esp_hid/src/esp_hidd.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/fatfs/diskio/diskio.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hid/src/esp_hidd.c - build/ide/esp_idf_components/fatfs/diskio/diskio_rawflash.c + build/ide/esp_idf_components/esp_hid/src/esp_hidh.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/fatfs/diskio/diskio_rawflash.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hid/src/esp_hidh.c - build/ide/esp_idf_components/fatfs/diskio/diskio_sdmmc.c + build/ide/esp_idf_components/esp_http_client/lib/http_auth.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/fatfs/diskio/diskio_sdmmc.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_http_client/lib/http_auth.c - build/ide/esp_idf_components/fatfs/diskio/diskio_wl.c + build/ide/esp_idf_components/esp_http_client/lib/http_header.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/fatfs/diskio/diskio_wl.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_http_client/lib/http_header.c - build/ide/esp_idf_components/fatfs/src/ff.c + build/ide/esp_idf_components/esp_http_client/lib/http_utils.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/fatfs/src/ff.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_http_client/lib/http_utils.c - build/ide/esp_idf_components/fatfs/src/ffunicode.c + build/ide/esp_idf_components/esp_http_server/src/httpd_main.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/fatfs/src/ffunicode.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_http_server/src/httpd_main.c - build/ide/esp_idf_components/fatfs/vfs/vfs_fat.c + build/ide/esp_idf_components/esp_http_server/src/httpd_parse.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/fatfs/vfs/vfs_fat.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_http_server/src/httpd_parse.c - build/ide/esp_idf_components/fatfs/vfs/vfs_fat_sdmmc.c + build/ide/esp_idf_components/esp_http_server/src/httpd_sess.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/fatfs/vfs/vfs_fat_sdmmc.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_http_server/src/httpd_sess.c - build/ide/esp_idf_components/fatfs/vfs/vfs_fat_spiflash.c + build/ide/esp_idf_components/esp_http_server/src/httpd_txrx.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/fatfs/vfs/vfs_fat_spiflash.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_http_server/src/httpd_txrx.c - build/ide/esp_idf_components/freemodbus/common/esp_modbus_master.c + build/ide/esp_idf_components/esp_http_server/src/httpd_uri.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/common/esp_modbus_master.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_http_server/src/httpd_uri.c - build/ide/esp_idf_components/freemodbus/common/esp_modbus_master_serial.c + build/ide/esp_idf_components/esp_http_server/src/httpd_ws.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/common/esp_modbus_master_serial.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_http_server/src/httpd_ws.c - build/ide/esp_idf_components/freemodbus/common/esp_modbus_master_tcp.c + build/ide/esp_idf_components/esp_https_ota/src/esp_https_ota.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/common/esp_modbus_master_tcp.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_https_ota/src/esp_https_ota.c - build/ide/esp_idf_components/freemodbus/common/esp_modbus_slave.c + build/ide/esp_idf_components/esp_hw_support/port/esp_clk_tree_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/common/esp_modbus_slave.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/port/esp_clk_tree_common.c - build/ide/esp_idf_components/freemodbus/common/esp_modbus_slave_serial.c + build/ide/esp_idf_components/esp_lcd/src/esp_lcd_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/common/esp_modbus_slave_serial.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_lcd/src/esp_lcd_common.c - build/ide/esp_idf_components/freemodbus/common/esp_modbus_slave_tcp.c + build/ide/esp_idf_components/esp_lcd/src/esp_lcd_panel_io.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/common/esp_modbus_slave_tcp.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_lcd/src/esp_lcd_panel_io.c - build/ide/esp_idf_components/freemodbus/modbus/mb.c + build/ide/esp_idf_components/esp_lcd/src/esp_lcd_panel_io_i2c.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/modbus/mb.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_lcd/src/esp_lcd_panel_io_i2c.c - build/ide/esp_idf_components/freemodbus/modbus/mb_m.c + build/ide/esp_idf_components/esp_lcd/src/esp_lcd_panel_io_i2s.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/modbus/mb_m.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_lcd/src/esp_lcd_panel_io_i2s.c - build/ide/esp_idf_components/freemodbus/port/port.c + build/ide/esp_idf_components/esp_lcd/src/esp_lcd_panel_io_spi.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/port/port.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_lcd/src/esp_lcd_panel_io_spi.c - build/ide/esp_idf_components/freemodbus/port/portevent.c + build/ide/esp_idf_components/esp_lcd/src/esp_lcd_panel_nt35510.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/port/portevent.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_lcd/src/esp_lcd_panel_nt35510.c - build/ide/esp_idf_components/freemodbus/port/portevent_m.c + build/ide/esp_idf_components/esp_lcd/src/esp_lcd_panel_ops.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/port/portevent_m.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_lcd/src/esp_lcd_panel_ops.c - build/ide/esp_idf_components/freemodbus/port/portother.c + build/ide/esp_idf_components/esp_lcd/src/esp_lcd_panel_ssd1306.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/port/portother.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_lcd/src/esp_lcd_panel_ssd1306.c - build/ide/esp_idf_components/freemodbus/port/portother_m.c + build/ide/esp_idf_components/esp_lcd/src/esp_lcd_panel_st7789.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/port/portother_m.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_lcd/src/esp_lcd_panel_st7789.c - build/ide/esp_idf_components/freemodbus/port/portserial.c + build/ide/esp_idf_components/esp_local_ctrl/proto-c/esp_local_ctrl.pb-c.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/port/portserial.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_local_ctrl/proto-c/esp_local_ctrl.pb-c.c - build/ide/esp_idf_components/freemodbus/port/portserial_m.c + build/ide/esp_idf_components/esp_local_ctrl/src/esp_local_ctrl.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/port/portserial_m.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_local_ctrl/src/esp_local_ctrl.c - build/ide/esp_idf_components/freemodbus/port/porttimer.c + build/ide/esp_idf_components/esp_local_ctrl/src/esp_local_ctrl_handler.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/port/porttimer.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_local_ctrl/src/esp_local_ctrl_handler.c - build/ide/esp_idf_components/freemodbus/port/porttimer_m.c + build/ide/esp_idf_components/esp_local_ctrl/src/esp_local_ctrl_transport_httpd.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/port/porttimer_m.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_local_ctrl/src/esp_local_ctrl_transport_httpd.c - build/ide/esp_idf_components/freertos/port/port_common.c + build/ide/esp_idf_components/esp_netif/lwip/esp_netif_lwip.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freertos/port/port_common.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_netif/lwip/esp_netif_lwip.c - build/ide/esp_idf_components/hal/esp32/adc_hal.c + build/ide/esp_idf_components/esp_netif/lwip/esp_netif_lwip_defaults.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/esp32/adc_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_netif/lwip/esp_netif_lwip_defaults.c - build/ide/esp_idf_components/hal/esp32/brownout_hal.c + build/ide/esp_idf_components/esp_netif/lwip/esp_netif_sntp.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/esp32/brownout_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_netif/lwip/esp_netif_sntp.c - build/ide/esp_idf_components/hal/esp32/efuse_hal.c + build/ide/esp_idf_components/esp_phy/src/btbb_init.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/esp32/efuse_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_phy/src/btbb_init.c - build/ide/esp_idf_components/hal/esp32/emac_hal.c + build/ide/esp_idf_components/esp_phy/src/lib_printf.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/esp32/emac_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_phy/src/lib_printf.c - build/ide/esp_idf_components/hal/esp32/gpio_hal_workaround.c + build/ide/esp_idf_components/esp_phy/src/phy_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/esp32/gpio_hal_workaround.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_phy/src/phy_common.c - build/ide/esp_idf_components/hal/esp32/interrupt_descriptor_table.c + build/ide/esp_idf_components/esp_phy/src/phy_init.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/esp32/interrupt_descriptor_table.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_phy/src/phy_init.c - build/ide/esp_idf_components/hal/esp32/touch_sensor_hal.c + build/ide/esp_idf_components/esp_phy/src/phy_override.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/hal/esp32/touch_sensor_hal.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_phy/src/phy_override.c - build/ide/esp_idf_components/jsmn/src/jsmn.c + build/ide/esp_idf_components/esp_psram/esp32/esp_himem.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/jsmn/src/jsmn.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_psram/esp32/esp_himem.c - build/ide/esp_idf_components/json/cJSON/cJSON.c + build/ide/esp_idf_components/esp_psram/esp32/esp_psram_extram_cache.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/json/cJSON/cJSON.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_psram/esp32/esp_psram_extram_cache.c - build/ide/esp_idf_components/json/cJSON/cJSON_Utils.c + build/ide/esp_idf_components/esp_psram/esp32/esp_psram_impl_quad.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/json/cJSON/cJSON_Utils.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_psram/esp32/esp_psram_impl_quad.c - build/ide/esp_idf_components/libsodium/port/randombytes_esp32.c + build/ide/esp_idf_components/esp_rom/patches/esp_rom_crc.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/port/randombytes_esp32.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_rom/patches/esp_rom_crc.c - build/ide/esp_idf_components/mbedtls/port/esp_bignum.c + build/ide/esp_idf_components/esp_rom/patches/esp_rom_efuse.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/port/esp_bignum.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_rom/patches/esp_rom_efuse.c - build/ide/esp_idf_components/mbedtls/port/esp_hardware.c + build/ide/esp_idf_components/esp_rom/patches/esp_rom_longjmp.S 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/port/esp_hardware.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_rom/patches/esp_rom_longjmp.S - build/ide/esp_idf_components/mbedtls/port/esp_mem.c + build/ide/esp_idf_components/esp_rom/patches/esp_rom_spiflash.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/port/esp_mem.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_rom/patches/esp_rom_spiflash.c - build/ide/esp_idf_components/mbedtls/port/esp_timing.c + build/ide/esp_idf_components/esp_rom/patches/esp_rom_sys.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/port/esp_timing.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_rom/patches/esp_rom_sys.c - build/ide/esp_idf_components/mbedtls/port/mbedtls_debug.c + build/ide/esp_idf_components/esp_rom/patches/esp_rom_uart.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/port/mbedtls_debug.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_rom/patches/esp_rom_uart.c - build/ide/esp_idf_components/mbedtls/port/net_sockets.c + build/ide/esp_idf_components/esp_system/port/brownout.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/port/net_sockets.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/port/brownout.c - build/ide/esp_idf_components/mqtt/esp-mqtt/mqtt_client.c + build/ide/esp_idf_components/esp_system/port/cpu_start.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mqtt/esp-mqtt/mqtt_client.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/port/cpu_start.c - build/ide/esp_idf_components/newlib/port/esp_time_impl.c + build/ide/esp_idf_components/esp_system/port/esp_system_chip.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/newlib/port/esp_time_impl.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/port/esp_system_chip.c - build/ide/esp_idf_components/nghttp/port/http_parser.c + build/ide/esp_idf_components/esp_system/port/panic_handler.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nghttp/port/http_parser.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/port/panic_handler.c - build/ide/esp_idf_components/nvs_flash/src/nvs_api.cpp + build/ide/esp_idf_components/esp_system/task_wdt/task_wdt.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nvs_flash/src/nvs_api.cpp + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/task_wdt/task_wdt.c - build/ide/esp_idf_components/nvs_flash/src/nvs_cxx_api.cpp + build/ide/esp_idf_components/esp_system/task_wdt/task_wdt_impl_timergroup.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nvs_flash/src/nvs_cxx_api.cpp + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/task_wdt/task_wdt_impl_timergroup.c - build/ide/esp_idf_components/nvs_flash/src/nvs_handle_locked.cpp + build/ide/esp_idf_components/esp_timer/src/esp_timer.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nvs_flash/src/nvs_handle_locked.cpp + /home/karl/espressif/esp-idf-v5.1.1/components/esp_timer/src/esp_timer.c - build/ide/esp_idf_components/nvs_flash/src/nvs_handle_simple.cpp + build/ide/esp_idf_components/esp_timer/src/esp_timer_impl_lac.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nvs_flash/src/nvs_handle_simple.cpp + /home/karl/espressif/esp-idf-v5.1.1/components/esp_timer/src/esp_timer_impl_lac.c - build/ide/esp_idf_components/nvs_flash/src/nvs_item_hash_list.cpp + build/ide/esp_idf_components/esp_timer/src/ets_timer_legacy.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nvs_flash/src/nvs_item_hash_list.cpp + /home/karl/espressif/esp-idf-v5.1.1/components/esp_timer/src/ets_timer_legacy.c - build/ide/esp_idf_components/nvs_flash/src/nvs_page.cpp + build/ide/esp_idf_components/esp_timer/src/system_time.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nvs_flash/src/nvs_page.cpp + /home/karl/espressif/esp-idf-v5.1.1/components/esp_timer/src/system_time.c - build/ide/esp_idf_components/nvs_flash/src/nvs_pagemanager.cpp + build/ide/esp_idf_components/esp_wifi/esp32/esp_adapter.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nvs_flash/src/nvs_pagemanager.cpp + /home/karl/espressif/esp-idf-v5.1.1/components/esp_wifi/esp32/esp_adapter.c - build/ide/esp_idf_components/nvs_flash/src/nvs_partition.cpp + build/ide/esp_idf_components/esp_wifi/src/mesh_event.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nvs_flash/src/nvs_partition.cpp + /home/karl/espressif/esp-idf-v5.1.1/components/esp_wifi/src/mesh_event.c - build/ide/esp_idf_components/nvs_flash/src/nvs_partition_lookup.cpp + build/ide/esp_idf_components/esp_wifi/src/smartconfig.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nvs_flash/src/nvs_partition_lookup.cpp + /home/karl/espressif/esp-idf-v5.1.1/components/esp_wifi/src/smartconfig.c - build/ide/esp_idf_components/nvs_flash/src/nvs_partition_manager.cpp + build/ide/esp_idf_components/esp_wifi/src/smartconfig_ack.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nvs_flash/src/nvs_partition_manager.cpp + /home/karl/espressif/esp-idf-v5.1.1/components/esp_wifi/src/smartconfig_ack.c - build/ide/esp_idf_components/nvs_flash/src/nvs_storage.cpp + build/ide/esp_idf_components/esp_wifi/src/wifi_default.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nvs_flash/src/nvs_storage.cpp + /home/karl/espressif/esp-idf-v5.1.1/components/esp_wifi/src/wifi_default.c - build/ide/esp_idf_components/nvs_flash/src/nvs_types.cpp + build/ide/esp_idf_components/esp_wifi/src/wifi_default_ap.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nvs_flash/src/nvs_types.cpp + /home/karl/espressif/esp-idf-v5.1.1/components/esp_wifi/src/wifi_default_ap.c - build/ide/esp_idf_components/openssl/library/ssl_bio.c + build/ide/esp_idf_components/esp_wifi/src/wifi_init.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/openssl/library/ssl_bio.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_wifi/src/wifi_init.c - build/ide/esp_idf_components/openssl/library/ssl_cert.c + build/ide/esp_idf_components/esp_wifi/src/wifi_netif.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/openssl/library/ssl_cert.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_wifi/src/wifi_netif.c - build/ide/esp_idf_components/openssl/library/ssl_err.c + build/ide/esp_idf_components/espcoredump/src/core_dump_binary.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/openssl/library/ssl_err.c + /home/karl/espressif/esp-idf-v5.1.1/components/espcoredump/src/core_dump_binary.c - build/ide/esp_idf_components/openssl/library/ssl_lib.c + build/ide/esp_idf_components/espcoredump/src/core_dump_checksum.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/openssl/library/ssl_lib.c + /home/karl/espressif/esp-idf-v5.1.1/components/espcoredump/src/core_dump_checksum.c - build/ide/esp_idf_components/openssl/library/ssl_methods.c + build/ide/esp_idf_components/espcoredump/src/core_dump_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/openssl/library/ssl_methods.c + /home/karl/espressif/esp-idf-v5.1.1/components/espcoredump/src/core_dump_common.c - build/ide/esp_idf_components/openssl/library/ssl_pkey.c + build/ide/esp_idf_components/espcoredump/src/core_dump_elf.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/openssl/library/ssl_pkey.c + /home/karl/espressif/esp-idf-v5.1.1/components/espcoredump/src/core_dump_elf.c - build/ide/esp_idf_components/openssl/library/ssl_stack.c + build/ide/esp_idf_components/espcoredump/src/core_dump_flash.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/openssl/library/ssl_stack.c + /home/karl/espressif/esp-idf-v5.1.1/components/espcoredump/src/core_dump_flash.c - build/ide/esp_idf_components/openssl/library/ssl_x509.c + build/ide/esp_idf_components/espcoredump/src/core_dump_uart.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/openssl/library/ssl_x509.c + /home/karl/espressif/esp-idf-v5.1.1/components/espcoredump/src/core_dump_uart.c - build/ide/esp_idf_components/openssl/platform/ssl_pm.c + build/ide/esp_idf_components/fatfs/diskio/diskio.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/openssl/platform/ssl_pm.c + /home/karl/espressif/esp-idf-v5.1.1/components/fatfs/diskio/diskio.c - build/ide/esp_idf_components/openssl/platform/ssl_port.c + build/ide/esp_idf_components/fatfs/diskio/diskio_rawflash.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/openssl/platform/ssl_port.c + /home/karl/espressif/esp-idf-v5.1.1/components/fatfs/diskio/diskio_rawflash.c - build/ide/esp_idf_components/protocomm/proto-c/constants.pb-c.c + build/ide/esp_idf_components/fatfs/diskio/diskio_sdmmc.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/protocomm/proto-c/constants.pb-c.c + /home/karl/espressif/esp-idf-v5.1.1/components/fatfs/diskio/diskio_sdmmc.c - build/ide/esp_idf_components/protocomm/proto-c/sec0.pb-c.c + build/ide/esp_idf_components/fatfs/diskio/diskio_wl.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/protocomm/proto-c/sec0.pb-c.c + /home/karl/espressif/esp-idf-v5.1.1/components/fatfs/diskio/diskio_wl.c - build/ide/esp_idf_components/protocomm/proto-c/sec1.pb-c.c + build/ide/esp_idf_components/fatfs/src/ff.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/protocomm/proto-c/sec1.pb-c.c + /home/karl/espressif/esp-idf-v5.1.1/components/fatfs/src/ff.c - build/ide/esp_idf_components/protocomm/proto-c/session.pb-c.c + build/ide/esp_idf_components/fatfs/src/ffunicode.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/protocomm/proto-c/session.pb-c.c + /home/karl/espressif/esp-idf-v5.1.1/components/fatfs/src/ffunicode.c - build/ide/esp_idf_components/soc/esp32/adc_periph.c + build/ide/esp_idf_components/fatfs/vfs/vfs_fat.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/soc/esp32/adc_periph.c + /home/karl/espressif/esp-idf-v5.1.1/components/fatfs/vfs/vfs_fat.c - build/ide/esp_idf_components/soc/esp32/dac_periph.c + build/ide/esp_idf_components/fatfs/vfs/vfs_fat_sdmmc.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/soc/esp32/dac_periph.c + /home/karl/espressif/esp-idf-v5.1.1/components/fatfs/vfs/vfs_fat_sdmmc.c - build/ide/esp_idf_components/soc/esp32/gpio_periph.c + build/ide/esp_idf_components/fatfs/vfs/vfs_fat_spiflash.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/soc/esp32/gpio_periph.c + /home/karl/espressif/esp-idf-v5.1.1/components/fatfs/vfs/vfs_fat_spiflash.c - build/ide/esp_idf_components/soc/esp32/i2c_periph.c + build/ide/esp_idf_components/freertos/FreeRTOS-Kernel/croutine.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/soc/esp32/i2c_periph.c + /home/karl/espressif/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/croutine.c - build/ide/esp_idf_components/soc/esp32/i2s_periph.c + build/ide/esp_idf_components/freertos/FreeRTOS-Kernel/event_groups.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/soc/esp32/i2s_periph.c + /home/karl/espressif/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/event_groups.c - build/ide/esp_idf_components/soc/esp32/interrupts.c + build/ide/esp_idf_components/freertos/FreeRTOS-Kernel/list.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/soc/esp32/interrupts.c + /home/karl/espressif/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/list.c - build/ide/esp_idf_components/soc/esp32/ledc_periph.c + build/ide/esp_idf_components/freertos/FreeRTOS-Kernel/queue.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/soc/esp32/ledc_periph.c + /home/karl/espressif/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/queue.c - build/ide/esp_idf_components/soc/esp32/pcnt_periph.c + build/ide/esp_idf_components/freertos/FreeRTOS-Kernel/stream_buffer.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/soc/esp32/pcnt_periph.c + /home/karl/espressif/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/stream_buffer.c - build/ide/esp_idf_components/soc/esp32/rmt_periph.c + build/ide/esp_idf_components/freertos/FreeRTOS-Kernel/tasks.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/soc/esp32/rmt_periph.c + /home/karl/espressif/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/tasks.c - build/ide/esp_idf_components/soc/esp32/rtc_io_periph.c + build/ide/esp_idf_components/freertos/FreeRTOS-Kernel/timers.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/soc/esp32/rtc_io_periph.c + /home/karl/espressif/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/timers.c - build/ide/esp_idf_components/soc/esp32/sdio_slave_periph.c + build/ide/esp_idf_components/freertos/esp_additions/freertos_v8_compat.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/soc/esp32/sdio_slave_periph.c + /home/karl/espressif/esp-idf-v5.1.1/components/freertos/esp_additions/freertos_v8_compat.c - build/ide/esp_idf_components/soc/esp32/sdmmc_periph.c + build/ide/esp_idf_components/freertos/esp_additions/idf_additions.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/soc/esp32/sdmmc_periph.c + /home/karl/espressif/esp-idf-v5.1.1/components/freertos/esp_additions/idf_additions.c - build/ide/esp_idf_components/soc/esp32/sigmadelta_periph.c + build/ide/esp_idf_components/hal/esp32/cache_hal_esp32.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/soc/esp32/sigmadelta_periph.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/esp32/cache_hal_esp32.c - build/ide/esp_idf_components/soc/esp32/soc_memory_layout.c + build/ide/esp_idf_components/hal/esp32/clk_tree_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/soc/esp32/soc_memory_layout.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/esp32/clk_tree_hal.c - build/ide/esp_idf_components/soc/esp32/spi_periph.c + build/ide/esp_idf_components/hal/esp32/efuse_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/soc/esp32/spi_periph.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/esp32/efuse_hal.c - build/ide/esp_idf_components/soc/esp32/timer_periph.c + build/ide/esp_idf_components/hal/esp32/gpio_hal_workaround.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/soc/esp32/timer_periph.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/esp32/gpio_hal_workaround.c - build/ide/esp_idf_components/soc/esp32/touch_sensor_periph.c + build/ide/esp_idf_components/hal/esp32/touch_sensor_hal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/soc/esp32/touch_sensor_periph.c + /home/karl/espressif/esp-idf-v5.1.1/components/hal/esp32/touch_sensor_hal.c - build/ide/esp_idf_components/soc/esp32/uart_periph.c + build/ide/esp_idf_components/heap/port/memory_layout_utils.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/soc/esp32/uart_periph.c + /home/karl/espressif/esp-idf-v5.1.1/components/heap/port/memory_layout_utils.c - build/ide/esp_idf_components/spi_flash/esp32/flash_ops_esp32.c + build/ide/esp_idf_components/heap/tlsf/tlsf.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/spi_flash/esp32/flash_ops_esp32.c + /home/karl/espressif/esp-idf-v5.1.1/components/heap/tlsf/tlsf.c - build/ide/esp_idf_components/spi_flash/esp32/spi_flash_rom_patch.c + build/ide/esp_idf_components/json/cJSON/cJSON.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/spi_flash/esp32/spi_flash_rom_patch.c + /home/karl/espressif/esp-idf-v5.1.1/components/json/cJSON/cJSON.c - build/ide/esp_idf_components/wifi_provisioning/proto-c/wifi_config.pb-c.c + build/ide/esp_idf_components/json/cJSON/cJSON_Utils.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wifi_provisioning/proto-c/wifi_config.pb-c.c + /home/karl/espressif/esp-idf-v5.1.1/components/json/cJSON/cJSON_Utils.c - build/ide/esp_idf_components/wifi_provisioning/proto-c/wifi_constants.pb-c.c + build/ide/esp_idf_components/lwip/port/sockets_ext.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wifi_provisioning/proto-c/wifi_constants.pb-c.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/port/sockets_ext.c - build/ide/esp_idf_components/wifi_provisioning/proto-c/wifi_scan.pb-c.c + build/ide/esp_idf_components/mbedtls/port/esp_bignum.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wifi_provisioning/proto-c/wifi_scan.pb-c.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/port/esp_bignum.c - build/ide/esp_idf_components/wifi_provisioning/src/handlers.c + build/ide/esp_idf_components/mbedtls/port/esp_hardware.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wifi_provisioning/src/handlers.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/port/esp_hardware.c - build/ide/esp_idf_components/wifi_provisioning/src/manager.c + build/ide/esp_idf_components/mbedtls/port/esp_mem.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wifi_provisioning/src/manager.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/port/esp_mem.c - build/ide/esp_idf_components/wifi_provisioning/src/scheme_console.c + build/ide/esp_idf_components/mbedtls/port/esp_timing.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wifi_provisioning/src/scheme_console.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/port/esp_timing.c - build/ide/esp_idf_components/wifi_provisioning/src/scheme_softap.c + build/ide/esp_idf_components/mbedtls/port/mbedtls_debug.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wifi_provisioning/src/scheme_softap.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/port/mbedtls_debug.c - build/ide/esp_idf_components/wifi_provisioning/src/wifi_config.c + build/ide/esp_idf_components/mbedtls/port/net_sockets.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wifi_provisioning/src/wifi_config.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/port/net_sockets.c - build/ide/esp_idf_components/wifi_provisioning/src/wifi_scan.c + build/ide/esp_idf_components/mqtt/esp-mqtt/mqtt_client.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wifi_provisioning/src/wifi_scan.c + /home/karl/espressif/esp-idf-v5.1.1/components/mqtt/esp-mqtt/mqtt_client.c - build/ide/esp_idf_components/wpa_supplicant/port/os_xtensa.c + build/ide/esp_idf_components/newlib/port/esp_time_impl.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/port/os_xtensa.c + /home/karl/espressif/esp-idf-v5.1.1/components/newlib/port/esp_time_impl.c - build/ide/esp_idf_components/xtensa/esp32/trax_init.c + build/ide/esp_idf_components/nvs_flash/src/nvs_api.cpp 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/xtensa/esp32/trax_init.c + /home/karl/espressif/esp-idf-v5.1.1/components/nvs_flash/src/nvs_api.cpp - build/ide/esp_idf_components/bootloader_support/src/idf/bootloader_sha.c + build/ide/esp_idf_components/nvs_flash/src/nvs_cxx_api.cpp + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/nvs_flash/src/nvs_cxx_api.cpp + + + build/ide/esp_idf_components/nvs_flash/src/nvs_handle_locked.cpp 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/bootloader_support/src/idf/bootloader_sha.c + /home/karl/espressif/esp-idf-v5.1.1/components/nvs_flash/src/nvs_handle_locked.cpp - build/ide/esp_idf_components/cbor/tinycbor/src/cborencoder.c + build/ide/esp_idf_components/nvs_flash/src/nvs_handle_simple.cpp + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/nvs_flash/src/nvs_handle_simple.cpp + + + build/ide/esp_idf_components/nvs_flash/src/nvs_item_hash_list.cpp 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/cbor/tinycbor/src/cborencoder.c + /home/karl/espressif/esp-idf-v5.1.1/components/nvs_flash/src/nvs_item_hash_list.cpp - build/ide/esp_idf_components/cbor/tinycbor/src/cborencoder_close_container_checked.c + build/ide/esp_idf_components/nvs_flash/src/nvs_page.cpp 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/cbor/tinycbor/src/cborencoder_close_container_checked.c + /home/karl/espressif/esp-idf-v5.1.1/components/nvs_flash/src/nvs_page.cpp - build/ide/esp_idf_components/cbor/tinycbor/src/cborerrorstrings.c + build/ide/esp_idf_components/nvs_flash/src/nvs_pagemanager.cpp 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/cbor/tinycbor/src/cborerrorstrings.c + /home/karl/espressif/esp-idf-v5.1.1/components/nvs_flash/src/nvs_pagemanager.cpp - build/ide/esp_idf_components/cbor/tinycbor/src/cborparser.c + build/ide/esp_idf_components/nvs_flash/src/nvs_partition.cpp 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/cbor/tinycbor/src/cborparser.c + /home/karl/espressif/esp-idf-v5.1.1/components/nvs_flash/src/nvs_partition.cpp - build/ide/esp_idf_components/cbor/tinycbor/src/cborparser_dup_string.c + build/ide/esp_idf_components/nvs_flash/src/nvs_partition_lookup.cpp 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/cbor/tinycbor/src/cborparser_dup_string.c + /home/karl/espressif/esp-idf-v5.1.1/components/nvs_flash/src/nvs_partition_lookup.cpp - build/ide/esp_idf_components/cbor/tinycbor/src/cborpretty.c + build/ide/esp_idf_components/nvs_flash/src/nvs_partition_manager.cpp 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/cbor/tinycbor/src/cborpretty.c + /home/karl/espressif/esp-idf-v5.1.1/components/nvs_flash/src/nvs_partition_manager.cpp - build/ide/esp_idf_components/cbor/tinycbor/src/cborpretty_stdio.c + build/ide/esp_idf_components/nvs_flash/src/nvs_storage.cpp 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/cbor/tinycbor/src/cborpretty_stdio.c + /home/karl/espressif/esp-idf-v5.1.1/components/nvs_flash/src/nvs_storage.cpp - build/ide/esp_idf_components/cbor/tinycbor/src/cbortojson.c + build/ide/esp_idf_components/nvs_flash/src/nvs_types.cpp 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/cbor/tinycbor/src/cbortojson.c + /home/karl/espressif/esp-idf-v5.1.1/components/nvs_flash/src/nvs_types.cpp - build/ide/esp_idf_components/cbor/tinycbor/src/cborvalidation.c + build/ide/esp_idf_components/protocomm/proto-c/constants.pb-c.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/cbor/tinycbor/src/cborvalidation.c + /home/karl/espressif/esp-idf-v5.1.1/components/protocomm/proto-c/constants.pb-c.c - build/ide/esp_idf_components/cbor/tinycbor/src/open_memstream.c + build/ide/esp_idf_components/protocomm/proto-c/sec0.pb-c.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/cbor/tinycbor/src/open_memstream.c + /home/karl/espressif/esp-idf-v5.1.1/components/protocomm/proto-c/sec0.pb-c.c - build/ide/esp_idf_components/cmock/CMock/src/cmock.c + build/ide/esp_idf_components/protocomm/proto-c/sec1.pb-c.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/cmock/CMock/src/cmock.c + /home/karl/espressif/esp-idf-v5.1.1/components/protocomm/proto-c/sec1.pb-c.c - build/ide/esp_idf_components/coap/libcoap/src/address.c + build/ide/esp_idf_components/protocomm/proto-c/sec2.pb-c.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/coap/libcoap/src/address.c + /home/karl/espressif/esp-idf-v5.1.1/components/protocomm/proto-c/sec2.pb-c.c - build/ide/esp_idf_components/coap/libcoap/src/async.c + build/ide/esp_idf_components/protocomm/proto-c/session.pb-c.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/coap/libcoap/src/async.c + /home/karl/espressif/esp-idf-v5.1.1/components/protocomm/proto-c/session.pb-c.c - build/ide/esp_idf_components/coap/libcoap/src/block.c + build/ide/esp_idf_components/soc/esp32/adc_periph.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/coap/libcoap/src/block.c + /home/karl/espressif/esp-idf-v5.1.1/components/soc/esp32/adc_periph.c - build/ide/esp_idf_components/coap/libcoap/src/coap_event.c + build/ide/esp_idf_components/soc/esp32/dac_periph.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/coap/libcoap/src/coap_event.c + /home/karl/espressif/esp-idf-v5.1.1/components/soc/esp32/dac_periph.c - build/ide/esp_idf_components/coap/libcoap/src/coap_hashkey.c + build/ide/esp_idf_components/soc/esp32/dport_access.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/coap/libcoap/src/coap_hashkey.c + /home/karl/espressif/esp-idf-v5.1.1/components/soc/esp32/dport_access.c - build/ide/esp_idf_components/coap/libcoap/src/coap_io.c + build/ide/esp_idf_components/soc/esp32/gpio_periph.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/coap/libcoap/src/coap_io.c + /home/karl/espressif/esp-idf-v5.1.1/components/soc/esp32/gpio_periph.c - build/ide/esp_idf_components/coap/libcoap/src/coap_session.c + build/ide/esp_idf_components/soc/esp32/i2c_periph.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/coap/libcoap/src/coap_session.c + /home/karl/espressif/esp-idf-v5.1.1/components/soc/esp32/i2c_periph.c - build/ide/esp_idf_components/coap/libcoap/src/coap_time.c + build/ide/esp_idf_components/soc/esp32/i2s_periph.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/coap/libcoap/src/coap_time.c + /home/karl/espressif/esp-idf-v5.1.1/components/soc/esp32/i2s_periph.c - build/ide/esp_idf_components/coap/libcoap/src/encode.c + build/ide/esp_idf_components/soc/esp32/interrupts.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/coap/libcoap/src/encode.c + /home/karl/espressif/esp-idf-v5.1.1/components/soc/esp32/interrupts.c - build/ide/esp_idf_components/coap/libcoap/src/mem.c + build/ide/esp_idf_components/soc/esp32/lcd_periph.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/coap/libcoap/src/mem.c + /home/karl/espressif/esp-idf-v5.1.1/components/soc/esp32/lcd_periph.c - build/ide/esp_idf_components/coap/libcoap/src/net.c + build/ide/esp_idf_components/soc/esp32/ledc_periph.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/coap/libcoap/src/net.c + /home/karl/espressif/esp-idf-v5.1.1/components/soc/esp32/ledc_periph.c - build/ide/esp_idf_components/coap/libcoap/src/option.c + build/ide/esp_idf_components/soc/esp32/mcpwm_periph.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/coap/libcoap/src/option.c + /home/karl/espressif/esp-idf-v5.1.1/components/soc/esp32/mcpwm_periph.c - build/ide/esp_idf_components/coap/libcoap/src/pdu.c + build/ide/esp_idf_components/soc/esp32/pcnt_periph.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/coap/libcoap/src/pdu.c + /home/karl/espressif/esp-idf-v5.1.1/components/soc/esp32/pcnt_periph.c - build/ide/esp_idf_components/coap/libcoap/src/resource.c + build/ide/esp_idf_components/soc/esp32/rmt_periph.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/coap/libcoap/src/resource.c + /home/karl/espressif/esp-idf-v5.1.1/components/soc/esp32/rmt_periph.c - build/ide/esp_idf_components/coap/libcoap/src/str.c + build/ide/esp_idf_components/soc/esp32/rtc_io_periph.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/coap/libcoap/src/str.c + /home/karl/espressif/esp-idf-v5.1.1/components/soc/esp32/rtc_io_periph.c - build/ide/esp_idf_components/coap/libcoap/src/subscribe.c + build/ide/esp_idf_components/soc/esp32/sdio_slave_periph.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/coap/libcoap/src/subscribe.c + /home/karl/espressif/esp-idf-v5.1.1/components/soc/esp32/sdio_slave_periph.c - build/ide/esp_idf_components/coap/libcoap/src/uri.c + build/ide/esp_idf_components/soc/esp32/sdm_periph.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/coap/libcoap/src/uri.c + /home/karl/espressif/esp-idf-v5.1.1/components/soc/esp32/sdm_periph.c - build/ide/esp_idf_components/efuse/src/esp32/esp_efuse_api.c + build/ide/esp_idf_components/soc/esp32/sdmmc_periph.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/efuse/src/esp32/esp_efuse_api.c + /home/karl/espressif/esp-idf-v5.1.1/components/soc/esp32/sdmmc_periph.c - build/ide/esp_idf_components/efuse/src/esp32/esp_efuse_fields.c + build/ide/esp_idf_components/soc/esp32/spi_periph.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/efuse/src/esp32/esp_efuse_fields.c + /home/karl/espressif/esp-idf-v5.1.1/components/soc/esp32/spi_periph.c - build/ide/esp_idf_components/efuse/src/esp32/esp_efuse_utility.c + build/ide/esp_idf_components/soc/esp32/timer_periph.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/efuse/src/esp32/esp_efuse_utility.c + /home/karl/espressif/esp-idf-v5.1.1/components/soc/esp32/timer_periph.c - build/ide/esp_idf_components/esp_http_server/src/util/ctrl_sock.c + build/ide/esp_idf_components/soc/esp32/touch_sensor_periph.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_http_server/src/util/ctrl_sock.c + /home/karl/espressif/esp-idf-v5.1.1/components/soc/esp32/touch_sensor_periph.c - build/ide/esp_idf_components/esp_hw_support/port/esp32/rtc_clk.c + build/ide/esp_idf_components/soc/esp32/twai_periph.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_hw_support/port/esp32/rtc_clk.c + /home/karl/espressif/esp-idf-v5.1.1/components/soc/esp32/twai_periph.c - build/ide/esp_idf_components/esp_hw_support/port/esp32/rtc_clk_init.c + build/ide/esp_idf_components/soc/esp32/uart_periph.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_hw_support/port/esp32/rtc_clk_init.c + /home/karl/espressif/esp-idf-v5.1.1/components/soc/esp32/uart_periph.c - build/ide/esp_idf_components/esp_hw_support/port/esp32/rtc_init.c + build/ide/esp_idf_components/wifi_provisioning/proto-c/wifi_config.pb-c.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_hw_support/port/esp32/rtc_init.c + /home/karl/espressif/esp-idf-v5.1.1/components/wifi_provisioning/proto-c/wifi_config.pb-c.c - build/ide/esp_idf_components/esp_hw_support/port/esp32/rtc_pm.c + build/ide/esp_idf_components/wifi_provisioning/proto-c/wifi_constants.pb-c.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_hw_support/port/esp32/rtc_pm.c + /home/karl/espressif/esp-idf-v5.1.1/components/wifi_provisioning/proto-c/wifi_constants.pb-c.c - build/ide/esp_idf_components/esp_hw_support/port/esp32/rtc_sleep.c + build/ide/esp_idf_components/wifi_provisioning/proto-c/wifi_ctrl.pb-c.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_hw_support/port/esp32/rtc_sleep.c + /home/karl/espressif/esp-idf-v5.1.1/components/wifi_provisioning/proto-c/wifi_ctrl.pb-c.c - build/ide/esp_idf_components/esp_hw_support/port/esp32/rtc_time.c + build/ide/esp_idf_components/wifi_provisioning/proto-c/wifi_scan.pb-c.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_hw_support/port/esp32/rtc_time.c + /home/karl/espressif/esp-idf-v5.1.1/components/wifi_provisioning/proto-c/wifi_scan.pb-c.c - build/ide/esp_idf_components/esp_hw_support/port/esp32/rtc_wdt.c + build/ide/esp_idf_components/wifi_provisioning/src/handlers.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_hw_support/port/esp32/rtc_wdt.c + /home/karl/espressif/esp-idf-v5.1.1/components/wifi_provisioning/src/handlers.c - build/ide/esp_idf_components/fatfs/port/freertos/ffsystem.c + build/ide/esp_idf_components/wifi_provisioning/src/manager.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/wifi_provisioning/src/manager.c + + + build/ide/esp_idf_components/wifi_provisioning/src/scheme_console.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/wifi_provisioning/src/scheme_console.c + + + build/ide/esp_idf_components/wifi_provisioning/src/scheme_softap.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/wifi_provisioning/src/scheme_softap.c + + + build/ide/esp_idf_components/wifi_provisioning/src/wifi_config.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/wifi_provisioning/src/wifi_config.c + + + build/ide/esp_idf_components/wifi_provisioning/src/wifi_ctrl.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/wifi_provisioning/src/wifi_ctrl.c + + + build/ide/esp_idf_components/wifi_provisioning/src/wifi_scan.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/wifi_provisioning/src/wifi_scan.c + + + build/ide/esp_idf_components/wpa_supplicant/port/eloop.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/port/eloop.c + + + build/ide/esp_idf_components/wpa_supplicant/port/os_xtensa.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/port/os_xtensa.c + + + build/ide/esp_idf_components/bootloader_support/bootloader_flash/src/bootloader_flash.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/bootloader_support/bootloader_flash/src/bootloader_flash.c + + + build/ide/esp_idf_components/bootloader_support/bootloader_flash/src/bootloader_flash_config_esp32.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/bootloader_support/bootloader_flash/src/bootloader_flash_config_esp32.c + + + build/ide/esp_idf_components/bootloader_support/bootloader_flash/src/flash_qio_mode.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/fatfs/port/freertos/ffsystem.c + /home/karl/espressif/esp-idf-v5.1.1/components/bootloader_support/bootloader_flash/src/flash_qio_mode.c - build/ide/esp_idf_components/freemodbus/modbus/ascii/mbascii.c + build/ide/esp_idf_components/bootloader_support/src/idf/bootloader_sha.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/modbus/ascii/mbascii.c + /home/karl/espressif/esp-idf-v5.1.1/components/bootloader_support/src/idf/bootloader_sha.c - build/ide/esp_idf_components/freemodbus/modbus/ascii/mbascii_m.c + build/ide/esp_idf_components/cmock/CMock/src/cmock.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/modbus/ascii/mbascii_m.c + /home/karl/espressif/esp-idf-v5.1.1/components/cmock/CMock/src/cmock.c - build/ide/esp_idf_components/freemodbus/modbus/functions/mbfunccoils.c + build/ide/esp_idf_components/driver/dac/esp32/dac_dma.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/modbus/functions/mbfunccoils.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/dac/esp32/dac_dma.c - build/ide/esp_idf_components/freemodbus/modbus/functions/mbfunccoils_m.c + build/ide/esp_idf_components/driver/deprecated/esp32/dac_legacy.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/modbus/functions/mbfunccoils_m.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/deprecated/esp32/dac_legacy.c - build/ide/esp_idf_components/freemodbus/modbus/functions/mbfuncdiag.c + build/ide/esp_idf_components/driver/spi/gpspi/spi_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/modbus/functions/mbfuncdiag.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/spi/gpspi/spi_common.c - build/ide/esp_idf_components/freemodbus/modbus/functions/mbfuncdisc.c + build/ide/esp_idf_components/driver/spi/gpspi/spi_master.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/modbus/functions/mbfuncdisc.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/spi/gpspi/spi_master.c - build/ide/esp_idf_components/freemodbus/modbus/functions/mbfuncdisc_m.c + build/ide/esp_idf_components/driver/spi/gpspi/spi_slave.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/modbus/functions/mbfuncdisc_m.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/spi/gpspi/spi_slave.c - build/ide/esp_idf_components/freemodbus/modbus/functions/mbfuncholding.c + build/ide/esp_idf_components/driver/spi/sdspi/sdspi_crc.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/modbus/functions/mbfuncholding.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/spi/sdspi/sdspi_crc.c - build/ide/esp_idf_components/freemodbus/modbus/functions/mbfuncholding_m.c + build/ide/esp_idf_components/driver/spi/sdspi/sdspi_host.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/modbus/functions/mbfuncholding_m.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/spi/sdspi/sdspi_host.c - build/ide/esp_idf_components/freemodbus/modbus/functions/mbfuncinput.c + build/ide/esp_idf_components/driver/spi/sdspi/sdspi_transaction.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/modbus/functions/mbfuncinput.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/spi/sdspi/sdspi_transaction.c - build/ide/esp_idf_components/freemodbus/modbus/functions/mbfuncinput_m.c + build/ide/esp_idf_components/driver/touch_sensor/esp32/touch_sensor.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/modbus/functions/mbfuncinput_m.c + /home/karl/espressif/esp-idf-v5.1.1/components/driver/touch_sensor/esp32/touch_sensor.c - build/ide/esp_idf_components/freemodbus/modbus/functions/mbfuncother.c + build/ide/esp_idf_components/esp_adc/deprecated/esp32/esp_adc_cal_legacy.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/modbus/functions/mbfuncother.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_adc/deprecated/esp32/esp_adc_cal_legacy.c - build/ide/esp_idf_components/freemodbus/modbus/functions/mbutils.c + build/ide/esp_idf_components/esp_http_server/src/util/ctrl_sock.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/modbus/functions/mbutils.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_http_server/src/util/ctrl_sock.c - build/ide/esp_idf_components/freemodbus/modbus/rtu/mbcrc.c + build/ide/esp_idf_components/esp_hw_support/port/esp32/cache_sram_mmu.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/modbus/rtu/mbcrc.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/port/esp32/cache_sram_mmu.c - build/ide/esp_idf_components/freemodbus/modbus/rtu/mbrtu.c + build/ide/esp_idf_components/esp_hw_support/port/esp32/chip_info.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/modbus/rtu/mbrtu.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/port/esp32/chip_info.c - build/ide/esp_idf_components/freemodbus/modbus/rtu/mbrtu_m.c + build/ide/esp_idf_components/esp_hw_support/port/esp32/cpu_region_protect.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/modbus/rtu/mbrtu_m.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/port/esp32/cpu_region_protect.c - build/ide/esp_idf_components/freemodbus/modbus/tcp/mbtcp.c + build/ide/esp_idf_components/esp_hw_support/port/esp32/esp_clk_tree.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/modbus/tcp/mbtcp.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/port/esp32/esp_clk_tree.c - build/ide/esp_idf_components/freemodbus/modbus/tcp/mbtcp_m.c + build/ide/esp_idf_components/esp_hw_support/port/esp32/io_mux.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/modbus/tcp/mbtcp_m.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/port/esp32/io_mux.c - build/ide/esp_idf_components/freemodbus/serial_master/modbus_controller/mbc_serial_master.c + build/ide/esp_idf_components/esp_hw_support/port/esp32/rtc_clk.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/serial_master/modbus_controller/mbc_serial_master.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/port/esp32/rtc_clk.c - build/ide/esp_idf_components/freemodbus/serial_slave/modbus_controller/mbc_serial_slave.c + build/ide/esp_idf_components/esp_hw_support/port/esp32/rtc_clk_init.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/serial_slave/modbus_controller/mbc_serial_slave.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/port/esp32/rtc_clk_init.c - build/ide/esp_idf_components/freemodbus/tcp_master/modbus_controller/mbc_tcp_master.c + build/ide/esp_idf_components/esp_hw_support/port/esp32/rtc_init.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/tcp_master/modbus_controller/mbc_tcp_master.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/port/esp32/rtc_init.c - build/ide/esp_idf_components/freemodbus/tcp_master/port/port_tcp_master.c + build/ide/esp_idf_components/esp_hw_support/port/esp32/rtc_sleep.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/tcp_master/port/port_tcp_master.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/port/esp32/rtc_sleep.c - build/ide/esp_idf_components/freemodbus/tcp_slave/modbus_controller/mbc_tcp_slave.c + build/ide/esp_idf_components/esp_hw_support/port/esp32/rtc_time.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/tcp_slave/modbus_controller/mbc_tcp_slave.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/port/esp32/rtc_time.c - build/ide/esp_idf_components/freemodbus/tcp_slave/port/port_tcp_slave.c + build/ide/esp_idf_components/esp_hw_support/port/esp32/sar_periph_ctrl.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freemodbus/tcp_slave/port/port_tcp_slave.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_hw_support/port/esp32/sar_periph_ctrl.c - build/ide/esp_idf_components/freertos/port/xtensa/port.c + build/ide/esp_idf_components/esp_mm/port/esp32/ext_mem_layout.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freertos/port/xtensa/port.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_mm/port/esp32/ext_mem_layout.c - build/ide/esp_idf_components/freertos/port/xtensa/portasm.S + build/ide/esp_idf_components/esp_netif/lwip/netif/esp_pbuf_ref.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freertos/port/xtensa/portasm.S + /home/karl/espressif/esp-idf-v5.1.1/components/esp_netif/lwip/netif/esp_pbuf_ref.c - build/ide/esp_idf_components/freertos/port/xtensa/xtensa_context.S + build/ide/esp_idf_components/esp_netif/lwip/netif/ethernetif.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freertos/port/xtensa/xtensa_context.S + /home/karl/espressif/esp-idf-v5.1.1/components/esp_netif/lwip/netif/ethernetif.c - build/ide/esp_idf_components/freertos/port/xtensa/xtensa_init.c + build/ide/esp_idf_components/esp_netif/lwip/netif/wlanif.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freertos/port/xtensa/xtensa_init.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_netif/lwip/netif/wlanif.c - build/ide/esp_idf_components/freertos/port/xtensa/xtensa_overlay_os_hook.c + build/ide/esp_idf_components/fatfs/port/freertos/ffsystem.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freertos/port/xtensa/xtensa_overlay_os_hook.c + /home/karl/espressif/esp-idf-v5.1.1/components/fatfs/port/freertos/ffsystem.c - build/ide/esp_idf_components/freertos/port/xtensa/xtensa_vector_defaults.S + build/ide/esp_idf_components/freertos/FreeRTOS-Kernel/portable/port_systick.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freertos/port/xtensa/xtensa_vector_defaults.S + /home/karl/espressif/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/portable/port_systick.c - build/ide/esp_idf_components/freertos/port/xtensa/xtensa_vectors.S + build/ide/esp_idf_components/heap/port/esp32/memory_layout.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/freertos/port/xtensa/xtensa_vectors.S + /home/karl/espressif/esp-idf-v5.1.1/components/heap/port/esp32/memory_layout.c build/ide/esp_idf_components/lwip/apps/dhcpserver/dhcpserver.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/apps/dhcpserver/dhcpserver.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/apps/dhcpserver/dhcpserver.c build/ide/esp_idf_components/lwip/apps/ping/esp_ping.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/apps/ping/esp_ping.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/apps/ping/esp_ping.c build/ide/esp_idf_components/lwip/apps/ping/ping.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/apps/ping/ping.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/apps/ping/ping.c build/ide/esp_idf_components/lwip/apps/ping/ping_sock.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/apps/ping/ping_sock.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/apps/ping/ping_sock.c build/ide/esp_idf_components/lwip/apps/sntp/sntp.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/apps/sntp/sntp.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/apps/sntp/sntp.c + + + build/ide/esp_idf_components/lwip/port/debug/lwip_debug.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/port/debug/lwip_debug.c + + + build/ide/esp_idf_components/lwip/port/esp32xx/vfs_lwip.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/port/esp32xx/vfs_lwip.c + + + build/ide/esp_idf_components/lwip/port/freertos/sys_arch.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/port/freertos/sys_arch.c + + + build/ide/esp_idf_components/lwip/port/hooks/lwip_default_hooks.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/port/hooks/lwip_default_hooks.c - build/ide/esp_idf_components/lwip/port/esp32/vfs_lwip.c + build/ide/esp_idf_components/lwip/port/hooks/tcp_isn_default.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/port/esp32/vfs_lwip.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/port/hooks/tcp_isn_default.c build/ide/esp_idf_components/mbedtls/mbedtls/library/aes.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/aes.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/aes.c - build/ide/esp_idf_components/mbedtls/mbedtls/library/aesni.c + build/ide/esp_idf_components/mbedtls/mbedtls/library/aesce.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/aesni.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/aesce.c - build/ide/esp_idf_components/mbedtls/mbedtls/library/arc4.c + build/ide/esp_idf_components/mbedtls/mbedtls/library/aesni.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/arc4.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/aesni.c build/ide/esp_idf_components/mbedtls/mbedtls/library/aria.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/aria.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/aria.c build/ide/esp_idf_components/mbedtls/mbedtls/library/asn1parse.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/asn1parse.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/asn1parse.c build/ide/esp_idf_components/mbedtls/mbedtls/library/asn1write.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/asn1write.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/asn1write.c build/ide/esp_idf_components/mbedtls/mbedtls/library/base64.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/base64.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/base64.c build/ide/esp_idf_components/mbedtls/mbedtls/library/bignum.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/bignum.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/bignum.c - build/ide/esp_idf_components/mbedtls/mbedtls/library/blowfish.c + build/ide/esp_idf_components/mbedtls/mbedtls/library/bignum_core.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/blowfish.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/bignum_core.c - build/ide/esp_idf_components/mbedtls/mbedtls/library/camellia.c + build/ide/esp_idf_components/mbedtls/mbedtls/library/bignum_mod.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/camellia.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/bignum_mod.c - build/ide/esp_idf_components/mbedtls/mbedtls/library/ccm.c + build/ide/esp_idf_components/mbedtls/mbedtls/library/bignum_mod_raw.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/bignum_mod_raw.c + + + build/ide/esp_idf_components/mbedtls/mbedtls/library/camellia.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/ccm.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/camellia.c - build/ide/esp_idf_components/mbedtls/mbedtls/library/certs.c + build/ide/esp_idf_components/mbedtls/mbedtls/library/ccm.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/certs.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/ccm.c build/ide/esp_idf_components/mbedtls/mbedtls/library/chacha20.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/chacha20.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/chacha20.c build/ide/esp_idf_components/mbedtls/mbedtls/library/chachapoly.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/chachapoly.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/chachapoly.c build/ide/esp_idf_components/mbedtls/mbedtls/library/cipher.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/cipher.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/cipher.c build/ide/esp_idf_components/mbedtls/mbedtls/library/cipher_wrap.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/cipher_wrap.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/cipher_wrap.c build/ide/esp_idf_components/mbedtls/mbedtls/library/cmac.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/cmac.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/cmac.c build/ide/esp_idf_components/mbedtls/mbedtls/library/constant_time.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/constant_time.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/constant_time.c build/ide/esp_idf_components/mbedtls/mbedtls/library/ctr_drbg.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/ctr_drbg.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/ctr_drbg.c build/ide/esp_idf_components/mbedtls/mbedtls/library/debug.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/debug.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/debug.c build/ide/esp_idf_components/mbedtls/mbedtls/library/des.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/des.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/des.c build/ide/esp_idf_components/mbedtls/mbedtls/library/dhm.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/dhm.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/dhm.c build/ide/esp_idf_components/mbedtls/mbedtls/library/ecdh.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/ecdh.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/ecdh.c build/ide/esp_idf_components/mbedtls/mbedtls/library/ecdsa.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/ecdsa.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/ecdsa.c build/ide/esp_idf_components/mbedtls/mbedtls/library/ecjpake.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/ecjpake.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/ecjpake.c build/ide/esp_idf_components/mbedtls/mbedtls/library/ecp.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/ecp.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/ecp.c build/ide/esp_idf_components/mbedtls/mbedtls/library/ecp_curves.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/ecp_curves.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/ecp_curves.c build/ide/esp_idf_components/mbedtls/mbedtls/library/entropy.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/entropy.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/entropy.c build/ide/esp_idf_components/mbedtls/mbedtls/library/entropy_poll.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/entropy_poll.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/entropy_poll.c build/ide/esp_idf_components/mbedtls/mbedtls/library/error.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/error.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/error.c build/ide/esp_idf_components/mbedtls/mbedtls/library/gcm.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/gcm.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/gcm.c - build/ide/esp_idf_components/mbedtls/mbedtls/library/havege.c + build/ide/esp_idf_components/mbedtls/mbedtls/library/hash_info.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/havege.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/hash_info.c build/ide/esp_idf_components/mbedtls/mbedtls/library/hkdf.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/hkdf.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/hkdf.c build/ide/esp_idf_components/mbedtls/mbedtls/library/hmac_drbg.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/hmac_drbg.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/hmac_drbg.c - build/ide/esp_idf_components/mbedtls/mbedtls/library/md.c + build/ide/esp_idf_components/mbedtls/mbedtls/library/lmots.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/md.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/lmots.c - build/ide/esp_idf_components/mbedtls/mbedtls/library/md2.c + build/ide/esp_idf_components/mbedtls/mbedtls/library/lms.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/md2.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/lms.c - build/ide/esp_idf_components/mbedtls/mbedtls/library/md4.c + build/ide/esp_idf_components/mbedtls/mbedtls/library/md.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/md4.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/md.c build/ide/esp_idf_components/mbedtls/mbedtls/library/md5.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/md5.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/md5.c build/ide/esp_idf_components/mbedtls/mbedtls/library/memory_buffer_alloc.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/memory_buffer_alloc.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/memory_buffer_alloc.c build/ide/esp_idf_components/mbedtls/mbedtls/library/mps_reader.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/mps_reader.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/mps_reader.c build/ide/esp_idf_components/mbedtls/mbedtls/library/mps_trace.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/mps_trace.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/mps_trace.c build/ide/esp_idf_components/mbedtls/mbedtls/library/nist_kw.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/nist_kw.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/nist_kw.c build/ide/esp_idf_components/mbedtls/mbedtls/library/oid.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/oid.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/oid.c build/ide/esp_idf_components/mbedtls/mbedtls/library/padlock.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/padlock.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/padlock.c build/ide/esp_idf_components/mbedtls/mbedtls/library/pem.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/pem.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/pem.c build/ide/esp_idf_components/mbedtls/mbedtls/library/pk.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/pk.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/pk.c build/ide/esp_idf_components/mbedtls/mbedtls/library/pk_wrap.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/pk_wrap.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/pk_wrap.c - build/ide/esp_idf_components/mbedtls/mbedtls/library/pkcs11.c + build/ide/esp_idf_components/mbedtls/mbedtls/library/pkcs12.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/pkcs11.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/pkcs12.c - build/ide/esp_idf_components/mbedtls/mbedtls/library/pkcs12.c + build/ide/esp_idf_components/mbedtls/mbedtls/library/pkcs5.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/pkcs12.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/pkcs5.c - build/ide/esp_idf_components/mbedtls/mbedtls/library/pkcs5.c + build/ide/esp_idf_components/mbedtls/mbedtls/library/pkcs7.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/pkcs5.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/pkcs7.c build/ide/esp_idf_components/mbedtls/mbedtls/library/pkparse.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/pkparse.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/pkparse.c build/ide/esp_idf_components/mbedtls/mbedtls/library/pkwrite.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/pkwrite.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/pkwrite.c build/ide/esp_idf_components/mbedtls/mbedtls/library/platform.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/platform.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/platform.c build/ide/esp_idf_components/mbedtls/mbedtls/library/platform_util.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/platform_util.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/platform_util.c build/ide/esp_idf_components/mbedtls/mbedtls/library/poly1305.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/poly1305.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/poly1305.c build/ide/esp_idf_components/mbedtls/mbedtls/library/psa_crypto.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/psa_crypto.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/psa_crypto.c build/ide/esp_idf_components/mbedtls/mbedtls/library/psa_crypto_aead.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/psa_crypto_aead.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/psa_crypto_aead.c build/ide/esp_idf_components/mbedtls/mbedtls/library/psa_crypto_cipher.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/psa_crypto_cipher.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/psa_crypto_cipher.c build/ide/esp_idf_components/mbedtls/mbedtls/library/psa_crypto_client.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/psa_crypto_client.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/psa_crypto_client.c build/ide/esp_idf_components/mbedtls/mbedtls/library/psa_crypto_driver_wrappers.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/psa_crypto_driver_wrappers.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/psa_crypto_driver_wrappers.c build/ide/esp_idf_components/mbedtls/mbedtls/library/psa_crypto_ecp.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/psa_crypto_ecp.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/psa_crypto_ecp.c build/ide/esp_idf_components/mbedtls/mbedtls/library/psa_crypto_hash.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/psa_crypto_hash.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/psa_crypto_hash.c build/ide/esp_idf_components/mbedtls/mbedtls/library/psa_crypto_mac.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/psa_crypto_mac.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/psa_crypto_mac.c + + + build/ide/esp_idf_components/mbedtls/mbedtls/library/psa_crypto_pake.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/psa_crypto_pake.c build/ide/esp_idf_components/mbedtls/mbedtls/library/psa_crypto_rsa.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/psa_crypto_rsa.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/psa_crypto_rsa.c build/ide/esp_idf_components/mbedtls/mbedtls/library/psa_crypto_se.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/psa_crypto_se.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/psa_crypto_se.c build/ide/esp_idf_components/mbedtls/mbedtls/library/psa_crypto_slot_management.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/psa_crypto_slot_management.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/psa_crypto_slot_management.c build/ide/esp_idf_components/mbedtls/mbedtls/library/psa_crypto_storage.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/psa_crypto_storage.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/psa_crypto_storage.c build/ide/esp_idf_components/mbedtls/mbedtls/library/psa_its_file.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/psa_its_file.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/psa_its_file.c + + + build/ide/esp_idf_components/mbedtls/mbedtls/library/psa_util.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/psa_util.c build/ide/esp_idf_components/mbedtls/mbedtls/library/ripemd160.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/ripemd160.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/ripemd160.c build/ide/esp_idf_components/mbedtls/mbedtls/library/rsa.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/rsa.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/rsa.c - build/ide/esp_idf_components/mbedtls/mbedtls/library/rsa_internal.c + build/ide/esp_idf_components/mbedtls/mbedtls/library/rsa_alt_helpers.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/rsa_internal.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/rsa_alt_helpers.c build/ide/esp_idf_components/mbedtls/mbedtls/library/sha1.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/sha1.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/sha1.c build/ide/esp_idf_components/mbedtls/mbedtls/library/sha256.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/sha256.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/sha256.c build/ide/esp_idf_components/mbedtls/mbedtls/library/sha512.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/sha512.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/sha512.c build/ide/esp_idf_components/mbedtls/mbedtls/library/ssl_cache.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/ssl_cache.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/ssl_cache.c build/ide/esp_idf_components/mbedtls/mbedtls/library/ssl_ciphersuites.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/ssl_ciphersuites.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/ssl_ciphersuites.c - build/ide/esp_idf_components/mbedtls/mbedtls/library/ssl_cli.c + build/ide/esp_idf_components/mbedtls/mbedtls/library/ssl_client.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/ssl_cli.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/ssl_client.c build/ide/esp_idf_components/mbedtls/mbedtls/library/ssl_cookie.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/ssl_cookie.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/ssl_cookie.c - build/ide/esp_idf_components/mbedtls/mbedtls/library/ssl_msg.c + build/ide/esp_idf_components/mbedtls/mbedtls/library/ssl_debug_helpers_generated.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/ssl_msg.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/ssl_debug_helpers_generated.c - build/ide/esp_idf_components/mbedtls/mbedtls/library/ssl_srv.c + build/ide/esp_idf_components/mbedtls/mbedtls/library/ssl_msg.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/ssl_srv.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/ssl_msg.c build/ide/esp_idf_components/mbedtls/mbedtls/library/ssl_ticket.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/ssl_ticket.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/ssl_ticket.c build/ide/esp_idf_components/mbedtls/mbedtls/library/ssl_tls.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/ssl_tls.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/ssl_tls.c + + + build/ide/esp_idf_components/mbedtls/mbedtls/library/ssl_tls12_client.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/ssl_tls12_client.c + + + build/ide/esp_idf_components/mbedtls/mbedtls/library/ssl_tls12_server.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/ssl_tls12_server.c + + + build/ide/esp_idf_components/mbedtls/mbedtls/library/ssl_tls13_client.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/ssl_tls13_client.c + + + build/ide/esp_idf_components/mbedtls/mbedtls/library/ssl_tls13_generic.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/ssl_tls13_generic.c build/ide/esp_idf_components/mbedtls/mbedtls/library/ssl_tls13_keys.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/ssl_tls13_keys.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/ssl_tls13_keys.c + + + build/ide/esp_idf_components/mbedtls/mbedtls/library/ssl_tls13_server.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/ssl_tls13_server.c build/ide/esp_idf_components/mbedtls/mbedtls/library/threading.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/threading.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/threading.c build/ide/esp_idf_components/mbedtls/mbedtls/library/timing.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/timing.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/timing.c build/ide/esp_idf_components/mbedtls/mbedtls/library/version.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/version.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/version.c build/ide/esp_idf_components/mbedtls/mbedtls/library/version_features.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/version_features.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/version_features.c build/ide/esp_idf_components/mbedtls/mbedtls/library/x509.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/x509.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/x509.c build/ide/esp_idf_components/mbedtls/mbedtls/library/x509_create.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/x509_create.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/x509_create.c build/ide/esp_idf_components/mbedtls/mbedtls/library/x509_crl.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/x509_crl.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/x509_crl.c build/ide/esp_idf_components/mbedtls/mbedtls/library/x509_crt.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/x509_crt.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/x509_crt.c build/ide/esp_idf_components/mbedtls/mbedtls/library/x509_csr.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/x509_csr.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/x509_csr.c build/ide/esp_idf_components/mbedtls/mbedtls/library/x509write_crt.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/x509write_crt.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/x509write_crt.c build/ide/esp_idf_components/mbedtls/mbedtls/library/x509write_csr.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/x509write_csr.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/mbedtls/library/x509write_csr.c - build/ide/esp_idf_components/mbedtls/mbedtls/library/xtea.c + build/ide/esp_idf_components/mbedtls/port/aes/esp_aes_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/mbedtls/library/xtea.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/port/aes/esp_aes_common.c - build/ide/esp_idf_components/mbedtls/port/aes/esp_aes_common.c + build/ide/esp_idf_components/mbedtls/port/aes/esp_aes_gcm.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/port/aes/esp_aes_common.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/port/aes/esp_aes_gcm.c build/ide/esp_idf_components/mbedtls/port/aes/esp_aes_xts.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/port/aes/esp_aes_xts.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/port/aes/esp_aes_xts.c build/ide/esp_idf_components/mbedtls/port/esp32/bignum.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/port/esp32/bignum.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/port/esp32/bignum.c build/ide/esp_idf_components/mbedtls/port/md/esp_md.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/port/md/esp_md.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/port/md/esp_md.c build/ide/esp_idf_components/mbedtls/port/sha/esp_sha.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/port/sha/esp_sha.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/port/sha/esp_sha.c build/ide/esp_idf_components/mqtt/esp-mqtt/lib/mqtt_msg.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mqtt/esp-mqtt/lib/mqtt_msg.c + /home/karl/espressif/esp-idf-v5.1.1/components/mqtt/esp-mqtt/lib/mqtt_msg.c build/ide/esp_idf_components/mqtt/esp-mqtt/lib/mqtt_outbox.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mqtt/esp-mqtt/lib/mqtt_outbox.c + /home/karl/espressif/esp-idf-v5.1.1/components/mqtt/esp-mqtt/lib/mqtt_outbox.c build/ide/esp_idf_components/mqtt/esp-mqtt/lib/platform_esp32_idf.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mqtt/esp-mqtt/lib/platform_esp32_idf.c + /home/karl/espressif/esp-idf-v5.1.1/components/mqtt/esp-mqtt/lib/platform_esp32_idf.c - build/ide/esp_idf_components/nghttp/nghttp2/lib/nghttp2_buf.c + build/ide/esp_idf_components/protobuf-c/protobuf-c/protobuf-c/protobuf-c.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nghttp/nghttp2/lib/nghttp2_buf.c + /home/karl/espressif/esp-idf-v5.1.1/components/protobuf-c/protobuf-c/protobuf-c/protobuf-c.c - build/ide/esp_idf_components/nghttp/nghttp2/lib/nghttp2_callbacks.c + build/ide/esp_idf_components/protocomm/src/common/protocomm.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nghttp/nghttp2/lib/nghttp2_callbacks.c + /home/karl/espressif/esp-idf-v5.1.1/components/protocomm/src/common/protocomm.c - build/ide/esp_idf_components/nghttp/nghttp2/lib/nghttp2_debug.c + build/ide/esp_idf_components/protocomm/src/security/security0.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nghttp/nghttp2/lib/nghttp2_debug.c + /home/karl/espressif/esp-idf-v5.1.1/components/protocomm/src/security/security0.c - build/ide/esp_idf_components/nghttp/nghttp2/lib/nghttp2_frame.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nghttp/nghttp2/lib/nghttp2_frame.c - - - build/ide/esp_idf_components/nghttp/nghttp2/lib/nghttp2_hd.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nghttp/nghttp2/lib/nghttp2_hd.c - - - build/ide/esp_idf_components/nghttp/nghttp2/lib/nghttp2_hd_huffman.c + build/ide/esp_idf_components/protocomm/src/security/security1.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nghttp/nghttp2/lib/nghttp2_hd_huffman.c + /home/karl/espressif/esp-idf-v5.1.1/components/protocomm/src/security/security1.c - build/ide/esp_idf_components/nghttp/nghttp2/lib/nghttp2_hd_huffman_data.c + build/ide/esp_idf_components/protocomm/src/security/security2.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nghttp/nghttp2/lib/nghttp2_hd_huffman_data.c + /home/karl/espressif/esp-idf-v5.1.1/components/protocomm/src/security/security2.c - build/ide/esp_idf_components/nghttp/nghttp2/lib/nghttp2_helper.c + build/ide/esp_idf_components/protocomm/src/transports/protocomm_console.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nghttp/nghttp2/lib/nghttp2_helper.c + /home/karl/espressif/esp-idf-v5.1.1/components/protocomm/src/transports/protocomm_console.c - build/ide/esp_idf_components/nghttp/nghttp2/lib/nghttp2_http.c + build/ide/esp_idf_components/protocomm/src/transports/protocomm_httpd.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nghttp/nghttp2/lib/nghttp2_http.c + /home/karl/espressif/esp-idf-v5.1.1/components/protocomm/src/transports/protocomm_httpd.c - build/ide/esp_idf_components/nghttp/nghttp2/lib/nghttp2_map.c + build/ide/esp_idf_components/spiffs/spiffs/src/spiffs_cache.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nghttp/nghttp2/lib/nghttp2_map.c + /home/karl/espressif/esp-idf-v5.1.1/components/spiffs/spiffs/src/spiffs_cache.c - build/ide/esp_idf_components/nghttp/nghttp2/lib/nghttp2_mem.c + build/ide/esp_idf_components/spiffs/spiffs/src/spiffs_check.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nghttp/nghttp2/lib/nghttp2_mem.c + /home/karl/espressif/esp-idf-v5.1.1/components/spiffs/spiffs/src/spiffs_check.c - build/ide/esp_idf_components/nghttp/nghttp2/lib/nghttp2_npn.c + build/ide/esp_idf_components/spiffs/spiffs/src/spiffs_gc.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nghttp/nghttp2/lib/nghttp2_npn.c + /home/karl/espressif/esp-idf-v5.1.1/components/spiffs/spiffs/src/spiffs_gc.c - build/ide/esp_idf_components/nghttp/nghttp2/lib/nghttp2_option.c + build/ide/esp_idf_components/spiffs/spiffs/src/spiffs_hydrogen.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nghttp/nghttp2/lib/nghttp2_option.c + /home/karl/espressif/esp-idf-v5.1.1/components/spiffs/spiffs/src/spiffs_hydrogen.c - build/ide/esp_idf_components/nghttp/nghttp2/lib/nghttp2_outbound_item.c + build/ide/esp_idf_components/spiffs/spiffs/src/spiffs_nucleus.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nghttp/nghttp2/lib/nghttp2_outbound_item.c + /home/karl/espressif/esp-idf-v5.1.1/components/spiffs/spiffs/src/spiffs_nucleus.c - build/ide/esp_idf_components/nghttp/nghttp2/lib/nghttp2_pq.c + build/ide/esp_idf_components/unity/port/esp/unity_utils_memory_esp.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nghttp/nghttp2/lib/nghttp2_pq.c + /home/karl/espressif/esp-idf-v5.1.1/components/unity/port/esp/unity_utils_memory_esp.c - build/ide/esp_idf_components/nghttp/nghttp2/lib/nghttp2_priority_spec.c + build/ide/esp_idf_components/unity/unity/src/unity.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nghttp/nghttp2/lib/nghttp2_priority_spec.c + /home/karl/espressif/esp-idf-v5.1.1/components/unity/unity/src/unity.c - build/ide/esp_idf_components/nghttp/nghttp2/lib/nghttp2_queue.c + build/ide/esp_idf_components/wpa_supplicant/esp_supplicant/src/esp_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nghttp/nghttp2/lib/nghttp2_queue.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/esp_supplicant/src/esp_common.c - build/ide/esp_idf_components/nghttp/nghttp2/lib/nghttp2_rcbuf.c + build/ide/esp_idf_components/wpa_supplicant/esp_supplicant/src/esp_hostap.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nghttp/nghttp2/lib/nghttp2_rcbuf.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/esp_supplicant/src/esp_hostap.c - build/ide/esp_idf_components/nghttp/nghttp2/lib/nghttp2_session.c + build/ide/esp_idf_components/wpa_supplicant/esp_supplicant/src/esp_owe.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nghttp/nghttp2/lib/nghttp2_session.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/esp_supplicant/src/esp_owe.c - build/ide/esp_idf_components/nghttp/nghttp2/lib/nghttp2_stream.c + build/ide/esp_idf_components/wpa_supplicant/esp_supplicant/src/esp_scan.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nghttp/nghttp2/lib/nghttp2_stream.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/esp_supplicant/src/esp_scan.c - build/ide/esp_idf_components/nghttp/nghttp2/lib/nghttp2_submit.c + build/ide/esp_idf_components/wpa_supplicant/esp_supplicant/src/esp_wpa2.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nghttp/nghttp2/lib/nghttp2_submit.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/esp_supplicant/src/esp_wpa2.c - build/ide/esp_idf_components/nghttp/nghttp2/lib/nghttp2_version.c + build/ide/esp_idf_components/wpa_supplicant/esp_supplicant/src/esp_wpa3.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/nghttp/nghttp2/lib/nghttp2_version.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/esp_supplicant/src/esp_wpa3.c - build/ide/esp_idf_components/protobuf-c/protobuf-c/protobuf-c/protobuf-c.c + build/ide/esp_idf_components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/protobuf-c/protobuf-c/protobuf-c/protobuf-c.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/esp_supplicant/src/esp_wpa_main.c - build/ide/esp_idf_components/protocomm/src/common/protocomm.c + build/ide/esp_idf_components/wpa_supplicant/esp_supplicant/src/esp_wpas_glue.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/protocomm/src/common/protocomm.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/esp_supplicant/src/esp_wpas_glue.c - build/ide/esp_idf_components/protocomm/src/security/security0.c + build/ide/esp_idf_components/wpa_supplicant/esp_supplicant/src/esp_wps.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/protocomm/src/security/security0.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/esp_supplicant/src/esp_wps.c - build/ide/esp_idf_components/protocomm/src/security/security1.c + build/ide/esp_idf_components/wpa_supplicant/src/ap/ap_config.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/protocomm/src/security/security1.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/ap/ap_config.c - build/ide/esp_idf_components/protocomm/src/transports/protocomm_console.c + build/ide/esp_idf_components/wpa_supplicant/src/ap/comeback_token.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/protocomm/src/transports/protocomm_console.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/ap/comeback_token.c - build/ide/esp_idf_components/protocomm/src/transports/protocomm_httpd.c + build/ide/esp_idf_components/wpa_supplicant/src/ap/ieee802_11.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/protocomm/src/transports/protocomm_httpd.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/ap/ieee802_11.c - build/ide/esp_idf_components/spiffs/spiffs/src/spiffs_cache.c + build/ide/esp_idf_components/wpa_supplicant/src/ap/ieee802_1x.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/spiffs/spiffs/src/spiffs_cache.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/ap/ieee802_1x.c - build/ide/esp_idf_components/spiffs/spiffs/src/spiffs_check.c + build/ide/esp_idf_components/wpa_supplicant/src/ap/pmksa_cache_auth.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/spiffs/spiffs/src/spiffs_check.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/ap/pmksa_cache_auth.c - build/ide/esp_idf_components/spiffs/spiffs/src/spiffs_gc.c + build/ide/esp_idf_components/wpa_supplicant/src/ap/sta_info.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/spiffs/spiffs/src/spiffs_gc.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/ap/sta_info.c - build/ide/esp_idf_components/spiffs/spiffs/src/spiffs_hydrogen.c + build/ide/esp_idf_components/wpa_supplicant/src/ap/wpa_auth.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/spiffs/spiffs/src/spiffs_hydrogen.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/ap/wpa_auth.c - build/ide/esp_idf_components/spiffs/spiffs/src/spiffs_nucleus.c + build/ide/esp_idf_components/wpa_supplicant/src/ap/wpa_auth_ie.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/spiffs/spiffs/src/spiffs_nucleus.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/ap/wpa_auth_ie.c - build/ide/esp_idf_components/unity/unity/src/unity.c + build/ide/esp_idf_components/wpa_supplicant/src/common/bss.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/unity/unity/src/unity.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/common/bss.c - build/ide/esp_idf_components/wpa_supplicant/src/ap/ap_config.c + build/ide/esp_idf_components/wpa_supplicant/src/common/dragonfly.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/ap/ap_config.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/common/dragonfly.c - build/ide/esp_idf_components/wpa_supplicant/src/ap/ieee802_1x.c + build/ide/esp_idf_components/wpa_supplicant/src/common/ieee802_11_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/ap/ieee802_1x.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/common/ieee802_11_common.c - build/ide/esp_idf_components/wpa_supplicant/src/ap/wpa_auth.c + build/ide/esp_idf_components/wpa_supplicant/src/common/sae.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/ap/wpa_auth.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/common/sae.c - build/ide/esp_idf_components/wpa_supplicant/src/ap/wpa_auth_ie.c + build/ide/esp_idf_components/wpa_supplicant/src/common/sae_pk.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/ap/wpa_auth_ie.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/common/sae_pk.c - build/ide/esp_idf_components/wpa_supplicant/src/common/dragonfly.c + build/ide/esp_idf_components/wpa_supplicant/src/common/scan.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/common/dragonfly.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/common/scan.c - build/ide/esp_idf_components/wpa_supplicant/src/common/sae.c + build/ide/esp_idf_components/wpa_supplicant/src/common/wpa_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/common/sae.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/common/wpa_common.c - build/ide/esp_idf_components/wpa_supplicant/src/common/wpa_common.c + build/ide/esp_idf_components/wpa_supplicant/src/crypto/aes-ccm.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/common/wpa_common.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/crypto/aes-ccm.c - build/ide/esp_idf_components/wpa_supplicant/src/crypto/aes-ccm.c + build/ide/esp_idf_components/wpa_supplicant/src/crypto/aes-gcm.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/crypto/aes-ccm.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/crypto/aes-gcm.c build/ide/esp_idf_components/wpa_supplicant/src/crypto/aes-omac1.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/crypto/aes-omac1.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/crypto/aes-omac1.c build/ide/esp_idf_components/wpa_supplicant/src/crypto/aes-siv.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/crypto/aes-siv.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/crypto/aes-siv.c build/ide/esp_idf_components/wpa_supplicant/src/crypto/aes-unwrap.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/crypto/aes-unwrap.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/crypto/aes-unwrap.c build/ide/esp_idf_components/wpa_supplicant/src/crypto/aes-wrap.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/crypto/aes-wrap.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/crypto/aes-wrap.c build/ide/esp_idf_components/wpa_supplicant/src/crypto/ccmp.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/crypto/ccmp.c - - - build/ide/esp_idf_components/wpa_supplicant/src/crypto/crypto_mbedtls-bignum.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/crypto/crypto_mbedtls-bignum.c - - - build/ide/esp_idf_components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/crypto/crypto_mbedtls-ec.c - - - build/ide/esp_idf_components/wpa_supplicant/src/crypto/crypto_mbedtls.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/crypto/crypto_mbedtls.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/crypto/ccmp.c build/ide/esp_idf_components/wpa_supplicant/src/crypto/crypto_ops.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/crypto/crypto_ops.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/crypto/crypto_ops.c build/ide/esp_idf_components/wpa_supplicant/src/crypto/des-internal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/crypto/des-internal.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/crypto/des-internal.c build/ide/esp_idf_components/wpa_supplicant/src/crypto/dh_group5.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/crypto/dh_group5.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/crypto/dh_group5.c build/ide/esp_idf_components/wpa_supplicant/src/crypto/dh_groups.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/crypto/dh_groups.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/crypto/dh_groups.c build/ide/esp_idf_components/wpa_supplicant/src/crypto/md4-internal.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/crypto/md4-internal.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/crypto/md4-internal.c build/ide/esp_idf_components/wpa_supplicant/src/crypto/ms_funcs.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/crypto/ms_funcs.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/crypto/ms_funcs.c build/ide/esp_idf_components/wpa_supplicant/src/crypto/rc4.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/crypto/rc4.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/crypto/rc4.c build/ide/esp_idf_components/wpa_supplicant/src/crypto/sha1-prf.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/crypto/sha1-prf.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/crypto/sha1-prf.c build/ide/esp_idf_components/wpa_supplicant/src/crypto/sha1-tlsprf.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/crypto/sha1-tlsprf.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/crypto/sha1-tlsprf.c + + + build/ide/esp_idf_components/wpa_supplicant/src/crypto/sha1-tprf.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/crypto/sha1-tprf.c build/ide/esp_idf_components/wpa_supplicant/src/crypto/sha256-kdf.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/crypto/sha256-kdf.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/crypto/sha256-kdf.c build/ide/esp_idf_components/wpa_supplicant/src/crypto/sha256-prf.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/crypto/sha256-prf.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/crypto/sha256-prf.c build/ide/esp_idf_components/wpa_supplicant/src/crypto/sha256-tlsprf.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/crypto/sha256-tlsprf.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/crypto/sha256-tlsprf.c + + + build/ide/esp_idf_components/wpa_supplicant/src/crypto/sha384-prf.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/crypto/sha384-prf.c build/ide/esp_idf_components/wpa_supplicant/src/crypto/sha384-tlsprf.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/crypto/sha384-tlsprf.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/crypto/sha384-tlsprf.c - build/ide/esp_idf_components/wpa_supplicant/src/crypto/tls_mbedtls.c + build/ide/esp_idf_components/wpa_supplicant/src/eap_common/eap_wsc_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/crypto/tls_mbedtls.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/eap_common/eap_wsc_common.c build/ide/esp_idf_components/wpa_supplicant/src/eap_peer/chap.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/eap_peer/chap.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/eap_peer/chap.c build/ide/esp_idf_components/wpa_supplicant/src/eap_peer/eap.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/eap_peer/eap.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/eap_peer/eap.c build/ide/esp_idf_components/wpa_supplicant/src/eap_peer/eap_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/eap_peer/eap_common.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/eap_peer/eap_common.c build/ide/esp_idf_components/wpa_supplicant/src/eap_peer/eap_fast.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/eap_peer/eap_fast.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/eap_peer/eap_fast.c build/ide/esp_idf_components/wpa_supplicant/src/eap_peer/eap_fast_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/eap_peer/eap_fast_common.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/eap_peer/eap_fast_common.c build/ide/esp_idf_components/wpa_supplicant/src/eap_peer/eap_fast_pac.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/eap_peer/eap_fast_pac.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/eap_peer/eap_fast_pac.c build/ide/esp_idf_components/wpa_supplicant/src/eap_peer/eap_mschapv2.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/eap_peer/eap_mschapv2.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/eap_peer/eap_mschapv2.c build/ide/esp_idf_components/wpa_supplicant/src/eap_peer/eap_peap.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/eap_peer/eap_peap.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/eap_peer/eap_peap.c build/ide/esp_idf_components/wpa_supplicant/src/eap_peer/eap_peap_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/eap_peer/eap_peap_common.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/eap_peer/eap_peap_common.c build/ide/esp_idf_components/wpa_supplicant/src/eap_peer/eap_tls.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/eap_peer/eap_tls.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/eap_peer/eap_tls.c build/ide/esp_idf_components/wpa_supplicant/src/eap_peer/eap_tls_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/eap_peer/eap_tls_common.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/eap_peer/eap_tls_common.c build/ide/esp_idf_components/wpa_supplicant/src/eap_peer/eap_ttls.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/eap_peer/eap_ttls.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/eap_peer/eap_ttls.c build/ide/esp_idf_components/wpa_supplicant/src/eap_peer/mschapv2.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/eap_peer/mschapv2.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/eap_peer/mschapv2.c - build/ide/esp_idf_components/wpa_supplicant/src/esp_supplicant/esp_common.c + build/ide/esp_idf_components/wpa_supplicant/src/rsn_supp/pmksa_cache.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/esp_supplicant/esp_common.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/rsn_supp/pmksa_cache.c - build/ide/esp_idf_components/wpa_supplicant/src/esp_supplicant/esp_dpp.c + build/ide/esp_idf_components/wpa_supplicant/src/rsn_supp/wpa.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/esp_supplicant/esp_dpp.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/rsn_supp/wpa.c - build/ide/esp_idf_components/wpa_supplicant/src/esp_supplicant/esp_hostap.c + build/ide/esp_idf_components/wpa_supplicant/src/rsn_supp/wpa_ie.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/esp_supplicant/esp_hostap.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/rsn_supp/wpa_ie.c - build/ide/esp_idf_components/wpa_supplicant/src/esp_supplicant/esp_wpa2.c + build/ide/esp_idf_components/wpa_supplicant/src/utils/base64.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/esp_supplicant/esp_wpa2.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/utils/base64.c - build/ide/esp_idf_components/wpa_supplicant/src/esp_supplicant/esp_wpa3.c + build/ide/esp_idf_components/wpa_supplicant/src/utils/bitfield.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/esp_supplicant/esp_wpa3.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/utils/bitfield.c - build/ide/esp_idf_components/wpa_supplicant/src/esp_supplicant/esp_wpa_main.c + build/ide/esp_idf_components/wpa_supplicant/src/utils/common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/esp_supplicant/esp_wpa_main.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/utils/common.c - build/ide/esp_idf_components/wpa_supplicant/src/esp_supplicant/esp_wpas_glue.c + build/ide/esp_idf_components/wpa_supplicant/src/utils/ext_password.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/esp_supplicant/esp_wpas_glue.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/utils/ext_password.c - build/ide/esp_idf_components/wpa_supplicant/src/esp_supplicant/esp_wps.c + build/ide/esp_idf_components/wpa_supplicant/src/utils/json.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/esp_supplicant/esp_wps.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/utils/json.c - build/ide/esp_idf_components/wpa_supplicant/src/rsn_supp/pmksa_cache.c + build/ide/esp_idf_components/wpa_supplicant/src/utils/uuid.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/rsn_supp/pmksa_cache.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/utils/uuid.c - build/ide/esp_idf_components/wpa_supplicant/src/rsn_supp/wpa.c + build/ide/esp_idf_components/wpa_supplicant/src/utils/wpa_debug.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/rsn_supp/wpa.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/utils/wpa_debug.c - build/ide/esp_idf_components/wpa_supplicant/src/rsn_supp/wpa_ie.c + build/ide/esp_idf_components/wpa_supplicant/src/utils/wpabuf.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/rsn_supp/wpa_ie.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/utils/wpabuf.c - build/ide/esp_idf_components/wpa_supplicant/src/utils/base64.c + build/ide/esp_idf_components/wpa_supplicant/src/wps/wps.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/utils/base64.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/wps/wps.c - build/ide/esp_idf_components/wpa_supplicant/src/utils/bitfield.c + build/ide/esp_idf_components/wpa_supplicant/src/wps/wps_attr_build.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/utils/bitfield.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/wps/wps_attr_build.c - build/ide/esp_idf_components/wpa_supplicant/src/utils/common.c + build/ide/esp_idf_components/wpa_supplicant/src/wps/wps_attr_parse.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/utils/common.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/wps/wps_attr_parse.c - build/ide/esp_idf_components/wpa_supplicant/src/utils/ext_password.c + build/ide/esp_idf_components/wpa_supplicant/src/wps/wps_attr_process.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/utils/ext_password.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/wps/wps_attr_process.c - build/ide/esp_idf_components/wpa_supplicant/src/utils/json.c + build/ide/esp_idf_components/wpa_supplicant/src/wps/wps_common.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/utils/json.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/wps/wps_common.c - build/ide/esp_idf_components/wpa_supplicant/src/utils/uuid.c + build/ide/esp_idf_components/wpa_supplicant/src/wps/wps_dev_attr.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/utils/uuid.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/wps/wps_dev_attr.c - build/ide/esp_idf_components/wpa_supplicant/src/utils/wpa_debug.c + build/ide/esp_idf_components/wpa_supplicant/src/wps/wps_enrollee.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/utils/wpa_debug.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/src/wps/wps_enrollee.c - build/ide/esp_idf_components/wpa_supplicant/src/utils/wpabuf.c + build/ide/esp_idf_components/esp_gdbstub/src/port/xtensa/gdbstub-entry.S 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/utils/wpabuf.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_gdbstub/src/port/xtensa/gdbstub-entry.S - build/ide/esp_idf_components/wpa_supplicant/src/wps/wps.c + build/ide/esp_idf_components/esp_gdbstub/src/port/xtensa/gdbstub_xtensa.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/wps/wps.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_gdbstub/src/port/xtensa/gdbstub_xtensa.c - build/ide/esp_idf_components/wpa_supplicant/src/wps/wps_attr_build.c + build/ide/esp_idf_components/esp_gdbstub/src/port/xtensa/xt_debugexception.S 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/wps/wps_attr_build.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_gdbstub/src/port/xtensa/xt_debugexception.S - build/ide/esp_idf_components/wpa_supplicant/src/wps/wps_attr_parse.c + build/ide/esp_idf_components/esp_system/port/arch/xtensa/debug_helpers.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/wps/wps_attr_parse.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/port/arch/xtensa/debug_helpers.c - build/ide/esp_idf_components/wpa_supplicant/src/wps/wps_attr_process.c + build/ide/esp_idf_components/esp_system/port/arch/xtensa/debug_helpers_asm.S 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/wps/wps_attr_process.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/port/arch/xtensa/debug_helpers_asm.S - build/ide/esp_idf_components/wpa_supplicant/src/wps/wps_common.c + build/ide/esp_idf_components/esp_system/port/arch/xtensa/debug_stubs.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/wps/wps_common.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/port/arch/xtensa/debug_stubs.c - build/ide/esp_idf_components/wpa_supplicant/src/wps/wps_dev_attr.c + build/ide/esp_idf_components/esp_system/port/arch/xtensa/esp_ipc_isr.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/wps/wps_dev_attr.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/port/arch/xtensa/esp_ipc_isr.c - build/ide/esp_idf_components/wpa_supplicant/src/wps/wps_enrollee.c + build/ide/esp_idf_components/esp_system/port/arch/xtensa/esp_ipc_isr_handler.S 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/wps/wps_enrollee.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/port/arch/xtensa/esp_ipc_isr_handler.S - build/ide/esp_idf_components/wpa_supplicant/src/wps/wps_registrar.c + build/ide/esp_idf_components/esp_system/port/arch/xtensa/esp_ipc_isr_routines.S 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/wps/wps_registrar.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/port/arch/xtensa/esp_ipc_isr_routines.S - build/ide/esp_idf_components/wpa_supplicant/src/wps/wps_validate.c + build/ide/esp_idf_components/esp_system/port/arch/xtensa/expression_with_stack.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/wpa_supplicant/src/wps/wps_validate.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/port/arch/xtensa/expression_with_stack.c - build/ide/esp_idf_components/asio/asio/asio/src/asio.cpp + build/ide/esp_idf_components/esp_system/port/arch/xtensa/expression_with_stack_asm.S 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/asio/asio/asio/src/asio.cpp + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/port/arch/xtensa/expression_with_stack_asm.S build/ide/esp_idf_components/esp_system/port/arch/xtensa/panic_arch.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_system/port/arch/xtensa/panic_arch.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/port/arch/xtensa/panic_arch.c build/ide/esp_idf_components/esp_system/port/arch/xtensa/panic_handler_asm.S 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_system/port/arch/xtensa/panic_handler_asm.S + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/port/arch/xtensa/panic_handler_asm.S + + + build/ide/esp_idf_components/esp_system/port/arch/xtensa/trax.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/port/arch/xtensa/trax.c + + + build/ide/esp_idf_components/esp_system/port/soc/esp32/cache_err_int.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/port/soc/esp32/cache_err_int.c build/ide/esp_idf_components/esp_system/port/soc/esp32/clk.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_system/port/soc/esp32/clk.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/port/soc/esp32/clk.c - build/ide/esp_idf_components/esp_system/port/soc/esp32/dport_panic_highint_hdl.S + build/ide/esp_idf_components/esp_system/port/soc/esp32/highint_hdl.S 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_system/port/soc/esp32/dport_panic_highint_hdl.S + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/port/soc/esp32/highint_hdl.S build/ide/esp_idf_components/esp_system/port/soc/esp32/reset_reason.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/esp_system/port/soc/esp32/reset_reason.c + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/port/soc/esp32/reset_reason.c + + + build/ide/esp_idf_components/esp_system/port/soc/esp32/system_internal.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/esp_system/port/soc/esp32/system_internal.c build/ide/esp_idf_components/espcoredump/src/port/xtensa/core_dump_port.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/espcoredump/src/port/xtensa/core_dump_port.c + /home/karl/espressif/esp-idf-v5.1.1/components/espcoredump/src/port/xtensa/core_dump_port.c + + + build/ide/esp_idf_components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c + 1 + /home/karl/espressif/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c - build/ide/esp_idf_components/expat/expat/expat/lib/xmlparse.c + build/ide/esp_idf_components/freertos/FreeRTOS-Kernel/portable/xtensa/portasm.S 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/expat/expat/expat/lib/xmlparse.c + /home/karl/espressif/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/portasm.S - build/ide/esp_idf_components/expat/expat/expat/lib/xmlrole.c + build/ide/esp_idf_components/freertos/FreeRTOS-Kernel/portable/xtensa/xtensa_context.S 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/expat/expat/expat/lib/xmlrole.c + /home/karl/espressif/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/xtensa_context.S - build/ide/esp_idf_components/expat/expat/expat/lib/xmltok.c + build/ide/esp_idf_components/freertos/FreeRTOS-Kernel/portable/xtensa/xtensa_init.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/expat/expat/expat/lib/xmltok.c + /home/karl/espressif/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/xtensa_init.c - build/ide/esp_idf_components/expat/expat/expat/lib/xmltok_impl.c + build/ide/esp_idf_components/freertos/FreeRTOS-Kernel/portable/xtensa/xtensa_overlay_os_hook.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/expat/expat/expat/lib/xmltok_impl.c + /home/karl/espressif/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/xtensa_overlay_os_hook.c - build/ide/esp_idf_components/expat/expat/expat/lib/xmltok_ns.c + build/ide/esp_idf_components/freertos/FreeRTOS-Kernel/portable/xtensa/xtensa_vectors.S 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/expat/expat/expat/lib/xmltok_ns.c + /home/karl/espressif/esp-idf-v5.1.1/components/freertos/FreeRTOS-Kernel/portable/xtensa/xtensa_vectors.S build/ide/esp_idf_components/lwip/lwip/src/api/api_lib.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/api/api_lib.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/api/api_lib.c build/ide/esp_idf_components/lwip/lwip/src/api/api_msg.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/api/api_msg.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/api/api_msg.c build/ide/esp_idf_components/lwip/lwip/src/api/err.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/api/err.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/api/err.c build/ide/esp_idf_components/lwip/lwip/src/api/if_api.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/api/if_api.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/api/if_api.c build/ide/esp_idf_components/lwip/lwip/src/api/netbuf.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/api/netbuf.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/api/netbuf.c build/ide/esp_idf_components/lwip/lwip/src/api/netdb.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/api/netdb.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/api/netdb.c build/ide/esp_idf_components/lwip/lwip/src/api/netifapi.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/api/netifapi.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/api/netifapi.c build/ide/esp_idf_components/lwip/lwip/src/api/sockets.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/api/sockets.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/api/sockets.c build/ide/esp_idf_components/lwip/lwip/src/api/tcpip.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/api/tcpip.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/api/tcpip.c build/ide/esp_idf_components/lwip/lwip/src/core/def.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/def.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/def.c build/ide/esp_idf_components/lwip/lwip/src/core/dns.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/dns.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/dns.c build/ide/esp_idf_components/lwip/lwip/src/core/inet_chksum.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/inet_chksum.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/inet_chksum.c build/ide/esp_idf_components/lwip/lwip/src/core/init.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/init.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/init.c build/ide/esp_idf_components/lwip/lwip/src/core/ip.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/ip.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/ip.c build/ide/esp_idf_components/lwip/lwip/src/core/mem.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/mem.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/mem.c build/ide/esp_idf_components/lwip/lwip/src/core/memp.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/memp.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/memp.c build/ide/esp_idf_components/lwip/lwip/src/core/netif.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/netif.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/netif.c build/ide/esp_idf_components/lwip/lwip/src/core/pbuf.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/pbuf.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/pbuf.c build/ide/esp_idf_components/lwip/lwip/src/core/raw.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/raw.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/raw.c build/ide/esp_idf_components/lwip/lwip/src/core/stats.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/stats.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/stats.c build/ide/esp_idf_components/lwip/lwip/src/core/sys.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/sys.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/sys.c build/ide/esp_idf_components/lwip/lwip/src/core/tcp.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/tcp.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/tcp.c build/ide/esp_idf_components/lwip/lwip/src/core/tcp_in.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/tcp_in.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/tcp_in.c build/ide/esp_idf_components/lwip/lwip/src/core/tcp_out.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/tcp_out.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/tcp_out.c build/ide/esp_idf_components/lwip/lwip/src/core/timeouts.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/timeouts.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/timeouts.c build/ide/esp_idf_components/lwip/lwip/src/core/udp.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/udp.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/udp.c - build/ide/esp_idf_components/lwip/lwip/src/netif/ethernet.c + build/ide/esp_idf_components/lwip/lwip/src/netif/bridgeif.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/ethernet.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/bridgeif.c - build/ide/esp_idf_components/lwip/lwip/src/netif/lowpan6.c + build/ide/esp_idf_components/lwip/lwip/src/netif/bridgeif_fdb.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/lowpan6.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/bridgeif_fdb.c - build/ide/esp_idf_components/lwip/lwip/src/netif/slipif.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/slipif.c - - - build/ide/esp_idf_components/lwip/port/esp32/debug/lwip_debug.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/port/esp32/debug/lwip_debug.c - - - build/ide/esp_idf_components/lwip/port/esp32/freertos/sys_arch.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/port/esp32/freertos/sys_arch.c - - - build/ide/esp_idf_components/lwip/port/esp32/hooks/lwip_default_hooks.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/port/esp32/hooks/lwip_default_hooks.c - - - build/ide/esp_idf_components/lwip/port/esp32/hooks/tcp_isn_default.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/port/esp32/hooks/tcp_isn_default.c - - - build/ide/esp_idf_components/lwip/port/esp32/netif/dhcp_state.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/port/esp32/netif/dhcp_state.c - - - build/ide/esp_idf_components/lwip/port/esp32/netif/ethernetif.c + build/ide/esp_idf_components/lwip/lwip/src/netif/ethernet.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/port/esp32/netif/ethernetif.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/ethernet.c - build/ide/esp_idf_components/lwip/port/esp32/netif/wlanif.c + build/ide/esp_idf_components/lwip/lwip/src/netif/slipif.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/port/esp32/netif/wlanif.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/slipif.c build/ide/esp_idf_components/mbedtls/port/aes/block/esp_aes.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/port/aes/block/esp_aes.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/port/aes/block/esp_aes.c build/ide/esp_idf_components/mbedtls/port/sha/parallel_engine/esp_sha1.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/port/sha/parallel_engine/esp_sha1.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/port/sha/parallel_engine/esp_sha1.c build/ide/esp_idf_components/mbedtls/port/sha/parallel_engine/esp_sha256.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/port/sha/parallel_engine/esp_sha256.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/port/sha/parallel_engine/esp_sha256.c build/ide/esp_idf_components/mbedtls/port/sha/parallel_engine/esp_sha512.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/port/sha/parallel_engine/esp_sha512.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/port/sha/parallel_engine/esp_sha512.c build/ide/esp_idf_components/mbedtls/port/sha/parallel_engine/sha.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/mbedtls/port/sha/parallel_engine/sha.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_auth/crypto_auth.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_auth/crypto_auth.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_box/crypto_box.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_box/crypto_box.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_box/crypto_box_easy.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_box/crypto_box_easy.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_box/crypto_box_seal.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_box/crypto_box_seal.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_generichash/crypto_generichash.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_generichash/crypto_generichash.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_hash/crypto_hash.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_hash/crypto_hash.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_kdf/crypto_kdf.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_kdf/crypto_kdf.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_kx/crypto_kx.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_kx/crypto_kx.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_onetimeauth/crypto_onetimeauth.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_onetimeauth/crypto_onetimeauth.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_pwhash/crypto_pwhash.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_pwhash/crypto_pwhash.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_scalarmult/crypto_scalarmult.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_scalarmult/crypto_scalarmult.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox_easy.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox_easy.c + /home/karl/espressif/esp-idf-v5.1.1/components/mbedtls/port/sha/parallel_engine/sha.c - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_shorthash/crypto_shorthash.c + build/ide/esp_idf_components/protocomm/src/crypto/srp6a/esp_srp.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_shorthash/crypto_shorthash.c + /home/karl/espressif/esp-idf-v5.1.1/components/protocomm/src/crypto/srp6a/esp_srp.c - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_sign/crypto_sign.c + build/ide/esp_idf_components/protocomm/src/crypto/srp6a/esp_srp_mpi.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_sign/crypto_sign.c + /home/karl/espressif/esp-idf-v5.1.1/components/protocomm/src/crypto/srp6a/esp_srp_mpi.c - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_stream/crypto_stream.c + build/ide/esp_idf_components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls-bignum.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_stream/crypto_stream.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls-bignum.c - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/randombytes/randombytes.c + build/ide/esp_idf_components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls-ec.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/randombytes/randombytes.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls-ec.c - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/sodium/codecs.c + build/ide/esp_idf_components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls-rsa.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/sodium/codecs.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls-rsa.c - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/sodium/core.c + build/ide/esp_idf_components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/sodium/core.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/esp_supplicant/src/crypto/crypto_mbedtls.c - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/sodium/runtime.c + build/ide/esp_idf_components/wpa_supplicant/esp_supplicant/src/crypto/tls_mbedtls.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/sodium/runtime.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/sodium/utils.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/sodium/utils.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/sodium/version.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/sodium/version.c + /home/karl/espressif/esp-idf-v5.1.1/components/wpa_supplicant/esp_supplicant/src/crypto/tls_mbedtls.c build/ide/esp_idf_components/lwip/lwip/src/apps/netbiosns/netbiosns.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/apps/netbiosns/netbiosns.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/apps/netbiosns/netbiosns.c build/ide/esp_idf_components/lwip/lwip/src/apps/sntp/sntp.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/apps/sntp/sntp.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/apps/sntp/sntp.c build/ide/esp_idf_components/lwip/lwip/src/core/ipv4/autoip.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/ipv4/autoip.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/ipv4/autoip.c build/ide/esp_idf_components/lwip/lwip/src/core/ipv4/dhcp.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/ipv4/dhcp.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/ipv4/dhcp.c build/ide/esp_idf_components/lwip/lwip/src/core/ipv4/etharp.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/ipv4/etharp.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/ipv4/etharp.c build/ide/esp_idf_components/lwip/lwip/src/core/ipv4/icmp.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/ipv4/icmp.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/ipv4/icmp.c build/ide/esp_idf_components/lwip/lwip/src/core/ipv4/igmp.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/ipv4/igmp.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/ipv4/igmp.c build/ide/esp_idf_components/lwip/lwip/src/core/ipv4/ip4.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/ipv4/ip4.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/ipv4/ip4.c build/ide/esp_idf_components/lwip/lwip/src/core/ipv4/ip4_addr.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/ipv4/ip4_addr.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/ipv4/ip4_addr.c build/ide/esp_idf_components/lwip/lwip/src/core/ipv4/ip4_frag.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/ipv4/ip4_frag.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/ipv4/ip4_frag.c build/ide/esp_idf_components/lwip/lwip/src/core/ipv4/ip4_napt.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/ipv4/ip4_napt.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/ipv4/ip4_napt.c build/ide/esp_idf_components/lwip/lwip/src/core/ipv6/dhcp6.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/ipv6/dhcp6.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/ipv6/dhcp6.c build/ide/esp_idf_components/lwip/lwip/src/core/ipv6/ethip6.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/ipv6/ethip6.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/ipv6/ethip6.c build/ide/esp_idf_components/lwip/lwip/src/core/ipv6/icmp6.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/ipv6/icmp6.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/ipv6/icmp6.c build/ide/esp_idf_components/lwip/lwip/src/core/ipv6/inet6.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/ipv6/inet6.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/ipv6/inet6.c build/ide/esp_idf_components/lwip/lwip/src/core/ipv6/ip6.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/ipv6/ip6.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/ipv6/ip6.c build/ide/esp_idf_components/lwip/lwip/src/core/ipv6/ip6_addr.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/ipv6/ip6_addr.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/ipv6/ip6_addr.c build/ide/esp_idf_components/lwip/lwip/src/core/ipv6/ip6_frag.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/ipv6/ip6_frag.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/ipv6/ip6_frag.c build/ide/esp_idf_components/lwip/lwip/src/core/ipv6/mld6.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/ipv6/mld6.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/ipv6/mld6.c build/ide/esp_idf_components/lwip/lwip/src/core/ipv6/nd6.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/core/ipv6/nd6.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/core/ipv6/nd6.c build/ide/esp_idf_components/lwip/lwip/src/netif/ppp/auth.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/ppp/auth.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/ppp/auth.c build/ide/esp_idf_components/lwip/lwip/src/netif/ppp/ccp.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/ppp/ccp.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/ppp/ccp.c build/ide/esp_idf_components/lwip/lwip/src/netif/ppp/chap-md5.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/ppp/chap-md5.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/ppp/chap-md5.c build/ide/esp_idf_components/lwip/lwip/src/netif/ppp/chap-new.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/ppp/chap-new.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/ppp/chap-new.c build/ide/esp_idf_components/lwip/lwip/src/netif/ppp/chap_ms.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/ppp/chap_ms.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/ppp/chap_ms.c build/ide/esp_idf_components/lwip/lwip/src/netif/ppp/demand.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/ppp/demand.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/ppp/demand.c build/ide/esp_idf_components/lwip/lwip/src/netif/ppp/eap.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/ppp/eap.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/ppp/eap.c build/ide/esp_idf_components/lwip/lwip/src/netif/ppp/ecp.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/ppp/ecp.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/ppp/ecp.c build/ide/esp_idf_components/lwip/lwip/src/netif/ppp/eui64.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/ppp/eui64.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/ppp/eui64.c build/ide/esp_idf_components/lwip/lwip/src/netif/ppp/fsm.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/ppp/fsm.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/ppp/fsm.c build/ide/esp_idf_components/lwip/lwip/src/netif/ppp/ipcp.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/ppp/ipcp.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/ppp/ipcp.c build/ide/esp_idf_components/lwip/lwip/src/netif/ppp/ipv6cp.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/ppp/ipv6cp.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/ppp/ipv6cp.c build/ide/esp_idf_components/lwip/lwip/src/netif/ppp/lcp.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/ppp/lcp.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/ppp/lcp.c build/ide/esp_idf_components/lwip/lwip/src/netif/ppp/magic.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/ppp/magic.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/ppp/magic.c build/ide/esp_idf_components/lwip/lwip/src/netif/ppp/mppe.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/ppp/mppe.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/ppp/mppe.c build/ide/esp_idf_components/lwip/lwip/src/netif/ppp/multilink.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/ppp/multilink.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/ppp/multilink.c build/ide/esp_idf_components/lwip/lwip/src/netif/ppp/ppp.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/ppp/ppp.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/ppp/ppp.c build/ide/esp_idf_components/lwip/lwip/src/netif/ppp/pppapi.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/ppp/pppapi.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/ppp/pppapi.c build/ide/esp_idf_components/lwip/lwip/src/netif/ppp/pppcrypt.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/ppp/pppcrypt.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/ppp/pppcrypt.c build/ide/esp_idf_components/lwip/lwip/src/netif/ppp/pppoe.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/ppp/pppoe.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/ppp/pppoe.c build/ide/esp_idf_components/lwip/lwip/src/netif/ppp/pppol2tp.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/ppp/pppol2tp.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/ppp/pppol2tp.c build/ide/esp_idf_components/lwip/lwip/src/netif/ppp/pppos.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/ppp/pppos.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/ppp/pppos.c build/ide/esp_idf_components/lwip/lwip/src/netif/ppp/upap.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/ppp/upap.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/ppp/upap.c build/ide/esp_idf_components/lwip/lwip/src/netif/ppp/utils.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/ppp/utils.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/ppp/utils.c build/ide/esp_idf_components/lwip/lwip/src/netif/ppp/vj.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/lwip/lwip/src/netif/ppp/vj.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_auth/hmacsha256/auth_hmacsha256.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_auth/hmacsha256/auth_hmacsha256.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_auth/hmacsha512/auth_hmacsha512.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_auth/hmacsha512/auth_hmacsha512.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_auth/hmacsha512256/auth_hmacsha512256.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_box/curve25519xchacha20poly1305/box_curve25519xchacha20poly1305.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_box/curve25519xchacha20poly1305/box_curve25519xchacha20poly1305.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_box/curve25519xchacha20poly1305/box_seal_curve25519xchacha20poly1305.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_box/curve25519xchacha20poly1305/box_seal_curve25519xchacha20poly1305.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_core/ed25519/core_ed25519.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_core/ed25519/core_ed25519.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_core/ed25519/core_ristretto255.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_core/ed25519/core_ristretto255.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_core/hchacha20/core_hchacha20.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_core/hchacha20/core_hchacha20.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_core/hsalsa20/core_hsalsa20.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_core/hsalsa20/core_hsalsa20.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_generichash/blake2b/generichash_blake2.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_generichash/blake2b/generichash_blake2.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_hash/sha256/hash_sha256.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_hash/sha256/hash_sha256.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_hash/sha512/hash_sha512.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_hash/sha512/hash_sha512.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_kdf/blake2b/kdf_blake2b.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_kdf/blake2b/kdf_blake2b.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_onetimeauth/poly1305/onetimeauth_poly1305.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-core.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-core.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-encoding.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-encoding.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-fill-block-avx2.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-fill-block-avx2.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-fill-block-avx512f.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-fill-block-avx512f.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-fill-block-ref.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-fill-block-ref.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-fill-block-ssse3.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_pwhash/argon2/argon2-fill-block-ssse3.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_pwhash/argon2/argon2.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_pwhash/argon2/argon2.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_pwhash/argon2/blake2b-long.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_pwhash/argon2/blake2b-long.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_pwhash/argon2/pwhash_argon2i.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_pwhash/argon2/pwhash_argon2i.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_pwhash/argon2/pwhash_argon2id.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_pwhash/argon2/pwhash_argon2id.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pbkdf2-sha256.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/scrypt_platform.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_scalarmult/curve25519/scalarmult_curve25519.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_secretbox/xchacha20poly1305/secretbox_xchacha20poly1305.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_secretbox/xchacha20poly1305/secretbox_xchacha20poly1305.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_secretbox/xsalsa20poly1305/secretbox_xsalsa20poly1305.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_secretstream/xchacha20poly1305/secretstream_xchacha20poly1305.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_secretstream/xchacha20poly1305/secretstream_xchacha20poly1305.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_shorthash/siphash24/shorthash_siphash24.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_shorthash/siphash24/shorthash_siphash24.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_shorthash/siphash24/shorthash_siphashx24.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_shorthash/siphash24/shorthash_siphashx24.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_sign/ed25519/sign_ed25519.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_sign/ed25519/sign_ed25519.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_stream/chacha20/stream_chacha20.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_stream/chacha20/stream_chacha20.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_stream/salsa20/stream_salsa20.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_stream/salsa20/stream_salsa20.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_stream/salsa2012/stream_salsa2012.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_stream/salsa2012/stream_salsa2012.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_stream/salsa208/stream_salsa208.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_stream/salsa208/stream_salsa208.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_stream/xchacha20/stream_xchacha20.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_stream/xchacha20/stream_xchacha20.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_stream/xsalsa20/stream_xsalsa20.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_verify/sodium/verify.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_verify/sodium/verify.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_aead/chacha20poly1305/sodium/aead_chacha20poly1305.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_aead/xchacha20poly1305/sodium/aead_xchacha20poly1305.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_aead/xchacha20poly1305/sodium/aead_xchacha20poly1305.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_core/ed25519/ref10/ed25519_ref10.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20_ref2.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_core/hsalsa20/ref2/core_hsalsa20_ref2.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_core/salsa/ref/core_salsa_ref.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_core/salsa/ref/core_salsa_ref.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-avx2.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-avx2.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ref.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ref.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ssse3.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2b-compress-ssse3.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2b-ref.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_generichash/blake2b/ref/blake2b-ref.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_generichash/blake2b/ref/generichash_blake2b.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_generichash/blake2b/ref/generichash_blake2b.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_hash/sha256/cp/hash_sha256_cp.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_hash/sha256/cp/hash_sha256_cp.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_hash/sha512/cp/hash_sha512_cp.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_hash/sha512/cp/hash_sha512_cp.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_onetimeauth/poly1305/donna/poly1305_donna.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_pwhash/scryptsalsa208sha256/nosse/pwhash_scryptsalsa208sha256_nosse.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_scalarmult/curve25519/ref10/x25519_ref10.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/consts.S - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/consts.S - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/curve25519_sandy2x.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/curve25519_sandy2x.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_invert.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_invert.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_mul.S - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_mul.S - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_nsquare.S - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_nsquare.S - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_pack.S - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe51_pack.S - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe_frombytes_sandy2x.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/fe_frombytes_sandy2x.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.S - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/ladder.S - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/sandy2x.S - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_scalarmult/curve25519/sandy2x/sandy2x.S - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_scalarmult/ed25519/ref10/scalarmult_ed25519_ref10.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_scalarmult/ed25519/ref10/scalarmult_ed25519_ref10.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_scalarmult/ristretto255/ref10/scalarmult_ristretto255_ref10.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_scalarmult/ristretto255/ref10/scalarmult_ristretto255_ref10.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphash24_ref.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphash24_ref.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphashx24_ref.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_shorthash/siphash24/ref/shorthash_siphashx24_ref.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_sign/ed25519/ref10/keypair.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_sign/ed25519/ref10/keypair.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_sign/ed25519/ref10/obsolete.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_sign/ed25519/ref10/obsolete.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_sign/ed25519/ref10/open.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_sign/ed25519/ref10/open.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sign.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_sign/ed25519/ref10/sign.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-avx2.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-avx2.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-ssse3.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_stream/chacha20/dolbeau/chacha20_dolbeau-ssse3.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_stream/chacha20/ref/chacha20_ref.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_stream/chacha20/ref/chacha20_ref.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_stream/salsa20/ref/salsa20_ref.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_stream/salsa20/ref/salsa20_ref.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_stream/salsa20/xmm6/salsa20_xmm6-asm.S - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_stream/salsa20/xmm6/salsa20_xmm6-asm.S - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_stream/salsa20/xmm6/salsa20_xmm6.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_stream/salsa20/xmm6/salsa20_xmm6.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-avx2.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-avx2.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-sse2.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_stream/salsa20/xmm6int/salsa20_xmm6int-sse2.c - - - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012_ref.c - 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_stream/salsa2012/ref/stream_salsa2012_ref.c + /home/karl/espressif/esp-idf-v5.1.1/components/lwip/lwip/src/netif/ppp/vj.c - build/ide/esp_idf_components/libsodium/libsodium/src/libsodium/crypto_stream/salsa208/ref/stream_salsa208_ref.c + build/ide/esp_idf_components/efuse/src/efuse_controller/keys/without_key_purposes/three_key_blocks/esp_efuse_api_key.c 1 - /home/carlos/espressif/idf-v4.3.5/esp-idf-v4.3.5/components/libsodium/libsodium/src/libsodium/crypto_stream/salsa208/ref/stream_salsa208_ref.c + /home/karl/espressif/esp-idf-v5.1.1/components/efuse/src/efuse_controller/keys/without_key_purposes/three_key_blocks/esp_efuse_api_key.c diff --git a/README.md b/README.md index 3724a1e3..4b22187f 100644 --- a/README.md +++ b/README.md @@ -19,26 +19,23 @@ audio streams with sample rates up to 48Khz maybe more, I didn't test. Please check out the task list and feel free to fill in. -I dropped the usage of ADF completely but copied stripped down, needed components to this project. +I dropped the usage of ADF completely but copied stripped down, needed components to this project (using ESP-ADF v2.6). This was necessary because ADF was using flac in closed source precompiled library -which made it impossible to get good results for multiroom syncing. IDF's I2S driver was also copied -to project's components and adapted. Originally it wasn't possible to pre load DMA buffers with audio -samples and therefore no precise sync could be achieved. +which made it impossible to get good results for multiroom syncing. ### Codebase -The codebase is split into components and build on ESP-IDF v4.3.5. I still +The codebase is split into components and build on ESP-IDF v5.1.1. I still have some refactoring on the todo list as the concept has started to settle and allow for new features can be added in a structured manner. In the code you will find parts that are only partly related features and still not on the task list. Also there is a lot of code clean up needed. Components - - audio-board : taken from ADF, stripped down to strictly necessary parts for usage with Lyrat v4.3 - - audio-hal : taken from ADF, stripped down to strictly necessary parts for usage with Lyrat v4.3 - - audio-sal : taken from ADF, stripped down to strictly necessary parts for usage with Lyrat v4.3 - - custom_board : - - custom-driver : modified I2S driver from IDF v4.3.1 which supports preloading DMA buffers with valid data + - audio-board : taken from ADF, stripped down to strictly necessary parts for playback + - audio-hal : taken from ADF, stripped down to strictly necessary parts for playback + - audio-sal : taken from ADF, stripped down to strictly necessary parts for playback + - custom_board : generic board component to support easy integration of DACs - dsp_processor : Audio Processor, low pass filters, effects, etc. - esp-dsp : Submodule to the ESP-ADF done by David Douard - esp-peripherals : taken from ADF, stripped down to strictly necessary parts for usage with Lyrat v4.3 @@ -216,29 +213,13 @@ Then on every `git commit`, a few sanity/formatting checks will be performed. ## Task list -- [ok] Fix to alinge with above -- [ok] put kconfig to better locations in tree - * add codec description -- [ok] Integrate ESP wifi provision -- [ok] Find and connect to Avahi broadcasted Snapcast server name -- [ ] Add a client command interface layer like volume/mute control +- [ ] put kconfig to better locations in tree - [ ] add missing codec's (ogg) -- [ok] test esp-dsp functionality after ADF drop -- [ok] Check compatibility with different HW than Lyrat v4.3 -- [ok] rework dsp_processor and test. At the moment only dspfStereo and dspfBassBoost will work. Also ensure/test we got enough RAM on WROVER modules -- [ ] reduce dsp_processor memory footprint - [ ] dsp_processor: add equalizer - * Control interface for equalizer +- [ ] Control interface for equalizer (component: ui_http_server) - [ ] clean and polish code (remove all unused variables etc.) -- [ok] Improve Documentation, e.g. Hardware guide (supported codecs) -- [ ] upgrade to IDF v5 -- [ ] in IDF v5 use native i2s driver, as it supports preloading DMA buffer with valid data now +- [ ] Improve Documentation - [ ] Throw out ADF copied components from project tree and use CmakeLists.txt to pull in necessary files from ADF ## Minor task - - [ok] soft mute - play sample in buffer with decreasing volume - - [ok] hard mute - using ADF's HAL - - [ok] Startup: do not start parsing on samples to codec before sample ring buffer hits requested buffer size. - - [ok] Start from empty buffer - - [ ] fill in missing component descriptions in Readme.md - - [ok] DAC latency setting from android app +- [ ] fill in missing component descriptions in Readme.md diff --git a/components/audio_board/CMakeLists.txt b/components/audio_board/CMakeLists.txt index 438ffcd2..b9be3175 100644 --- a/components/audio_board/CMakeLists.txt +++ b/components/audio_board/CMakeLists.txt @@ -1,10 +1,9 @@ set(COMPONENT_ADD_INCLUDEDIRS ./include) # Edit following two lines to set component requirements (see docs) -set(COMPONENT_REQUIRES ) -set(COMPONENT_PRIV_REQUIRES audio_sal audio_hal esp_peripherals) +set(COMPONENT_REQUIRES driver) +set(COMPONENT_PRIV_REQUIRES esp_peripherals audio_sal audio_hal) -#[[ if (CONFIG_ESP_LYRAT_V4_2_BOARD) message(STATUS "Current board name is " CONFIG_ESP_LYRAT_V4_2_BOARD) list(APPEND COMPONENT_ADD_INCLUDEDIRS ./lyrat_v4_2) @@ -13,7 +12,6 @@ set(COMPONENT_SRCS ./lyrat_v4_2/board_pins_config.c ) endif() -]] if (CONFIG_ESP_LYRAT_V4_3_BOARD) message(STATUS "Current board name is " CONFIG_ESP_LYRAT_V4_3_BOARD) @@ -33,7 +31,6 @@ set(COMPONENT_SRCS ) endif() - if (CONFIG_ESP_LYRAT_MINI_V1_1_BOARD) message(STATUS "Current board name is " CONFIG_ESP_LYRAT_MINI_V1_1_BOARD) list(APPEND COMPONENT_ADD_INCLUDEDIRS ./lyrat_mini_v1_1) @@ -43,7 +40,7 @@ set(COMPONENT_SRCS ) endif() -#[[ + if (CONFIG_ESP_LYRATD_MSC_V2_1_BOARD) message(STATUS "Current board name is " CONFIG_ESP_LYRATD_MSC_V2_1_BOARD) list(APPEND COMPONENT_ADD_INCLUDEDIRS ./lyratd_msc_v2_1) @@ -68,10 +65,11 @@ list(APPEND COMPONENT_ADD_INCLUDEDIRS ./esp32_korvo_du1906) set(COMPONENT_SRCS ./esp32_korvo_du1906/board.c ./esp32_korvo_du1906/board_pins_config.c -./esp32_korvo_du1906/du1906_bar_pattern.c +#./esp32_korvo_du1906/du1906_bar_pattern.c ) endif() + if (CONFIG_ESP32_S2_KALUGA_1_V1_2_BOARD) message(STATUS "Current board name is " CONFIG_ESP32_S2_KALUGA_1_V1_2_BOARD) list(APPEND COMPONENT_ADD_INCLUDEDIRS ./esp32_s2_kaluga_1_v1_2) @@ -80,6 +78,62 @@ set(COMPONENT_SRCS ./esp32_s2_kaluga_1_v1_2/board_pins_config.c ) endif() + +#[[ +if (CONFIG_ESP32_S3_KORVO2_V3_BOARD) +message(STATUS "Current board name is " CONFIG_ESP32_S3_KORVO2_V3_BOARD) +list(APPEND COMPONENT_ADD_INCLUDEDIRS ./esp32_s3_korvo2_v3) +set(COMPONENT_SRCS +./esp32_s3_korvo2_v3/board.c +./esp32_s3_korvo2_v3/board_pins_config.c +) +endif() + +if (CONFIG_ESP32_S3_KORVO2L_V1_BOARD) +message(STATUS "Current board name is " CONFIG_ESP32_S3_KORVO2L_V1_BOARD) +list(APPEND COMPONENT_ADD_INCLUDEDIRS ./esp32_s3_korvo2l_v1) +set(COMPONENT_SRCS +./esp32_s3_korvo2l_v1/board.c +./esp32_s3_korvo2l_v1/board_pins_config.c +) +endif() + +if (CONFIG_ESP32_S3_BOX_LITE_BOARD) +message(STATUS "Current board name is " CONFIG_ESP32_S3_BOX_LITE_BOARD) +list(APPEND COMPONENT_ADD_INCLUDEDIRS ./esp32_s3_box_lite) +set(COMPONENT_SRCS +./esp32_s3_box_lite/board.c +./esp32_s3_box_lite/board_pins_config.c +) +endif() + +if (CONFIG_ESP32_S3_BOX_BOARD) +message(STATUS "Current board name is " CONFIG_ESP32_S3_BOX_BOARD) +list(APPEND COMPONENT_ADD_INCLUDEDIRS ./esp32_s3_box) +set(COMPONENT_SRCS +./esp32_s3_box/board.c +./esp32_s3_box/board_pins_config.c +) +endif() + +if (CONFIG_ESP32_C3_LYRA_V2_BOARD) +message(STATUS "Current board name is " CONFIG_ESP32_C3_LYRA_V2_BOARD) +list(APPEND COMPONENT_ADD_INCLUDEDIRS ./esp32_c3_lyra) +set(COMPONENT_SRCS +./esp32_c3_lyra/board.c +./esp32_c3_lyra/board_pins_config.c +./esp32_c3_lyra/C3_lyra_sys_pattern.c +) +endif() + +if (CONFIG_ESP32_C6_DEVKIT_BOARD) +message(STATUS "Current board name is " CONFIG_ESP32_C6_DEVKIT_BOARD) +list(APPEND COMPONENT_ADD_INCLUDEDIRS ./esp32_c6_devkit) +set(COMPONENT_SRCS +./esp32_c6_devkit/board.c +./esp32_c6_devkit/board_pins_config.c +) +endif() ]] register_component() diff --git a/components/audio_board/Kconfig.projbuild b/components/audio_board/Kconfig.projbuild index 050309a9..d0c2dbaa 100644 --- a/components/audio_board/Kconfig.projbuild +++ b/components/audio_board/Kconfig.projbuild @@ -1,54 +1,331 @@ -menu "Audio HAL" - -choice AUDIO_BOARD - prompt "Audio board" - default ESP_LYRAT_V4_3_BOARD - help - Select an audio board to use with the ESP-ADF -config AUDIO_BOARD_CUSTOM - bool "Custom audio board" -config ESP_LYRAT_V4_3_BOARD - bool "ESP32-Lyrat V4.3" -config ESP_LYRAT_V4_2_BOARD - bool "ESP32-Lyrat V4.2" -config ESP_LYRATD_MSC_V2_1_BOARD - bool "ESP32-LyraTD-MSC V2.1" -config ESP_LYRATD_MSC_V2_2_BOARD - bool "ESP32-LyraTD-MSC V2.2" -config ESP_LYRAT_MINI_V1_1_BOARD - bool "ESP32-Lyrat-Mini V1.1" -config ESP32_KORVO_DU1906_BOARD - bool "ESP32_KORVO_DU1906" -config ESP32_S2_KALUGA_1_V1_2_BOARD - bool "ESP32-S2-Kaluga-1 v1.2" -config ESP_AI_THINKER_ES8388_BOARD - bool "ESP-AI-Thinker-ES8388 v2.2" - -endchoice - -choice ESP32_KORVO_DU1906_DAC - prompt "ESP32 KORVO DU1906 Board DAC chip" - depends on ESP32_KORVO_DU1906_BOARD - default ESP32_KORVO_DU1906_DAC_TAS5805M - help - Select DAC chip to use on ESP32_KORVO_DU1906 board - -config ESP32_KORVO_DU1906_DAC_TAS5805M - bool "ESP32_KORVO_DU1906_DAC_TAS5805M" -config ESP32_KORVO_DU1906_DAC_ES7148 - bool "ESP32_KORVO_DU1906_DAC_ES7148" - -endchoice - -choice ESP32_KORVO_DU1906_ADC - prompt "ESP32 KORVO DU1906 Board ADC chip" - depends on ESP32_KORVO_DU1906_BOARD - default ESP32_KORVO_DU1906_ADC_ES7243 - help - Select ADC chip to use on ESP32_KORVO_DU1906 board - -config ESP32_KORVO_DU1906_ADC_ES7243 - bool "ESP32_KORVO_DU1906_ADC_ES7243" -endchoice +menu "Audio Board" + + config I2S_USE_MSB_FORMAT + bool + default n + help + Specifies if the I2S should use MSB format instead. Some DACs (such as PT8211) need this enabled to ensure + compatibility with their LSBJ timing under their native bit-depth. This option is only adjusted by the DAC + choice and is not exposed to menuconfig. + See https://github.com/schreibfaul1/ESP32-audioI2S/blob/1d9b299d0197f99fc70335295adcd226dc220f88/src/Audio.cpp#L4929 + + choice AUDIO_BOARD + prompt "Audio board" + default ESP_LYRAT_V4_3_BOARD + help + Select an audio board to use with the ESP-ADF + config AUDIO_BOARD_CUSTOM + bool "Custom audio board" + config ESP_LYRAT_V4_3_BOARD + bool "ESP32-Lyrat V4.3" + config ESP_LYRAT_V4_2_BOARD + bool "ESP32-Lyrat V4.2" + config ESP_LYRATD_MSC_V2_1_BOARD + bool "ESP32-LyraTD-MSC V2.1" + config ESP_LYRATD_MSC_V2_2_BOARD + bool "ESP32-LyraTD-MSC V2.2" + config ESP_LYRAT_MINI_V1_1_BOARD + bool "ESP32-Lyrat-Mini V1.1" + config ESP32_KORVO_DU1906_BOARD + bool "ESP32_KORVO_DU1906" + config ESP32_S2_KALUGA_1_V1_2_BOARD + bool "ESP32-S2-Kaluga-1 v1.2" + config ESP_AI_THINKER_ES8388_BOARD + bool "ESP-AI-Thinker-ES8388 v2.2" + #config ESP32_S3_KORVO2_V3_BOARD + # bool "ESP32-S3-Korvo-2 v3" + #config ESP32_S3_KORVO2L_V1_BOARD + # bool "ESP32-S3-Korvo-2L v1" + #config ESP32_S3_BOX_LITE_BOARD + # bool "ESP32-S3-BOX-Lite" + #config ESP32_S3_BOX_BOARD + # bool "ESP32-S3-BOX" + #config ESP32_C3_LYRA_V2_BOARD + # bool "ESP32-C3-Lyra-v2.0" + #config ESP32_C6_DEVKIT_BOARD + # bool "ESP32-C6-DEVKIT" + + endchoice + + choice ESP32_KORVO_DU1906_DAC + prompt "ESP32 KORVO DU1906 Board DAC chip" + depends on ESP32_KORVO_DU1906_BOARD + default ESP32_KORVO_DU1906_DAC_TAS5805M + help + Select DAC chip to use on ESP32_KORVO_DU1906 board + + config ESP32_KORVO_DU1906_DAC_TAS5805M + bool "ESP32_KORVO_DU1906_DAC_TAS5805M" + config ESP32_KORVO_DU1906_DAC_ES7148 + bool "ESP32_KORVO_DU1906_DAC_ES7148" + + endchoice + + choice ESP32_KORVO_DU1906_ADC + prompt "ESP32 KORVO DU1906 Board ADC chip" + depends on ESP32_KORVO_DU1906_BOARD + default ESP32_KORVO_DU1906_ADC_ES7243 + help + Select ADC chip to use on ESP32_KORVO_DU1906 board + + config ESP32_KORVO_DU1906_ADC_ES7243 + bool "ESP32_KORVO_DU1906_ADC_ES7243" + endchoice + + menu "Custom Audio Board" + depends on AUDIO_BOARD_CUSTOM + + choice GENERIC_BOARD_DAC + prompt "DAC chip" + default DAC_MA120 + help + Select a DAC connected to the generic ESP32 board + + config DAC_PCM51XX + bool "TI PCM51XX/TAS57XX based DAC" + + config DAC_PCM5102A + bool "TI PCM5102A based DAC" + + config DAC_MA120 + bool "Infineon MA120 ClassD AMP" + + config DAC_MA120X0 + bool "Infineon MA120X0 ClassD AMP" + + config DAC_ADAU1961 + bool "Analog Devices ADAU1961 DAC" + + config DAC_MAX98357 + bool "Analog Devices MAX98357 DAC" + + config DAC_TAS5805M + bool "Texas Instruments TAS5805M" + + config DAC_PT8211 + bool "Princeton Technology PT8211" + select I2S_USE_MSB_FORMAT + + endchoice + + menu "DAC I2C control interface" + config DAC_I2C_SDA + int "SDA pin" + default 12 if DAC_ADAU1961 + default 21 if DAC_MA120 || DAC_PCM51XX || DAC_MA120 || DAC_MA120X0 || DAC_MAX98357 || DAC_PCM5102A || DAC_TAS5805M + default -1 if DAC_PT8211 + help + I2C SDA pin of the DAC control interface + config DAC_I2C_SCL + int "SCL pin" + default 14 if DAC_ADAU1961 + default 22 if DAC_MA120 || DAC_PCM51XX || DAC_MA120 || DAC_MA120X0 || DAC_MAX98357 || DAC_PCM5102A + default 27 if DAC_TAS5805M + default -1 if DAC_PT8211 + help + I2C SCL pin of the DAC control interface + config DAC_I2C_ADDR + hex "I2C address" + default 0x70 if DAC_ADAU1961 + default 0x20 if DAC_MA120 || DAC_PCM51XX || DAC_MA120 || DAC_MA120X0 || DAC_MAX98357 || DAC_PCM5102A + default 0x2D if DAC_TAS5805M + default 0x00 if DAC_PT8211 + help + I2C Address of the DAC control interface + endmenu + + menu "I2S master interface" + config MASTER_I2S_MCLK_PIN + int "Master i2s mclk" + default 3 if DAC_ADAU1961 + default 0 + help + Master audio interface master clock. + + config MASTER_I2S_BCK_PIN + int "Master i2s bck" + default 15 if DAC_ADAU1961 + default 23 if DAC_MAX98357 + default 26 if DAC_TAS5805M + default 23 + + help + Master audio interface bit clock. + + config MASTER_I2S_LRCK_PIN + int "Master i2s lrck" + default 13 if DAC_ADAU1961 + default 24 if DAC_MAX98357 + default 25 if DAC_TAS5805M + default 2 + help + Master audio interface left/right sync clock. + + config MASTER_I2S_DATAOUT_PIN + int "Master i2s data out" + default 4 if DAC_ADAU1961 + default 25 if DAC_MAX98357 + default 22 if DAC_TAS5805M + default 14 + help + Master audio interface data out. + + endmenu + + menu "DAC-Operation-Mode" + depends on DAC_TAS5805M + + config DAC_BRIDGE_MODE + bool "Enable Bridge-Mode" + default false if DAC_TAS5805M + help + If enabled left channel will be played with more power. To use the right channel please change Word-Select-Setting in Logic-Level-Settings. + endmenu + + menu "I2S slave interface" + config SLAVE_I2S_BCK_PIN + int "Slave i2s bck" + default 26 + help + Slave audio interface bit clock. + config SLAVE_I2S_MCLK_PIN + int "Slave i2s mclk" + default 0 + help + Slave audio interface bit clock. + config SLAVE_I2S_LRCK_PIN + int "Slave i2s lrck" + default 12 + help + Slave audio interface left/right sync clock. + + config SLAVE_I2S_DATAOUT_PIN + int "Slave i2s data out" + default 5 + help + Slave audio interface data out. + endmenu + + menu "Merus MA120x0 interface Configuration" + depends on DAC_MA120X0 + + config MA120X0_NENABLE_PIN + int "Master enable/disable for ma120x0" + default 16 + help + GPIO number to control enable/disable. + + config MA120X0_NMUTE_PIN + int "Master mute/unmute for ma120x0" + default 2 + help + GPIO number to controm mute/unmute. + + config MERUS_NERR_PIN + int "NERR monitor pin" + default 21 + help + GPIO number to monitor NERROR. + + config MERUS_NCLIP_PIN + int "Clip indication pin" + default 22 + help + GPIO number low if clip observed + endmenu + + menu "Merus MA120 interface Configuration" + depends on DAC_MA120 + + config MA120_ENABLE_PIN + int "Master enable/disable for ma120x0" + default 16 + help + GPIO number to control enable/disable. + + config MA120_NMUTE_PIN + int "Master mute/unmute for ma120x0" + default 2 + help + GPIO number to controm mute/unmute. + + config MERUS_NERR_PIN + int "NERR monitor pin" + default 21 + help + GPIO number to monitor NERROR. + + config MERUS_NCLIP_PIN + int "Clip indication pin" + default 22 + help + GPIO number low if clip observed + endmenu + + menu "TI PCM5102A interface Configuration" + depends on DAC_PCM5102A + + config PCM5102A_MUTE_PIN + int "Master mute/unmute for PCM5102A" + default 18 + help + GPIO number to control mute/unmute. + This is labeled "X(S)MT" on chip/boards + endmenu + + menu "MAX98357 interface Configuration" + depends on DAC_MAX98357 + + config MAX98357_MUTE_PIN + int "Master mute/mode for MAX98357" + default 18 + help + GPIO number to control mute/mode. This require a special resistor to select the correct mode. + You need to put a serie resistor to select the mode (GPIO --> Resistor --> SD): + LEFT only : 0ohm (direct connection) + RIGHT only : 220Kohm + (L+R)/2 : 1Mohm + Refer to Analog Devices' doc for more infos. + This is labeled "SD" on chip/boards. + endmenu + + menu "PT8211 interface Configuration" + depends on DAC_PT8211 + + config PT8211_MUTE_PIN + int "Master mute/unmute" + default -1 + help + GPIO number to control mute/unmute. + Note that PT8211 does not have a mute control pin. This output is intended to control external circuit (e.g., amplifier). + + config PT8211_MUTE_ACTIVE_LOW + bool "Mute active LOW" + default false + help + Output LOW instead of HIGH on mute/unmute pin when in mute state. + + endmenu + + menu "Logic-Level-Settings" + config INVERT_MCLK_LEVEL + bool "Invert Logic Level MCLK" + default false + help + Invert the Logic-Level of MCLK. + config INVERT_WORD_SELECT_LEVEL + bool "Invert Logic Level WordSelect" + default false + help + Some Dacs can bridge their outputs. Word-Select is used for selecting the played audio channel. This will switch L/R. + config INVERT_BCLK_LEVEL + bool "Invert Logic Level BCLK" + default false + help + Invert the Logic-Level of BCLK. + + endmenu + + endmenu endmenu diff --git a/components/audio_board/ai_thinker_es8388/board_def.h b/components/audio_board/ai_thinker_es8388/board_def.h index 21611884..84bc3762 100644 --- a/components/audio_board/ai_thinker_es8388/board_def.h +++ b/components/audio_board/ai_thinker_es8388/board_def.h @@ -42,57 +42,62 @@ #define AUXIN_DETECT_GPIO GPIO_NUM_12 #define HEADPHONE_DETECT GPIO_NUM_19 #define PA_ENABLE_GPIO GPIO_NUM_21 +#define BOARD_PA_GAIN (10) /* Power amplifier gain defined by board (dB) */ #define GREEN_LED_GPIO GPIO_NUM_22 extern audio_hal_func_t AUDIO_CODEC_ES8388_DEFAULT_HANDLE; -#define AUDIO_CODEC_DEFAULT_CONFIG() \ - { \ - .adc_input = AUDIO_HAL_ADC_INPUT_LINE1, \ - .dac_output = AUDIO_HAL_DAC_OUTPUT_ALL, \ - .codec_mode = AUDIO_HAL_CODEC_MODE_BOTH, \ - .i2s_iface = { \ - .mode = AUDIO_HAL_MODE_SLAVE, \ - .fmt = AUDIO_HAL_I2S_NORMAL, \ - .samples = AUDIO_HAL_48K_SAMPLES, \ - .bits = AUDIO_HAL_BIT_LENGTH_16BITS, \ - }, \ -}; +#define AUDIO_CODEC_DEFAULT_CONFIG() \ + { \ + .adc_input = AUDIO_HAL_ADC_INPUT_LINE1, \ + .dac_output = AUDIO_HAL_DAC_OUTPUT_ALL, \ + .codec_mode = AUDIO_HAL_CODEC_MODE_BOTH, \ + .i2s_iface = \ + { \ + .mode = AUDIO_HAL_MODE_SLAVE, \ + .fmt = AUDIO_HAL_I2S_NORMAL, \ + .samples = AUDIO_HAL_48K_SAMPLES, \ + .bits = AUDIO_HAL_BIT_LENGTH_16BITS, \ + }, \ + }; +/** + * @brief Button Function Definition + */ #define INPUT_KEY_NUM 6 -#define INPUT_KEY_DEFAULT_INFO() \ - { \ - { \ - .type = PERIPH_ID_BUTTON, \ - .user_id = INPUT_KEY_USER_ID_REC, \ - .act_id = BUTTON_REC_ID, \ - }, \ - { \ - .type = PERIPH_ID_BUTTON, \ - .user_id = INPUT_KEY_USER_ID_MODE, \ - .act_id = BUTTON_MODE_ID, \ - }, \ - { \ - .type = PERIPH_ID_TOUCH, \ - .user_id = INPUT_KEY_USER_ID_SET, \ - .act_id = BUTTON_SET_ID, \ - }, \ - { \ - .type = PERIPH_ID_TOUCH, \ - .user_id = INPUT_KEY_USER_ID_PLAY, \ - .act_id = BUTTON_PLAY_ID, \ - }, \ - { \ - .type = PERIPH_ID_TOUCH, \ - .user_id = INPUT_KEY_USER_ID_VOLUP, \ - .act_id = BUTTON_VOLUP_ID, \ - }, \ - { \ - .type = PERIPH_ID_TOUCH, .user_id = INPUT_KEY_USER_ID_VOLDOWN, \ - .act_id = BUTTON_VOLDOWN_ID, \ - } \ +#define INPUT_KEY_DEFAULT_INFO() \ + { \ + { \ + .type = PERIPH_ID_BUTTON, \ + .user_id = INPUT_KEY_USER_ID_REC, \ + .act_id = BUTTON_REC_ID, \ + }, \ + { \ + .type = PERIPH_ID_BUTTON, \ + .user_id = INPUT_KEY_USER_ID_MODE, \ + .act_id = BUTTON_MODE_ID, \ + }, \ + { \ + .type = PERIPH_ID_TOUCH, \ + .user_id = INPUT_KEY_USER_ID_SET, \ + .act_id = BUTTON_SET_ID, \ + }, \ + { \ + .type = PERIPH_ID_TOUCH, \ + .user_id = INPUT_KEY_USER_ID_PLAY, \ + .act_id = BUTTON_PLAY_ID, \ + }, \ + { \ + .type = PERIPH_ID_TOUCH, \ + .user_id = INPUT_KEY_USER_ID_VOLUP, \ + .act_id = BUTTON_VOLUP_ID, \ + }, \ + { \ + .type = PERIPH_ID_TOUCH, .user_id = INPUT_KEY_USER_ID_VOLDOWN, \ + .act_id = BUTTON_VOLDOWN_ID, \ + } \ } #endif diff --git a/components/audio_board/ai_thinker_es8388/board_pins_config.c b/components/audio_board/ai_thinker_es8388/board_pins_config.c index 55b2c237..da3fab4c 100644 --- a/components/audio_board/ai_thinker_es8388/board_pins_config.c +++ b/components/audio_board/ai_thinker_es8388/board_pins_config.c @@ -24,60 +24,51 @@ * */ +#include + #include "audio_error.h" #include "audio_mem.h" #include "board.h" #include "driver/gpio.h" #include "esp_log.h" -#include static const char *TAG = "AI_THINKER_ES8388"; -esp_err_t -get_i2c_pins (i2c_port_t port, i2c_config_t *i2c_config) -{ - AUDIO_NULL_CHECK (TAG, i2c_config, return ESP_FAIL); - if (port == I2C_NUM_0 || port == I2C_NUM_1) - { - i2c_config->sda_io_num = GPIO_NUM_33; - i2c_config->scl_io_num = GPIO_NUM_32; - } - else - { - i2c_config->sda_io_num = -1; - i2c_config->scl_io_num = -1; - ESP_LOGE (TAG, "i2c port %d is not supported", port); - return ESP_FAIL; - } +esp_err_t get_i2c_pins(i2c_port_t port, i2c_config_t *i2c_config) { + AUDIO_NULL_CHECK(TAG, i2c_config, return ESP_FAIL); + if (port == I2C_NUM_0 || port == I2C_NUM_1) { + i2c_config->sda_io_num = GPIO_NUM_33; + i2c_config->scl_io_num = GPIO_NUM_32; + } else { + i2c_config->sda_io_num = -1; + i2c_config->scl_io_num = -1; + ESP_LOGE(TAG, "i2c port %d is not supported", port); + return ESP_FAIL; + } return ESP_OK; } -esp_err_t -get_i2s_pins (i2s_port_t port, i2s_pin_config_t *i2s_config) -{ - AUDIO_NULL_CHECK (TAG, i2s_config, return ESP_FAIL); - if (port == I2S_NUM_0 || port == I2S_NUM_1) - { - i2s_config->bck_io_num = GPIO_NUM_27; - i2s_config->ws_io_num = GPIO_NUM_25; - i2s_config->data_out_num = GPIO_NUM_26; - i2s_config->data_in_num = GPIO_NUM_35; - } - else - { - memset (i2s_config, -1, sizeof (i2s_pin_config_t)); - ESP_LOGE (TAG, "i2s port %d is not supported", port); - return ESP_FAIL; - } +esp_err_t get_i2s_pins(i2s_port_t port, board_i2s_pin_t *i2s_config) { + AUDIO_NULL_CHECK(TAG, i2s_config, return ESP_FAIL); + if (port == I2S_NUM_0 || port == I2S_NUM_1) { + i2s_config->mck_io_num = GPIO_NUM_0; + i2s_config->bck_io_num = GPIO_NUM_27; + i2s_config->ws_io_num = GPIO_NUM_25; + i2s_config->data_out_num = GPIO_NUM_26; + i2s_config->data_in_num = GPIO_NUM_35; + } else { + memset(i2s_config, -1, sizeof(board_i2s_pin_t)); + ESP_LOGE(TAG, "i2s port %d is not supported", port); + return ESP_FAIL; + } return ESP_OK; } -esp_err_t -get_spi_pins (spi_bus_config_t *spi_config, - spi_device_interface_config_t *spi_device_interface_config) -{ - AUDIO_NULL_CHECK (TAG, spi_config, return ESP_FAIL); - AUDIO_NULL_CHECK (TAG, spi_device_interface_config, return ESP_FAIL); +esp_err_t get_spi_pins( + spi_bus_config_t *spi_config, + spi_device_interface_config_t *spi_device_interface_config) { + AUDIO_NULL_CHECK(TAG, spi_config, return ESP_FAIL); + AUDIO_NULL_CHECK(TAG, spi_device_interface_config, return ESP_FAIL); spi_config->mosi_io_num = -1; spi_config->miso_io_num = -1; @@ -87,142 +78,40 @@ get_spi_pins (spi_bus_config_t *spi_config, spi_device_interface_config->spics_io_num = -1; - ESP_LOGW (TAG, "SPI interface is not supported"); - return ESP_OK; -} - -esp_err_t -i2s_mclk_gpio_select (i2s_port_t i2s_num, gpio_num_t gpio_num) -{ - if (i2s_num >= I2S_NUM_MAX) - { - ESP_LOGE (TAG, "Does not support i2s number(%d)", i2s_num); - return ESP_ERR_INVALID_ARG; - } - if (gpio_num != GPIO_NUM_0 && gpio_num != GPIO_NUM_1 - && gpio_num != GPIO_NUM_3) - { - ESP_LOGE (TAG, "Only support GPIO0/GPIO1/GPIO3, gpio_num:%d", gpio_num); - return ESP_ERR_INVALID_ARG; - } - ESP_LOGI (TAG, "I2S%d, MCLK output by GPIO%d", i2s_num, gpio_num); - if (i2s_num == I2S_NUM_0) - { - if (gpio_num == GPIO_NUM_0) - { - PIN_FUNC_SELECT (PERIPHS_IO_MUX_GPIO0_U, FUNC_GPIO0_CLK_OUT1); - WRITE_PERI_REG (PIN_CTRL, 0xFFF0); - } - else if (gpio_num == GPIO_NUM_1) - { - PIN_FUNC_SELECT (PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD_CLK_OUT3); - WRITE_PERI_REG (PIN_CTRL, 0xF0F0); - } - else - { - PIN_FUNC_SELECT (PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD_CLK_OUT2); - WRITE_PERI_REG (PIN_CTRL, 0xFF00); - } - } - else if (i2s_num == I2S_NUM_1) - { - if (gpio_num == GPIO_NUM_0) - { - PIN_FUNC_SELECT (PERIPHS_IO_MUX_GPIO0_U, FUNC_GPIO0_CLK_OUT1); - WRITE_PERI_REG (PIN_CTRL, 0xFFFF); - } - else if (gpio_num == GPIO_NUM_1) - { - PIN_FUNC_SELECT (PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD_CLK_OUT3); - WRITE_PERI_REG (PIN_CTRL, 0xF0FF); - } - else - { - PIN_FUNC_SELECT (PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD_CLK_OUT2); - WRITE_PERI_REG (PIN_CTRL, 0xFF0F); - } - } + ESP_LOGW(TAG, "SPI interface is not supported"); return ESP_OK; } // sdcard -int8_t -get_sdcard_intr_gpio (void) -{ - return SDCARD_INTR_GPIO; -} +int8_t get_sdcard_intr_gpio(void) { return SDCARD_INTR_GPIO; } -int8_t -get_sdcard_open_file_num_max (void) -{ - return SDCARD_OPEN_FILE_NUM_MAX; -} +int8_t get_sdcard_open_file_num_max(void) { return SDCARD_OPEN_FILE_NUM_MAX; } // input-output pins -int8_t -get_auxin_detect_gpio (void) -{ - return AUXIN_DETECT_GPIO; -} +int8_t get_auxin_detect_gpio(void) { return AUXIN_DETECT_GPIO; } -int8_t -get_headphone_detect_gpio (void) -{ - return HEADPHONE_DETECT; -} +int8_t get_headphone_detect_gpio(void) { return HEADPHONE_DETECT; } -int8_t -get_pa_enable_gpio (void) -{ - return PA_ENABLE_GPIO; -} +int8_t get_pa_enable_gpio(void) { return PA_ENABLE_GPIO; } // button pins -int8_t -get_input_rec_id (void) -{ - return BUTTON_REC_ID; -} +int8_t get_input_rec_id(void) { return BUTTON_REC_ID; } -int8_t -get_input_mode_id (void) -{ - return BUTTON_MODE_ID; -} +int8_t get_input_mode_id(void) { return BUTTON_MODE_ID; } // touch pins -int8_t -get_input_set_id (void) -{ - return BUTTON_SET_ID; -} +int8_t get_input_set_id(void) { return BUTTON_SET_ID; } -int8_t -get_input_play_id (void) -{ - return BUTTON_PLAY_ID; -} +int8_t get_input_play_id(void) { return BUTTON_PLAY_ID; } -int8_t -get_input_volup_id (void) -{ - return BUTTON_VOLUP_ID; -} +int8_t get_input_volup_id(void) { return BUTTON_VOLUP_ID; } -int8_t -get_input_voldown_id (void) -{ - return BUTTON_VOLDOWN_ID; -} +int8_t get_input_voldown_id(void) { return BUTTON_VOLDOWN_ID; } // led pins -int8_t -get_green_led_gpio (void) -{ - return GREEN_LED_GPIO; -} +int8_t get_green_led_gpio(void) { return GREEN_LED_GPIO; } diff --git a/components/audio_board/component.mk b/components/audio_board/component.mk index dc97d1b3..64415737 100644 --- a/components/audio_board/component.mk +++ b/components/audio_board/component.mk @@ -42,6 +42,16 @@ COMPONENT_ADD_INCLUDEDIRS += ./esp32_s2_kaluga_1_v1_2 COMPONENT_SRCDIRS += ./esp32_s2_kaluga_1_v1_2 endif +ifdef CONFIG_ESP32_S3_KORVO2_V3_BOARD +COMPONENT_ADD_INCLUDEDIRS += ./esp32_s3_korvo2_v3 +COMPONENT_SRCDIRS += ./esp32_s3_korvo2_v3 +endif + +ifdef CONFIG_ESP32_C3_LYRA_V2_BOARD +COMPONENT_ADD_INCLUDEDIRS += ./esp32_c3_lyra +COMPONENT_SRCDIRS += ./esp32_c3_lyra +endif + ifdef CONFIG_ESP_AI_THINKER_ES8388_BOARD COMPONENT_ADD_INCLUDEDIRS += ./ai_thinker_es8388 COMPONENT_SRCDIRS += ./ai_thinker_es8388 diff --git a/components/audio_board/esp32_c3_lyra/C3_lyra_sys_pattern.c b/components/audio_board/esp32_c3_lyra/C3_lyra_sys_pattern.c new file mode 100644 index 00000000..f05c5075 --- /dev/null +++ b/components/audio_board/esp32_c3_lyra/C3_lyra_sys_pattern.c @@ -0,0 +1,305 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2022 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include "board_def.h" +#include "display_service.h" +#include "driver/gpio.h" +#include "esp_log.h" +#include "periph_ws2812.h" +#include "string.h" + +const struct periph_ws2812_ctrl_cfg + ws2812_display_pattern[DISPLAY_PATTERN_MAX][WS2812_LED_BAR_NUMBERS] = { + { + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_RED, + .loop = 1000, + .time_off_ms = 200, + .time_on_ms = 400, + } // 0 + }, + { + { + .mode = PERIPH_WS2812_FADE, + .color = LED2812_COLOR_PURPLE, + .loop = 0xFFFFFFFF, + .time_off_ms = 1500, + .time_on_ms = 1500, + } // 1 + }, + { + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_WHITE, + .loop = 0xFFFFFFFF, + .time_off_ms = 200, + .time_on_ms = 800, + } // 2 + }, + { + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_BLACK, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + } // 3 + }, + { + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_RED, + .loop = 1, + .time_off_ms = 1000, + .time_on_ms = 4000, + } // 4 + }, + { + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_WHITE, + .loop = 5, + .time_off_ms = 200, + .time_on_ms = 1000, + } // 5 + }, + { + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_BLUE, + .loop = 100, + .time_off_ms = 200, + .time_on_ms = 800, + } // 6 + }, + { + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_PURPLE, + .loop = 4, + .time_off_ms = 100, + .time_on_ms = 100, + } // 7 + }, + { + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_PURPLE, + .loop = 4, + .time_off_ms = 100, + .time_on_ms = 100, + } // 8 + }, + { + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_PURPLE, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + } // 9 + }, + { + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_PURPLE, + .loop = 2, + .time_off_ms = 200, + .time_on_ms = 400, + } // 10 + }, + { + { + .mode = PERIPH_WS2812_FADE, + .color = LED2812_COLOR_PURPLE, + .loop = 100, + .time_off_ms = 2000, + .time_on_ms = 2000, + } // 11 + }, + { + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_PURPLE, + .loop = 2, + .time_off_ms = 200, + .time_on_ms = 400, + } // 12 + }, + { + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_BLUE, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + } // 13 + }, + { + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_BLACK, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + } // 14 + }, + { + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_YELLOW, + .loop = 2000, + .time_off_ms = 200, + .time_on_ms = 600, + } // 15 + }, + { + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_BLACK, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + } // 16 + }, + { + { + .mode = PERIPH_WS2812_FADE, + .color = LED2812_COLOR_GREEN, + .loop = 1, + .time_off_ms = 0, + .time_on_ms = 1000, + } // 17 + }, + { + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_ORANGE, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + } // 18 + }, + { + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_BLACK, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + } // 19 + }, + { + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_WHITE, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + } // 20 + }, + { + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_BLACK, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + } // 21 + }, + { + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_RED, + .loop = 1000, + .time_off_ms = 200, + .time_on_ms = 800, + } // 22 + }, + { + { + .mode = PERIPH_WS2812_FADE, + .color = LED2812_COLOR_PURPLE, + .loop = 1000, + .time_off_ms = 1500, + .time_on_ms = 1500, + } // 23 + }, + { + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_PURPLE, + .loop = 1000, + .time_off_ms = 1000, + .time_on_ms = 2000, + } // 24 + }, + { + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_PURPLE, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + } // 25 + }, + { + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_RED, + .loop = 0xFFFFFFFF, + .time_off_ms = 2000, + .time_on_ms = 2000, + } // 26 + }, + { + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_BLUE, + .loop = 0xFFFFFFFF, + .time_off_ms = 500, + .time_on_ms = 500, + } // 27, + }, + { + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_BLACK, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + } // 28, + }}; + +int8_t get_ws2812_gpio_pin(void) { return WS2812_LED_GPIO_PIN; } + +int get_ws2812_num(void) { return WS2812_LED_BAR_NUMBERS; } + +void ws2812_pattern_copy(struct periph_ws2812_ctrl_cfg *p) { + ESP_LOGD("ws2812_pattern_copy", "has been called, %s %d", __FILE__, __LINE__); + memcpy(p, ws2812_display_pattern, sizeof(ws2812_display_pattern)); +} diff --git a/components/audio_board/esp32_c3_lyra/board.c b/components/audio_board/esp32_c3_lyra/board.c new file mode 100644 index 00000000..aea5d2cb --- /dev/null +++ b/components/audio_board/esp32_c3_lyra/board.c @@ -0,0 +1,121 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2022 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include "board.h" + +#include "audio_mem.h" +#include "display_service.h" +#include "esp_log.h" +#include "led_bar_ws2812.h" +#include "periph_adc_button.h" + +static const char *TAG = "AUDIO_BOARD"; + +static audio_board_handle_t board_handle = NULL; + +audio_board_handle_t audio_board_init(void) { + if (board_handle) { + ESP_LOGW(TAG, "The board has already been initialized!"); + return board_handle; + } + board_handle = + (audio_board_handle_t)audio_calloc(1, sizeof(struct audio_board_handle)); + AUDIO_MEM_CHECK(TAG, board_handle, return NULL); + board_handle->audio_hal = audio_board_codec_init(); + + return board_handle; +} + +audio_hal_handle_t audio_board_codec_init(void) { + gpio_config_t io_conf = {0}; + bool enable = true; + io_conf.mode = GPIO_MODE_OUTPUT; + io_conf.pin_bit_mask = BIT64(get_pa_enable_gpio()); + io_conf.pull_down_en = 0; + io_conf.pull_up_en = 0; + gpio_config(&io_conf); + if (enable) { + gpio_set_level(get_pa_enable_gpio(), 1); + } else { + gpio_set_level(get_pa_enable_gpio(), 0); + } + return NULL; +} + +esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, + periph_sdcard_mode_t mode) { + esp_err_t ret = ESP_FAIL; + return ret; +} + +display_service_handle_t audio_board_led_init(void) { + led_bar_ws2812_handle_t led = + led_bar_ws2812_init(get_ws2812_gpio_pin(), get_ws2812_num()); + AUDIO_NULL_CHECK(TAG, led, return NULL); + display_service_config_t display = { + .based_cfg = + { + .task_stack = 0, + .task_prio = 0, + .task_core = 0, + .task_func = NULL, + .service_start = NULL, + .service_stop = NULL, + .service_destroy = NULL, + .service_ioctl = led_bar_ws2812_pattern, + .service_name = "DISPLAY_serv", + .user_data = NULL, + }, + .instance = led, + }; + + return display_service_create(&display); +} + +esp_err_t audio_board_key_init(esp_periph_set_handle_t set) { + periph_adc_button_cfg_t adc_btn_cfg = PERIPH_ADC_BUTTON_DEFAULT_CONFIG(); + adc_arr_t adc_btn_tag = ADC_DEFAULT_ARR(); + adc_btn_tag.adc_ch = ADC1_CHANNEL_2; + adc_btn_tag.total_steps = 6; + int btn_array[7] = {190, 600, 1000, 1375, 1775, 2195, 2700}; + adc_btn_tag.adc_level_step = (int *)(&btn_array); + adc_btn_cfg.arr = &adc_btn_tag; + adc_btn_cfg.arr_size = 1; + esp_periph_handle_t adc_btn_handle = periph_adc_button_init(&adc_btn_cfg); + AUDIO_NULL_CHECK(TAG, adc_btn_handle, return ESP_ERR_ADF_MEMORY_LACK); + return esp_periph_start(set, adc_btn_handle); +} + +audio_board_handle_t audio_board_get_handle(void) { return board_handle; } + +esp_err_t audio_board_deinit(audio_board_handle_t audio_board) { + esp_err_t ret = ESP_OK; + ret = audio_hal_deinit(audio_board->audio_hal); + audio_board->audio_hal = NULL; + audio_free(audio_board); + board_handle = NULL; + return ret; +} diff --git a/components/audio_board/esp32_c3_lyra/board.h b/components/audio_board/esp32_c3_lyra/board.h new file mode 100644 index 00000000..a8b26585 --- /dev/null +++ b/components/audio_board/esp32_c3_lyra/board.h @@ -0,0 +1,129 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2022 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _AUDIO_BOARD_H_ +#define _AUDIO_BOARD_H_ + +#include "audio_hal.h" +#include "board_def.h" +#include "board_pins_config.h" +#include "display_service.h" +#include "esp_peripherals.h" +#include "periph_sdcard.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Audio board handle + */ +struct audio_board_handle { + audio_hal_handle_t audio_hal; /*!< audio hardware abstract layer handle */ +}; + +typedef struct audio_board_handle *audio_board_handle_t; + +/** + * @brief Initialize audio board + * + * @return The audio board handle + */ +audio_board_handle_t audio_board_init(void); + +/** + * @brief Initialize codec chip + * + * @return The audio hal handle + */ +audio_hal_handle_t audio_board_codec_init(void); + +/** + * @brief Initialize led peripheral and display service + * + * @return The audio display service handle + */ +display_service_handle_t audio_board_led_init(void); + +/** + * @brief Initialize sdcard peripheral + * + * @param set The handle of esp_periph_set_handle_t + * + * @return + * - ESP_OK, success + * - Others, fail + */ +esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, + periph_sdcard_mode_t mode); + +/** + * @brief Initialize key peripheral + * + * @param set The handle of esp_periph_set_handle_t + * + * @return + * - ESP_OK, success + * - Others, fail + */ +esp_err_t audio_board_key_init(esp_periph_set_handle_t set); + +/** + * @brief Query audio_board_handle + * + * @return The audio board handle + */ +audio_board_handle_t audio_board_get_handle(void); + +/** + * @brief Uninitialize the audio board + * + * @param audio_board The handle of audio board + * + * @return ESP_OK success, + * others fail + */ +esp_err_t audio_board_deinit(audio_board_handle_t audio_board); + +/** + * @brief Get the ws2812 gpio pin + * + * @return GPIO pin + */ +int8_t get_ws2812_gpio_pin(void); + +/** + * @brief Get the number of ws2812 + * + * @return number of ws2812 + */ +int get_ws2812_num(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/components/audio_board/esp32_c3_lyra/board_def.h b/components/audio_board/esp32_c3_lyra/board_def.h new file mode 100644 index 00000000..34ea25bb --- /dev/null +++ b/components/audio_board/esp32_c3_lyra/board_def.h @@ -0,0 +1,126 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2022 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _AUDIO_BOARD_DEFINITION_H_ +#define _AUDIO_BOARD_DEFINITION_H_ + +/** + * @brief Audio Codec Chip Function Definition + */ +#define BOARD_PA_GAIN (10) /* Power amplifier gain defined by board (dB) */ + +/** + * @brief ADC Function Definition + */ +#define MIC_ADC_GPIO GPIO_NUM_0 +#define PA_ENABLE_GPIO GPIO_NUM_1 +#define BUTTON_ADC_GPIO GPIO_NUM_2 + +/** + * @brief SDCARD Function Definition + */ +#define FUNC_SDCARD_EN (0) +#define SDCARD_OPEN_FILE_NUM_MAX 5 +#define SDCARD_INTR_GPIO -1 +#define SDCARD_PWR_CTRL -1 + +#define ESP_SD_PIN_CLK -1 +#define ESP_SD_PIN_CMD -1 +#define ESP_SD_PIN_D0 -1 +#define ESP_SD_PIN_D3 -1 + +/** + * @brief PDM TX Function Definition + */ +#define PDM_TX_GPIO GPIO_NUM_3 + +/** + * @brief LED Function Definition + */ +#define LED_PWM_BLUE_GPIO GPIO_NUM_4 +#define LED_PWM_RED_GPIO GPIO_NUM_5 +#define LED_PWM_GREEN_GPIO GPIO_NUM_6 +#define WS2812_LED_GPIO_PIN GPIO_NUM_10 +#define WS2812_LED_BAR_NUMBERS 1 +#define LED_STRIP_CTRL_GPIO GPIO_NUM_7 + +/** + * @brief IR Function Definition + */ +#define ESP_IR_TX_GPIO GPIO_NUM_18 +#define ESP_IR_RX_GPIO GPIO_NUM_19 + +/** + * @brief I2C Function Definition + */ +#define I2C_CLK_GPIO GPIO_NUM_8 +#define I2C_DATA_GPIO GPIO_NUM_9 + +/** + * @brief Button Function Definition + */ +#define INPUT_KEY_NUM 6 +#define BUTTON_VOLUP_ID 0 +#define BUTTON_VOLDOWN_ID 1 +#define BUTTON_SET_ID 2 +#define BUTTON_PLAY_ID 3 +#define BUTTON_COLOR_ID 4 +#define BUTTON_MODE_ID 5 + +#define INPUT_KEY_DEFAULT_INFO() \ + { \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_COLOR, \ + .act_id = BUTTON_COLOR_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_MODE, \ + .act_id = BUTTON_MODE_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_SET, \ + .act_id = BUTTON_SET_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_PLAY, \ + .act_id = BUTTON_PLAY_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_VOLUP, \ + .act_id = BUTTON_VOLUP_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, .user_id = INPUT_KEY_USER_ID_VOLDOWN, \ + .act_id = BUTTON_VOLDOWN_ID, \ + } \ + } + +#endif diff --git a/components/audio_board/esp32_c3_lyra/board_pins_config.c b/components/audio_board/esp32_c3_lyra/board_pins_config.c new file mode 100644 index 00000000..98301379 --- /dev/null +++ b/components/audio_board/esp32_c3_lyra/board_pins_config.c @@ -0,0 +1,107 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2022 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include + +#include "audio_error.h" +#include "audio_mem.h" +#include "board.h" +#include "driver/gpio.h" +#include "esp_log.h" +#include "soc/soc_caps.h" + +static const char *TAG = "ESP32_C3_Lyra"; + +esp_err_t get_i2c_pins(i2c_port_t port, i2c_config_t *i2c_config) { + AUDIO_NULL_CHECK(TAG, i2c_config, return ESP_FAIL); + if (port == I2C_NUM_0) { + i2c_config->sda_io_num = GPIO_NUM_9; + i2c_config->scl_io_num = GPIO_NUM_8; + } else { + i2c_config->sda_io_num = -1; + i2c_config->scl_io_num = -1; + ESP_LOGE(TAG, "i2c port %d is not supported", port); + return ESP_FAIL; + } + return ESP_OK; +} + +esp_err_t get_i2s_pins(i2s_port_t port, board_i2s_pin_t *i2s_config) { + AUDIO_NULL_CHECK(TAG, i2s_config, return ESP_FAIL); + + i2s_config->bck_io_num = -1; + i2s_config->ws_io_num = -1; + i2s_config->data_out_num = PDM_TX_GPIO; + i2s_config->data_in_num = -1; + + return ESP_OK; +} + +esp_err_t get_spi_pins( + spi_bus_config_t *spi_config, + spi_device_interface_config_t *spi_device_interface_config) { + AUDIO_NULL_CHECK(TAG, spi_config, return ESP_FAIL); + AUDIO_NULL_CHECK(TAG, spi_device_interface_config, return ESP_FAIL); + + spi_config->mosi_io_num = -1; + spi_config->miso_io_num = -1; + spi_config->sclk_io_num = -1; + spi_config->quadwp_io_num = -1; + spi_config->quadhd_io_num = -1; + + spi_device_interface_config->spics_io_num = -1; + + ESP_LOGW(TAG, "SPI interface is not supported"); + return ESP_OK; +} + +// sdcard +int8_t get_sdcard_intr_gpio(void) { return SDCARD_INTR_GPIO; } + +int8_t get_sdcard_open_file_num_max(void) { return SDCARD_OPEN_FILE_NUM_MAX; } + +int8_t get_sdcard_power_ctrl_gpio(void) { return SDCARD_PWR_CTRL; } + +// input-output pins +int8_t get_pa_enable_gpio(void) { return PA_ENABLE_GPIO; } + +// adc button id +int8_t get_input_rec_id(void) { return -1; } + +int8_t get_input_mode_id(void) { return BUTTON_MODE_ID; } + +int8_t get_input_set_id(void) { return BUTTON_SET_ID; } + +int8_t get_input_play_id(void) { return BUTTON_PLAY_ID; } + +int8_t get_input_volup_id(void) { return BUTTON_VOLUP_ID; } + +int8_t get_input_voldown_id(void) { return BUTTON_VOLDOWN_ID; } + +// led pins +int8_t get_ws2812_led_gpio(void) { return WS2812_LED_GPIO_PIN; } + +int8_t get_es8311_mclk_src(void) { return -1; } diff --git a/components/audio_board/esp32_c6_devkit/board.c b/components/audio_board/esp32_c6_devkit/board.c new file mode 100644 index 00000000..587cc92d --- /dev/null +++ b/components/audio_board/esp32_c6_devkit/board.c @@ -0,0 +1,109 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2022 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include "board.h" + +#include "audio_mem.h" +#include "display_service.h" +#include "esp_log.h" +#include "led_bar_ws2812.h" +#include "periph_adc_button.h" + +static const char *TAG = "AUDIO_BOARD"; + +static audio_board_handle_t board_handle = NULL; + +audio_board_handle_t audio_board_init(void) { + if (board_handle) { + ESP_LOGW(TAG, "The board has already been initialized!"); + return board_handle; + } + audio_hal_codec_config_t audio_codec_cfg = AUDIO_CODEC_DEFAULT_CONFIG(); + board_handle = + (audio_board_handle_t)audio_calloc(1, sizeof(struct audio_board_handle)); + AUDIO_MEM_CHECK(TAG, board_handle, return NULL); + + board_handle->audio_hal = + audio_hal_init(&audio_codec_cfg, &AUDIO_CODEC_ES8311_DEFAULT_HANDLE); + return board_handle; +} + +esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, + periph_sdcard_mode_t mode) { + esp_err_t ret = ESP_FAIL; + return ret; +} + +display_service_handle_t audio_board_led_init(void) { + led_bar_ws2812_handle_t led = + led_bar_ws2812_init(get_ws2812_gpio_pin(), get_ws2812_num()); + AUDIO_NULL_CHECK(TAG, led, return NULL); + display_service_config_t display = { + .based_cfg = + { + .task_stack = 0, + .task_prio = 0, + .task_core = 0, + .task_func = NULL, + .service_start = NULL, + .service_stop = NULL, + .service_destroy = NULL, + .service_ioctl = led_bar_ws2812_pattern, + .service_name = "DISPLAY_serv", + .user_data = NULL, + }, + .instance = led, + }; + + return display_service_create(&display); +} + +esp_err_t audio_board_key_init(esp_periph_set_handle_t set) { + esp_err_t ret = ESP_OK; + periph_adc_button_cfg_t adc_btn_cfg = PERIPH_ADC_BUTTON_DEFAULT_CONFIG(); + adc_arr_t adc_btn_tag = ADC_DEFAULT_ARR(); + adc_btn_tag.adc_ch = ADC1_CHANNEL_2; + adc_btn_tag.total_steps = 6; + int btn_array[7] = {380, 820, 1100, 1650, 1980, 2410, 2700}; + adc_btn_tag.adc_level_step = (int *)(&btn_array); + adc_btn_cfg.arr = &adc_btn_tag; + adc_btn_cfg.arr_size = 1; + esp_periph_handle_t adc_btn_handle = periph_adc_button_init(&adc_btn_cfg); + AUDIO_NULL_CHECK(TAG, adc_btn_handle, return ESP_ERR_ADF_MEMORY_LACK); + ret = esp_periph_start(set, adc_btn_handle); + return ret; +} + +audio_board_handle_t audio_board_get_handle(void) { return board_handle; } + +esp_err_t audio_board_deinit(audio_board_handle_t audio_board) { + esp_err_t ret = ESP_OK; + ret = audio_hal_deinit(audio_board->audio_hal); + audio_board->audio_hal = NULL; + audio_free(audio_board); + board_handle = NULL; + return ret; +} diff --git a/components/audio_board/esp32_c6_devkit/board.h b/components/audio_board/esp32_c6_devkit/board.h new file mode 100644 index 00000000..a8b26585 --- /dev/null +++ b/components/audio_board/esp32_c6_devkit/board.h @@ -0,0 +1,129 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2022 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _AUDIO_BOARD_H_ +#define _AUDIO_BOARD_H_ + +#include "audio_hal.h" +#include "board_def.h" +#include "board_pins_config.h" +#include "display_service.h" +#include "esp_peripherals.h" +#include "periph_sdcard.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Audio board handle + */ +struct audio_board_handle { + audio_hal_handle_t audio_hal; /*!< audio hardware abstract layer handle */ +}; + +typedef struct audio_board_handle *audio_board_handle_t; + +/** + * @brief Initialize audio board + * + * @return The audio board handle + */ +audio_board_handle_t audio_board_init(void); + +/** + * @brief Initialize codec chip + * + * @return The audio hal handle + */ +audio_hal_handle_t audio_board_codec_init(void); + +/** + * @brief Initialize led peripheral and display service + * + * @return The audio display service handle + */ +display_service_handle_t audio_board_led_init(void); + +/** + * @brief Initialize sdcard peripheral + * + * @param set The handle of esp_periph_set_handle_t + * + * @return + * - ESP_OK, success + * - Others, fail + */ +esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, + periph_sdcard_mode_t mode); + +/** + * @brief Initialize key peripheral + * + * @param set The handle of esp_periph_set_handle_t + * + * @return + * - ESP_OK, success + * - Others, fail + */ +esp_err_t audio_board_key_init(esp_periph_set_handle_t set); + +/** + * @brief Query audio_board_handle + * + * @return The audio board handle + */ +audio_board_handle_t audio_board_get_handle(void); + +/** + * @brief Uninitialize the audio board + * + * @param audio_board The handle of audio board + * + * @return ESP_OK success, + * others fail + */ +esp_err_t audio_board_deinit(audio_board_handle_t audio_board); + +/** + * @brief Get the ws2812 gpio pin + * + * @return GPIO pin + */ +int8_t get_ws2812_gpio_pin(void); + +/** + * @brief Get the number of ws2812 + * + * @return number of ws2812 + */ +int get_ws2812_num(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/components/audio_board/esp32_c6_devkit/board_def.h b/components/audio_board/esp32_c6_devkit/board_def.h new file mode 100644 index 00000000..6b5e8139 --- /dev/null +++ b/components/audio_board/esp32_c6_devkit/board_def.h @@ -0,0 +1,138 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2022 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _AUDIO_BOARD_DEFINITION_H_ +#define _AUDIO_BOARD_DEFINITION_H_ + +/** + * @brief Audio Codec Chip Function Definition + */ +#define BOARD_PA_GAIN (10) /* Power amplifier gain defined by board (dB) */ + +/** + * @brief ADC Function Definition + */ +#define MIC_ADC_GPIO -1 +#define PA_ENABLE_GPIO GPIO_NUM_7 +#define BUTTON_ADC_GPIO GPIO_NUM_2 + +/** + * @brief SDCARD Function Definition + */ +#define FUNC_SDCARD_EN (0) +#define SDCARD_OPEN_FILE_NUM_MAX 5 +#define SDCARD_INTR_GPIO -1 +#define SDCARD_PWR_CTRL -1 + +#define ESP_SD_PIN_CLK -1 +#define ESP_SD_PIN_CMD -1 +#define ESP_SD_PIN_D0 -1 +#define ESP_SD_PIN_D3 -1 + +/** + * @brief PDM TX Function Definition + */ +#define PDM_TX_GPIO GPIO_NUM_3 + +/** + * @brief LED Function Definition + */ +#define WS2812_LED_GPIO_PIN GPIO_NUM_8 +#define WS2812_LED_BAR_NUMBERS 1 + +/** + * @brief IR Function Definition + */ +#define ESP_IR_TX_GPIO GPIO_NUM_18 +#define ESP_IR_RX_GPIO GPIO_NUM_19 + +/** + * @brief I2C Function Definition + */ +#define I2C_CLK_GPIO GPIO_NUM_18 +#define I2C_DATA_GPIO GPIO_NUM_19 + +/** + * @brief Button Function Definition + */ +#define INPUT_KEY_NUM 6 +#define BUTTON_VOLUP_ID 0 +#define BUTTON_VOLDOWN_ID 1 +#define BUTTON_SET_ID 2 +#define BUTTON_PLAY_ID 3 +#define BUTTON_MODE_ID 4 +#define BUTTON_REC_ID 5 + +extern audio_hal_func_t AUDIO_CODEC_ES8311_DEFAULT_HANDLE; + +#define AUDIO_CODEC_DEFAULT_CONFIG() \ + { \ + .adc_input = AUDIO_HAL_ADC_INPUT_LINE1, \ + .dac_output = AUDIO_HAL_DAC_OUTPUT_ALL, \ + .codec_mode = AUDIO_HAL_CODEC_MODE_BOTH, \ + .i2s_iface = \ + { \ + .mode = AUDIO_HAL_MODE_SLAVE, \ + .fmt = AUDIO_HAL_I2S_NORMAL, \ + .samples = AUDIO_HAL_48K_SAMPLES, \ + .bits = AUDIO_HAL_BIT_LENGTH_16BITS, \ + }, \ + }; + +#define INPUT_KEY_DEFAULT_INFO() \ + { \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_REC, \ + .act_id = BUTTON_REC_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_MODE, \ + .act_id = BUTTON_MODE_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_SET, \ + .act_id = BUTTON_SET_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_PLAY, \ + .act_id = BUTTON_PLAY_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_VOLUP, \ + .act_id = BUTTON_VOLUP_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, .user_id = INPUT_KEY_USER_ID_VOLDOWN, \ + .act_id = BUTTON_VOLDOWN_ID, \ + } \ + } + +#endif diff --git a/components/audio_board/esp32_c6_devkit/board_pins_config.c b/components/audio_board/esp32_c6_devkit/board_pins_config.c new file mode 100644 index 00000000..c32714f4 --- /dev/null +++ b/components/audio_board/esp32_c6_devkit/board_pins_config.c @@ -0,0 +1,106 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2022 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include + +#include "audio_error.h" +#include "audio_mem.h" +#include "board.h" +#include "driver/gpio.h" +#include "esp_log.h" + +static const char *TAG = "ESP32_C6_DevKit"; + +esp_err_t get_i2c_pins(i2c_port_t port, i2c_config_t *i2c_config) { + AUDIO_NULL_CHECK(TAG, i2c_config, return ESP_FAIL); + if (port == I2C_NUM_0) { + i2c_config->sda_io_num = GPIO_NUM_19; + i2c_config->scl_io_num = GPIO_NUM_18; + } else { + i2c_config->sda_io_num = -1; + i2c_config->scl_io_num = -1; + ESP_LOGE(TAG, "i2c port %d is not supported", port); + return ESP_FAIL; + } + return ESP_OK; +} + +esp_err_t get_i2s_pins(i2s_port_t port, board_i2s_pin_t *i2s_config) { + AUDIO_NULL_CHECK(TAG, i2s_config, return ESP_FAIL); + i2s_config->mck_io_num = GPIO_NUM_20; + i2s_config->bck_io_num = GPIO_NUM_22; + i2s_config->ws_io_num = GPIO_NUM_21; + i2s_config->data_out_num = GPIO_NUM_23; + i2s_config->data_in_num = GPIO_NUM_15; + + return ESP_OK; +} + +esp_err_t get_spi_pins( + spi_bus_config_t *spi_config, + spi_device_interface_config_t *spi_device_interface_config) { + AUDIO_NULL_CHECK(TAG, spi_config, return ESP_FAIL); + AUDIO_NULL_CHECK(TAG, spi_device_interface_config, return ESP_FAIL); + + spi_config->mosi_io_num = -1; + spi_config->miso_io_num = -1; + spi_config->sclk_io_num = -1; + spi_config->quadwp_io_num = -1; + spi_config->quadhd_io_num = -1; + + spi_device_interface_config->spics_io_num = -1; + + ESP_LOGW(TAG, "SPI interface is not supported"); + return ESP_OK; +} + +// sdcard +int8_t get_sdcard_intr_gpio(void) { return SDCARD_INTR_GPIO; } + +int8_t get_sdcard_open_file_num_max(void) { return SDCARD_OPEN_FILE_NUM_MAX; } + +int8_t get_sdcard_power_ctrl_gpio(void) { return SDCARD_PWR_CTRL; } + +// input-output pins +int8_t get_pa_enable_gpio(void) { return PA_ENABLE_GPIO; } + +// adc button id +int8_t get_input_rec_id(void) { return -1; } + +int8_t get_input_mode_id(void) { return BUTTON_MODE_ID; } + +int8_t get_input_set_id(void) { return BUTTON_SET_ID; } + +int8_t get_input_play_id(void) { return BUTTON_PLAY_ID; } + +int8_t get_input_volup_id(void) { return BUTTON_VOLUP_ID; } + +int8_t get_input_voldown_id(void) { return BUTTON_VOLDOWN_ID; } + +// led pins +int8_t get_ws2812_led_gpio(void) { return WS2812_LED_GPIO_PIN; } + +int8_t get_es8311_mclk_src(void) { return -1; } diff --git a/components/audio_board/esp32_korvo_du1906/board.c b/components/audio_board/esp32_korvo_du1906/board.c new file mode 100644 index 00000000..1a26f4ef --- /dev/null +++ b/components/audio_board/esp32_korvo_du1906/board.c @@ -0,0 +1,160 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2020 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include "board.h" + +#include "audio_mem.h" +// #include "display_service.h" +#include "es7243.h" +#include "esp_log.h" +// #include "led_bar_ws2812.h" +// #include "led_indicator.h" +// #include "periph_adc_button.h" +// #include "periph_sdcard.h" + +static const char *TAG = "AUDIO_BOARD"; + +static audio_board_handle_t board_handle; + +audio_board_handle_t audio_board_init(void) { + if (board_handle) { + ESP_LOGW(TAG, "The board has already been initialized!"); + return board_handle; + } + board_handle = + (audio_board_handle_t)audio_calloc(1, sizeof(struct audio_board_handle)); + AUDIO_MEM_CHECK(TAG, board_handle, return NULL); + board_handle->audio_hal = audio_board_dac_init(); + es7243_adc_set_addr(0x24); + board_handle->adc_line_in_hal = audio_board_adc_init(); + es7243_adc_set_addr(0x26); + board_handle->adc_ref_pa_hal = audio_board_adc_init(); + return board_handle; +} + +audio_hal_handle_t audio_board_dac_init(void) { + audio_hal_handle_t dac_hal = NULL; + audio_hal_codec_config_t audio_codec_cfg = AUDIO_CODEC_DEFAULT_CONFIG(); +#ifdef CONFIG_ESP32_KORVO_DU1906_DAC_TAS5805M + dac_hal = + audio_hal_init(&audio_codec_cfg, &AUDIO_CODEC_TAS5805M_DEFAULT_HANDLE); +#elif CONFIG_ESP32_KORVO_DU1906_DAC_ES7148 + dac_hal = + audio_hal_init(&audio_codec_cfg, &AUDIO_CODEC_ES7148_DEFAULT_HANDLE); +#endif + + AUDIO_NULL_CHECK(TAG, dac_hal, return NULL); + return dac_hal; +} + +audio_hal_handle_t audio_board_adc_init(void) { + audio_hal_handle_t adc_hal = NULL; +#ifdef CONFIG_ESP32_KORVO_DU1906_ADC_ES7243 + audio_hal_codec_config_t audio_codec_cfg = AUDIO_CODEC_DEFAULT_CONFIG(); + adc_hal = + audio_hal_init(&audio_codec_cfg, &AUDIO_CODEC_ES7243_DEFAULT_HANDLE); + AUDIO_NULL_CHECK(TAG, adc_hal, return NULL); +#endif + return adc_hal; +} + +// display_service_handle_t audio_board_led_init(void) { +// led_bar_ws2812_handle_t led = +// led_bar_ws2812_init(get_ws2812_gpio_pin(), get_ws2812_num()); +// AUDIO_NULL_CHECK(TAG, led, return NULL); +// display_service_config_t display = { +// .based_cfg = +// { +// .task_stack = 0, +// .task_prio = 0, +// .task_core = 0, +// .task_func = NULL, +// .service_start = NULL, +// .service_stop = NULL, +// .service_destroy = NULL, +// .service_ioctl = led_bar_ws2812_pattern, +// .service_name = "DISPLAY_serv", +// .user_data = NULL, +// }, +// .instance = led, +// }; +// +// return display_service_create(&display); +// } +// +// esp_err_t audio_board_key_init(esp_periph_set_handle_t set) { +// periph_adc_button_cfg_t adc_btn_cfg = PERIPH_ADC_BUTTON_DEFAULT_CONFIG(); +// adc_btn_cfg.task_cfg.ext_stack = true; +// adc_arr_t adc_btn_tag = ADC_DEFAULT_ARR(); +// adc_btn_tag.adc_ch = ADC1_CHANNEL_0; // GPIO36 +// adc_btn_tag.total_steps = 4; +// int btn_array[5] = {200, 900, 1500, 2100, 2930}; +// adc_btn_tag.adc_level_step = btn_array; +// adc_btn_cfg.arr = &adc_btn_tag; +// adc_btn_cfg.arr_size = 1; +// esp_periph_handle_t adc_btn_handle = periph_adc_button_init(&adc_btn_cfg); +// AUDIO_NULL_CHECK(TAG, adc_btn_handle, return ESP_ERR_ADF_MEMORY_LACK); +// return esp_periph_start(set, adc_btn_handle); +// } +// +// esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, +// periph_sdcard_mode_t mode) { +// if (mode != SD_MODE_1_LINE) { +// ESP_LOGE(TAG, "Current board only support 1-line SD mode!"); +// return ESP_FAIL; +// } +// periph_sdcard_cfg_t sdcard_cfg = { +// .root = "/sdcard", +// .card_detect_pin = get_sdcard_intr_gpio(), // GPIO_NUM_34 +// .mode = mode}; +// esp_periph_handle_t sdcard_handle = periph_sdcard_init(&sdcard_cfg); +// esp_err_t ret = esp_periph_start(set, sdcard_handle); +// int retry_time = 5; +// bool mount_flag = false; +// while (retry_time--) { +// if (periph_sdcard_is_mounted(sdcard_handle)) { +// mount_flag = true; +// break; +// } else { +// vTaskDelay(500 / portTICK_PERIOD_MS); +// } +// } +// if (mount_flag == false) { +// ESP_LOGE(TAG, "Sdcard mount failed"); +// return ESP_FAIL; +// } +// return ret; +// } + +audio_board_handle_t audio_board_get_handle(void) { return board_handle; } + +esp_err_t audio_board_deinit(audio_board_handle_t audio_board) { + esp_err_t ret = ESP_OK; + ret |= audio_hal_deinit(audio_board->audio_hal); + audio_free(audio_board); + board_handle = NULL; + return ret; +} diff --git a/components/audio_board/esp32_korvo_du1906/board.h b/components/audio_board/esp32_korvo_du1906/board.h new file mode 100644 index 00000000..13b3cb72 --- /dev/null +++ b/components/audio_board/esp32_korvo_du1906/board.h @@ -0,0 +1,142 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2020 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _AUDIO_BOARD_H_ +#define _AUDIO_BOARD_H_ + +#include "audio_hal.h" +#include "board_def.h" +#include "board_pins_config.h" +// #include "display_service.h" +// #include "esp_peripherals.h" +// #include "periph_sdcard.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern audio_hal_func_t AUDIO_CODEC_TAS5805M_DEFAULT_HANDLE; +extern audio_hal_func_t AUDIO_CODEC_ES7148_DEFAULT_HANDLE; +extern audio_hal_func_t AUDIO_CODEC_ES7243_DEFAULT_HANDLE; + +/** + * @brief Audio board handle + */ +struct audio_board_handle { + audio_hal_handle_t audio_hal; /*!< pa hardware abstract layer handle */ + audio_hal_handle_t adc_line_in_hal; /*!< adc hardware abstract layer handle */ + audio_hal_handle_t adc_ref_pa_hal; /*!< adc hardware abstract layer handle */ +}; + +typedef struct audio_board_handle *audio_board_handle_t; + +/** + * @brief Initialize audio board + * + * @return The audio board handle + */ +audio_board_handle_t audio_board_init(void); + +/** + * @brief Initialize DAC chip + * + * @return The audio hal handle + */ +audio_hal_handle_t audio_board_dac_init(void); + +/** + * @brief Initialize ADC chip + * + * @return The audio hal handle + */ +audio_hal_handle_t audio_board_adc_init(void); + +/** + * @brief Initialize led peripheral and display service + * + * @return The audio display service handle + */ +// display_service_handle_t audio_board_led_init(void); + +/** + * @brief Initialize key peripheral + * + * @param set The handle of esp_periph_set_handle_t + * + * @return + * - ESP_OK, success + * - Others, fail + */ +// esp_err_t audio_board_key_init(esp_periph_set_handle_t set); + +/** + * @brief Initialize sdcard peripheral + * + * @param set The handle of esp_periph_set_handle_t + * + * @return + * - ESP_OK, success + * - Others, fail + */ +// esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, +// periph_sdcard_mode_t mode); + +/** + * @brief Query audio_board_handle + * + * @return The audio board handle + */ +audio_board_handle_t audio_board_get_handle(void); + +/** + * @brief Uninitialize the audio board + * + * @param audio_board The handle of audio board + * + * @return ESP_OK, success + * others, fail + */ +esp_err_t audio_board_deinit(audio_board_handle_t audio_board); + +/** + * @brief Get the ws2812 gpio pin + * + * @return GPIO pin + */ +int8_t get_ws2812_gpio_pin(void); + +/** + * @brief Get the number of ws2812 + * + * @return number of ws2812 + */ +int get_ws2812_num(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/components/audio_board/esp32_korvo_du1906/board_def.h b/components/audio_board/esp32_korvo_du1906/board_def.h new file mode 100644 index 00000000..6744e536 --- /dev/null +++ b/components/audio_board/esp32_korvo_du1906/board_def.h @@ -0,0 +1,116 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2020 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _AUDIO_BOARD_DEFINITION_H_ +#define _AUDIO_BOARD_DEFINITION_H_ + +/** + * @brief SDCARD Function Definition + */ +#define FUNC_SDCARD_EN (1) +#define SDCARD_OPEN_FILE_NUM_MAX 5 +#define SDCARD_INTR_GPIO GPIO_NUM_39 + +#define ESP_SD_PIN_CLK GPIO_NUM_14 +#define ESP_SD_PIN_CMD GPIO_NUM_15 +#define ESP_SD_PIN_D0 GPIO_NUM_2 +#define ESP_SD_PIN_D3 -1 + +/** + * @brief LED Function Definition + */ +#define FUNC_SYS_LEN_EN (1) +#define WS2812_LED_GPIO_PIN 3 +#define WS2812_LED_BAR_NUMBERS 2 + +/** + * @brief Battery Detect Function Definition + */ +#define FUNC_BATTERY_DET_EN (1) +#define BATTERY_DETECT_GPIO GPIO_NUM_37 + +/** + * @brief Audio Codec Chip Function Definition + */ +#define FUNC_AUDIO_CODEC_EN (1) +#define CODEC_ADC_I2S_PORT (0) +#define ES7243_MCLK_GPIO GPIO_NUM_0 +#define PA_ENABLE_GPIO GPIO_NUM_12 +#define BOARD_PA_GAIN (10) /* Power amplifier gain defined by board (dB) */ + +#define AUDIO_CODEC_DEFAULT_CONFIG() \ + { \ + .adc_input = AUDIO_HAL_ADC_INPUT_LINE1, \ + .dac_output = AUDIO_HAL_DAC_OUTPUT_ALL, \ + .codec_mode = AUDIO_HAL_CODEC_MODE_BOTH, \ + .i2s_iface = \ + { \ + .mode = AUDIO_HAL_MODE_SLAVE, \ + .fmt = AUDIO_HAL_I2S_NORMAL, \ + .samples = AUDIO_HAL_48K_SAMPLES, \ + .bits = AUDIO_HAL_BIT_LENGTH_16BITS, \ + }, \ + }; + +/** + * @brief Button Function Definition + */ +#define FUNC_BUTTON_EN (1) +#define ADC_DETECT_GPIO GPIO_NUM_36 +#define INPUT_KEY_NUM 4 +#define BUTTON_VOLUP_ID 0 +#define BUTTON_VOLDOWN_ID 1 +#define BUTTON_MUTE_ID 2 +#define BUTTON_SET_ID 3 +#define BUTTON_REC_ID (-1) +#define BUTTON_MODE_ID (-1) +#define GREEN_LED_GPIO (-1) + +#define INPUT_KEY_DEFAULT_INFO() \ + { \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_VOLUP, \ + .act_id = BUTTON_VOLUP_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_VOLDOWN, \ + .act_id = BUTTON_VOLDOWN_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_MUTE, \ + .act_id = BUTTON_MUTE_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_SET, \ + .act_id = BUTTON_SET_ID, \ + }, \ + } + +#endif diff --git a/components/audio_board/esp32_korvo_du1906/board_pins_config.c b/components/audio_board/esp32_korvo_du1906/board_pins_config.c new file mode 100644 index 00000000..697bda89 --- /dev/null +++ b/components/audio_board/esp32_korvo_du1906/board_pins_config.c @@ -0,0 +1,117 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2020 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include "audio_error.h" +#include "audio_mem.h" +#include "board.h" +#include "driver/gpio.h" +#include "esp_log.h" +#include "soc/io_mux_reg.h" +#include "soc/soc_caps.h" +#include "string.h" + +static const char *TAG = "ESP32_Korvo_DU1906"; + +esp_err_t get_i2c_pins(i2c_port_t port, i2c_config_t *i2c_config) { + AUDIO_NULL_CHECK(TAG, i2c_config, return ESP_FAIL); + if (port == I2C_NUM_0 || port == I2C_NUM_1) { + i2c_config->sda_io_num = GPIO_NUM_18; + i2c_config->scl_io_num = GPIO_NUM_23; + } else { + i2c_config->sda_io_num = -1; + i2c_config->scl_io_num = -1; + ESP_LOGE(TAG, "i2c port %d is not supported", port); + return ESP_FAIL; + } + return ESP_OK; +} + +esp_err_t get_i2s_pins(i2s_port_t port, board_i2s_pin_t *i2s_config) { + AUDIO_NULL_CHECK(TAG, i2s_config, return ESP_FAIL); + if (port == I2S_NUM_0) { + i2s_config->mck_io_num = GPIO_NUM_0; + i2s_config->bck_io_num = GPIO_NUM_4; + i2s_config->ws_io_num = GPIO_NUM_13; + i2s_config->data_out_num = GPIO_NUM_16; + i2s_config->data_in_num = GPIO_NUM_39; + } else if (port == I2S_NUM_1) { + i2s_config->bck_io_num = -1; + i2s_config->ws_io_num = -1; + i2s_config->data_out_num = -1; + i2s_config->data_in_num = -1; + } else { + memset(i2s_config, -1, sizeof(board_i2s_pin_t)); + ESP_LOGE(TAG, "i2s port %d is not supported", port); + return ESP_FAIL; + } + + return ESP_OK; +} + +esp_err_t get_spi_pins( + spi_bus_config_t *spi_config, + spi_device_interface_config_t *spi_device_interface_config) { + AUDIO_NULL_CHECK(TAG, spi_config, return ESP_FAIL); + AUDIO_NULL_CHECK(TAG, spi_device_interface_config, return ESP_FAIL); + + spi_config->mosi_io_num = -1; + spi_config->miso_io_num = -1; + spi_config->sclk_io_num = -1; + spi_config->quadwp_io_num = -1; + spi_config->quadhd_io_num = -1; + + spi_device_interface_config->spics_io_num = -1; + + ESP_LOGW(TAG, "SPI interface is not supported"); + return ESP_OK; +} + +// sdcard + +int8_t get_sdcard_intr_gpio(void) { return SDCARD_INTR_GPIO; } + +int8_t get_sdcard_open_file_num_max(void) { return SDCARD_OPEN_FILE_NUM_MAX; } + +// Using "mute" button instead of "play" button as the audio control button, +// since `ESP32-Korvo-DU1906` board has not "play" button +int8_t get_input_play_id(void) { return BUTTON_MUTE_ID; } + +int8_t get_input_set_id(void) { return BUTTON_SET_ID; } + +int8_t get_input_volup_id(void) { return BUTTON_VOLUP_ID; } + +int8_t get_input_voldown_id(void) { return BUTTON_VOLDOWN_ID; } + +int8_t get_input_rec_id(void) { return BUTTON_REC_ID; } + +int8_t get_input_mode_id(void) { return BUTTON_MODE_ID; } + +int8_t get_pa_enable_gpio(void) { return PA_ENABLE_GPIO; } + +int8_t get_es7243_mclk_gpio(void) { return ES7243_MCLK_GPIO; } + +// led pins +int8_t get_green_led_gpio(void) { return GREEN_LED_GPIO; } diff --git a/components/audio_board/esp32_korvo_du1906/du1906_bar_pattern.c b/components/audio_board/esp32_korvo_du1906/du1906_bar_pattern.c new file mode 100644 index 00000000..81ee70af --- /dev/null +++ b/components/audio_board/esp32_korvo_du1906/du1906_bar_pattern.c @@ -0,0 +1,507 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2020 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include "board_def.h" +#include "display_service.h" +#include "esp_log.h" +#include "periph_ws2812.h" +#include "string.h" + +const struct periph_ws2812_ctrl_cfg + ws2812_display_pattern[DISPLAY_PATTERN_MAX][WS2812_LED_BAR_NUMBERS] = { + { + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_RED, + .loop = 1000, + .time_off_ms = 200, + .time_on_ms = 400, + }, + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_RED, + .loop = 1000, + .time_off_ms = 200, + .time_on_ms = 400, + } // 0 + }, + { + { + .mode = PERIPH_WS2812_FADE, + .color = LED2812_COLOR_PURPLE, + .loop = 0xFFFFFFFF, + .time_off_ms = 1500, + .time_on_ms = 1500, + }, + { + .mode = PERIPH_WS2812_FADE, + .color = LED2812_COLOR_PURPLE, + .loop = 0xFFFFFFFF, + .time_off_ms = 1500, + .time_on_ms = 1500, + } // 1 + }, + { + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_WHITE, + .loop = 0xFFFFFFFF, + .time_off_ms = 200, + .time_on_ms = 800, + }, + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_WHITE, + .loop = 0xFFFFFFFF, + .time_off_ms = 200, + .time_on_ms = 800, + } // 2 + }, + { + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_BLACK, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + }, + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_BLACK, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + } // 3 + }, + { + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_RED, + .loop = 1, + .time_off_ms = 1000, + .time_on_ms = 4000, + }, + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_RED, + .loop = 1, + .time_off_ms = 1000, + .time_on_ms = 4000, + } // 4 + }, + { + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_WHITE, + .loop = 5, + .time_off_ms = 200, + .time_on_ms = 1000, + }, + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_WHITE, + .loop = 5, + .time_off_ms = 200, + .time_on_ms = 1000, + } // 5 + }, + { + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_BLUE, + .loop = 100, + .time_off_ms = 200, + .time_on_ms = 800, + }, + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_BLUE, + .loop = 100, + .time_off_ms = 200, + .time_on_ms = 800, + } // 6 + }, + { + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_PURPLE, + .loop = 4, + .time_off_ms = 100, + .time_on_ms = 100, + }, + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_PURPLE, + .loop = 4, + .time_off_ms = 100, + .time_on_ms = 100, + } // 7 + }, + { + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_PURPLE, + .loop = 4, + .time_off_ms = 100, + .time_on_ms = 100, + }, + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_PURPLE, + .loop = 4, + .time_off_ms = 100, + .time_on_ms = 100, + } // 8 + }, + { + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_PURPLE, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + }, + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_PURPLE, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + } // 9 + }, + { + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_PURPLE, + .loop = 2, + .time_off_ms = 200, + .time_on_ms = 400, + }, + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_PURPLE, + .loop = 2, + .time_off_ms = 200, + .time_on_ms = 400, + } // 10 + }, + { + { + .mode = PERIPH_WS2812_FADE, + .color = LED2812_COLOR_PURPLE, + .loop = 100, + .time_off_ms = 2000, + .time_on_ms = 2000, + }, + { + .mode = PERIPH_WS2812_FADE, + .color = LED2812_COLOR_PURPLE, + .loop = 100, + .time_off_ms = 2000, + .time_on_ms = 2000, + } // 11 + }, + { + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_PURPLE, + .loop = 2, + .time_off_ms = 200, + .time_on_ms = 400, + }, + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_PURPLE, + .loop = 2, + .time_off_ms = 200, + .time_on_ms = 400, + } // 12 + }, + { + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_BLUE, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + }, + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_BLUE, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + } // 13 + }, + { + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_BLACK, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + }, + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_BLACK, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + } // 14 + }, + { + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_YELLOW, + .loop = 2000, + .time_off_ms = 200, + .time_on_ms = 600, + }, + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_YELLOW, + .loop = 2000, + .time_off_ms = 200, + .time_on_ms = 600, + } // 15 + }, + { + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_BLACK, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + }, + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_BLACK, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + } // 16 + }, + { + { + .mode = PERIPH_WS2812_FADE, + .color = LED2812_COLOR_GREEN, + .loop = 1, + .time_off_ms = 0, + .time_on_ms = 1000, + }, + { + .mode = PERIPH_WS2812_FADE, + .color = LED2812_COLOR_GREEN, + .loop = 1, + .time_off_ms = 0, + .time_on_ms = 1000, + } // 17 + }, + { + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_ORANGE, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + }, + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_ORANGE, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + } // 18 + }, + { + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_BLACK, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + }, + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_BLACK, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + } // 19 + }, + { + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_WHITE, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + }, + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_WHITE, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + } // 20 + }, + { + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_BLACK, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + }, + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_BLACK, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + } // 21 + }, + { + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_RED, + .loop = 1000, + .time_off_ms = 200, + .time_on_ms = 800, + }, + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_RED, + .loop = 1000, + .time_off_ms = 200, + .time_on_ms = 800, + } // 22 + }, + { + { + .mode = PERIPH_WS2812_FADE, + .color = LED2812_COLOR_PURPLE, + .loop = 1000, + .time_off_ms = 1500, + .time_on_ms = 1500, + }, + { + .mode = PERIPH_WS2812_FADE, + .color = LED2812_COLOR_PURPLE, + .loop = 1000, + .time_off_ms = 1500, + .time_on_ms = 1500, + } // 23 + }, + { + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_PURPLE, + .loop = 1000, + .time_off_ms = 1000, + .time_on_ms = 2000, + }, + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_PURPLE, + .loop = 1000, + .time_off_ms = 1000, + .time_on_ms = 2000, + } // 24 + }, + { + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_PURPLE, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + }, + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_PURPLE, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + } // 25 + }, + { + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_RED, + .loop = 0xFFFFFFFF, + .time_off_ms = 2000, + .time_on_ms = 2000, + }, + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_RED, + .loop = 0xFFFFFFFF, + .time_off_ms = 2000, + .time_on_ms = 2000, + } // 26 + }, + { + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_BLUE, + .loop = 0xFFFFFFFF, + .time_off_ms = 500, + .time_on_ms = 500, + }, + { + .mode = PERIPH_WS2812_BLINK, + .color = LED2812_COLOR_BLUE, + .loop = 0xFFFFFFFF, + .time_off_ms = 500, + .time_on_ms = 500, + } // 27, + }, + { + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_BLACK, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + }, + { + .mode = PERIPH_WS2812_ONE, + .color = LED2812_COLOR_BLACK, + .loop = 0, + .time_off_ms = 0, + .time_on_ms = 0, + } // 28, + }}; + +int8_t get_ws2812_gpio_pin(void) { return WS2812_LED_GPIO_PIN; } + +int get_ws2812_num(void) { return WS2812_LED_BAR_NUMBERS; } + +void ws2812_pattern_copy(struct periph_ws2812_ctrl_cfg *p) { + ESP_LOGD("ws2812_pattern_copy", "has been called, %s %d", __FILE__, __LINE__); + memcpy(p, ws2812_display_pattern, sizeof(ws2812_display_pattern)); +} diff --git a/components/audio_board/esp32_s2_kaluga_1_v1_2/board.c b/components/audio_board/esp32_s2_kaluga_1_v1_2/board.c new file mode 100644 index 00000000..56f9502b --- /dev/null +++ b/components/audio_board/esp32_s2_kaluga_1_v1_2/board.c @@ -0,0 +1,149 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2020 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include "board.h" + +#include "audio_mem.h" +#include "esp_log.h" +// #include "periph_adc_button.h" + +static const char *TAG = "AUDIO_BOARD"; + +static audio_board_handle_t board_handle = NULL; + +audio_board_handle_t audio_board_init(void) { + if (board_handle) { + ESP_LOGW(TAG, "The board has already been initialized!"); + return board_handle; + } + board_handle = + (audio_board_handle_t)audio_calloc(1, sizeof(struct audio_board_handle)); + AUDIO_MEM_CHECK(TAG, board_handle, return NULL); + board_handle->audio_hal = audio_board_codec_init(); + + return board_handle; +} + +audio_hal_handle_t audio_board_codec_init(void) { + audio_hal_codec_config_t audio_codec_cfg = AUDIO_CODEC_DEFAULT_CONFIG(); + audio_hal_handle_t codec_hal = + audio_hal_init(&audio_codec_cfg, &AUDIO_CODEC_ES8311_DEFAULT_HANDLE); + AUDIO_NULL_CHECK(TAG, codec_hal, return NULL); + return codec_hal; +} + +esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, + periph_sdcard_mode_t mode) { + esp_err_t ret = ESP_FAIL; + return ret; +} + +// display_service_handle_t audio_board_led_init(void) { +// // TODO +// return NULL; +// } +// #if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0)) +// esp_err_t _get_lcd_io_bus(void *bus, esp_lcd_panel_io_spi_config_t +// *io_config, +// esp_lcd_panel_io_handle_t *out_panel_io) { +// return esp_lcd_new_panel_io_spi((esp_lcd_spi_bus_handle_t)bus, io_config, +// out_panel_io); +// } +// +// void *audio_board_lcd_init(esp_periph_set_handle_t set, void *cb) { +// gpio_config_t bk_gpio_config = {.mode = GPIO_MODE_OUTPUT, +// .pin_bit_mask = 1ULL << LCD_CTRL_GPIO}; +// // Initialize the GPIO of backlight +// ESP_ERROR_CHECK(gpio_config(&bk_gpio_config)); +// +// spi_bus_config_t buscfg = {.sclk_io_num = LCD_CLK_GPIO, +// .mosi_io_num = LCD_MOSI_GPIO, +// .miso_io_num = -1, +// .quadwp_io_num = -1, +// .quadhd_io_num = -1, +// .max_transfer_sz = 16 * LCD_H_RES * 2 + 8}; +// ESP_ERROR_CHECK(spi_bus_initialize(SPI2_HOST, &buscfg, SPI_DMA_CH_AUTO)); +// +// esp_lcd_panel_io_spi_config_t io_config = { +// .dc_gpio_num = LCD_DC_GPIO, +// .cs_gpio_num = LCD_CS_GPIO, +// .pclk_hz = 60 * 1000 * 1000, +// .lcd_cmd_bits = 8, +// .lcd_param_bits = 8, +// .spi_mode = 0, +// .trans_queue_depth = 10, +// .on_color_trans_done = cb, +// .user_ctx = NULL, +// }; +// esp_lcd_panel_dev_config_t panel_config = { +// .reset_gpio_num = LCD_RST_GPIO, +// .color_space = ESP_LCD_COLOR_SPACE_BGR, +// .bits_per_pixel = 16, +// }; +// periph_lcd_cfg_t cfg = { +// .io_bus = (void *)SPI2_HOST, +// .new_panel_io = _get_lcd_io_bus, +// .lcd_io_cfg = &io_config, +// .new_lcd_panel = esp_lcd_new_panel_st7789, +// .lcd_dev_cfg = &panel_config, +// .rest_cb = NULL, +// .rest_cb_ctx = NULL, +// .lcd_swap_xy = LCD_SWAP_XY, +// .lcd_mirror_x = LCD_MIRROR_X, +// .lcd_mirror_y = LCD_MIRROR_Y, +// .lcd_color_invert = LCD_COLOR_INV, +// }; +// esp_periph_handle_t periph_lcd = periph_lcd_init(&cfg); +// AUDIO_NULL_CHECK(TAG, periph_lcd, return NULL); +// esp_periph_start(set, periph_lcd); +// return (void *)periph_lcd_get_panel_handle(periph_lcd); +// } +// #endif +// +// esp_err_t audio_board_key_init(esp_periph_set_handle_t set) { +// periph_adc_button_cfg_t adc_btn_cfg = PERIPH_ADC_BUTTON_DEFAULT_CONFIG(); +// adc_arr_t adc_btn_tag = ADC_DEFAULT_ARR(); +// adc_btn_tag.adc_ch = ADC1_CHANNEL_5; +// adc_btn_tag.total_steps = 6; +// int btn_array[7] = {190, 600, 1000, 1375, 1775, 2195, 2610}; +// adc_btn_tag.adc_level_step = btn_array; +// adc_btn_cfg.arr = &adc_btn_tag; +// adc_btn_cfg.arr_size = 1; +// esp_periph_handle_t adc_btn_handle = periph_adc_button_init(&adc_btn_cfg); +// AUDIO_NULL_CHECK(TAG, adc_btn_handle, return ESP_ERR_ADF_MEMORY_LACK); +// return esp_periph_start(set, adc_btn_handle); +// } + +audio_board_handle_t audio_board_get_handle(void) { return board_handle; } + +esp_err_t audio_board_deinit(audio_board_handle_t audio_board) { + esp_err_t ret = ESP_OK; + ret = audio_hal_deinit(audio_board->audio_hal); + audio_board->audio_hal = NULL; + audio_free(audio_board); + board_handle = NULL; + return ret; +} diff --git a/components/audio_board/esp32_s2_kaluga_1_v1_2/board.h b/components/audio_board/esp32_s2_kaluga_1_v1_2/board.h new file mode 100644 index 00000000..f08adcba --- /dev/null +++ b/components/audio_board/esp32_s2_kaluga_1_v1_2/board.h @@ -0,0 +1,127 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2020 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _AUDIO_BOARD_H_ +#define _AUDIO_BOARD_H_ + +#include "audio_hal.h" +#include "board_def.h" +#include "board_pins_config.h" +// #include "display_service.h" +// #include "esp_peripherals.h" +// #include "periph_lcd.h" +// #include "periph_sdcard.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Audio board handle + */ +struct audio_board_handle { + audio_hal_handle_t audio_hal; /*!< audio hardware abstract layer handle */ +}; + +typedef struct audio_board_handle *audio_board_handle_t; + +/** + * @brief Initialize audio board + * + * @return The audio board handle + */ +audio_board_handle_t audio_board_init(void); + +/** + * @brief Initialize codec chip + * + * @return The audio hal handle + */ +audio_hal_handle_t audio_board_codec_init(void); + +/** + * @brief Initialize led peripheral and display service + * + * @return The audio display service handle + */ +// display_service_handle_t audio_board_led_init(void); + +/** + * @brief Initialize lcd peripheral + * + * @param set The handle of esp_periph_set_handle_t + * @param cb The `on_color_trans_done` callback in + * `esp_lcd_panel_io_spi_config_t` + * + * @return The `esp_lcd_panel_handle_t` handle + */ +// void *audio_board_lcd_init(esp_periph_set_handle_t set, void *cb); + +/** + * @brief Initialize sdcard peripheral + * + * @param set The handle of esp_periph_set_handle_t + * + * @return + * - ESP_OK, success + * - Others, fail + */ +// esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, +// periph_sdcard_mode_t mode); + +/** + * @brief Initialize key peripheral + * + * @param set The handle of esp_periph_set_handle_t + * + * @return + * - ESP_OK, success + * - Others, fail + */ +// esp_err_t audio_board_key_init(esp_periph_set_handle_t set); + +/** + * @brief Query audio_board_handle + * + * @return The audio board handle + */ +audio_board_handle_t audio_board_get_handle(void); + +/** + * @brief Uninitialize the audio board + * + * @param audio_board The handle of audio board + * + * @return ESP_OK success, + * others fail + */ +esp_err_t audio_board_deinit(audio_board_handle_t audio_board); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/components/audio_board/esp32_s2_kaluga_1_v1_2/board_def.h b/components/audio_board/esp32_s2_kaluga_1_v1_2/board_def.h new file mode 100644 index 00000000..c4ba250e --- /dev/null +++ b/components/audio_board/esp32_s2_kaluga_1_v1_2/board_def.h @@ -0,0 +1,143 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2020 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _AUDIO_BOARD_DEFINITION_H_ +#define _AUDIO_BOARD_DEFINITION_H_ + +#include "driver/touch_pad.h" + +/** + * @brief LED Function Definition + */ +#define FUNC_SYS_LEN_EN (1) +#define WS2812_LED_GPIO 45 + +/** + * @brief LCD SCREEN Function Definition + */ +#define FUNC_LCD_SCREEN_EN (1) +#define LCD_CTRL_GPIO GPIO_NUM_6 +#define LCD_RST_GPIO GPIO_NUM_16 +#define LCD_CS_GPIO GPIO_NUM_11 +// LCD SPI Pins +#define LCD_DC_GPIO GPIO_NUM_13 +#define LCD_CLK_GPIO GPIO_NUM_15 +#define LCD_MOSI_GPIO GPIO_NUM_9 +// The LCD pixel number in horizontal and vertical +#define LCD_H_RES 320 +#define LCD_V_RES 240 +#define LCD_SWAP_XY (true) +#define LCD_MIRROR_X (true) +#define LCD_MIRROR_Y (true) +#define LCD_COLOR_INV (false) + +/** + * @brief SDCARD Function Definition + */ +#define FUNC_SDCARD_EN (0) +#define SDCARD_OPEN_FILE_NUM_MAX 5 +#define SDCARD_INTR_GPIO -1 +#define SDCARD_PWR_CTRL -1 + +#define ESP_SD_PIN_CLK -1 +#define ESP_SD_PIN_CMD -1 +#define ESP_SD_PIN_D0 -1 +#define ESP_SD_PIN_D3 -1 + +/** + * @brief Audio Codec Chip Function Definition + */ +#define FUNC_AUDIO_CODEC_EN (1) +#define PA_ENABLE_GPIO 10 +#define ES8311_MCLK_SOURCE 1 /* 0 From MCLK, 1 From BCLK */ +#define CODEC_ADC_I2S_PORT (0) +#define CODEC_ADC_BITS_PER_SAMPLE I2S_BITS_PER_SAMPLE_16BIT +#define CODEC_ADC_SAMPLE_RATE (48000) +#define RECORD_HARDWARE_AEC (false) +#define BOARD_PA_GAIN (0) /* Power amplifier gain defined by board (dB) */ + +extern audio_hal_func_t AUDIO_CODEC_ES8311_DEFAULT_HANDLE; +#define AUDIO_CODEC_DEFAULT_CONFIG() \ + { \ + .adc_input = AUDIO_HAL_ADC_INPUT_LINE1, \ + .dac_output = AUDIO_HAL_DAC_OUTPUT_ALL, \ + .codec_mode = AUDIO_HAL_CODEC_MODE_BOTH, \ + .i2s_iface = \ + { \ + .mode = AUDIO_HAL_MODE_SLAVE, \ + .fmt = AUDIO_HAL_I2S_NORMAL, \ + .samples = AUDIO_HAL_48K_SAMPLES, \ + .bits = AUDIO_HAL_BIT_LENGTH_16BITS, \ + }, \ + }; + +/** + * @brief Button Function Definition + */ +#define FUNC_BUTTON_EN (1) +#define BUTTON_ADC 6 +#define INPUT_KEY_NUM 6 +#define BUTTON_VOLUP_ID 0 +#define BUTTON_VOLDOWN_ID 1 +#define BUTTON_SET_ID 2 +#define BUTTON_PLAY_ID 3 +#define BUTTON_MODE_ID 4 +#define BUTTON_REC_ID 5 +#define GREEN_LED_GPIO (-1) +#define INPUT_KEY_DEFAULT_INFO() \ + { \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_REC, \ + .act_id = BUTTON_REC_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_MODE, \ + .act_id = BUTTON_MODE_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_SET, \ + .act_id = BUTTON_SET_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_PLAY, \ + .act_id = BUTTON_PLAY_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_VOLUP, \ + .act_id = BUTTON_VOLUP_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, .user_id = INPUT_KEY_USER_ID_VOLDOWN, \ + .act_id = BUTTON_VOLDOWN_ID, \ + } \ + } + +#endif diff --git a/components/audio_board/esp32_s2_kaluga_1_v1_2/board_pins_config.c b/components/audio_board/esp32_s2_kaluga_1_v1_2/board_pins_config.c new file mode 100644 index 00000000..5b61ed72 --- /dev/null +++ b/components/audio_board/esp32_s2_kaluga_1_v1_2/board_pins_config.c @@ -0,0 +1,115 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2020 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include + +#include "audio_error.h" +#include "audio_mem.h" +#include "board.h" +#include "driver/gpio.h" +#include "esp_idf_version.h" +#include "esp_log.h" +#include "soc/soc_caps.h" +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0) +#include "rom/gpio.h" +#include "soc/gpio_sig_map.h" +#endif +static const char *TAG = "KALUGA_V1_2"; + +esp_err_t get_i2c_pins(i2c_port_t port, i2c_config_t *i2c_config) { + AUDIO_NULL_CHECK(TAG, i2c_config, return ESP_FAIL); + if (port == I2C_NUM_0) { + i2c_config->sda_io_num = GPIO_NUM_8; + i2c_config->scl_io_num = GPIO_NUM_7; + } else { + i2c_config->sda_io_num = -1; + i2c_config->scl_io_num = -1; + ESP_LOGE(TAG, "i2c port %d is not supported", port); + return ESP_FAIL; + } + return ESP_OK; +} + +esp_err_t get_i2s_pins(i2s_port_t port, board_i2s_pin_t *i2s_config) { + AUDIO_NULL_CHECK(TAG, i2s_config, return ESP_FAIL); + + i2s_config->bck_io_num = GPIO_NUM_18; + i2s_config->ws_io_num = GPIO_NUM_17; + i2s_config->data_out_num = GPIO_NUM_12; + i2s_config->data_in_num = GPIO_NUM_34; + i2s_config->mck_io_num = GPIO_NUM_35; + return ESP_OK; +} + +esp_err_t get_spi_pins( + spi_bus_config_t *spi_config, + spi_device_interface_config_t *spi_device_interface_config) { + AUDIO_NULL_CHECK(TAG, spi_config, return ESP_FAIL); + AUDIO_NULL_CHECK(TAG, spi_device_interface_config, return ESP_FAIL); + + spi_config->mosi_io_num = -1; + spi_config->miso_io_num = -1; + spi_config->sclk_io_num = -1; + spi_config->quadwp_io_num = -1; + spi_config->quadhd_io_num = -1; + + spi_device_interface_config->spics_io_num = -1; + + ESP_LOGW(TAG, "SPI interface is not supported"); + return ESP_OK; +} + +// sdcard +int8_t get_sdcard_intr_gpio(void) { return SDCARD_INTR_GPIO; } + +int8_t get_sdcard_open_file_num_max(void) { return SDCARD_OPEN_FILE_NUM_MAX; } + +int8_t get_sdcard_power_ctrl_gpio(void) { return SDCARD_PWR_CTRL; } + +// input-output pins +int8_t get_pa_enable_gpio(void) { return PA_ENABLE_GPIO; } + +// adc button id +int8_t get_input_rec_id(void) { return BUTTON_REC_ID; } + +int8_t get_input_mode_id(void) { return BUTTON_MODE_ID; } + +int8_t get_input_set_id(void) { return BUTTON_SET_ID; } + +int8_t get_input_play_id(void) { return BUTTON_PLAY_ID; } + +int8_t get_input_volup_id(void) { return BUTTON_VOLUP_ID; } + +int8_t get_input_voldown_id(void) { return BUTTON_VOLDOWN_ID; } + +// led pins +int8_t get_ws2812_led_gpio(void) { return WS2812_LED_GPIO; } + +int8_t get_es8311_mclk_src(void) { return ES8311_MCLK_SOURCE; } + +// led pins + +int8_t get_green_led_gpio(void) { return GREEN_LED_GPIO; } diff --git a/components/audio_board/esp32_s3_box/board.c b/components/audio_board/esp32_s3_box/board.c new file mode 100644 index 00000000..d677642d --- /dev/null +++ b/components/audio_board/esp32_s3_box/board.c @@ -0,0 +1,187 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2022 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include "board.h" + +#include "audio_mem.h" +#include "esp_lcd_panel_ops.h" +#include "esp_log.h" +#include "periph_adc_button.h" +#include "periph_lcd.h" +#include "periph_sdcard.h" +#include "tca9554.h" + +static const char *TAG = "AUDIO_BOARD"; + +static audio_board_handle_t board_handle = 0; + +audio_board_handle_t audio_board_init(void) { + if (board_handle) { + ESP_LOGW(TAG, "The board has already been initialized!"); + return board_handle; + } + board_handle = + (audio_board_handle_t)audio_calloc(1, sizeof(struct audio_board_handle)); + AUDIO_MEM_CHECK(TAG, board_handle, return NULL); + board_handle->audio_hal = audio_board_codec_init(); + board_handle->adc_hal = audio_board_adc_init(); + return board_handle; +} + +audio_hal_handle_t audio_board_adc_init(void) { + audio_hal_codec_config_t audio_codec_cfg = AUDIO_CODEC_DEFAULT_CONFIG(); + audio_hal_handle_t adc_hal = NULL; + adc_hal = + audio_hal_init(&audio_codec_cfg, &AUDIO_CODEC_ES7210_DEFAULT_HANDLE); + AUDIO_NULL_CHECK(TAG, adc_hal, return NULL); + return adc_hal; +} + +audio_hal_handle_t audio_board_codec_init(void) { + audio_hal_codec_config_t audio_codec_cfg = AUDIO_CODEC_DEFAULT_CONFIG(); + audio_hal_handle_t codec_hal = + audio_hal_init(&audio_codec_cfg, &AUDIO_CODEC_ES8311_DEFAULT_HANDLE); + AUDIO_NULL_CHECK(TAG, codec_hal, return NULL); + return codec_hal; +} + +esp_err_t _lcd_rest(esp_periph_handle_t self, void *ctx) { + // Reset the LCD + vTaskDelay(20 / portTICK_PERIOD_MS); + return ESP_OK; +} + +esp_err_t _get_lcd_io_bus(void *bus, esp_lcd_panel_io_spi_config_t *io_config, + esp_lcd_panel_io_handle_t *out_panel_io) { + return esp_lcd_new_panel_io_spi((esp_lcd_spi_bus_handle_t)bus, io_config, + out_panel_io); +} + +void *audio_board_lcd_init(esp_periph_set_handle_t set, void *cb) { + gpio_config_t bk_gpio_config = { + .mode = GPIO_MODE_OUTPUT, + /*!< Prevent left shift negtive value warning */ + .pin_bit_mask = LCD_CTRL_GPIO > 0 ? 1ULL << LCD_CTRL_GPIO : 0ULL, + }; + gpio_config(&bk_gpio_config); + gpio_set_level(LCD_CTRL_GPIO, true); + + spi_bus_config_t buscfg = {.sclk_io_num = LCD_CLK_GPIO, + .mosi_io_num = LCD_MOSI_GPIO, + .miso_io_num = -1, + .quadwp_io_num = -1, + .quadhd_io_num = -1, + .max_transfer_sz = LCD_V_RES * LCD_H_RES * 2}; + ESP_ERROR_CHECK(spi_bus_initialize(SPI2_HOST, &buscfg, SPI_DMA_CH_AUTO)); + + esp_lcd_panel_io_spi_config_t io_config = { + .dc_gpio_num = LCD_DC_GPIO, + .cs_gpio_num = LCD_CS_GPIO, + .pclk_hz = 10 * 1000 * 1000, + .lcd_cmd_bits = 8, + .lcd_param_bits = 8, + .spi_mode = 0, + .trans_queue_depth = 10, + .on_color_trans_done = cb, + .user_ctx = NULL, + }; + esp_lcd_panel_dev_config_t panel_config = { + .reset_gpio_num = LCD_RST_GPIO, + .color_space = LCD_COLOR_SPACE, + .bits_per_pixel = 16, + }; + periph_lcd_cfg_t cfg = { + .io_bus = (void *)SPI2_HOST, + .new_panel_io = _get_lcd_io_bus, + .lcd_io_cfg = &io_config, + .new_lcd_panel = esp_lcd_new_panel_st7789, + .lcd_dev_cfg = &panel_config, + .rest_cb = NULL, + .rest_cb_ctx = NULL, + .lcd_swap_xy = LCD_SWAP_XY, + .lcd_mirror_x = LCD_MIRROR_X, + .lcd_mirror_y = LCD_MIRROR_Y, + .lcd_color_invert = LCD_COLOR_INV, + }; + esp_periph_handle_t periph_lcd = periph_lcd_init(&cfg); + AUDIO_NULL_CHECK(TAG, periph_lcd, return NULL); + esp_periph_start(set, periph_lcd); + + return (void *)periph_lcd_get_panel_handle(periph_lcd); +} + +esp_err_t audio_board_key_init(esp_periph_set_handle_t set) { + periph_adc_button_cfg_t adc_btn_cfg = PERIPH_ADC_BUTTON_DEFAULT_CONFIG(); + adc_arr_t adc_btn_tag = ADC_DEFAULT_ARR(); + adc_btn_tag.total_steps = 3; + adc_btn_tag.adc_ch = ADC1_CHANNEL_0; + int btn_array[4] = {190, 1000, 2195, 3000}; + adc_btn_tag.adc_level_step = btn_array; + adc_btn_cfg.arr = &adc_btn_tag; + adc_btn_cfg.arr_size = 1; + esp_periph_handle_t adc_btn_handle = periph_adc_button_init(&adc_btn_cfg); + AUDIO_NULL_CHECK(TAG, adc_btn_handle, return ESP_ERR_ADF_MEMORY_LACK); + return esp_periph_start(set, adc_btn_handle); +} + +esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, + periph_sdcard_mode_t mode) { + if (mode != SD_MODE_1_LINE) { + ESP_LOGE(TAG, "Current board only support 1-line SD mode!"); + return ESP_FAIL; + } + periph_sdcard_cfg_t sdcard_cfg = {.root = "/sdcard", + .card_detect_pin = get_sdcard_intr_gpio(), + .mode = mode}; + esp_periph_handle_t sdcard_handle = periph_sdcard_init(&sdcard_cfg); + esp_err_t ret = esp_periph_start(set, sdcard_handle); + int retry_time = 5; + bool mount_flag = false; + while (retry_time--) { + if (periph_sdcard_is_mounted(sdcard_handle)) { + mount_flag = true; + break; + } else { + vTaskDelay(500 / portTICK_PERIOD_MS); + } + } + if (mount_flag == false) { + ESP_LOGE(TAG, "Sdcard mount failed"); + return ESP_FAIL; + } + return ret; +} + +audio_board_handle_t audio_board_get_handle(void) { return board_handle; } + +esp_err_t audio_board_deinit(audio_board_handle_t audio_board) { + esp_err_t ret = ESP_OK; + ret |= audio_hal_deinit(audio_board->audio_hal); + ret |= audio_hal_deinit(audio_board->adc_hal); + audio_free(audio_board); + board_handle = NULL; + return ret; +} diff --git a/components/audio_board/esp32_s3_box/board.h b/components/audio_board/esp32_s3_box/board.h new file mode 100644 index 00000000..22b701a3 --- /dev/null +++ b/components/audio_board/esp32_s3_box/board.h @@ -0,0 +1,135 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2022 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _AUDIO_BOARD_H_ +#define _AUDIO_BOARD_H_ + +#include "audio_hal.h" +#include "board_def.h" +#include "board_pins_config.h" +#include "display_service.h" +#include "esp_peripherals.h" +#include "periph_lcd.h" +#include "periph_sdcard.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Audio board handle + */ +struct audio_board_handle { + audio_hal_handle_t audio_hal; /*!< audio hardware abstract layer handle */ + audio_hal_handle_t adc_hal; /*!< adc hardware abstract layer handle */ +}; + +typedef struct audio_board_handle *audio_board_handle_t; + +/** + * @brief Initialize audio board + * + * @return The audio board handle + */ +audio_board_handle_t audio_board_init(void); + +/** + * @brief Initialize codec chip + * + * @return The audio hal handle + */ +audio_hal_handle_t audio_board_codec_init(void); + +/** + * @brief Initialize adc + * + * @return The adc hal handle + */ +audio_hal_handle_t audio_board_adc_init(void); + +/** + * @brief Initialize lcd peripheral + * + * @param set The handle of esp_periph_set_handle_t + * @param cb The `on_color_trans_done` callback in + * `esp_lcd_panel_io_spi_config_t` + * + * @return The `esp_lcd_panel_handle_t` handle + */ +void *audio_board_lcd_init(esp_periph_set_handle_t set, void *cb); + +/** + * @brief Initialize led peripheral and display service + * + * @return The audio display service handle + */ +display_service_handle_t audio_board_blue_led_init(void); + +/** + * @brief Initialize key peripheral + * + * @param set The handle of esp_periph_set_handle_t + * + * @return + * - ESP_OK, success + * - Others, fail + */ +esp_err_t audio_board_key_init(esp_periph_set_handle_t set); + +/** + * @brief Initialize sdcard peripheral + * + * @param set The handle of esp_periph_set_handle_t + * + * @return + * - ESP_OK, success + * - Others, fail + */ +esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, + periph_sdcard_mode_t mode); + +/** + * @brief Query audio_board_handle + * + * @return The audio board handle + */ +audio_board_handle_t audio_board_get_handle(void); + +/** + * @brief Uninitialize the audio board + * + * @param audio_board The handle of audio board + * + * @return 0 success, + * others fail + */ +esp_err_t audio_board_deinit(audio_board_handle_t audio_board); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/components/audio_board/esp32_s3_box/board_def.h b/components/audio_board/esp32_s3_box/board_def.h new file mode 100644 index 00000000..68ab4225 --- /dev/null +++ b/components/audio_board/esp32_s3_box/board_def.h @@ -0,0 +1,136 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2022 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _AUDIO_BOARD_DEFINITION_H_ +#define _AUDIO_BOARD_DEFINITION_H_ + +/** + * @brief LCD SCREEN Function Definition + */ +#define FUNC_LCD_SCREEN_EN (1) +#define LCD_CTRL_GPIO GPIO_NUM_45 +#define LCD_RST_GPIO GPIO_NUM_48 +#define LCD_DC_GPIO GPIO_NUM_4 +#define LCD_CS_GPIO GPIO_NUM_5 +#define LCD_CLK_GPIO GPIO_NUM_7 +#define LCD_MOSI_GPIO GPIO_NUM_6 +// The LCD pixel number in horizontal and vertical +#define LCD_H_RES 320 +#define LCD_V_RES 240 +#define LCD_SWAP_XY (false) +#define LCD_MIRROR_X (true) +#define LCD_MIRROR_Y (true) +#define LCD_COLOR_INV (false) +#define LCD_COLOR_SPACE ESP_LCD_COLOR_SPACE_BGR + +/** + * @brief SDCARD Function Definition + * PMOD2 for one line sdcard + */ +#define FUNC_SDCARD_EN (1) +#define SDCARD_OPEN_FILE_NUM_MAX 5 +#define SDCARD_INTR_GPIO -1 +#define SDCARD_PWR_CTRL -1 +#define ESP_SD_PIN_CLK GPIO_NUM_13 +#define ESP_SD_PIN_CMD GPIO_NUM_11 +#define ESP_SD_PIN_D0 GPIO_NUM_14 +#define ESP_SD_PIN_D1 -1 +#define ESP_SD_PIN_D2 -1 +#define ESP_SD_PIN_D3 -1 +#define ESP_SD_PIN_D4 -1 +#define ESP_SD_PIN_D5 -1 +#define ESP_SD_PIN_D6 -1 +#define ESP_SD_PIN_D7 -1 +#define ESP_SD_PIN_CD -1 +#define ESP_SD_PIN_WP -1 + +/** + * @brief LCD TOUCH PANEL Function Definition + */ +#define FUNC_LCD_TOUCH_EN (1) +#define TOUCH_PANEL_SWAP_XY (0) +#define TOUCH_PANEL_INVERSE_X (1) +#define TOUCH_PANEL_INVERSE_Y (0) + +/** + * @brief Audio Codec Chip Function Definition + */ +#define FUNC_AUDIO_CODEC_EN (1) +#define PA_ENABLE_GPIO GPIO_NUM_46 +#define HEADPHONE_DETECT -1 +#define CODEC_ADC_I2S_PORT (0) +#define CODEC_ADC_BITS_PER_SAMPLE I2S_BITS_PER_SAMPLE_32BIT +#define CODEC_ADC_SAMPLE_RATE (48000) +#define RECORD_HARDWARE_AEC (true) +#define BOARD_PA_GAIN (0) /* Power amplifier gain defined by board (dB) */ + +extern audio_hal_func_t AUDIO_CODEC_ES8311_DEFAULT_HANDLE; +extern audio_hal_func_t AUDIO_CODEC_ES7210_DEFAULT_HANDLE; +#define AUDIO_CODEC_DEFAULT_CONFIG() \ + { \ + .adc_input = AUDIO_HAL_ADC_INPUT_LINE1, \ + .dac_output = AUDIO_HAL_DAC_OUTPUT_ALL, \ + .codec_mode = AUDIO_HAL_CODEC_MODE_BOTH, \ + .i2s_iface = \ + { \ + .mode = AUDIO_HAL_MODE_SLAVE, \ + .fmt = AUDIO_HAL_I2S_NORMAL, \ + .samples = AUDIO_HAL_48K_SAMPLES, \ + .bits = AUDIO_HAL_BIT_LENGTH_16BITS, \ + }, \ + }; + +/** + * @brief Button Function Definition + */ +#define FUNC_BUTTON_EN (0) +#define INPUT_KEY_NUM 3 +#define BUTTON_VOLUP_ID 0 +#define BUTTON_VOLDOWN_ID 1 +#define BUTTON_SET_ID 2 +#define BUTTON_PLAY_ID 3 +#define BUTTON_MODE_ID 4 +#define BUTTON_REC_ID 5 + +#define INPUT_KEY_DEFAULT_INFO() \ + { \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_SET, \ + .act_id = BUTTON_SET_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_VOLUP, \ + .act_id = BUTTON_VOLUP_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, .user_id = INPUT_KEY_USER_ID_VOLDOWN, \ + .act_id = BUTTON_VOLDOWN_ID, \ + } \ + } + +#endif diff --git a/components/audio_board/esp32_s3_box/board_pins_config.c b/components/audio_board/esp32_s3_box/board_pins_config.c new file mode 100644 index 00000000..a05865cb --- /dev/null +++ b/components/audio_board/esp32_s3_box/board_pins_config.c @@ -0,0 +1,129 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2022 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include + +#include "audio_error.h" +#include "audio_mem.h" +#include "board.h" +#include "driver/gpio.h" +#include "esp_log.h" +#include "soc/soc_caps.h" + +static const char *TAG = "ESP32_S3_BOX"; + +esp_err_t get_i2c_pins(i2c_port_t port, i2c_config_t *i2c_config) { + AUDIO_NULL_CHECK(TAG, i2c_config, return ESP_FAIL); + if (port == I2C_NUM_0 || port == I2C_NUM_1) { + i2c_config->sda_io_num = GPIO_NUM_8; + i2c_config->scl_io_num = GPIO_NUM_18; + } else { + i2c_config->sda_io_num = -1; + i2c_config->scl_io_num = -1; + ESP_LOGE(TAG, "i2c port %d is not supported", port); + return ESP_FAIL; + } + return ESP_OK; +} + +esp_err_t get_i2s_pins(i2s_port_t port, board_i2s_pin_t *i2s_config) { + AUDIO_NULL_CHECK(TAG, i2s_config, return ESP_FAIL); + if (port == I2S_NUM_0) { + i2s_config->bck_io_num = GPIO_NUM_17; + i2s_config->ws_io_num = GPIO_NUM_47; + i2s_config->data_out_num = GPIO_NUM_15; + i2s_config->data_in_num = GPIO_NUM_16; + i2s_config->mck_io_num = GPIO_NUM_2; + } else if (port == I2S_NUM_1) { + i2s_config->bck_io_num = -1; + i2s_config->ws_io_num = -1; + i2s_config->data_out_num = -1; + i2s_config->data_in_num = -1; + i2s_config->mck_io_num = -1; + } else { + memset(i2s_config, -1, sizeof(board_i2s_pin_t)); + ESP_LOGE(TAG, "i2s port %d is not supported", port); + return ESP_FAIL; + } + + return ESP_OK; +} + +esp_err_t get_spi_pins( + spi_bus_config_t *spi_config, + spi_device_interface_config_t *spi_device_interface_config) { + AUDIO_NULL_CHECK(TAG, spi_config, return ESP_FAIL); + AUDIO_NULL_CHECK(TAG, spi_device_interface_config, return ESP_FAIL); + + spi_config->mosi_io_num = -1; + spi_config->miso_io_num = -1; + spi_config->sclk_io_num = -1; + spi_config->quadwp_io_num = -1; + spi_config->quadhd_io_num = -1; + + spi_device_interface_config->spics_io_num = -1; + + ESP_LOGW(TAG, "SPI interface is not supported"); + return ESP_OK; +} + +// sdcard + +int8_t get_sdcard_intr_gpio(void) { return SDCARD_INTR_GPIO; } + +int8_t get_sdcard_open_file_num_max(void) { return SDCARD_OPEN_FILE_NUM_MAX; } + +int8_t get_sdcard_power_ctrl_gpio(void) { return SDCARD_PWR_CTRL; } + +// input-output pins + +int8_t get_headphone_detect_gpio(void) { return HEADPHONE_DETECT; } + +int8_t get_pa_enable_gpio(void) { return PA_ENABLE_GPIO; } + +int8_t get_es7243_mclk_gpio(void) { return GPIO_NUM_2; } + +// adc button id + +int8_t get_input_rec_id(void) { return BUTTON_REC_ID; } + +int8_t get_input_mode_id(void) { return BUTTON_MODE_ID; } + +int8_t get_input_set_id(void) { return BUTTON_SET_ID; } + +int8_t get_input_play_id(void) { return BUTTON_PLAY_ID; } + +int8_t get_input_volup_id(void) { return BUTTON_VOLUP_ID; } + +int8_t get_input_voldown_id(void) { return BUTTON_VOLDOWN_ID; } + +// led pins + +int8_t get_green_led_gpio(void) { return -1; } + +int8_t get_blue_led_gpio(void) { return -1; } + +int8_t get_es8311_mclk_src(void) { return -1; } diff --git a/components/audio_board/esp32_s3_box_lite/board.c b/components/audio_board/esp32_s3_box_lite/board.c new file mode 100644 index 00000000..060214d9 --- /dev/null +++ b/components/audio_board/esp32_s3_box_lite/board.c @@ -0,0 +1,187 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2022 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include "board.h" + +#include "audio_mem.h" +#include "esp_lcd_panel_ops.h" +#include "esp_log.h" +#include "periph_adc_button.h" +#include "periph_lcd.h" +#include "periph_sdcard.h" +#include "tca9554.h" + +static const char *TAG = "AUDIO_BOARD"; + +static audio_board_handle_t board_handle = 0; + +audio_board_handle_t audio_board_init(void) { + if (board_handle) { + ESP_LOGW(TAG, "The board has already been initialized!"); + return board_handle; + } + board_handle = + (audio_board_handle_t)audio_calloc(1, sizeof(struct audio_board_handle)); + AUDIO_MEM_CHECK(TAG, board_handle, return NULL); + board_handle->audio_hal = audio_board_codec_init(); + board_handle->adc_hal = audio_board_adc_init(); + return board_handle; +} + +audio_hal_handle_t audio_board_adc_init(void) { + audio_hal_codec_config_t audio_codec_cfg = AUDIO_CODEC_DEFAULT_CONFIG(); + audio_hal_handle_t adc_hal = NULL; + adc_hal = + audio_hal_init(&audio_codec_cfg, &AUDIO_CODEC_ES7243E_DEFAULT_HANDLE); + AUDIO_NULL_CHECK(TAG, adc_hal, return NULL); + return adc_hal; +} + +audio_hal_handle_t audio_board_codec_init(void) { + audio_hal_codec_config_t audio_codec_cfg = AUDIO_CODEC_DEFAULT_CONFIG(); + audio_hal_handle_t codec_hal = + audio_hal_init(&audio_codec_cfg, &AUDIO_CODEC_ES8156_DEFAULT_HANDLE); + AUDIO_NULL_CHECK(TAG, codec_hal, return NULL); + return codec_hal; +} + +esp_err_t _lcd_rest(esp_periph_handle_t self, void *ctx) { + // Reset the LCD + vTaskDelay(200 / portTICK_PERIOD_MS); + return ESP_OK; +} + +esp_err_t _get_lcd_io_bus(void *bus, esp_lcd_panel_io_spi_config_t *io_config, + esp_lcd_panel_io_handle_t *out_panel_io) { + return esp_lcd_new_panel_io_spi((esp_lcd_spi_bus_handle_t)bus, io_config, + out_panel_io); +} + +void *audio_board_lcd_init(esp_periph_set_handle_t set, void *cb) { + gpio_config_t bk_gpio_config = { + .mode = GPIO_MODE_OUTPUT, + /*!< Prevent left shift negtive value warning */ + .pin_bit_mask = LCD_CTRL_GPIO > 0 ? 1ULL << LCD_CTRL_GPIO : 0ULL, + }; + gpio_config(&bk_gpio_config); + gpio_set_level(LCD_CTRL_GPIO, false); + + spi_bus_config_t buscfg = {.sclk_io_num = LCD_CLK_GPIO, + .mosi_io_num = LCD_MOSI_GPIO, + .miso_io_num = -1, + .quadwp_io_num = -1, + .quadhd_io_num = -1, + .max_transfer_sz = 16 * LCD_H_RES * 2 + 8}; + ESP_ERROR_CHECK(spi_bus_initialize(SPI2_HOST, &buscfg, SPI_DMA_CH_AUTO)); + + esp_lcd_panel_io_spi_config_t io_config = { + .dc_gpio_num = LCD_DC_GPIO, + .cs_gpio_num = LCD_CS_GPIO, + .pclk_hz = 10 * 1000 * 1000, + .lcd_cmd_bits = 8, + .lcd_param_bits = 8, + .spi_mode = 0, + .trans_queue_depth = 10, + .on_color_trans_done = cb, + .user_ctx = NULL, + }; + esp_lcd_panel_dev_config_t panel_config = { + .reset_gpio_num = LCD_RST_GPIO, + .color_space = LCD_COLOR_SPACE, + .bits_per_pixel = 16, + }; + periph_lcd_cfg_t cfg = { + .io_bus = (void *)SPI2_HOST, + .new_panel_io = _get_lcd_io_bus, + .lcd_io_cfg = &io_config, + .new_lcd_panel = esp_lcd_new_panel_st7789, + .lcd_dev_cfg = &panel_config, + .rest_cb = NULL, + .rest_cb_ctx = NULL, + .lcd_swap_xy = LCD_SWAP_XY, + .lcd_mirror_x = LCD_MIRROR_X, + .lcd_mirror_y = LCD_MIRROR_Y, + .lcd_color_invert = LCD_COLOR_INV, + }; + esp_periph_handle_t periph_lcd = periph_lcd_init(&cfg); + AUDIO_NULL_CHECK(TAG, periph_lcd, return NULL); + esp_periph_start(set, periph_lcd); + + return (void *)periph_lcd_get_panel_handle(periph_lcd); +} + +esp_err_t audio_board_key_init(esp_periph_set_handle_t set) { + periph_adc_button_cfg_t adc_btn_cfg = PERIPH_ADC_BUTTON_DEFAULT_CONFIG(); + adc_arr_t adc_btn_tag = ADC_DEFAULT_ARR(); + adc_btn_tag.total_steps = 3; + adc_btn_tag.adc_ch = ADC1_CHANNEL_0; + int btn_array[4] = {190, 1000, 2195, 3000}; + adc_btn_tag.adc_level_step = btn_array; + adc_btn_cfg.arr = &adc_btn_tag; + adc_btn_cfg.arr_size = 1; + esp_periph_handle_t adc_btn_handle = periph_adc_button_init(&adc_btn_cfg); + AUDIO_NULL_CHECK(TAG, adc_btn_handle, return ESP_ERR_ADF_MEMORY_LACK); + return esp_periph_start(set, adc_btn_handle); +} + +esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, + periph_sdcard_mode_t mode) { + if (mode != SD_MODE_1_LINE) { + ESP_LOGE(TAG, "Current board only support 1-line SD mode!"); + return ESP_FAIL; + } + periph_sdcard_cfg_t sdcard_cfg = {.root = "/sdcard", + .card_detect_pin = get_sdcard_intr_gpio(), + .mode = mode}; + esp_periph_handle_t sdcard_handle = periph_sdcard_init(&sdcard_cfg); + esp_err_t ret = esp_periph_start(set, sdcard_handle); + int retry_time = 5; + bool mount_flag = false; + while (retry_time--) { + if (periph_sdcard_is_mounted(sdcard_handle)) { + mount_flag = true; + break; + } else { + vTaskDelay(500 / portTICK_PERIOD_MS); + } + } + if (mount_flag == false) { + ESP_LOGE(TAG, "Sdcard mount failed"); + return ESP_FAIL; + } + return ret; +} + +audio_board_handle_t audio_board_get_handle(void) { return board_handle; } + +esp_err_t audio_board_deinit(audio_board_handle_t audio_board) { + esp_err_t ret = ESP_OK; + ret |= audio_hal_deinit(audio_board->audio_hal); + ret |= audio_hal_deinit(audio_board->adc_hal); + audio_free(audio_board); + board_handle = NULL; + return ret; +} diff --git a/components/audio_board/esp32_s3_box_lite/board.h b/components/audio_board/esp32_s3_box_lite/board.h new file mode 100644 index 00000000..22b701a3 --- /dev/null +++ b/components/audio_board/esp32_s3_box_lite/board.h @@ -0,0 +1,135 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2022 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _AUDIO_BOARD_H_ +#define _AUDIO_BOARD_H_ + +#include "audio_hal.h" +#include "board_def.h" +#include "board_pins_config.h" +#include "display_service.h" +#include "esp_peripherals.h" +#include "periph_lcd.h" +#include "periph_sdcard.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Audio board handle + */ +struct audio_board_handle { + audio_hal_handle_t audio_hal; /*!< audio hardware abstract layer handle */ + audio_hal_handle_t adc_hal; /*!< adc hardware abstract layer handle */ +}; + +typedef struct audio_board_handle *audio_board_handle_t; + +/** + * @brief Initialize audio board + * + * @return The audio board handle + */ +audio_board_handle_t audio_board_init(void); + +/** + * @brief Initialize codec chip + * + * @return The audio hal handle + */ +audio_hal_handle_t audio_board_codec_init(void); + +/** + * @brief Initialize adc + * + * @return The adc hal handle + */ +audio_hal_handle_t audio_board_adc_init(void); + +/** + * @brief Initialize lcd peripheral + * + * @param set The handle of esp_periph_set_handle_t + * @param cb The `on_color_trans_done` callback in + * `esp_lcd_panel_io_spi_config_t` + * + * @return The `esp_lcd_panel_handle_t` handle + */ +void *audio_board_lcd_init(esp_periph_set_handle_t set, void *cb); + +/** + * @brief Initialize led peripheral and display service + * + * @return The audio display service handle + */ +display_service_handle_t audio_board_blue_led_init(void); + +/** + * @brief Initialize key peripheral + * + * @param set The handle of esp_periph_set_handle_t + * + * @return + * - ESP_OK, success + * - Others, fail + */ +esp_err_t audio_board_key_init(esp_periph_set_handle_t set); + +/** + * @brief Initialize sdcard peripheral + * + * @param set The handle of esp_periph_set_handle_t + * + * @return + * - ESP_OK, success + * - Others, fail + */ +esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, + periph_sdcard_mode_t mode); + +/** + * @brief Query audio_board_handle + * + * @return The audio board handle + */ +audio_board_handle_t audio_board_get_handle(void); + +/** + * @brief Uninitialize the audio board + * + * @param audio_board The handle of audio board + * + * @return 0 success, + * others fail + */ +esp_err_t audio_board_deinit(audio_board_handle_t audio_board); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/components/audio_board/esp32_s3_box_lite/board_def.h b/components/audio_board/esp32_s3_box_lite/board_def.h new file mode 100644 index 00000000..0c02a553 --- /dev/null +++ b/components/audio_board/esp32_s3_box_lite/board_def.h @@ -0,0 +1,127 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2022 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _AUDIO_BOARD_DEFINITION_H_ +#define _AUDIO_BOARD_DEFINITION_H_ + +/** + * @brief LCD SCREEN Function Definition + */ +#define FUNC_LCD_SCREEN_EN (1) +#define LCD_CTRL_GPIO GPIO_NUM_45 +#define LCD_RST_GPIO GPIO_NUM_48 +#define LCD_DC_GPIO GPIO_NUM_4 +#define LCD_CS_GPIO GPIO_NUM_5 +#define LCD_MOSI_GPIO GPIO_NUM_6 +#define LCD_CLK_GPIO GPIO_NUM_7 +// The LCD pixel number in horizontal and vertical +#define LCD_H_RES 320 +#define LCD_V_RES 240 +#define LCD_SWAP_XY (true) +#define LCD_MIRROR_X (false) +#define LCD_MIRROR_Y (true) +#define LCD_COLOR_INV (true) +#define LCD_COLOR_SPACE ESP_LCD_COLOR_SPACE_RGB + +/** + * @brief SDCARD Function Definition + * PMOD2 for one line sdcard + */ +#define FUNC_SDCARD_EN (1) +#define SDCARD_OPEN_FILE_NUM_MAX 5 +#define SDCARD_INTR_GPIO -1 +#define SDCARD_PWR_CTRL -1 +#define ESP_SD_PIN_CLK GPIO_NUM_13 +#define ESP_SD_PIN_CMD GPIO_NUM_11 +#define ESP_SD_PIN_D0 GPIO_NUM_14 +#define ESP_SD_PIN_D1 -1 +#define ESP_SD_PIN_D2 -1 +#define ESP_SD_PIN_D3 -1 +#define ESP_SD_PIN_D4 -1 +#define ESP_SD_PIN_D5 -1 +#define ESP_SD_PIN_D6 -1 +#define ESP_SD_PIN_D7 -1 +#define ESP_SD_PIN_CD -1 +#define ESP_SD_PIN_WP -1 + +/** + * @brief Audio Codec Chip Function Definition + */ +#define FUNC_AUDIO_CODEC_EN (1) +#define HEADPHONE_DETECT -1 +#define PA_ENABLE_GPIO GPIO_NUM_46 +#define CODEC_ADC_I2S_PORT (0) +#define CODEC_ADC_BITS_PER_SAMPLE I2S_BITS_PER_SAMPLE_32BIT +#define CODEC_ADC_SAMPLE_RATE (48000) +#define RECORD_HARDWARE_AEC (false) +#define BOARD_PA_GAIN (0) /* Power amplifier gain defined by board (dB) */ + +extern audio_hal_func_t AUDIO_CODEC_ES8156_DEFAULT_HANDLE; +extern audio_hal_func_t AUDIO_CODEC_ES7243E_DEFAULT_HANDLE; + +#define AUDIO_CODEC_DEFAULT_CONFIG() \ + { \ + .adc_input = AUDIO_HAL_ADC_INPUT_LINE1, \ + .dac_output = AUDIO_HAL_DAC_OUTPUT_ALL, \ + .codec_mode = AUDIO_HAL_CODEC_MODE_BOTH, \ + .i2s_iface = \ + { \ + .mode = AUDIO_HAL_MODE_SLAVE, \ + .fmt = AUDIO_HAL_I2S_NORMAL, \ + .samples = AUDIO_HAL_48K_SAMPLES, \ + .bits = AUDIO_HAL_BIT_LENGTH_16BITS, \ + }, \ + }; + +/** + * @brief Button Function Definition + */ +#define INPUT_KEY_NUM 3 +#define BUTTON_VOLUP_ID 0 +#define BUTTON_VOLDOWN_ID 1 +#define BUTTON_SET_ID 2 +#define BUTTON_PLAY_ID 3 +#define BUTTON_MODE_ID 4 +#define BUTTON_REC_ID 5 +#define INPUT_KEY_DEFAULT_INFO() \ + { \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_SET, \ + .act_id = BUTTON_SET_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_VOLUP, \ + .act_id = BUTTON_VOLUP_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, .user_id = INPUT_KEY_USER_ID_VOLDOWN, \ + .act_id = BUTTON_VOLDOWN_ID, \ + } \ + } + +#endif diff --git a/components/audio_board/esp32_s3_box_lite/board_pins_config.c b/components/audio_board/esp32_s3_box_lite/board_pins_config.c new file mode 100644 index 00000000..d403a569 --- /dev/null +++ b/components/audio_board/esp32_s3_box_lite/board_pins_config.c @@ -0,0 +1,129 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2022 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include + +#include "audio_error.h" +#include "audio_mem.h" +#include "board.h" +#include "driver/gpio.h" +#include "esp_log.h" +#include "soc/soc_caps.h" + +static const char *TAG = "ESP32_S3_BOX_LITE"; + +esp_err_t get_i2c_pins(i2c_port_t port, i2c_config_t *i2c_config) { + AUDIO_NULL_CHECK(TAG, i2c_config, return ESP_FAIL); + if (port == I2C_NUM_0 || port == I2C_NUM_1) { + i2c_config->sda_io_num = GPIO_NUM_8; + i2c_config->scl_io_num = GPIO_NUM_18; + } else { + i2c_config->sda_io_num = -1; + i2c_config->scl_io_num = -1; + ESP_LOGE(TAG, "i2c port %d is not supported", port); + return ESP_FAIL; + } + return ESP_OK; +} + +esp_err_t get_i2s_pins(i2s_port_t port, board_i2s_pin_t *i2s_config) { + AUDIO_NULL_CHECK(TAG, i2s_config, return ESP_FAIL); + if (port == I2S_NUM_0) { + i2s_config->bck_io_num = GPIO_NUM_17; + i2s_config->ws_io_num = GPIO_NUM_47; + i2s_config->data_out_num = GPIO_NUM_15; + i2s_config->data_in_num = GPIO_NUM_16; + i2s_config->mck_io_num = GPIO_NUM_2; + } else if (port == I2S_NUM_1) { + i2s_config->bck_io_num = -1; + i2s_config->ws_io_num = -1; + i2s_config->data_out_num = -1; + i2s_config->data_in_num = -1; + i2s_config->mck_io_num = -1; + } else { + memset(i2s_config, -1, sizeof(i2s_pin_config_t)); + ESP_LOGE(TAG, "i2s port %d is not supported", port); + return ESP_FAIL; + } + + return ESP_OK; +} + +esp_err_t get_spi_pins( + spi_bus_config_t *spi_config, + spi_device_interface_config_t *spi_device_interface_config) { + AUDIO_NULL_CHECK(TAG, spi_config, return ESP_FAIL); + AUDIO_NULL_CHECK(TAG, spi_device_interface_config, return ESP_FAIL); + + spi_config->mosi_io_num = -1; + spi_config->miso_io_num = -1; + spi_config->sclk_io_num = -1; + spi_config->quadwp_io_num = -1; + spi_config->quadhd_io_num = -1; + + spi_device_interface_config->spics_io_num = -1; + + ESP_LOGW(TAG, "SPI interface is not supported"); + return ESP_OK; +} + +// sdcard + +int8_t get_sdcard_intr_gpio(void) { return SDCARD_INTR_GPIO; } + +int8_t get_sdcard_open_file_num_max(void) { return SDCARD_OPEN_FILE_NUM_MAX; } + +int8_t get_sdcard_power_ctrl_gpio(void) { return SDCARD_PWR_CTRL; } + +// input-output pins + +int8_t get_headphone_detect_gpio(void) { return HEADPHONE_DETECT; } + +int8_t get_pa_enable_gpio(void) { return PA_ENABLE_GPIO; } + +int8_t get_es7243_mclk_gpio(void) { return GPIO_NUM_2; } + +// adc button id + +int8_t get_input_rec_id(void) { return BUTTON_REC_ID; } + +int8_t get_input_mode_id(void) { return BUTTON_MODE_ID; } + +int8_t get_input_set_id(void) { return BUTTON_SET_ID; } + +int8_t get_input_play_id(void) { return BUTTON_PLAY_ID; } + +int8_t get_input_volup_id(void) { return BUTTON_VOLUP_ID; } + +int8_t get_input_voldown_id(void) { return BUTTON_VOLDOWN_ID; } + +// led pins + +int8_t get_green_led_gpio(void) { return -1; } + +int8_t get_blue_led_gpio(void) { return -1; } + +int8_t get_es8311_mclk_src(void) { return -1; } diff --git a/components/audio_board/esp32_s3_korvo2_v3/board.c b/components/audio_board/esp32_s3_korvo2_v3/board.c new file mode 100644 index 00000000..5c19e205 --- /dev/null +++ b/components/audio_board/esp32_s3_korvo2_v3/board.c @@ -0,0 +1,201 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2021 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include "board.h" + +#include "audio_mem.h" +#include "esp_log.h" +#include "periph_adc_button.h" +#include "periph_sdcard.h" +#include "tca9554.h" + +static const char *TAG = "AUDIO_BOARD"; + +static audio_board_handle_t board_handle = 0; + +audio_board_handle_t audio_board_init(void) { + if (board_handle) { + ESP_LOGW(TAG, "The board has already been initialized!"); + return board_handle; + } + board_handle = + (audio_board_handle_t)audio_calloc(1, sizeof(struct audio_board_handle)); + AUDIO_MEM_CHECK(TAG, board_handle, return NULL); + board_handle->audio_hal = audio_board_codec_init(); + board_handle->adc_hal = audio_board_adc_init(); + return board_handle; +} + +audio_hal_handle_t audio_board_adc_init(void) { + audio_hal_codec_config_t audio_codec_cfg = AUDIO_CODEC_DEFAULT_CONFIG(); + audio_codec_cfg.codec_mode = AUDIO_HAL_CODEC_MODE_ENCODE; + audio_hal_handle_t adc_hal = NULL; + adc_hal = + audio_hal_init(&audio_codec_cfg, &AUDIO_CODEC_ES7210_DEFAULT_HANDLE); + AUDIO_NULL_CHECK(TAG, adc_hal, return NULL); + return adc_hal; +} + +audio_hal_handle_t audio_board_codec_init(void) { + audio_hal_codec_config_t audio_codec_cfg = AUDIO_CODEC_DEFAULT_CONFIG(); + audio_hal_handle_t codec_hal = + audio_hal_init(&audio_codec_cfg, &AUDIO_CODEC_ES8311_DEFAULT_HANDLE); + AUDIO_NULL_CHECK(TAG, codec_hal, return NULL); + return codec_hal; +} + +esp_err_t _lcd_rest(esp_periph_handle_t self, void *ctx) { + // Reset the LCD + tca9554_set_output_state(LCD_RST_GPIO, TCA9554_IO_LOW); + vTaskDelay(100 / portTICK_PERIOD_MS); + tca9554_set_output_state(LCD_RST_GPIO, TCA9554_IO_HIGH); + vTaskDelay(200 / portTICK_PERIOD_MS); + return ESP_OK; +} + +esp_err_t _get_lcd_io_bus(void *bus, esp_lcd_panel_io_spi_config_t *io_config, + esp_lcd_panel_io_handle_t *out_panel_io) { + return esp_lcd_new_panel_io_spi((esp_lcd_spi_bus_handle_t)bus, io_config, + out_panel_io); +} + +display_service_handle_t audio_board_led_init(void) { return NULL; } + +void *audio_board_lcd_init(esp_periph_set_handle_t set, void *cb) { + esp_tca9554_config_t pca_cfg = { + .i2c_scl = GPIO_NUM_18, + .i2c_sda = GPIO_NUM_17, + .interrupt_output = -1, + }; + tca9554_init(&pca_cfg); + // Set LCD_BL_CTRL output + tca9554_set_io_config(LCD_CTRL_GPIO, TCA9554_IO_OUTPUT); + // Set LCD_RST output + tca9554_set_io_config(LCD_RST_GPIO, TCA9554_IO_OUTPUT); + // Set LCD_CS pin output + tca9554_set_io_config(LCD_CS_GPIO, TCA9554_IO_OUTPUT); + + tca9554_set_output_state(LCD_CTRL_GPIO, TCA9554_IO_HIGH); + tca9554_set_output_state(LCD_CS_GPIO, TCA9554_IO_HIGH); + vTaskDelay(10 / portTICK_PERIOD_MS); + tca9554_set_output_state(LCD_CS_GPIO, TCA9554_IO_LOW); + vTaskDelay(10 / portTICK_PERIOD_MS); + + spi_bus_config_t buscfg = {.sclk_io_num = LCD_CLK_GPIO, + .mosi_io_num = LCD_MOSI_GPIO, + .miso_io_num = -1, + .quadwp_io_num = -1, + .quadhd_io_num = -1, + .max_transfer_sz = LCD_V_RES * LCD_H_RES * 2}; + ESP_ERROR_CHECK(spi_bus_initialize(SPI2_HOST, &buscfg, SPI_DMA_CH_AUTO)); + + esp_lcd_panel_io_spi_config_t io_config = { + .dc_gpio_num = LCD_DC_GPIO, + .cs_gpio_num = -1, + .pclk_hz = 60 * 1000 * 1000, + .lcd_cmd_bits = 8, + .lcd_param_bits = 8, + .spi_mode = 0, + .trans_queue_depth = 10, + .on_color_trans_done = cb, + .user_ctx = NULL, + }; + esp_lcd_panel_dev_config_t panel_config = { + .reset_gpio_num = -1, + .color_space = ESP_LCD_COLOR_SPACE_BGR, + .bits_per_pixel = 16, + }; + periph_lcd_cfg_t cfg = { + .io_bus = (void *)SPI2_HOST, + .new_panel_io = _get_lcd_io_bus, + .lcd_io_cfg = &io_config, + .new_lcd_panel = esp_lcd_new_panel_st7789, + .lcd_dev_cfg = &panel_config, + .rest_cb = _lcd_rest, + .rest_cb_ctx = NULL, + .lcd_swap_xy = LCD_SWAP_XY, + .lcd_mirror_x = LCD_MIRROR_X, + .lcd_mirror_y = LCD_MIRROR_Y, + .lcd_color_invert = LCD_COLOR_INV, + }; + esp_periph_handle_t periph_lcd = periph_lcd_init(&cfg); + AUDIO_NULL_CHECK(TAG, periph_lcd, return NULL); + esp_periph_start(set, periph_lcd); + return (void *)periph_lcd_get_panel_handle(periph_lcd); +} + +esp_err_t audio_board_key_init(esp_periph_set_handle_t set) { + periph_adc_button_cfg_t adc_btn_cfg = PERIPH_ADC_BUTTON_DEFAULT_CONFIG(); + adc_arr_t adc_btn_tag = ADC_DEFAULT_ARR(); + adc_btn_tag.total_steps = 6; + adc_btn_tag.adc_ch = ADC1_CHANNEL_4; + int btn_array[7] = {190, 600, 1000, 1375, 1775, 2195, 3000}; + adc_btn_tag.adc_level_step = btn_array; + adc_btn_cfg.arr = &adc_btn_tag; + adc_btn_cfg.arr_size = 1; + esp_periph_handle_t adc_btn_handle = periph_adc_button_init(&adc_btn_cfg); + AUDIO_NULL_CHECK(TAG, adc_btn_handle, return ESP_ERR_ADF_MEMORY_LACK); + return esp_periph_start(set, adc_btn_handle); +} + +esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, + periph_sdcard_mode_t mode) { + if (mode != SD_MODE_1_LINE) { + ESP_LOGE(TAG, "Current board only support 1-line SD mode!"); + return ESP_FAIL; + } + periph_sdcard_cfg_t sdcard_cfg = {.root = "/sdcard", + .card_detect_pin = get_sdcard_intr_gpio(), + .mode = mode}; + esp_periph_handle_t sdcard_handle = periph_sdcard_init(&sdcard_cfg); + esp_err_t ret = esp_periph_start(set, sdcard_handle); + int retry_time = 5; + bool mount_flag = false; + while (retry_time--) { + if (periph_sdcard_is_mounted(sdcard_handle)) { + mount_flag = true; + break; + } else { + vTaskDelay(500 / portTICK_PERIOD_MS); + } + } + if (mount_flag == false) { + ESP_LOGE(TAG, "Sdcard mount failed"); + return ESP_FAIL; + } + return ret; +} + +audio_board_handle_t audio_board_get_handle(void) { return board_handle; } + +esp_err_t audio_board_deinit(audio_board_handle_t audio_board) { + esp_err_t ret = ESP_OK; + ret |= audio_hal_deinit(audio_board->audio_hal); + ret |= audio_hal_deinit(audio_board->adc_hal); + audio_free(audio_board); + board_handle = NULL; + return ret; +} diff --git a/components/audio_board/esp32_s3_korvo2_v3/board.h b/components/audio_board/esp32_s3_korvo2_v3/board.h new file mode 100644 index 00000000..d775791c --- /dev/null +++ b/components/audio_board/esp32_s3_korvo2_v3/board.h @@ -0,0 +1,142 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2021 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _AUDIO_BOARD_H_ +#define _AUDIO_BOARD_H_ + +#include "audio_hal.h" +#include "board_def.h" +#include "board_pins_config.h" +#include "display_service.h" +#include "esp_peripherals.h" +#include "periph_lcd.h" +#include "periph_sdcard.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Audio board handle + */ +struct audio_board_handle { + audio_hal_handle_t audio_hal; /*!< audio hardware abstract layer handle */ + audio_hal_handle_t adc_hal; /*!< adc hardware abstract layer handle */ +}; + +typedef struct audio_board_handle *audio_board_handle_t; + +/** + * @brief Initialize audio board + * + * @return The audio board handle + */ +audio_board_handle_t audio_board_init(void); + +/** + * @brief Initialize codec chip + * + * @return The audio hal handle + */ +audio_hal_handle_t audio_board_codec_init(void); + +/** + * @brief Initialize adc + * + * @return The adc hal handle + */ +audio_hal_handle_t audio_board_adc_init(void); + +/** + * @brief Initialize lcd peripheral + * + * @param set The handle of esp_periph_set_handle_t + * @param cb The `on_color_trans_done` callback in + * `esp_lcd_panel_io_spi_config_t` + * + * @return The `esp_lcd_panel_handle_t` handle + */ +void *audio_board_lcd_init(esp_periph_set_handle_t set, void *cb); + +/** + * @brief Initialize led peripheral and display service + * + * @return The audio display service handle + */ +display_service_handle_t audio_board_led_init(void); + +/** + * @brief Initialize led peripheral and display service + * + * @return The audio display service handle + */ +display_service_handle_t audio_board_blue_led_init(void); + +/** + * @brief Initialize key peripheral + * + * @param set The handle of esp_periph_set_handle_t + * + * @return + * - ESP_OK, success + * - Others, fail + */ +esp_err_t audio_board_key_init(esp_periph_set_handle_t set); + +/** + * @brief Initialize sdcard peripheral + * + * @param set The handle of esp_periph_set_handle_t + * + * @return + * - ESP_OK, success + * - Others, fail + */ +esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, + periph_sdcard_mode_t mode); + +/** + * @brief Query audio_board_handle + * + * @return The audio board handle + */ +audio_board_handle_t audio_board_get_handle(void); + +/** + * @brief Uninitialize the audio board + * + * @param audio_board The handle of audio board + * + * @return 0 success, + * others fail + */ +esp_err_t audio_board_deinit(audio_board_handle_t audio_board); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/components/audio_board/esp32_s3_korvo2_v3/board_def.h b/components/audio_board/esp32_s3_korvo2_v3/board_def.h new file mode 100644 index 00000000..76c98530 --- /dev/null +++ b/components/audio_board/esp32_s3_korvo2_v3/board_def.h @@ -0,0 +1,182 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2021 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _AUDIO_BOARD_DEFINITION_H_ +#define _AUDIO_BOARD_DEFINITION_H_ + +/** + * @brief LED Function Definition + */ +#define GREEN_LED_GPIO -1 +#define BLUE_LED_GPIO BIT(7) // TCA9554_GPIO_NUM_7 +#define RED_LED_GPIO BIT(6) // TCA9554_GPIO_NUM_6 + +/** + * @brief LCD SCREEN Function Definition + */ +#define FUNC_LCD_SCREEN_EN (1) +#define LCD_CTRL_GPIO BIT(1) // TCA9554_GPIO_NUM_1 +#define LCD_RST_GPIO BIT(2) // TCA9554_GPIO_NUM_2 +#define LCD_CS_GPIO BIT(3) // TCA9554_GPIO_NUM_3 +// LCD SPI Pins +#define LCD_DC_GPIO GPIO_NUM_2 +#define LCD_CLK_GPIO GPIO_NUM_1 +#define LCD_MOSI_GPIO GPIO_NUM_0 +// The LCD pixel number in horizontal and vertical +#define LCD_H_RES 320 +#define LCD_V_RES 240 +#define LCD_SWAP_XY (false) +#define LCD_MIRROR_X (true) +#define LCD_MIRROR_Y (true) +#define LCD_COLOR_INV (false) + +/** + * @brief SDCARD Function Definition + */ +#define FUNC_SDCARD_EN (1) +#define SDCARD_OPEN_FILE_NUM_MAX 5 +#define SDCARD_INTR_GPIO -1 +#define SDCARD_PWR_CTRL -1 + +#define ESP_SD_PIN_CLK GPIO_NUM_15 +#define ESP_SD_PIN_CMD GPIO_NUM_7 +#define ESP_SD_PIN_D0 GPIO_NUM_4 +#define ESP_SD_PIN_D1 -1 +#define ESP_SD_PIN_D2 -1 +#define ESP_SD_PIN_D3 -1 +#define ESP_SD_PIN_D4 -1 +#define ESP_SD_PIN_D5 -1 +#define ESP_SD_PIN_D6 -1 +#define ESP_SD_PIN_D7 -1 +#define ESP_SD_PIN_CD -1 +#define ESP_SD_PIN_WP -1 + +/** + * @brief Camera Function Definition + */ +#define FUNC_CAMERA_EN (1) +#define CAM_PIN_PWDN -1 +#define CAM_PIN_RESET -1 +#define CAM_PIN_XCLK GPIO_NUM_40 +#define CAM_PIN_SIOD GPIO_NUM_17 +#define CAM_PIN_SIOC GPIO_NUM_18 + +#define CAM_PIN_D7 GPIO_NUM_39 +#define CAM_PIN_D6 GPIO_NUM_41 +#define CAM_PIN_D5 GPIO_NUM_42 +#define CAM_PIN_D4 GPIO_NUM_12 +#define CAM_PIN_D3 GPIO_NUM_3 +#define CAM_PIN_D2 GPIO_NUM_14 +#define CAM_PIN_D1 GPIO_NUM_47 +#define CAM_PIN_D0 GPIO_NUM_13 +#define CAM_PIN_VSYNC GPIO_NUM_21 +#define CAM_PIN_HREF GPIO_NUM_38 +#define CAM_PIN_PCLK GPIO_NUM_11 + +/** + * @brief LCD TOUCH PANEL Function Definition + */ +#define FUNC_LCD_TOUCH_EN (1) +#define TOUCH_PANEL_SWAP_XY (0) +#define TOUCH_PANEL_INVERSE_X (1) +#define TOUCH_PANEL_INVERSE_Y (0) + +/** + * @brief Audio Codec Chip Function Definition + */ +#define FUNC_AUDIO_CODEC_EN (1) +#define ES8311_MCLK_SOURCE (0) /* 0 From MCLK of esp32 1 From BCLK */ +#define HEADPHONE_DETECT (-1) +#define PA_ENABLE_GPIO GPIO_NUM_48 +#define CODEC_ADC_I2S_PORT (0) +#define CODEC_ADC_BITS_PER_SAMPLE I2S_BITS_PER_SAMPLE_32BIT +#define CODEC_ADC_SAMPLE_RATE (48000) +#define RECORD_HARDWARE_AEC (true) +#define BOARD_PA_GAIN (6) /* Power amplifier gain defined by board (dB) */ + +extern audio_hal_func_t AUDIO_CODEC_ES8311_DEFAULT_HANDLE; +extern audio_hal_func_t AUDIO_CODEC_ES7210_DEFAULT_HANDLE; + +#define AUDIO_CODEC_DEFAULT_CONFIG() \ + { \ + .adc_input = AUDIO_HAL_ADC_INPUT_LINE1, \ + .dac_output = AUDIO_HAL_DAC_OUTPUT_ALL, \ + .codec_mode = AUDIO_HAL_CODEC_MODE_BOTH, \ + .i2s_iface = \ + { \ + .mode = AUDIO_HAL_MODE_SLAVE, \ + .fmt = AUDIO_HAL_I2S_NORMAL, \ + .samples = AUDIO_HAL_48K_SAMPLES, \ + .bits = AUDIO_HAL_BIT_LENGTH_16BITS, \ + }, \ + }; + +/** + * @brief Button Function Definition + */ +#define FUNC_BUTTON_EN (1) +#define INPUT_KEY_NUM 6 +#define BUTTON_VOLUP_ID 0 +#define BUTTON_VOLDOWN_ID 1 +#define BUTTON_SET_ID 2 +#define BUTTON_PLAY_ID 3 +#define BUTTON_MODE_ID 4 +#define BUTTON_REC_ID 5 + +#define INPUT_KEY_DEFAULT_INFO() \ + { \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_REC, \ + .act_id = BUTTON_REC_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_MUTE, \ + .act_id = BUTTON_MODE_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_SET, \ + .act_id = BUTTON_SET_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_PLAY, \ + .act_id = BUTTON_PLAY_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_VOLUP, \ + .act_id = BUTTON_VOLUP_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, .user_id = INPUT_KEY_USER_ID_VOLDOWN, \ + .act_id = BUTTON_VOLDOWN_ID, \ + } \ + } + +#endif diff --git a/components/audio_board/esp32_s3_korvo2_v3/board_pins_config.c b/components/audio_board/esp32_s3_korvo2_v3/board_pins_config.c new file mode 100644 index 00000000..9dd64ed9 --- /dev/null +++ b/components/audio_board/esp32_s3_korvo2_v3/board_pins_config.c @@ -0,0 +1,127 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2021 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include + +#include "audio_error.h" +#include "audio_mem.h" +#include "board.h" +#include "driver/gpio.h" +#include "esp_log.h" +#include "soc/soc_caps.h" + +static const char *TAG = "ESP32_S3_KORVO_2"; + +esp_err_t get_i2c_pins(i2c_port_t port, i2c_config_t *i2c_config) { + AUDIO_NULL_CHECK(TAG, i2c_config, return ESP_FAIL); + if (port == I2C_NUM_0 || port == I2C_NUM_1) { + i2c_config->sda_io_num = GPIO_NUM_17; + i2c_config->scl_io_num = GPIO_NUM_18; + } else { + i2c_config->sda_io_num = -1; + i2c_config->scl_io_num = -1; + ESP_LOGE(TAG, "i2c port %d is not supported", port); + return ESP_FAIL; + } + return ESP_OK; +} + +esp_err_t get_i2s_pins(i2s_port_t port, board_i2s_pin_t *i2s_config) { + AUDIO_NULL_CHECK(TAG, i2s_config, return ESP_FAIL); + if (port == I2S_NUM_0) { + i2s_config->bck_io_num = GPIO_NUM_9; + i2s_config->ws_io_num = GPIO_NUM_45; + i2s_config->data_out_num = GPIO_NUM_8; + i2s_config->data_in_num = GPIO_NUM_10; + i2s_config->mck_io_num = GPIO_NUM_16; + } else if (port == I2S_NUM_1) { + i2s_config->bck_io_num = -1; + i2s_config->ws_io_num = -1; + i2s_config->data_out_num = -1; + i2s_config->data_in_num = -1; + i2s_config->mck_io_num = -1; + } else { + memset(i2s_config, -1, sizeof(board_i2s_pin_t)); + ESP_LOGE(TAG, "i2s port %d is not supported", port); + return ESP_FAIL; + } + + return ESP_OK; +} + +esp_err_t get_spi_pins( + spi_bus_config_t *spi_config, + spi_device_interface_config_t *spi_device_interface_config) { + AUDIO_NULL_CHECK(TAG, spi_config, return ESP_FAIL); + AUDIO_NULL_CHECK(TAG, spi_device_interface_config, return ESP_FAIL); + + spi_config->mosi_io_num = -1; + spi_config->miso_io_num = -1; + spi_config->sclk_io_num = -1; + spi_config->quadwp_io_num = -1; + spi_config->quadhd_io_num = -1; + + spi_device_interface_config->spics_io_num = -1; + + ESP_LOGW(TAG, "SPI interface is not supported"); + return ESP_OK; +} + +// sdcard + +int8_t get_sdcard_intr_gpio(void) { return SDCARD_INTR_GPIO; } + +int8_t get_sdcard_open_file_num_max(void) { return SDCARD_OPEN_FILE_NUM_MAX; } + +int8_t get_sdcard_power_ctrl_gpio(void) { return SDCARD_PWR_CTRL; } + +// input-output pins + +int8_t get_headphone_detect_gpio(void) { return HEADPHONE_DETECT; } + +int8_t get_pa_enable_gpio(void) { return PA_ENABLE_GPIO; } + +// adc button id + +int8_t get_input_rec_id(void) { return BUTTON_REC_ID; } + +int8_t get_input_mode_id(void) { return BUTTON_MODE_ID; } + +int8_t get_input_set_id(void) { return BUTTON_SET_ID; } + +int8_t get_input_play_id(void) { return BUTTON_PLAY_ID; } + +int8_t get_input_volup_id(void) { return BUTTON_VOLUP_ID; } + +int8_t get_input_voldown_id(void) { return BUTTON_VOLDOWN_ID; } + +// led pins + +int8_t get_green_led_gpio(void) { return GREEN_LED_GPIO; } + +int8_t get_blue_led_gpio(void) { return BLUE_LED_GPIO; } + +int8_t get_es8311_mclk_src(void) { return ES8311_MCLK_SOURCE; } diff --git a/components/audio_board/esp32_s3_korvo2l_v1/board.c b/components/audio_board/esp32_s3_korvo2l_v1/board.c new file mode 100644 index 00000000..6094ef60 --- /dev/null +++ b/components/audio_board/esp32_s3_korvo2l_v1/board.c @@ -0,0 +1,206 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2022 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include "board.h" + +#include "audio_mem.h" +#include "esp_log.h" +#include "periph_adc_button.h" +#include "periph_sdcard.h" +#include "tca9554.h" + +static const char *TAG = "AUDIO_BOARD"; + +static audio_board_handle_t board_handle = 0; + +audio_board_handle_t audio_board_init(void) { + if (board_handle) { + ESP_LOGW(TAG, "The board has already been initialized!"); + return board_handle; + } + board_handle = + (audio_board_handle_t)audio_calloc(1, sizeof(struct audio_board_handle)); + AUDIO_MEM_CHECK(TAG, board_handle, return NULL); + board_handle->audio_hal = audio_board_codec_init(); + return board_handle; +} + +audio_hal_handle_t audio_board_codec_init(void) { + audio_hal_codec_config_t audio_codec_cfg = AUDIO_CODEC_DEFAULT_CONFIG(); + audio_hal_handle_t codec_hal = + audio_hal_init(&audio_codec_cfg, &AUDIO_CODEC_ES8311_DEFAULT_HANDLE); + AUDIO_NULL_CHECK(TAG, codec_hal, return NULL); + return codec_hal; +} + +esp_err_t audio_board_usb_cam_init(void) { + gpio_config_t usb_camera_pins_cfg = { + .intr_type = GPIO_INTR_DISABLE, + .mode = GPIO_MODE_OUTPUT, + .pin_bit_mask = (BIT64(USB_CAM_PIN_PWDN)), + .pull_up_en = 0, + .pull_down_en = 0, + }; + gpio_config(&usb_camera_pins_cfg); + gpio_set_level(USB_CAM_PIN_PWDN, 0); + + return ESP_OK; +} + +esp_err_t _lcd_rest(esp_periph_handle_t self, void *ctx) { + // Reset the LCD + tca9554_set_output_state(LCD_RST_GPIO, TCA9554_IO_LOW); + vTaskDelay(10 / portTICK_PERIOD_MS); + tca9554_set_output_state(LCD_RST_GPIO, TCA9554_IO_HIGH); + vTaskDelay(10 / portTICK_PERIOD_MS); + return ESP_OK; +} + +esp_err_t _get_lcd_io_bus(void *bus, esp_lcd_panel_io_spi_config_t *io_config, + esp_lcd_panel_io_handle_t *out_panel_io) { + return esp_lcd_new_panel_io_spi((esp_lcd_spi_bus_handle_t)bus, io_config, + out_panel_io); +} + +display_service_handle_t audio_board_led_init(void) { return NULL; } + +void *audio_board_lcd_init(esp_periph_set_handle_t set, void *cb) { + esp_tca9554_config_t pca_cfg = { + .i2c_scl = GPIO_NUM_18, + .i2c_sda = GPIO_NUM_17, + .interrupt_output = -1, + }; + tca9554_init(&pca_cfg); + // Set LCD_BL_CTRL output + tca9554_set_io_config(LCD_CTRL_GPIO, TCA9554_IO_OUTPUT); + // Set LCD_RST output + tca9554_set_io_config(LCD_RST_GPIO, TCA9554_IO_OUTPUT); + // Set LCD_CS pin output + tca9554_set_io_config(LCD_CS_GPIO, TCA9554_IO_OUTPUT); + + tca9554_set_output_state(LCD_CTRL_GPIO, TCA9554_IO_HIGH); + tca9554_set_output_state(LCD_CS_GPIO, TCA9554_IO_HIGH); + vTaskDelay(10 / portTICK_PERIOD_MS); + tca9554_set_output_state(LCD_CS_GPIO, TCA9554_IO_LOW); + vTaskDelay(10 / portTICK_PERIOD_MS); + + spi_bus_config_t buscfg = {.sclk_io_num = LCD_CLK_GPIO, + .mosi_io_num = LCD_MOSI_GPIO, + .miso_io_num = -1, + .quadwp_io_num = -1, + .quadhd_io_num = -1, + .max_transfer_sz = LCD_V_RES * LCD_H_RES * 2}; + ESP_ERROR_CHECK(spi_bus_initialize(SPI2_HOST, &buscfg, SPI_DMA_CH_AUTO)); + + esp_lcd_panel_io_spi_config_t io_config = { + .dc_gpio_num = LCD_DC_GPIO, + .cs_gpio_num = -1, + .pclk_hz = 60 * 1000 * 1000, + .lcd_cmd_bits = 8, + .lcd_param_bits = 8, + .spi_mode = 0, + .trans_queue_depth = 10, + .on_color_trans_done = cb, + .user_ctx = NULL, + }; + esp_lcd_panel_dev_config_t panel_config = { + .reset_gpio_num = -1, + .color_space = ESP_LCD_COLOR_SPACE_BGR, + .bits_per_pixel = 16, + }; + periph_lcd_cfg_t cfg = { + .io_bus = (void *)SPI2_HOST, + .new_panel_io = _get_lcd_io_bus, + .lcd_io_cfg = &io_config, + .new_lcd_panel = esp_lcd_new_panel_st7789, + .lcd_dev_cfg = &panel_config, + .rest_cb = _lcd_rest, + .rest_cb_ctx = NULL, + .lcd_swap_xy = LCD_SWAP_XY, + .lcd_mirror_x = LCD_MIRROR_X, + .lcd_mirror_y = LCD_MIRROR_Y, + .lcd_color_invert = LCD_COLOR_INV, + }; + esp_periph_handle_t periph_lcd = periph_lcd_init(&cfg); + AUDIO_NULL_CHECK(TAG, periph_lcd, return NULL); + + esp_periph_start(set, periph_lcd); + vTaskDelay(200 / portTICK_PERIOD_MS); + + return (void *)periph_lcd_get_panel_handle(periph_lcd); +} + +esp_err_t audio_board_key_init(esp_periph_set_handle_t set) { + periph_adc_button_cfg_t adc_btn_cfg = PERIPH_ADC_BUTTON_DEFAULT_CONFIG(); + adc_arr_t adc_btn_tag = ADC_DEFAULT_ARR(); + adc_btn_tag.total_steps = 6; + adc_btn_tag.adc_ch = ADC1_CHANNEL_4; + int btn_array[7] = {190, 600, 1000, 1375, 1775, 2195, 3000}; + adc_btn_tag.adc_level_step = btn_array; + adc_btn_cfg.arr = &adc_btn_tag; + adc_btn_cfg.arr_size = 1; + esp_periph_handle_t adc_btn_handle = periph_adc_button_init(&adc_btn_cfg); + AUDIO_NULL_CHECK(TAG, adc_btn_handle, return ESP_ERR_ADF_MEMORY_LACK); + return esp_periph_start(set, adc_btn_handle); +} + +esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, + periph_sdcard_mode_t mode) { + if (mode != SD_MODE_1_LINE) { + ESP_LOGE(TAG, "Current board only support 1-line SD mode!"); + return ESP_FAIL; + } + periph_sdcard_cfg_t sdcard_cfg = {.root = "/sdcard", + .card_detect_pin = get_sdcard_intr_gpio(), + .mode = mode}; + esp_periph_handle_t sdcard_handle = periph_sdcard_init(&sdcard_cfg); + esp_err_t ret = esp_periph_start(set, sdcard_handle); + int retry_time = 5; + bool mount_flag = false; + while (retry_time--) { + if (periph_sdcard_is_mounted(sdcard_handle)) { + mount_flag = true; + break; + } else { + vTaskDelay(500 / portTICK_PERIOD_MS); + } + } + if (mount_flag == false) { + ESP_LOGE(TAG, "Sdcard mount failed"); + return ESP_FAIL; + } + return ret; +} + +audio_board_handle_t audio_board_get_handle(void) { return board_handle; } + +esp_err_t audio_board_deinit(audio_board_handle_t audio_board) { + esp_err_t ret = ESP_OK; + ret |= audio_hal_deinit(audio_board->audio_hal); + audio_free(audio_board); + board_handle = NULL; + return ret; +} diff --git a/components/audio_board/esp32_s3_korvo2l_v1/board.h b/components/audio_board/esp32_s3_korvo2l_v1/board.h new file mode 100644 index 00000000..779a8e83 --- /dev/null +++ b/components/audio_board/esp32_s3_korvo2l_v1/board.h @@ -0,0 +1,143 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2022 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _AUDIO_BOARD_H_ +#define _AUDIO_BOARD_H_ + +#include "audio_hal.h" +#include "board_def.h" +#include "board_pins_config.h" +#include "display_service.h" +#include "esp_peripherals.h" +#include "periph_lcd.h" +#include "periph_sdcard.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Audio board handle + */ +struct audio_board_handle { + audio_hal_handle_t audio_hal; /*!< audio hardware abstract layer handle */ +}; + +typedef struct audio_board_handle *audio_board_handle_t; + +/** + * @brief Initialize audio board + * + * @return The audio board handle + */ +audio_board_handle_t audio_board_init(void); + +/** + * @brief Initialize codec chip + * + * @return The audio hal handle + */ +audio_hal_handle_t audio_board_codec_init(void); + +/** + * @brief Initialize USB Camera peripheral + * @note Just power on the USB camera + * + * @return + * - ESP_OK, success + */ +esp_err_t audio_board_usb_cam_init(void); + +/** + * @brief Initialize lcd peripheral + * + * @param set The handle of esp_periph_set_handle_t + * @param cb The `on_color_trans_done` callback in + * `esp_lcd_panel_io_spi_config_t` + * + * @return The `esp_lcd_panel_handle_t` handle + */ +void *audio_board_lcd_init(esp_periph_set_handle_t set, void *cb); + +/** + * @brief Initialize led peripheral and display service + * + * @return The audio display service handle + */ +display_service_handle_t audio_board_led_init(void); + +/** + * @brief Initialize led peripheral and display service + * + * @return The audio display service handle + */ +display_service_handle_t audio_board_blue_led_init(void); + +/** + * @brief Initialize key peripheral + * + * @param set The handle of esp_periph_set_handle_t + * + * @return + * - ESP_OK, success + * - Others, fail + */ +esp_err_t audio_board_key_init(esp_periph_set_handle_t set); + +/** + * @brief Initialize sdcard peripheral + * + * @param set The handle of esp_periph_set_handle_t + * + * @return + * - ESP_OK, success + * - Others, fail + */ +esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, + periph_sdcard_mode_t mode); + +/** + * @brief Query audio_board_handle + * + * @return The audio board handle + */ +audio_board_handle_t audio_board_get_handle(void); + +/** + * @brief Uninitialize the audio board + * + * @param audio_board The handle of audio board + * + * @return 0 success, + * others fail + */ +esp_err_t audio_board_deinit(audio_board_handle_t audio_board); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/components/audio_board/esp32_s3_korvo2l_v1/board_def.h b/components/audio_board/esp32_s3_korvo2l_v1/board_def.h new file mode 100644 index 00000000..dda5bc1d --- /dev/null +++ b/components/audio_board/esp32_s3_korvo2l_v1/board_def.h @@ -0,0 +1,186 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2022 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _AUDIO_BOARD_DEFINITION_H_ +#define _AUDIO_BOARD_DEFINITION_H_ + +/** + * @brief LED Function Definition + */ +#define GREEN_LED_GPIO -1 +#define BLUE_LED_GPIO BIT(7) // TCA9554_GPIO_NUM_7 +#define RED_LED_GPIO BIT(6) // TCA9554_GPIO_NUM_6 + +/** + * @brief LCD SCREEN Function Definition + */ +#define FUNC_LCD_SCREEN_EN (1) +#define LCD_CTRL_GPIO BIT(1) // TCA9554_GPIO_NUM_1 +#define LCD_RST_GPIO BIT(2) // TCA9554_GPIO_NUM_2 +#define LCD_CS_GPIO BIT(3) // TCA9554_GPIO_NUM_3 +// LCD SPI Pins +#define LCD_DC_GPIO GPIO_NUM_2 +#define LCD_CLK_GPIO GPIO_NUM_1 +#define LCD_MOSI_GPIO GPIO_NUM_0 +// The LCD pixel number in horizontal and vertical +#define LCD_H_RES 320 +#define LCD_V_RES 240 +#define LCD_SWAP_XY (false) +#define LCD_MIRROR_X (true) +#define LCD_MIRROR_Y (true) +#define LCD_COLOR_INV (false) + +/** + * @brief SDCARD Function Definition + */ +#define FUNC_SDCARD_EN (1) +#define SDCARD_OPEN_FILE_NUM_MAX 5 +#define SDCARD_INTR_GPIO -1 +#define SDCARD_PWR_CTRL -1 + +#define ESP_SD_PIN_CLK GPIO_NUM_6 +#define ESP_SD_PIN_CMD GPIO_NUM_7 +#define ESP_SD_PIN_D0 GPIO_NUM_4 +#define ESP_SD_PIN_D1 -1 +#define ESP_SD_PIN_D2 -1 +#define ESP_SD_PIN_D3 -1 +#define ESP_SD_PIN_D4 -1 +#define ESP_SD_PIN_D5 -1 +#define ESP_SD_PIN_D6 -1 +#define ESP_SD_PIN_D7 -1 +#define ESP_SD_PIN_CD -1 +#define ESP_SD_PIN_WP -1 + +/** + * @brief Camera Function Definition + */ +#define FUNC_CAMERA_EN (1) +#define CAM_PIN_PWDN -1 +#define CAM_PIN_RESET -1 +#define CAM_PIN_XCLK GPIO_NUM_40 +#define CAM_PIN_SIOD GPIO_NUM_17 +#define CAM_PIN_SIOC GPIO_NUM_18 + +#define CAM_PIN_D7 GPIO_NUM_39 +#define CAM_PIN_D6 GPIO_NUM_41 +#define CAM_PIN_D5 GPIO_NUM_42 +#define CAM_PIN_D4 GPIO_NUM_12 +#define CAM_PIN_D3 GPIO_NUM_3 +#define CAM_PIN_D2 GPIO_NUM_14 +#define CAM_PIN_D1 GPIO_NUM_47 +#define CAM_PIN_D0 GPIO_NUM_13 +#define CAM_PIN_VSYNC GPIO_NUM_21 +#define CAM_PIN_HREF GPIO_NUM_38 +#define CAM_PIN_PCLK GPIO_NUM_11 + +#define FUNC_USB_CAMERA_EN (1) +#define USB_CAM_PIN_PWDN GPIO_NUM_48 +#define USB_CAM_PIN_DP GPIO_NUM_19 +#define USB_CAM_PIN_DM GPIO_NUM_20 + +/** + * @brief LCD TOUCH PANEL Function Definition + */ +#define FUNC_LCD_TOUCH_EN (1) +#define TOUCH_PANEL_SWAP_XY (0) +#define TOUCH_PANEL_INVERSE_X (1) +#define TOUCH_PANEL_INVERSE_Y (0) + +/** + * @brief Audio Codec Chip Function Definition + */ +#define FUNC_AUDIO_CODEC_EN (1) +#define ES8311_MCLK_SOURCE (1) /* 0 From MCLK of esp32 1 From BCLK */ +#define HEADPHONE_DETECT (-1) +#define PA_ENABLE_GPIO GPIO_NUM_46 +#define CODEC_ADC_I2S_PORT (0) +#define CODEC_ADC_BITS_PER_SAMPLE I2S_BITS_PER_SAMPLE_16BIT +#define CODEC_ADC_SAMPLE_RATE (48000) +#define RECORD_HARDWARE_AEC (true) +#define BOARD_PA_GAIN (6) /* Power amplifier gain defined by board (dB) */ + +extern audio_hal_func_t AUDIO_CODEC_ES8311_DEFAULT_HANDLE; + +#define AUDIO_CODEC_DEFAULT_CONFIG() \ + { \ + .adc_input = AUDIO_HAL_ADC_INPUT_LINE1, \ + .dac_output = AUDIO_HAL_DAC_OUTPUT_ALL, \ + .codec_mode = AUDIO_HAL_CODEC_MODE_BOTH, \ + .i2s_iface = \ + { \ + .mode = AUDIO_HAL_MODE_SLAVE, \ + .fmt = AUDIO_HAL_I2S_NORMAL, \ + .samples = AUDIO_HAL_48K_SAMPLES, \ + .bits = AUDIO_HAL_BIT_LENGTH_16BITS, \ + }, \ + }; + +/** + * @brief Button Function Definition + */ +#define FUNC_BUTTON_EN (1) +#define INPUT_KEY_NUM 6 +#define BUTTON_VOLUP_ID 0 +#define BUTTON_VOLDOWN_ID 1 +#define BUTTON_SET_ID 2 +#define BUTTON_PLAY_ID 3 +#define BUTTON_MODE_ID 4 +#define BUTTON_REC_ID 5 + +#define INPUT_KEY_DEFAULT_INFO() \ + { \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_REC, \ + .act_id = BUTTON_REC_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_MUTE, \ + .act_id = BUTTON_MODE_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_SET, \ + .act_id = BUTTON_SET_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_PLAY, \ + .act_id = BUTTON_PLAY_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_VOLUP, \ + .act_id = BUTTON_VOLUP_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, .user_id = INPUT_KEY_USER_ID_VOLDOWN, \ + .act_id = BUTTON_VOLDOWN_ID, \ + } \ + } + +#endif diff --git a/components/audio_board/esp32_s3_korvo2l_v1/board_pins_config.c b/components/audio_board/esp32_s3_korvo2l_v1/board_pins_config.c new file mode 100644 index 00000000..6c48cf20 --- /dev/null +++ b/components/audio_board/esp32_s3_korvo2l_v1/board_pins_config.c @@ -0,0 +1,127 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2022 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include + +#include "audio_error.h" +#include "audio_mem.h" +#include "board.h" +#include "driver/gpio.h" +#include "esp_log.h" +#include "soc/soc_caps.h" + +static const char *TAG = "ESP32_S3_KORVO_2L"; + +esp_err_t get_i2c_pins(i2c_port_t port, i2c_config_t *i2c_config) { + AUDIO_NULL_CHECK(TAG, i2c_config, return ESP_FAIL); + if (port == I2C_NUM_0 || port == I2C_NUM_1) { + i2c_config->sda_io_num = GPIO_NUM_17; + i2c_config->scl_io_num = GPIO_NUM_18; + } else { + i2c_config->sda_io_num = -1; + i2c_config->scl_io_num = -1; + ESP_LOGE(TAG, "i2c port %d is not supported", port); + return ESP_FAIL; + } + return ESP_OK; +} + +esp_err_t get_i2s_pins(i2s_port_t port, board_i2s_pin_t *i2s_config) { + AUDIO_NULL_CHECK(TAG, i2s_config, return ESP_FAIL); + if (port == I2S_NUM_0) { + i2s_config->bck_io_num = GPIO_NUM_9; + i2s_config->ws_io_num = GPIO_NUM_45; + i2s_config->data_out_num = GPIO_NUM_8; + i2s_config->data_in_num = GPIO_NUM_10; + i2s_config->mck_io_num = -1; + } else if (port == I2S_NUM_1) { + i2s_config->bck_io_num = -1; + i2s_config->ws_io_num = -1; + i2s_config->data_out_num = -1; + i2s_config->data_in_num = -1; + i2s_config->mck_io_num = -1; + } else { + memset(i2s_config, -1, sizeof(board_i2s_pin_t)); + ESP_LOGE(TAG, "i2s port %d is not supported", port); + return ESP_FAIL; + } + + return ESP_OK; +} + +esp_err_t get_spi_pins( + spi_bus_config_t *spi_config, + spi_device_interface_config_t *spi_device_interface_config) { + AUDIO_NULL_CHECK(TAG, spi_config, return ESP_FAIL); + AUDIO_NULL_CHECK(TAG, spi_device_interface_config, return ESP_FAIL); + + spi_config->mosi_io_num = -1; + spi_config->miso_io_num = -1; + spi_config->sclk_io_num = -1; + spi_config->quadwp_io_num = -1; + spi_config->quadhd_io_num = -1; + + spi_device_interface_config->spics_io_num = -1; + + ESP_LOGW(TAG, "SPI interface is not supported"); + return ESP_OK; +} + +// sdcard + +int8_t get_sdcard_intr_gpio(void) { return SDCARD_INTR_GPIO; } + +int8_t get_sdcard_open_file_num_max(void) { return SDCARD_OPEN_FILE_NUM_MAX; } + +int8_t get_sdcard_power_ctrl_gpio(void) { return SDCARD_PWR_CTRL; } + +// input-output pins + +int8_t get_headphone_detect_gpio(void) { return HEADPHONE_DETECT; } + +int8_t get_pa_enable_gpio(void) { return PA_ENABLE_GPIO; } + +// adc button id + +int8_t get_input_rec_id(void) { return BUTTON_REC_ID; } + +int8_t get_input_mode_id(void) { return BUTTON_MODE_ID; } + +int8_t get_input_set_id(void) { return BUTTON_SET_ID; } + +int8_t get_input_play_id(void) { return BUTTON_PLAY_ID; } + +int8_t get_input_volup_id(void) { return BUTTON_VOLUP_ID; } + +int8_t get_input_voldown_id(void) { return BUTTON_VOLDOWN_ID; } + +// led pins + +int8_t get_green_led_gpio(void) { return GREEN_LED_GPIO; } + +int8_t get_blue_led_gpio(void) { return BLUE_LED_GPIO; } + +int8_t get_es8311_mclk_src(void) { return ES8311_MCLK_SOURCE; } diff --git a/components/audio_board/include/board_pins_config.h b/components/audio_board/include/board_pins_config.h index 1b5ff63e..217ebdc0 100644 --- a/components/audio_board/include/board_pins_config.h +++ b/components/audio_board/include/board_pins_config.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -28,207 +28,199 @@ #define _BOARD_PINS_CONFIG_H_ #include "driver/i2c.h" -#include "driver/i2s.h" +#include "driver/i2s_std.h" #include "driver/spi_common.h" #include "driver/spi_master.h" #include "driver/spi_slave.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - /** - * @brief Get i2c pins configuration - * - * @param port i2c port number to get configuration - * @param i2c_config i2c configuration parameters - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t get_i2c_pins (i2c_port_t port, i2c_config_t *i2c_config); - - /** - * @brief Get i2s pins configuration - * - * @param port i2s port number to get configuration - * @param i2s_config i2s configuration parameters - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t get_i2s_pins (i2s_port_t port, i2s_pin_config_t *i2s_config); - - /** - * @brief Get spi pins configuration - * - * @param spi_config spi bus configuration parameters - * @param spi_device_interface_config spi device configuration - * parameters - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t - get_spi_pins (spi_bus_config_t *spi_config, - spi_device_interface_config_t *spi_device_interface_config); - - /** - * @brief Set i2s mclk output pin - * - * @note GPIO1 and GPIO3 default are UART pins. - * - * @param i2s_num i2s port index - * @param gpio_num gpio number index, only support GPIO0, GPIO1 and - GPIO3. - - * @return - * - ESP_OK Success - * - ESP_ERR_INVALID_ARG Parameter error - * - ESP_ERR_INVALID_STATE Driver state error - * - ESP_ERR_ADF_NOT_SUPPORT Not support - */ - esp_err_t i2s_mclk_gpio_select (i2s_port_t i2s_num, gpio_num_t gpio_num); - - /** - * @brief Get the gpio number for sdcard interrupt - * - * @return -1 non-existent - * Others sdcard interrupt gpio number - */ - int8_t get_sdcard_intr_gpio (void); - - /** - * @brief Get sdcard maximum number of open files - * - * @return -1 error - * Others max num - */ - int8_t get_sdcard_open_file_num_max (void); - - /** - * @brief Get the gpio number for auxin detection - * - * @return -1 non-existent - * Others gpio number - */ - int8_t get_auxin_detect_gpio (void); - - /** - * @brief Get the gpio number for headphone detection - * - * @return -1 non-existent - * Others gpio number - */ - int8_t get_headphone_detect_gpio (void); - - /** - * @brief Get the gpio number for PA enable - * - * @return -1 non-existent - * Others gpio number - */ - int8_t get_pa_enable_gpio (void); - - /** - * @brief Get the gpio number for adc detection - * - * @return -1 non-existent - * Others gpio number - */ - int8_t get_adc_detect_gpio (void); - - /** - * @brief Get the mclk gpio number of es7243 - * - * @return -1 non-existent - * Others gpio number - */ - int8_t get_es7243_mclk_gpio (void); - - /** - * @brief Get the record-button id for adc-button - * - * @return -1 non-existent - * Others button id - */ - int8_t get_input_rec_id (void); - - /** - * @brief Get the number for mode-button - * - * @return -1 non-existent - * Others number - */ - int8_t get_input_mode_id (void); - - /** - * @brief Get number for set function - * - * @return -1 non-existent - * Others number - */ - int8_t get_input_set_id (void); - - /** - * @brief Get number for play function - * - * @return -1 non-existent - * Others number - */ - int8_t get_input_play_id (void); - - /** - * @brief number for volume up function - * - * @return -1 non-existent - * Others number - */ - int8_t get_input_volup_id (void); - - /** - * @brief Get number for volume down function - * - * @return -1 non-existent - * Others number - */ - int8_t get_input_voldown_id (void); - - /** - * @brief Get green led gpio number - * - * @return -1 non-existent - * Others gpio number - */ - int8_t get_reset_codec_gpio (void); - - /** - * @brief Get DSP reset gpio number - * - * @return -1 non-existent - * Others gpio number - */ - int8_t get_reset_board_gpio (void); - - /** - * @brief Get DSP reset gpio number - * - * @return -1 non-existent - * Others gpio number - */ - int8_t get_green_led_gpio (void); - - /** - * @brief Get green led gpio number - * - * @return -1 non-existent - * Others gpio number - */ - int8_t get_blue_led_gpio (void); +/** + * @brief Board i2s pin definition + */ +typedef struct { + int mck_io_num; /*!< MCK pin, output */ + int bck_io_num; /*!< BCK pin, input in slave role, output in master role */ + int ws_io_num; /*!< WS pin, input in slave role, output in master role */ + int data_out_num; /*!< DATA pin, output */ + int data_in_num; /*!< DATA pin, input */ +} board_i2s_pin_t; + +/** + * @brief Get i2c pins configuration + * + * @param port i2c port number to get configuration + * @param i2c_config i2c configuration parameters + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t get_i2c_pins(i2c_port_t port, i2c_config_t *i2c_config); + +/** + * @brief Get i2s pins configuration + * + * @param port i2s port number to get configuration + * @param i2s_config i2s configuration parameters + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t get_i2s_pins(i2s_port_t port, board_i2s_pin_t *i2s_config); + +/** + * @brief Get spi pins configuration + * + * @param spi_config spi bus configuration parameters + * @param spi_device_interface_config spi device configuration parameters + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t get_spi_pins( + spi_bus_config_t *spi_config, + spi_device_interface_config_t *spi_device_interface_config); + +/** + * @brief Get the gpio number for sdcard interrupt + * + * @return -1 non-existent + * Others sdcard interrupt gpio number + */ +int8_t get_sdcard_intr_gpio(void); + +/** + * @brief Get sdcard maximum number of open files + * + * @return -1 error + * Others max num + */ +int8_t get_sdcard_open_file_num_max(void); + +/** + * @brief Get the gpio number for auxin detection + * + * @return -1 non-existent + * Others gpio number + */ +int8_t get_auxin_detect_gpio(void); + +/** + * @brief Get the gpio number for headphone detection + * + * @return -1 non-existent + * Others gpio number + */ +int8_t get_headphone_detect_gpio(void); + +/** + * @brief Get the gpio number for PA enable + * + * @return -1 non-existent + * Others gpio number + */ +int8_t get_pa_enable_gpio(void); + +/** + * @brief Get the gpio number for adc detection + * + * @return -1 non-existent + * Others gpio number + */ +int8_t get_adc_detect_gpio(void); + +/** + * @brief Get the mclk gpio number of es7243 + * + * @return -1 non-existent + * Others gpio number + */ +int8_t get_es7243_mclk_gpio(void); + +/** + * @brief Get the record-button id for adc-button + * + * @return -1 non-existent + * Others button id + */ +int8_t get_input_rec_id(void); + +/** + * @brief Get the number for mode-button + * + * @return -1 non-existent + * Others number + */ +int8_t get_input_mode_id(void); + +/** + * @brief Get number for set function + * + * @return -1 non-existent + * Others number + */ +int8_t get_input_set_id(void); + +/** + * @brief Get number for play function + * + * @return -1 non-existent + * Others number + */ +int8_t get_input_play_id(void); + +/** + * @brief number for volume up function + * + * @return -1 non-existent + * Others number + */ +int8_t get_input_volup_id(void); + +/** + * @brief Get number for volume down function + * + * @return -1 non-existent + * Others number + */ +int8_t get_input_voldown_id(void); + +/** + * @brief Get green led gpio number + * + * @return -1 non-existent + * Others gpio number + */ +int8_t get_reset_codec_gpio(void); + +/** + * @brief Get DSP reset gpio number + * + * @return -1 non-existent + * Others gpio number + */ +int8_t get_reset_board_gpio(void); + +/** + * @brief Get DSP reset gpio number + * + * @return -1 non-existent + * Others gpio number + */ +int8_t get_green_led_gpio(void); + +/** + * @brief Get green led gpio number + * + * @return -1 non-existent + * Others gpio number + */ +int8_t get_blue_led_gpio(void); #ifdef __cplusplus } diff --git a/components/audio_board/lyrat_mini_v1_1/board_pins_config.c b/components/audio_board/lyrat_mini_v1_1/board_pins_config.c index 129daaef..be366660 100644 --- a/components/audio_board/lyrat_mini_v1_1/board_pins_config.c +++ b/components/audio_board/lyrat_mini_v1_1/board_pins_config.c @@ -50,22 +50,22 @@ esp_err_t get_i2c_pins(i2c_port_t port, i2c_config_t *i2c_config) { return ESP_OK; } -esp_err_t get_i2s_pins(i2s_port_t port, i2s_pin_config_t *i2s_config) { +esp_err_t get_i2s_pins(i2s_port_t port, board_i2s_pin_t *i2s_config) { AUDIO_NULL_CHECK(TAG, i2s_config, return ESP_FAIL); if (port == I2S_NUM_0) { - // i2s_config->mck_io_num = GPIO_NUM_0; + i2s_config->mck_io_num = GPIO_NUM_0; i2s_config->bck_io_num = GPIO_NUM_5; i2s_config->ws_io_num = GPIO_NUM_25; i2s_config->data_out_num = GPIO_NUM_26; i2s_config->data_in_num = GPIO_NUM_35; } else if (port == I2S_NUM_1) { - // i2s_config->mck_io_num = GPIO_NUM_0; + i2s_config->mck_io_num = GPIO_NUM_0; i2s_config->bck_io_num = GPIO_NUM_32; i2s_config->ws_io_num = GPIO_NUM_33; i2s_config->data_out_num = -1; i2s_config->data_in_num = GPIO_NUM_36; } else { - memset(i2s_config, -1, sizeof(i2s_pin_config_t)); + memset(i2s_config, -1, sizeof(board_i2s_pin_t)); ESP_LOGE(TAG, "i2s port %d is not supported", port); return ESP_FAIL; } @@ -91,43 +91,6 @@ esp_err_t get_spi_pins( return ESP_OK; } -esp_err_t i2s_mclk_gpio_select(i2s_port_t i2s_num, gpio_num_t gpio_num) { - if (i2s_num >= I2S_NUM_MAX) { - ESP_LOGE(TAG, "Does not support i2s number(%d)", i2s_num); - return ESP_ERR_INVALID_ARG; - } - if (gpio_num != GPIO_NUM_0 && gpio_num != GPIO_NUM_1 && - gpio_num != GPIO_NUM_3) { - ESP_LOGE(TAG, "Only support GPIO0/GPIO1/GPIO3, gpio_num:%d", gpio_num); - return ESP_ERR_INVALID_ARG; - } - ESP_LOGI(TAG, "I2S%d, MCLK output by GPIO%d", i2s_num, gpio_num); - if (i2s_num == I2S_NUM_0) { - if (gpio_num == GPIO_NUM_0) { - PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO0_U, FUNC_GPIO0_CLK_OUT1); - WRITE_PERI_REG(PIN_CTRL, 0xFFF0); - } else if (gpio_num == GPIO_NUM_1) { - PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD_CLK_OUT3); - WRITE_PERI_REG(PIN_CTRL, 0xF0F0); - } else { - PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD_CLK_OUT2); - WRITE_PERI_REG(PIN_CTRL, 0xFF00); - } - } else if (i2s_num == I2S_NUM_1) { - if (gpio_num == GPIO_NUM_0) { - PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO0_U, FUNC_GPIO0_CLK_OUT1); - WRITE_PERI_REG(PIN_CTRL, 0xFFFF); - } else if (gpio_num == GPIO_NUM_1) { - PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD_CLK_OUT3); - WRITE_PERI_REG(PIN_CTRL, 0xF0FF); - } else { - PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD_CLK_OUT2); - WRITE_PERI_REG(PIN_CTRL, 0xFF0F); - } - } - return ESP_OK; -} - // sdcard int8_t get_sdcard_intr_gpio(void) { return SDCARD_INTR_GPIO; } diff --git a/components/audio_board/lyrat_v4_2/board.c b/components/audio_board/lyrat_v4_2/board.c new file mode 100644 index 00000000..a9bfb73e --- /dev/null +++ b/components/audio_board/lyrat_v4_2/board.c @@ -0,0 +1,66 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2019 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include "board.h" + +#include "audio_mem.h" +#include "esp_log.h" + +static const char *TAG = "AUDIO_BOARD"; + +static audio_board_handle_t board_handle = 0; + +audio_board_handle_t audio_board_init(void) { + if (board_handle) { + ESP_LOGW(TAG, "The board has already been initialized!"); + return board_handle; + } + audio_hal_codec_config_t audio_codec_cfg = AUDIO_CODEC_DEFAULT_CONFIG(); + board_handle = + (audio_board_handle_t)audio_calloc(1, sizeof(struct audio_board_handle)); + AUDIO_MEM_CHECK(TAG, board_handle, return NULL); + + board_handle->audio_hal = + audio_hal_init(&audio_codec_cfg, &AUDIO_CODEC_ES8388_DEFAULT_HANDLE); + + return board_handle; +} + +// esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, +// periph_sdcard_mode_t mode) { +// esp_err_t ret = ESP_FAIL; +// return ret; +// } + +audio_board_handle_t audio_board_get_handle(void) { return board_handle; } + +esp_err_t audio_board_deinit(audio_board_handle_t audio_board) { + esp_err_t ret = ESP_OK; + ret = audio_hal_deinit(audio_board->audio_hal); + audio_free(audio_board); + board_handle = NULL; + return ret; +} diff --git a/components/audio_board/lyrat_v4_2/board.h b/components/audio_board/lyrat_v4_2/board.h new file mode 100644 index 00000000..ce0fdfe6 --- /dev/null +++ b/components/audio_board/lyrat_v4_2/board.h @@ -0,0 +1,115 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2019 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _AUDIO_BOARD_H_ +#define _AUDIO_BOARD_H_ + +#include "audio_hal.h" +#include "board_def.h" +#include "board_pins_config.h" +// #include "display_service.h" +// #include "esp_peripherals.h" +// #include "periph_sdcard.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Audio board handle + */ +struct audio_board_handle { + audio_hal_handle_t audio_hal; /*!< audio hardware abstract layer handle */ +}; + +typedef struct audio_board_handle *audio_board_handle_t; + +/** + * @brief Initialize audio board + * + * @return The audio board handle + */ +audio_board_handle_t audio_board_init(void); + +/** + * @brief Initialize codec chip + * + * @return The audio hal handle + */ +audio_hal_handle_t audio_board_codec_init(void); + +/** + * @brief Initialize led peripheral and display service + * + * @return The audio display service handle + */ +// display_service_handle_t audio_board_led_init(void); + +/** + * @brief Initialize key peripheral + * + * @param set The handle of esp_periph_set_handle_t + * + * @return + * - ESP_OK, success + * - Others, fail + */ +// esp_err_t audio_board_key_init(esp_periph_set_handle_t set); + +/** + * @brief Initialize sdcard peripheral + * + * @param set The handle of esp_periph_set_handle_t + * + * @return + * - ESP_OK, success + * - Others, fail + */ +// esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, +// periph_sdcard_mode_t mode); + +/** + * @brief Query audio_board_handle + * + * @return The audio board handle + */ +audio_board_handle_t audio_board_get_handle(void); + +/** + * @brief Uninitialize the audio board + * + * @param audio_board The handle of audio board + * + * @return 0 success, + * others fail + */ +esp_err_t audio_board_deinit(audio_board_handle_t audio_board); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/components/audio_board/lyrat_v4_2/board_def.h b/components/audio_board/lyrat_v4_2/board_def.h new file mode 100644 index 00000000..e784ac07 --- /dev/null +++ b/components/audio_board/lyrat_v4_2/board_def.h @@ -0,0 +1,123 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2019 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _AUDIO_BOARD_DEFINITION_H_ +#define _AUDIO_BOARD_DEFINITION_H_ + +#include "driver/touch_pad.h" + +/** + * @brief SDCARD Function Definition + */ +#define FUNC_SDCARD_EN (1) +#define SDCARD_OPEN_FILE_NUM_MAX 5 +#define SDCARD_INTR_GPIO GPIO_NUM_34 + +#define ESP_SD_PIN_CLK GPIO_NUM_14 +#define ESP_SD_PIN_CMD GPIO_NUM_15 +#define ESP_SD_PIN_D0 GPIO_NUM_2 +#define ESP_SD_PIN_D3 -1 + +/** + * @brief LED Function Definition + */ +#define FUNC_SYS_LEN_EN (1) +#define GREEN_LED_GPIO GPIO_NUM_22 +#define RED_LED_GPIO GPIO_NUM_19 + +/** + * @brief Audio Codec Chip Function Definition + */ +#define FUNC_AUDIO_CODEC_EN (1) +#define AUXIN_DETECT_GPIO GPIO_NUM_12 +#define PA_ENABLE_GPIO GPIO_NUM_21 +#define CODEC_ADC_I2S_PORT (0) +#define CODEC_ADC_BITS_PER_SAMPLE I2S_BITS_PER_SAMPLE_16BIT +#define CODEC_ADC_SAMPLE_RATE (48000) +#define RECORD_HARDWARE_AEC (false) +#define BOARD_PA_GAIN (10) /* Power amplifier gain defined by board (dB) */ + +extern audio_hal_func_t AUDIO_CODEC_ES8388_DEFAULT_HANDLE; +#define AUDIO_CODEC_DEFAULT_CONFIG() \ + { \ + .adc_input = AUDIO_HAL_ADC_INPUT_LINE1, \ + .dac_output = AUDIO_HAL_DAC_OUTPUT_ALL, \ + .codec_mode = AUDIO_HAL_CODEC_MODE_BOTH, \ + .i2s_iface = \ + { \ + .mode = AUDIO_HAL_MODE_SLAVE, \ + .fmt = AUDIO_HAL_I2S_NORMAL, \ + .samples = AUDIO_HAL_48K_SAMPLES, \ + .bits = AUDIO_HAL_BIT_LENGTH_16BITS, \ + }, \ + }; + +/** + * @brief Button Function Definition + */ +#define FUNC_BUTTON_EN (1) +#define INPUT_KEY_NUM 6 +#define BUTTON_REC_ID GPIO_NUM_36 +#define BUTTON_MODE_ID GPIO_NUM_39 +#define BUTTON_SET_ID TOUCH_PAD_NUM9 +#define BUTTON_PLAY_ID TOUCH_PAD_NUM8 +#define BUTTON_VOLUP_ID TOUCH_PAD_NUM7 +#define BUTTON_VOLDOWN_ID TOUCH_PAD_NUM4 + +#define INPUT_KEY_DEFAULT_INFO() \ + { \ + { \ + .type = PERIPH_ID_BUTTON, \ + .user_id = INPUT_KEY_USER_ID_REC, \ + .act_id = BUTTON_REC_ID, \ + }, \ + { \ + .type = PERIPH_ID_BUTTON, \ + .user_id = INPUT_KEY_USER_ID_MODE, \ + .act_id = BUTTON_MODE_ID, \ + }, \ + { \ + .type = PERIPH_ID_TOUCH, \ + .user_id = INPUT_KEY_USER_ID_SET, \ + .act_id = BUTTON_SET_ID, \ + }, \ + { \ + .type = PERIPH_ID_TOUCH, \ + .user_id = INPUT_KEY_USER_ID_PLAY, \ + .act_id = BUTTON_PLAY_ID, \ + }, \ + { \ + .type = PERIPH_ID_TOUCH, \ + .user_id = INPUT_KEY_USER_ID_VOLUP, \ + .act_id = BUTTON_VOLUP_ID, \ + }, \ + { \ + .type = PERIPH_ID_TOUCH, .user_id = INPUT_KEY_USER_ID_VOLDOWN, \ + .act_id = BUTTON_VOLDOWN_ID, \ + } \ + } + +#endif diff --git a/components/audio_board/lyrat_v4_2/board_pins_config.c b/components/audio_board/lyrat_v4_2/board_pins_config.c new file mode 100644 index 00000000..a262f4c8 --- /dev/null +++ b/components/audio_board/lyrat_v4_2/board_pins_config.c @@ -0,0 +1,119 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2019 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include + +#include "audio_error.h" +#include "audio_mem.h" +#include "board.h" +#include "driver/gpio.h" +#include "esp_log.h" +#include "soc/io_mux_reg.h" +#include "soc/soc_caps.h" + +static const char *TAG = "LYRAT_V4_2"; + +esp_err_t get_i2c_pins(i2c_port_t port, i2c_config_t *i2c_config) { + AUDIO_NULL_CHECK(TAG, i2c_config, return ESP_FAIL); + if (port == I2C_NUM_0 || port == I2C_NUM_1) { + i2c_config->sda_io_num = GPIO_NUM_18; + i2c_config->scl_io_num = GPIO_NUM_23; + } else { + i2c_config->sda_io_num = -1; + i2c_config->scl_io_num = -1; + ESP_LOGE(TAG, "i2c port %d is not supported", port); + return ESP_FAIL; + } + return ESP_OK; +} + +esp_err_t get_i2s_pins(i2s_port_t port, board_i2s_pin_t *i2s_config) { + AUDIO_NULL_CHECK(TAG, i2s_config, return ESP_FAIL); + if (port == I2S_NUM_0 || port == I2S_NUM_1) { + i2s_config->mck_io_num = GPIO_NUM_0; + i2s_config->bck_io_num = GPIO_NUM_5; + i2s_config->ws_io_num = GPIO_NUM_25; + i2s_config->data_out_num = GPIO_NUM_26; + i2s_config->data_in_num = GPIO_NUM_35; + } else { + memset(i2s_config, -1, sizeof(board_i2s_pin_t)); + ESP_LOGE(TAG, "i2s port %d is not supported", port); + return ESP_FAIL; + } + return ESP_OK; +} + +esp_err_t get_spi_pins( + spi_bus_config_t *spi_config, + spi_device_interface_config_t *spi_device_interface_config) { + AUDIO_NULL_CHECK(TAG, spi_config, return ESP_FAIL); + AUDIO_NULL_CHECK(TAG, spi_device_interface_config, return ESP_FAIL); + + spi_config->mosi_io_num = -1; + spi_config->miso_io_num = -1; + spi_config->sclk_io_num = -1; + spi_config->quadwp_io_num = -1; + spi_config->quadhd_io_num = -1; + + spi_device_interface_config->spics_io_num = -1; + + ESP_LOGW(TAG, "SPI interface is not is not supported"); + return ESP_OK; +} + +// sdcard + +int8_t get_sdcard_intr_gpio(void) { return SDCARD_INTR_GPIO; } + +int8_t get_sdcard_open_file_num_max(void) { return SDCARD_OPEN_FILE_NUM_MAX; } + +// input-output pins + +int8_t get_auxin_detect_gpio(void) { return AUXIN_DETECT_GPIO; } + +int8_t get_pa_enable_gpio(void) { return PA_ENABLE_GPIO; } + +// button pins + +int8_t get_input_rec_id(void) { return BUTTON_REC_ID; } + +int8_t get_input_mode_id(void) { return BUTTON_MODE_ID; } + +// touch pins + +int8_t get_input_set_id(void) { return BUTTON_SET_ID; } + +int8_t get_input_play_id(void) { return BUTTON_PLAY_ID; } + +int8_t get_input_volup_id(void) { return BUTTON_VOLUP_ID; } + +int8_t get_input_voldown_id(void) { return BUTTON_VOLDOWN_ID; } + +// led pins + +int8_t get_red_led_gpio(void) { return RED_LED_GPIO; } + +int8_t get_green_led_gpio(void) { return GREEN_LED_GPIO; } diff --git a/components/audio_board/lyrat_v4_3/board.c b/components/audio_board/lyrat_v4_3/board.c index e59adc00..8a3ec83d 100644 --- a/components/audio_board/lyrat_v4_3/board.c +++ b/components/audio_board/lyrat_v4_3/board.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,138 +18,130 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "board.h" + #include "audio_mem.h" #include "esp_log.h" -//#include "periph_sdcard.h" -//#include "led_indicator.h" -//#include "periph_touch.h" -//#include "periph_button.h" +// #include "periph_sdcard.h" +// #include "led_indicator.h" +// #include "periph_touch.h" +// #include "periph_button.h" static const char *TAG = "AUDIO_BOARD"; static audio_board_handle_t board_handle = 0; -audio_board_handle_t -audio_board_init (void) -{ - if (board_handle) - { - ESP_LOGW (TAG, "The board has already been initialized!"); - return board_handle; - } - board_handle = (audio_board_handle_t)audio_calloc ( - 1, sizeof (struct audio_board_handle)); - AUDIO_MEM_CHECK (TAG, board_handle, return NULL); - board_handle->audio_hal = audio_board_codec_init (); +audio_board_handle_t audio_board_init(void) { + if (board_handle) { + ESP_LOGW(TAG, "The board has already been initialized!"); + return board_handle; + } + board_handle = + (audio_board_handle_t)audio_calloc(1, sizeof(struct audio_board_handle)); + AUDIO_MEM_CHECK(TAG, board_handle, return NULL); + board_handle->audio_hal = audio_board_codec_init(); return board_handle; } -audio_hal_handle_t -audio_board_codec_init (void) -{ - audio_hal_codec_config_t audio_codec_cfg = AUDIO_CODEC_DEFAULT_CONFIG (); - audio_hal_handle_t codec_hal - = audio_hal_init (&audio_codec_cfg, &AUDIO_CODEC_ES8388_DEFAULT_HANDLE); - AUDIO_NULL_CHECK (TAG, codec_hal, return NULL); +audio_hal_handle_t audio_board_codec_init(void) { + audio_hal_codec_config_t audio_codec_cfg = AUDIO_CODEC_DEFAULT_CONFIG(); + audio_hal_handle_t codec_hal = + audio_hal_init(&audio_codec_cfg, &AUDIO_CODEC_ES8388_DEFAULT_HANDLE); + AUDIO_NULL_CHECK(TAG, codec_hal, return NULL); return codec_hal; } -/* -display_service_handle_t audio_board_led_init(void) -{ - led_indicator_handle_t led = -led_indicator_init((gpio_num_t)get_green_led_gpio()); display_service_config_t -display = { .based_cfg = { .task_stack = 0, .task_prio = 0, .task_core = 0, - .task_func = NULL, - .service_start = NULL, - .service_stop = NULL, - .service_destroy = NULL, - .service_ioctl = led_indicator_pattern, - .service_name = "DISPLAY_serv", - .user_data = NULL, - }, - .instance = led, - }; - - return display_service_create(&display); -} - -esp_err_t audio_board_key_init(esp_periph_set_handle_t set) -{ - periph_button_cfg_t btn_cfg = { - .gpio_mask = (1ULL << get_input_rec_id()) | (1ULL << -get_input_mode_id()), //REC BTN & MODE BTN - }; - esp_periph_handle_t button_handle = periph_button_init(&btn_cfg); - AUDIO_NULL_CHECK(TAG, button_handle, return ESP_ERR_ADF_MEMORY_LACK); - esp_err_t ret = ESP_OK; - ret = esp_periph_start(set, button_handle); - if (ret != ESP_OK) { - return ret; - } - periph_touch_cfg_t touch_cfg = { - .touch_mask = TOUCH_PAD_SEL4 | TOUCH_PAD_SEL7 | TOUCH_PAD_SEL8 | -TOUCH_PAD_SEL9, .tap_threshold_percent = 70, - }; - esp_periph_handle_t touch_periph = periph_touch_init(&touch_cfg); - AUDIO_NULL_CHECK(TAG, touch_periph, return ESP_ERR_ADF_MEMORY_LACK); - ret = esp_periph_start(set, touch_periph); - return ret; -} - -esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, -periph_sdcard_mode_t mode) -{ - if (mode >= SD_MODE_MAX) { - ESP_LOGE(TAG, "PLease select the correct sd mode!, current mode is %d", -mode); return ESP_FAIL; - } - periph_sdcard_cfg_t sdcard_cfg = { - .root = "/sdcard", - .card_detect_pin = get_sdcard_intr_gpio(), // GPIO_NUM_34 - .mode = mode, - }; - esp_periph_handle_t sdcard_handle = periph_sdcard_init(&sdcard_cfg); - esp_err_t ret = esp_periph_start(set, sdcard_handle); - int retry_time = 5; - bool mount_flag = false; - while (retry_time --) { - if (periph_sdcard_is_mounted(sdcard_handle)) { - mount_flag = true; - break; - } else { - vTaskDelay(500 / portTICK_PERIOD_MS); - } - } - if (mount_flag == false) { - ESP_LOGE(TAG, "Sdcard mount failed"); - return ESP_FAIL; - } - return ret; -} -*/ +// display_service_handle_t audio_board_led_init(void) +//{ +// led_indicator_handle_t led = +// led_indicator_init((gpio_num_t)get_green_led_gpio()); +// display_service_config_t display = { +// .based_cfg = { +// .task_stack = 0, +// .task_prio = 0, +// .task_core = 0, +// .task_func = NULL, +// .service_start = NULL, +// .service_stop = NULL, +// .service_destroy = NULL, +// .service_ioctl = led_indicator_pattern, +// .service_name = "DISPLAY_serv", +// .user_data = NULL, +// }, +// .instance = led, +// }; +// +// return display_service_create(&display); +// } +// +// esp_err_t audio_board_key_init(esp_periph_set_handle_t set) +//{ +// periph_button_cfg_t btn_cfg = { +// .gpio_mask = (1ULL << get_input_rec_id()) | (1ULL << +// get_input_mode_id()), //REC BTN & MODE BTN +// }; +// esp_periph_handle_t button_handle = periph_button_init(&btn_cfg); +// AUDIO_NULL_CHECK(TAG, button_handle, return ESP_ERR_ADF_MEMORY_LACK); +// esp_err_t ret = ESP_OK; +// ret = esp_periph_start(set, button_handle); +// if (ret != ESP_OK) { +// return ret; +// } +// periph_touch_cfg_t touch_cfg = { +// .touch_mask = TOUCH_PAD_SEL4 | TOUCH_PAD_SEL7 | TOUCH_PAD_SEL8 | +// TOUCH_PAD_SEL9, .tap_threshold_percent = 70, +// }; +// esp_periph_handle_t touch_periph = periph_touch_init(&touch_cfg); +// AUDIO_NULL_CHECK(TAG, touch_periph, return ESP_ERR_ADF_MEMORY_LACK); +// ret = esp_periph_start(set, touch_periph); +// return ret; +// } +// +// esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, +// periph_sdcard_mode_t mode) +//{ +// if (mode >= SD_MODE_4_LINE) { +// ESP_LOGE(TAG, "Please select the correct sd mode!, current mode is +// %d", mode); return ESP_FAIL; +// } +// periph_sdcard_cfg_t sdcard_cfg = { +// .root = "/sdcard", +// .card_detect_pin = get_sdcard_intr_gpio(), // GPIO_NUM_34 +// .mode = mode, +// }; +// esp_periph_handle_t sdcard_handle = periph_sdcard_init(&sdcard_cfg); +// esp_err_t ret = esp_periph_start(set, sdcard_handle); +// int retry_time = 5; +// bool mount_flag = false; +// while (retry_time --) { +// if (periph_sdcard_is_mounted(sdcard_handle)) { +// mount_flag = true; +// break; +// } else { +// vTaskDelay(500 / portTICK_PERIOD_MS); +// } +// } +// if (mount_flag == false) { +// ESP_LOGE(TAG, "Sdcard mount failed"); +// return ESP_FAIL; +// } +// return ret; +// } -audio_board_handle_t -audio_board_get_handle (void) -{ - return board_handle; -} +audio_board_handle_t audio_board_get_handle(void) { return board_handle; } -esp_err_t -audio_board_deinit (audio_board_handle_t audio_board) -{ +esp_err_t audio_board_deinit(audio_board_handle_t audio_board) { esp_err_t ret = ESP_OK; - ret = audio_hal_deinit (audio_board->audio_hal); - audio_free (audio_board); + ret = audio_hal_deinit(audio_board->audio_hal); + audio_free(audio_board); board_handle = NULL; return ret; } diff --git a/components/audio_board/lyrat_v4_3/board.h b/components/audio_board/lyrat_v4_3/board.h index 0dca37c8..46b8fd7f 100644 --- a/components/audio_board/lyrat_v4_3/board.h +++ b/components/audio_board/lyrat_v4_3/board.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -30,85 +30,83 @@ #include "audio_hal.h" #include "board_def.h" #include "board_pins_config.h" -//#include "esp_peripherals.h" -//#include "display_service.h" -//#include "periph_sdcard.h" +// #include "esp_peripherals.h" +// #include "display_service.h" +// #include "periph_sdcard.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - /** - * @brief Audio board handle - */ - struct audio_board_handle - { - audio_hal_handle_t audio_hal; /*!< audio hardware abstract layer handle */ - }; +/** + * @brief Audio board handle + */ +struct audio_board_handle { + audio_hal_handle_t audio_hal; /*!< audio hardware abstract layer handle */ +}; + +typedef struct audio_board_handle *audio_board_handle_t; + +/** + * @brief Initialize audio board + * + * @return The audio board handle + */ +audio_board_handle_t audio_board_init(void); - typedef struct audio_board_handle *audio_board_handle_t; +/** + * @brief Initialize codec chip + * + * @return The audio hal handle + */ +audio_hal_handle_t audio_board_codec_init(void); - /** - * @brief Initialize audio board - * - * @return The audio board handle - */ - audio_board_handle_t audio_board_init (void); +/** + * @brief Initialize led peripheral and display service + * + * @return The audio display service handle + */ +// display_service_handle_t audio_board_led_init(void); - /** - * @brief Initialize codec chip - * - * @return The audio hal handle - */ - audio_hal_handle_t audio_board_codec_init (void); +/** + * @brief Initialize key peripheral + * + * @param set The handle of esp_periph_set_handle_t + * + * @return + * - ESP_OK, success + * - Others, fail + */ +// esp_err_t audio_board_key_init(esp_periph_set_handle_t set); - ///** - // * @brief Initialize led peripheral and display service - // * - // * @return The audio display service handle - // */ - // display_service_handle_t audio_board_led_init(void); - // - ///** - // * @brief Initialize key peripheral - // * - // * @param set The handle of esp_periph_set_handle_t - // * - // * @return - // * - ESP_OK, success - // * - Others, fail - // */ - // esp_err_t audio_board_key_init(esp_periph_set_handle_t set); - // - ///** - // * @brief Initialize sdcard peripheral - // * - // * @param set The handle of esp_periph_set_handle_t - // * - // * @return - // * - ESP_OK, success - // * - Others, fail - // */ - // esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, - // periph_sdcard_mode_t mode); +/** + * @brief Initialize sdcard peripheral + * + * @param set The handle of esp_periph_set_handle_t + * + * @return + * - ESP_OK, success + * - Others, fail + */ +// esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, +// periph_sdcard_mode_t mode); - /** - * @brief Query audio_board_handle - * - * @return The audio board handle - */ - audio_board_handle_t audio_board_get_handle (void); +/** + * @brief Query audio_board_handle + * + * @return The audio board handle + */ +audio_board_handle_t audio_board_get_handle(void); - /** - * @brief Uninitialize the audio board - * - * @param audio_board The handle of audio board - * - * @return 0 success, - * others fail - */ - esp_err_t audio_board_deinit (audio_board_handle_t audio_board); +/** + * @brief Uninitialize the audio board + * + * @param audio_board The handle of audio board + * + * @return 0 success, + * others fail + */ +esp_err_t audio_board_deinit(audio_board_handle_t audio_board); #ifdef __cplusplus } diff --git a/components/audio_board/lyrat_v4_3/board_def.h b/components/audio_board/lyrat_v4_3/board_def.h index 21611884..aa18943a 100644 --- a/components/audio_board/lyrat_v4_3/board_def.h +++ b/components/audio_board/lyrat_v4_3/board_def.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -29,70 +29,97 @@ #include "driver/touch_pad.h" +/** + * @brief SDCARD Function Definition + */ +#define FUNC_SDCARD_EN (1) #define SDCARD_OPEN_FILE_NUM_MAX 5 #define SDCARD_INTR_GPIO GPIO_NUM_34 -#define BUTTON_REC_ID GPIO_NUM_36 -#define BUTTON_MODE_ID GPIO_NUM_39 -#define BUTTON_SET_ID TOUCH_PAD_NUM9 -#define BUTTON_PLAY_ID TOUCH_PAD_NUM8 -#define BUTTON_VOLUP_ID TOUCH_PAD_NUM7 -#define BUTTON_VOLDOWN_ID TOUCH_PAD_NUM4 +#define ESP_SD_PIN_CLK GPIO_NUM_14 +#define ESP_SD_PIN_CMD GPIO_NUM_15 +#define ESP_SD_PIN_D0 GPIO_NUM_2 +#define ESP_SD_PIN_D1 GPIO_NUM_4 +#define ESP_SD_PIN_D2 GPIO_NUM_12 +#define ESP_SD_PIN_D3 GPIO_NUM_13 +/** + * @brief LED Function Definition + */ +#define FUNC_SYS_LEN_EN (1) +#define GREEN_LED_GPIO GPIO_NUM_22 + +/** + * @brief Audio Codec Chip Function Definition + */ +#define FUNC_AUDIO_CODEC_EN (1) #define AUXIN_DETECT_GPIO GPIO_NUM_12 #define HEADPHONE_DETECT GPIO_NUM_19 #define PA_ENABLE_GPIO GPIO_NUM_21 - -#define GREEN_LED_GPIO GPIO_NUM_22 +#define CODEC_ADC_I2S_PORT (0) +#define CODEC_ADC_BITS_PER_SAMPLE I2S_BITS_PER_SAMPLE_16BIT +#define CODEC_ADC_SAMPLE_RATE (48000) +#define RECORD_HARDWARE_AEC (false) +#define BOARD_PA_GAIN (10) /* Power amplifier gain defined by board (dB) */ extern audio_hal_func_t AUDIO_CODEC_ES8388_DEFAULT_HANDLE; +#define AUDIO_CODEC_DEFAULT_CONFIG() \ + { \ + .adc_input = AUDIO_HAL_ADC_INPUT_LINE1, \ + .dac_output = AUDIO_HAL_DAC_OUTPUT_ALL, \ + .codec_mode = AUDIO_HAL_CODEC_MODE_BOTH, \ + .i2s_iface = \ + { \ + .mode = AUDIO_HAL_MODE_SLAVE, \ + .fmt = AUDIO_HAL_I2S_NORMAL, \ + .samples = AUDIO_HAL_48K_SAMPLES, \ + .bits = AUDIO_HAL_BIT_LENGTH_16BITS, \ + }, \ + }; -#define AUDIO_CODEC_DEFAULT_CONFIG() \ - { \ - .adc_input = AUDIO_HAL_ADC_INPUT_LINE1, \ - .dac_output = AUDIO_HAL_DAC_OUTPUT_ALL, \ - .codec_mode = AUDIO_HAL_CODEC_MODE_BOTH, \ - .i2s_iface = { \ - .mode = AUDIO_HAL_MODE_SLAVE, \ - .fmt = AUDIO_HAL_I2S_NORMAL, \ - .samples = AUDIO_HAL_48K_SAMPLES, \ - .bits = AUDIO_HAL_BIT_LENGTH_16BITS, \ - }, \ -}; - +/** + * @brief Button Function Definition + */ +#define FUNC_BUTTON_EN (1) #define INPUT_KEY_NUM 6 +#define BUTTON_REC_ID GPIO_NUM_36 +#define BUTTON_MODE_ID GPIO_NUM_39 +#define BUTTON_SET_ID TOUCH_PAD_NUM9 +#define BUTTON_PLAY_ID TOUCH_PAD_NUM8 +#define BUTTON_VOLUP_ID TOUCH_PAD_NUM7 +#define BUTTON_VOLDOWN_ID TOUCH_PAD_NUM4 -#define INPUT_KEY_DEFAULT_INFO() \ - { \ - { \ - .type = PERIPH_ID_BUTTON, \ - .user_id = INPUT_KEY_USER_ID_REC, \ - .act_id = BUTTON_REC_ID, \ - }, \ - { \ - .type = PERIPH_ID_BUTTON, \ - .user_id = INPUT_KEY_USER_ID_MODE, \ - .act_id = BUTTON_MODE_ID, \ - }, \ - { \ - .type = PERIPH_ID_TOUCH, \ - .user_id = INPUT_KEY_USER_ID_SET, \ - .act_id = BUTTON_SET_ID, \ - }, \ - { \ - .type = PERIPH_ID_TOUCH, \ - .user_id = INPUT_KEY_USER_ID_PLAY, \ - .act_id = BUTTON_PLAY_ID, \ - }, \ - { \ - .type = PERIPH_ID_TOUCH, \ - .user_id = INPUT_KEY_USER_ID_VOLUP, \ - .act_id = BUTTON_VOLUP_ID, \ - }, \ - { \ - .type = PERIPH_ID_TOUCH, .user_id = INPUT_KEY_USER_ID_VOLDOWN, \ - .act_id = BUTTON_VOLDOWN_ID, \ - } \ +#define INPUT_KEY_DEFAULT_INFO() \ + { \ + { \ + .type = PERIPH_ID_BUTTON, \ + .user_id = INPUT_KEY_USER_ID_REC, \ + .act_id = BUTTON_REC_ID, \ + }, \ + { \ + .type = PERIPH_ID_BUTTON, \ + .user_id = INPUT_KEY_USER_ID_MODE, \ + .act_id = BUTTON_MODE_ID, \ + }, \ + { \ + .type = PERIPH_ID_TOUCH, \ + .user_id = INPUT_KEY_USER_ID_SET, \ + .act_id = BUTTON_SET_ID, \ + }, \ + { \ + .type = PERIPH_ID_TOUCH, \ + .user_id = INPUT_KEY_USER_ID_PLAY, \ + .act_id = BUTTON_PLAY_ID, \ + }, \ + { \ + .type = PERIPH_ID_TOUCH, \ + .user_id = INPUT_KEY_USER_ID_VOLUP, \ + .act_id = BUTTON_VOLUP_ID, \ + }, \ + { \ + .type = PERIPH_ID_TOUCH, .user_id = INPUT_KEY_USER_ID_VOLDOWN, \ + .act_id = BUTTON_VOLDOWN_ID, \ + } \ } #endif diff --git a/components/audio_board/lyrat_v4_3/board_pins_config.c b/components/audio_board/lyrat_v4_3/board_pins_config.c index 22b8be69..44863ee4 100644 --- a/components/audio_board/lyrat_v4_3/board_pins_config.c +++ b/components/audio_board/lyrat_v4_3/board_pins_config.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,66 +18,59 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ +#include + #include "audio_error.h" #include "audio_mem.h" #include "board.h" #include "driver/gpio.h" #include "esp_log.h" -#include +#include "soc/io_mux_reg.h" +#include "soc/soc_caps.h" static const char *TAG = "LYRAT_V4_3"; -esp_err_t -get_i2c_pins (i2c_port_t port, i2c_config_t *i2c_config) -{ - AUDIO_NULL_CHECK (TAG, i2c_config, return ESP_FAIL); - if (port == I2C_NUM_0 || port == I2C_NUM_1) - { - i2c_config->sda_io_num = GPIO_NUM_18; - i2c_config->scl_io_num = GPIO_NUM_23; - } - else - { - i2c_config->sda_io_num = -1; - i2c_config->scl_io_num = -1; - ESP_LOGE (TAG, "i2c port %d is not supported", port); - return ESP_FAIL; - } +esp_err_t get_i2c_pins(i2c_port_t port, i2c_config_t *i2c_config) { + AUDIO_NULL_CHECK(TAG, i2c_config, return ESP_FAIL); + if (port == I2C_NUM_0 || port == I2C_NUM_1) { + i2c_config->sda_io_num = GPIO_NUM_18; + i2c_config->scl_io_num = GPIO_NUM_23; + } else { + i2c_config->sda_io_num = -1; + i2c_config->scl_io_num = -1; + ESP_LOGE(TAG, "i2c port %d is not supported", port); + return ESP_FAIL; + } return ESP_OK; } -esp_err_t -get_i2s_pins (i2s_port_t port, i2s_pin_config_t *i2s_config) -{ - AUDIO_NULL_CHECK (TAG, i2s_config, return ESP_FAIL); - if (port == I2S_NUM_0 || port == I2S_NUM_1) - { - i2s_config->bck_io_num = GPIO_NUM_5; - i2s_config->ws_io_num = GPIO_NUM_25; - i2s_config->data_out_num = GPIO_NUM_26; - i2s_config->data_in_num = GPIO_NUM_35; - } - else - { - memset (i2s_config, -1, sizeof (i2s_pin_config_t)); - ESP_LOGE (TAG, "i2s port %d is not supported", port); - return ESP_FAIL; - } +esp_err_t get_i2s_pins(i2s_port_t port, board_i2s_pin_t *i2s_config) { + AUDIO_NULL_CHECK(TAG, i2s_config, return ESP_FAIL); + if (port == I2S_NUM_0 || port == I2S_NUM_1) { + i2s_config->mck_io_num = GPIO_NUM_0; + i2s_config->bck_io_num = GPIO_NUM_5; + i2s_config->ws_io_num = GPIO_NUM_25; + i2s_config->data_out_num = GPIO_NUM_26; + i2s_config->data_in_num = GPIO_NUM_35; + } else { + memset(i2s_config, -1, sizeof(board_i2s_pin_t)); + ESP_LOGE(TAG, "i2s port %d is not supported", port); + return ESP_FAIL; + } return ESP_OK; } -esp_err_t -get_spi_pins (spi_bus_config_t *spi_config, - spi_device_interface_config_t *spi_device_interface_config) -{ - AUDIO_NULL_CHECK (TAG, spi_config, return ESP_FAIL); - AUDIO_NULL_CHECK (TAG, spi_device_interface_config, return ESP_FAIL); +esp_err_t get_spi_pins( + spi_bus_config_t *spi_config, + spi_device_interface_config_t *spi_device_interface_config) { + AUDIO_NULL_CHECK(TAG, spi_config, return ESP_FAIL); + AUDIO_NULL_CHECK(TAG, spi_device_interface_config, return ESP_FAIL); spi_config->mosi_io_num = -1; spi_config->miso_io_num = -1; @@ -87,142 +80,40 @@ get_spi_pins (spi_bus_config_t *spi_config, spi_device_interface_config->spics_io_num = -1; - ESP_LOGW (TAG, "SPI interface is not supported"); - return ESP_OK; -} - -esp_err_t -i2s_mclk_gpio_select (i2s_port_t i2s_num, gpio_num_t gpio_num) -{ - if (i2s_num >= I2S_NUM_MAX) - { - ESP_LOGE (TAG, "Does not support i2s number(%d)", i2s_num); - return ESP_ERR_INVALID_ARG; - } - if (gpio_num != GPIO_NUM_0 && gpio_num != GPIO_NUM_1 - && gpio_num != GPIO_NUM_3) - { - ESP_LOGE (TAG, "Only support GPIO0/GPIO1/GPIO3, gpio_num:%d", gpio_num); - return ESP_ERR_INVALID_ARG; - } - ESP_LOGI (TAG, "I2S%d, MCLK output by GPIO%d", i2s_num, gpio_num); - if (i2s_num == I2S_NUM_0) - { - if (gpio_num == GPIO_NUM_0) - { - PIN_FUNC_SELECT (PERIPHS_IO_MUX_GPIO0_U, FUNC_GPIO0_CLK_OUT1); - WRITE_PERI_REG (PIN_CTRL, 0xFFF0); - } - else if (gpio_num == GPIO_NUM_1) - { - PIN_FUNC_SELECT (PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD_CLK_OUT3); - WRITE_PERI_REG (PIN_CTRL, 0xF0F0); - } - else - { - PIN_FUNC_SELECT (PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD_CLK_OUT2); - WRITE_PERI_REG (PIN_CTRL, 0xFF00); - } - } - else if (i2s_num == I2S_NUM_1) - { - if (gpio_num == GPIO_NUM_0) - { - PIN_FUNC_SELECT (PERIPHS_IO_MUX_GPIO0_U, FUNC_GPIO0_CLK_OUT1); - WRITE_PERI_REG (PIN_CTRL, 0xFFFF); - } - else if (gpio_num == GPIO_NUM_1) - { - PIN_FUNC_SELECT (PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD_CLK_OUT3); - WRITE_PERI_REG (PIN_CTRL, 0xF0FF); - } - else - { - PIN_FUNC_SELECT (PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD_CLK_OUT2); - WRITE_PERI_REG (PIN_CTRL, 0xFF0F); - } - } + ESP_LOGW(TAG, "SPI interface is not supported"); return ESP_OK; } // sdcard -int8_t -get_sdcard_intr_gpio (void) -{ - return SDCARD_INTR_GPIO; -} +int8_t get_sdcard_intr_gpio(void) { return SDCARD_INTR_GPIO; } -int8_t -get_sdcard_open_file_num_max (void) -{ - return SDCARD_OPEN_FILE_NUM_MAX; -} +int8_t get_sdcard_open_file_num_max(void) { return SDCARD_OPEN_FILE_NUM_MAX; } // input-output pins -int8_t -get_auxin_detect_gpio (void) -{ - return AUXIN_DETECT_GPIO; -} +int8_t get_auxin_detect_gpio(void) { return AUXIN_DETECT_GPIO; } -int8_t -get_headphone_detect_gpio (void) -{ - return HEADPHONE_DETECT; -} +int8_t get_headphone_detect_gpio(void) { return HEADPHONE_DETECT; } -int8_t -get_pa_enable_gpio (void) -{ - return PA_ENABLE_GPIO; -} +int8_t get_pa_enable_gpio(void) { return PA_ENABLE_GPIO; } // button pins -int8_t -get_input_rec_id (void) -{ - return BUTTON_REC_ID; -} +int8_t get_input_rec_id(void) { return BUTTON_REC_ID; } -int8_t -get_input_mode_id (void) -{ - return BUTTON_MODE_ID; -} +int8_t get_input_mode_id(void) { return BUTTON_MODE_ID; } // touch pins -int8_t -get_input_set_id (void) -{ - return BUTTON_SET_ID; -} +int8_t get_input_set_id(void) { return BUTTON_SET_ID; } -int8_t -get_input_play_id (void) -{ - return BUTTON_PLAY_ID; -} +int8_t get_input_play_id(void) { return BUTTON_PLAY_ID; } -int8_t -get_input_volup_id (void) -{ - return BUTTON_VOLUP_ID; -} +int8_t get_input_volup_id(void) { return BUTTON_VOLUP_ID; } -int8_t -get_input_voldown_id (void) -{ - return BUTTON_VOLDOWN_ID; -} +int8_t get_input_voldown_id(void) { return BUTTON_VOLDOWN_ID; } // led pins -int8_t -get_green_led_gpio (void) -{ - return GREEN_LED_GPIO; -} +int8_t get_green_led_gpio(void) { return GREEN_LED_GPIO; } diff --git a/components/audio_board/lyratd_msc_v2_1/board.c b/components/audio_board/lyratd_msc_v2_1/board.c new file mode 100644 index 00000000..a7cd7dc2 --- /dev/null +++ b/components/audio_board/lyratd_msc_v2_1/board.c @@ -0,0 +1,131 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2019 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include "board.h" + +#include "audio_mem.h" +#include "esp_log.h" +// #include "led_bar_is31x.h" +// #include "periph_adc_button.h" +// #include "periph_sdcard.h" + +static const char *TAG = "AUDIO_BOARD"; + +static audio_board_handle_t board_handle = 0; + +audio_board_handle_t audio_board_init(void) { + if (board_handle) { + ESP_LOGW(TAG, "The board has already been initialized!"); + return board_handle; + } + board_handle = + (audio_board_handle_t)audio_calloc(1, sizeof(struct audio_board_handle)); + AUDIO_MEM_CHECK(TAG, board_handle, return NULL); + board_handle->audio_hal = audio_board_codec_init(); + + return board_handle; +} + +audio_hal_handle_t audio_board_codec_init(void) { + audio_hal_codec_config_t audio_codec_cfg = AUDIO_CODEC_DEFAULT_CONFIG(); + audio_hal_handle_t codec_hal = + audio_hal_init(&audio_codec_cfg, &AUDIO_CODEC_ZL38063_DEFAULT_HANDLE); + AUDIO_NULL_CHECK(TAG, codec_hal, return NULL); + return codec_hal; +} + +// display_service_handle_t audio_board_led_init(void) { +// esp_periph_handle_t led = led_bar_is31x_init(); +// AUDIO_NULL_CHECK(TAG, led, return NULL); +// display_service_config_t display = { +// .based_cfg = +// { +// .task_stack = 0, +// .task_prio = 0, +// .task_core = 0, +// .task_func = NULL, +// .service_start = NULL, +// .service_stop = NULL, +// .service_destroy = NULL, +// .service_ioctl = led_bar_is31x_pattern, +// .service_name = "DISPLAY_serv", +// .user_data = NULL, +// }, +// .instance = led, +// }; +// +// return display_service_create(&display); +// } +// +// esp_err_t audio_board_key_init(esp_periph_set_handle_t set) { +// periph_adc_button_cfg_t adc_btn_cfg = PERIPH_ADC_BUTTON_DEFAULT_CONFIG(); +// adc_arr_t adc_btn_tag = ADC_DEFAULT_ARR(); +// adc_btn_cfg.arr = &adc_btn_tag; +// adc_btn_cfg.arr_size = 1; +// esp_periph_handle_t adc_btn_handle = periph_adc_button_init(&adc_btn_cfg); +// AUDIO_NULL_CHECK(TAG, adc_btn_handle, return ESP_ERR_ADF_MEMORY_LACK); +// return esp_periph_start(set, adc_btn_handle); +// } +// +// esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, +// periph_sdcard_mode_t mode) { +// if (mode >= SD_MODE_8_LINE) { +// ESP_LOGE(TAG, "Please select the correct sd mode!, current mode is %d", +// mode); +// return ESP_FAIL; +// } +// periph_sdcard_cfg_t sdcard_cfg = { +// .root = "/sdcard", +// .card_detect_pin = get_sdcard_intr_gpio(), // GPIO_NUM_34 +// .mode = mode}; +// esp_periph_handle_t sdcard_handle = periph_sdcard_init(&sdcard_cfg); +// esp_err_t ret = esp_periph_start(set, sdcard_handle); +// int retry_time = 5; +// bool mount_flag = false; +// while (retry_time--) { +// if (periph_sdcard_is_mounted(sdcard_handle)) { +// mount_flag = true; +// break; +// } else { +// vTaskDelay(500 / portTICK_PERIOD_MS); +// } +// } +// if (mount_flag == false) { +// ESP_LOGE(TAG, "Sdcard mount failed"); +// return ESP_FAIL; +// } +// return ret; +// } + +audio_board_handle_t audio_board_get_handle(void) { return board_handle; } + +esp_err_t audio_board_deinit(audio_board_handle_t audio_board) { + esp_err_t ret = ESP_OK; + ret = audio_hal_deinit(audio_board->audio_hal); + audio_free(audio_board); + board_handle = NULL; + return ret; +} diff --git a/components/audio_board/lyratd_msc_v2_1/board.h b/components/audio_board/lyratd_msc_v2_1/board.h new file mode 100644 index 00000000..ce0fdfe6 --- /dev/null +++ b/components/audio_board/lyratd_msc_v2_1/board.h @@ -0,0 +1,115 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2019 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _AUDIO_BOARD_H_ +#define _AUDIO_BOARD_H_ + +#include "audio_hal.h" +#include "board_def.h" +#include "board_pins_config.h" +// #include "display_service.h" +// #include "esp_peripherals.h" +// #include "periph_sdcard.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Audio board handle + */ +struct audio_board_handle { + audio_hal_handle_t audio_hal; /*!< audio hardware abstract layer handle */ +}; + +typedef struct audio_board_handle *audio_board_handle_t; + +/** + * @brief Initialize audio board + * + * @return The audio board handle + */ +audio_board_handle_t audio_board_init(void); + +/** + * @brief Initialize codec chip + * + * @return The audio hal handle + */ +audio_hal_handle_t audio_board_codec_init(void); + +/** + * @brief Initialize led peripheral and display service + * + * @return The audio display service handle + */ +// display_service_handle_t audio_board_led_init(void); + +/** + * @brief Initialize key peripheral + * + * @param set The handle of esp_periph_set_handle_t + * + * @return + * - ESP_OK, success + * - Others, fail + */ +// esp_err_t audio_board_key_init(esp_periph_set_handle_t set); + +/** + * @brief Initialize sdcard peripheral + * + * @param set The handle of esp_periph_set_handle_t + * + * @return + * - ESP_OK, success + * - Others, fail + */ +// esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, +// periph_sdcard_mode_t mode); + +/** + * @brief Query audio_board_handle + * + * @return The audio board handle + */ +audio_board_handle_t audio_board_get_handle(void); + +/** + * @brief Uninitialize the audio board + * + * @param audio_board The handle of audio board + * + * @return 0 success, + * others fail + */ +esp_err_t audio_board_deinit(audio_board_handle_t audio_board); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/components/audio_board/lyratd_msc_v2_1/board_def.h b/components/audio_board/lyratd_msc_v2_1/board_def.h new file mode 100644 index 00000000..f791e545 --- /dev/null +++ b/components/audio_board/lyratd_msc_v2_1/board_def.h @@ -0,0 +1,119 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2019 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _AUDIO_BOARD_DEFINITION_H_ +#define _AUDIO_BOARD_DEFINITION_H_ + +/** + * @brief SDCARD Function Definition + */ +#define FUNC_SDCARD_EN (1) +#define SDCARD_OPEN_FILE_NUM_MAX 5 +#define SDCARD_INTR_GPIO GPIO_NUM_34 + +#define ESP_SD_PIN_CLK GPIO_NUM_14 +#define ESP_SD_PIN_CMD GPIO_NUM_15 +#define ESP_SD_PIN_D0 GPIO_NUM_2 +#define ESP_SD_PIN_D1 GPIO_NUM_4 +#define ESP_SD_PIN_D2 GPIO_NUM_12 +#define ESP_SD_PIN_D3 GPIO_NUM_13 + +/** + * @brief Audio Codec Chip Function Definition + */ +#define FUNC_AUDIO_CODEC_EN (1) +#define PA_ENABLE_GPIO GPIO_NUM_22 +#define CODEC_RESET_GPIO GPIO_NUM_19 +#define DSP_RESET_GPIO GPIO_NUM_21 +#define CODEC_ADC_I2S_PORT (0) +#define CODEC_ADC_BITS_PER_SAMPLE I2S_BITS_PER_SAMPLE_16BIT +#define CODEC_ADC_SAMPLE_RATE (44100) +#define RECORD_HARDWARE_AEC (false) +#define BOARD_PA_GAIN (20) /* Power amplifier gain defined by board (dB) */ + +extern audio_hal_func_t AUDIO_CODEC_ZL38063_DEFAULT_HANDLE; +#define AUDIO_CODEC_DEFAULT_CONFIG() \ + { \ + .adc_input = AUDIO_HAL_ADC_INPUT_LINE1, \ + .dac_output = AUDIO_HAL_DAC_OUTPUT_ALL, \ + .codec_mode = AUDIO_HAL_CODEC_MODE_BOTH, \ + .i2s_iface = \ + { \ + .mode = AUDIO_HAL_MODE_SLAVE, \ + .fmt = AUDIO_HAL_I2S_NORMAL, \ + .samples = AUDIO_HAL_48K_SAMPLES, \ + .bits = AUDIO_HAL_BIT_LENGTH_16BITS, \ + }, \ + }; + +/** + * @brief Button Function Definition + */ +#define FUNC_BUTTON_EN (1) +#define ADC_DETECT_GPIO GPIO_NUM_39 +#define INPUT_KEY_NUM 6 +#define BUTTON_SET_ID 0 +#define BUTTON_PLAY_ID 1 +#define BUTTON_REC_ID 2 +#define BUTTON_MODE_ID 3 +#define BUTTON_VOLDOWN_ID 4 +#define BUTTON_VOLUP_ID 5 +#define GREEN_LED_GPIO (-1) + +#define INPUT_KEY_DEFAULT_INFO() \ + { \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_REC, \ + .act_id = BUTTON_REC_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_MODE, \ + .act_id = BUTTON_MODE_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_SET, \ + .act_id = BUTTON_SET_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_PLAY, \ + .act_id = BUTTON_PLAY_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_VOLUP, \ + .act_id = BUTTON_VOLUP_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, .user_id = INPUT_KEY_USER_ID_VOLDOWN, \ + .act_id = BUTTON_VOLDOWN_ID, \ + } \ + } + +#endif diff --git a/components/audio_board/lyratd_msc_v2_1/board_pins_config.c b/components/audio_board/lyratd_msc_v2_1/board_pins_config.c new file mode 100644 index 00000000..a25fb8f3 --- /dev/null +++ b/components/audio_board/lyratd_msc_v2_1/board_pins_config.c @@ -0,0 +1,114 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2019 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include + +#include "audio_error.h" +#include "audio_mem.h" +#include "board.h" +#include "driver/gpio.h" +#include "esp_log.h" + +static const char *TAG = "LYRATD_MSC_V2_1"; + +esp_err_t get_i2c_pins(i2c_port_t port, i2c_config_t *i2c_config) { + AUDIO_NULL_CHECK(TAG, i2c_config, return ESP_FAIL); + if (port == I2C_NUM_0 || port == I2C_NUM_1) { + i2c_config->sda_io_num = GPIO_NUM_18; + i2c_config->scl_io_num = GPIO_NUM_23; + } else { + i2c_config->sda_io_num = -1; + i2c_config->scl_io_num = -1; + ESP_LOGE(TAG, "i2c port %d is not supported", port); + return ESP_FAIL; + } + return ESP_OK; +} + +esp_err_t get_i2s_pins(i2s_port_t port, board_i2s_pin_t *i2s_config) { + AUDIO_NULL_CHECK(TAG, i2s_config, return ESP_FAIL); + if (port == I2S_NUM_0 || port == I2S_NUM_1) { + i2s_config->bck_io_num = GPIO_NUM_5; + i2s_config->ws_io_num = GPIO_NUM_25; + i2s_config->data_out_num = GPIO_NUM_26; + i2s_config->data_in_num = GPIO_NUM_35; + } else { + memset(i2s_config, -1, sizeof(board_i2s_pin_t)); + ESP_LOGE(TAG, "i2s port %d is not supported", port); + return ESP_FAIL; + } + return ESP_OK; +} + +esp_err_t get_spi_pins( + spi_bus_config_t *spi_config, + spi_device_interface_config_t *spi_device_interface_config) { + AUDIO_NULL_CHECK(TAG, spi_config, return ESP_FAIL); + AUDIO_NULL_CHECK(TAG, spi_config, return ESP_FAIL); + spi_config->mosi_io_num = GPIO_NUM_33; + spi_config->miso_io_num = GPIO_NUM_27; + spi_config->sclk_io_num = GPIO_NUM_32; + spi_config->quadwp_io_num = -1; + spi_config->quadhd_io_num = -1; + + spi_device_interface_config->spics_io_num = GPIO_NUM_0; + + return ESP_OK; +} + +// sdcard + +int8_t get_sdcard_intr_gpio(void) { return SDCARD_INTR_GPIO; } + +int8_t get_sdcard_open_file_num_max(void) { return SDCARD_OPEN_FILE_NUM_MAX; } + +// input-output pins + +int8_t get_pa_enable_gpio(void) { return PA_ENABLE_GPIO; } + +// adc button + +int8_t get_adc_detect_gpio(void) { return ADC_DETECT_GPIO; } + +int8_t get_input_rec_id(void) { return BUTTON_REC_ID; } + +int8_t get_input_mode_id(void) { return BUTTON_MODE_ID; } + +int8_t get_input_play_id(void) { return BUTTON_PLAY_ID; } + +int8_t get_input_set_id(void) { return BUTTON_SET_ID; } + +int8_t get_input_volup_id(void) { return BUTTON_VOLUP_ID; } + +int8_t get_input_voldown_id(void) { return BUTTON_VOLDOWN_ID; } + +// board related +int8_t get_reset_codec_gpio(void) { return CODEC_RESET_GPIO; } + +int8_t get_reset_board_gpio(void) { return DSP_RESET_GPIO; } + +// led pins +int8_t get_green_led_gpio(void) { return GREEN_LED_GPIO; } diff --git a/components/audio_board/lyratd_msc_v2_2/board.c b/components/audio_board/lyratd_msc_v2_2/board.c new file mode 100644 index 00000000..a7cd7dc2 --- /dev/null +++ b/components/audio_board/lyratd_msc_v2_2/board.c @@ -0,0 +1,131 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2019 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include "board.h" + +#include "audio_mem.h" +#include "esp_log.h" +// #include "led_bar_is31x.h" +// #include "periph_adc_button.h" +// #include "periph_sdcard.h" + +static const char *TAG = "AUDIO_BOARD"; + +static audio_board_handle_t board_handle = 0; + +audio_board_handle_t audio_board_init(void) { + if (board_handle) { + ESP_LOGW(TAG, "The board has already been initialized!"); + return board_handle; + } + board_handle = + (audio_board_handle_t)audio_calloc(1, sizeof(struct audio_board_handle)); + AUDIO_MEM_CHECK(TAG, board_handle, return NULL); + board_handle->audio_hal = audio_board_codec_init(); + + return board_handle; +} + +audio_hal_handle_t audio_board_codec_init(void) { + audio_hal_codec_config_t audio_codec_cfg = AUDIO_CODEC_DEFAULT_CONFIG(); + audio_hal_handle_t codec_hal = + audio_hal_init(&audio_codec_cfg, &AUDIO_CODEC_ZL38063_DEFAULT_HANDLE); + AUDIO_NULL_CHECK(TAG, codec_hal, return NULL); + return codec_hal; +} + +// display_service_handle_t audio_board_led_init(void) { +// esp_periph_handle_t led = led_bar_is31x_init(); +// AUDIO_NULL_CHECK(TAG, led, return NULL); +// display_service_config_t display = { +// .based_cfg = +// { +// .task_stack = 0, +// .task_prio = 0, +// .task_core = 0, +// .task_func = NULL, +// .service_start = NULL, +// .service_stop = NULL, +// .service_destroy = NULL, +// .service_ioctl = led_bar_is31x_pattern, +// .service_name = "DISPLAY_serv", +// .user_data = NULL, +// }, +// .instance = led, +// }; +// +// return display_service_create(&display); +// } +// +// esp_err_t audio_board_key_init(esp_periph_set_handle_t set) { +// periph_adc_button_cfg_t adc_btn_cfg = PERIPH_ADC_BUTTON_DEFAULT_CONFIG(); +// adc_arr_t adc_btn_tag = ADC_DEFAULT_ARR(); +// adc_btn_cfg.arr = &adc_btn_tag; +// adc_btn_cfg.arr_size = 1; +// esp_periph_handle_t adc_btn_handle = periph_adc_button_init(&adc_btn_cfg); +// AUDIO_NULL_CHECK(TAG, adc_btn_handle, return ESP_ERR_ADF_MEMORY_LACK); +// return esp_periph_start(set, adc_btn_handle); +// } +// +// esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, +// periph_sdcard_mode_t mode) { +// if (mode >= SD_MODE_8_LINE) { +// ESP_LOGE(TAG, "Please select the correct sd mode!, current mode is %d", +// mode); +// return ESP_FAIL; +// } +// periph_sdcard_cfg_t sdcard_cfg = { +// .root = "/sdcard", +// .card_detect_pin = get_sdcard_intr_gpio(), // GPIO_NUM_34 +// .mode = mode}; +// esp_periph_handle_t sdcard_handle = periph_sdcard_init(&sdcard_cfg); +// esp_err_t ret = esp_periph_start(set, sdcard_handle); +// int retry_time = 5; +// bool mount_flag = false; +// while (retry_time--) { +// if (periph_sdcard_is_mounted(sdcard_handle)) { +// mount_flag = true; +// break; +// } else { +// vTaskDelay(500 / portTICK_PERIOD_MS); +// } +// } +// if (mount_flag == false) { +// ESP_LOGE(TAG, "Sdcard mount failed"); +// return ESP_FAIL; +// } +// return ret; +// } + +audio_board_handle_t audio_board_get_handle(void) { return board_handle; } + +esp_err_t audio_board_deinit(audio_board_handle_t audio_board) { + esp_err_t ret = ESP_OK; + ret = audio_hal_deinit(audio_board->audio_hal); + audio_free(audio_board); + board_handle = NULL; + return ret; +} diff --git a/components/audio_board/lyratd_msc_v2_2/board.h b/components/audio_board/lyratd_msc_v2_2/board.h new file mode 100644 index 00000000..ce0fdfe6 --- /dev/null +++ b/components/audio_board/lyratd_msc_v2_2/board.h @@ -0,0 +1,115 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2019 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _AUDIO_BOARD_H_ +#define _AUDIO_BOARD_H_ + +#include "audio_hal.h" +#include "board_def.h" +#include "board_pins_config.h" +// #include "display_service.h" +// #include "esp_peripherals.h" +// #include "periph_sdcard.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Audio board handle + */ +struct audio_board_handle { + audio_hal_handle_t audio_hal; /*!< audio hardware abstract layer handle */ +}; + +typedef struct audio_board_handle *audio_board_handle_t; + +/** + * @brief Initialize audio board + * + * @return The audio board handle + */ +audio_board_handle_t audio_board_init(void); + +/** + * @brief Initialize codec chip + * + * @return The audio hal handle + */ +audio_hal_handle_t audio_board_codec_init(void); + +/** + * @brief Initialize led peripheral and display service + * + * @return The audio display service handle + */ +// display_service_handle_t audio_board_led_init(void); + +/** + * @brief Initialize key peripheral + * + * @param set The handle of esp_periph_set_handle_t + * + * @return + * - ESP_OK, success + * - Others, fail + */ +// esp_err_t audio_board_key_init(esp_periph_set_handle_t set); + +/** + * @brief Initialize sdcard peripheral + * + * @param set The handle of esp_periph_set_handle_t + * + * @return + * - ESP_OK, success + * - Others, fail + */ +// esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, +// periph_sdcard_mode_t mode); + +/** + * @brief Query audio_board_handle + * + * @return The audio board handle + */ +audio_board_handle_t audio_board_get_handle(void); + +/** + * @brief Uninitialize the audio board + * + * @param audio_board The handle of audio board + * + * @return 0 success, + * others fail + */ +esp_err_t audio_board_deinit(audio_board_handle_t audio_board); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/components/audio_board/lyratd_msc_v2_2/board_def.h b/components/audio_board/lyratd_msc_v2_2/board_def.h new file mode 100644 index 00000000..850e7a01 --- /dev/null +++ b/components/audio_board/lyratd_msc_v2_2/board_def.h @@ -0,0 +1,120 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2019 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _AUDIO_BOARD_DEFINITION_H_ +#define _AUDIO_BOARD_DEFINITION_H_ + +/** + * @brief SDCARD Function Definition + */ +#define FUNC_SDCARD_EN (1) +#define SDCARD_OPEN_FILE_NUM_MAX 5 +#define SDCARD_INTR_GPIO GPIO_NUM_34 + +#define ESP_SD_PIN_CLK GPIO_NUM_14 +#define ESP_SD_PIN_CMD GPIO_NUM_15 +#define ESP_SD_PIN_D0 GPIO_NUM_2 +#define ESP_SD_PIN_D1 GPIO_NUM_4 +#define ESP_SD_PIN_D2 GPIO_NUM_12 +#define ESP_SD_PIN_D3 GPIO_NUM_13 + +/** + * @brief Audio Codec Chip Function Definition + */ +#define FUNC_AUDIO_CODEC_EN (1) +#define HEADPHONE_GPIO GPIO_NUM_36 +#define PA_ENABLE_GPIO GPIO_NUM_22 +#define CODEC_RESET_GPIO GPIO_NUM_19 +#define DSP_RESET_GPIO GPIO_NUM_21 +#define CODEC_ADC_I2S_PORT (0) +#define CODEC_ADC_BITS_PER_SAMPLE I2S_BITS_PER_SAMPLE_16BIT +#define CODEC_ADC_SAMPLE_RATE (44100) +#define RECORD_HARDWARE_AEC (false) +#define BOARD_PA_GAIN (20) /* Power amplifier gain defined by board (dB) */ + +extern audio_hal_func_t AUDIO_CODEC_ZL38063_DEFAULT_HANDLE; +#define AUDIO_CODEC_DEFAULT_CONFIG() \ + { \ + .adc_input = AUDIO_HAL_ADC_INPUT_LINE1, \ + .dac_output = AUDIO_HAL_DAC_OUTPUT_ALL, \ + .codec_mode = AUDIO_HAL_CODEC_MODE_BOTH, \ + .i2s_iface = \ + { \ + .mode = AUDIO_HAL_MODE_SLAVE, \ + .fmt = AUDIO_HAL_I2S_NORMAL, \ + .samples = AUDIO_HAL_48K_SAMPLES, \ + .bits = AUDIO_HAL_BIT_LENGTH_16BITS, \ + }, \ + }; + +/** + * @brief Button Function Definition + */ +#define FUNC_BUTTON_EN (1) +#define INPUT_KEY_NUM 6 +#define ADC_DETECT_GPIO GPIO_NUM_39 +#define BUTTON_SET_ID 0 +#define BUTTON_PLAY_ID 1 +#define BUTTON_REC_ID 2 +#define BUTTON_MODE_ID 3 +#define BUTTON_VOLDOWN_ID 4 +#define BUTTON_VOLUP_ID 5 +#define GREEN_LED_GPIO (-1) + +#define INPUT_KEY_DEFAULT_INFO() \ + { \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_REC, \ + .act_id = BUTTON_REC_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_MODE, \ + .act_id = BUTTON_MODE_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_SET, \ + .act_id = BUTTON_SET_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_PLAY, \ + .act_id = BUTTON_PLAY_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, \ + .user_id = INPUT_KEY_USER_ID_VOLUP, \ + .act_id = BUTTON_VOLUP_ID, \ + }, \ + { \ + .type = PERIPH_ID_ADC_BTN, .user_id = INPUT_KEY_USER_ID_VOLDOWN, \ + .act_id = BUTTON_VOLDOWN_ID, \ + } \ + } + +#endif diff --git a/components/audio_board/lyratd_msc_v2_2/board_pins_config.c b/components/audio_board/lyratd_msc_v2_2/board_pins_config.c new file mode 100644 index 00000000..616fdd72 --- /dev/null +++ b/components/audio_board/lyratd_msc_v2_2/board_pins_config.c @@ -0,0 +1,116 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2019 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include + +#include "audio_error.h" +#include "audio_mem.h" +#include "board.h" +#include "driver/gpio.h" +#include "esp_log.h" + +static const char *TAG = "LYRATD_MSC_V2_2"; + +esp_err_t get_i2c_pins(i2c_port_t port, i2c_config_t *i2c_config) { + AUDIO_NULL_CHECK(TAG, i2c_config, return ESP_FAIL); + if (port == I2C_NUM_0 || port == I2C_NUM_1) { + i2c_config->sda_io_num = GPIO_NUM_18; + i2c_config->scl_io_num = GPIO_NUM_23; + } else { + i2c_config->sda_io_num = -1; + i2c_config->scl_io_num = -1; + ESP_LOGE(TAG, "i2c port %d is not supported", port); + return ESP_FAIL; + } + return ESP_OK; +} + +esp_err_t get_i2s_pins(i2s_port_t port, board_i2s_pin_t *i2s_config) { + AUDIO_NULL_CHECK(TAG, i2s_config, return ESP_FAIL); + if (port == I2S_NUM_0 || port == I2S_NUM_1) { + i2s_config->bck_io_num = GPIO_NUM_5; + i2s_config->ws_io_num = GPIO_NUM_25; + i2s_config->data_out_num = GPIO_NUM_26; + i2s_config->data_in_num = GPIO_NUM_35; + } else { + memset(i2s_config, -1, sizeof(board_i2s_pin_t)); + ESP_LOGE(TAG, "i2s port %d is not supported", port); + return ESP_FAIL; + } + return ESP_OK; +} + +esp_err_t get_spi_pins( + spi_bus_config_t *spi_config, + spi_device_interface_config_t *spi_device_interface_config) { + AUDIO_NULL_CHECK(TAG, spi_config, return ESP_FAIL); + spi_config->mosi_io_num = GPIO_NUM_33; + spi_config->miso_io_num = GPIO_NUM_27; + spi_config->sclk_io_num = GPIO_NUM_32; + spi_config->quadwp_io_num = -1; + spi_config->quadhd_io_num = -1; + + spi_device_interface_config->spics_io_num = GPIO_NUM_0; + + return ESP_OK; +} + +// sdcard + +int8_t get_sdcard_intr_gpio(void) { return SDCARD_INTR_GPIO; } + +int8_t get_sdcard_open_file_num_max(void) { return SDCARD_OPEN_FILE_NUM_MAX; } + +// input-output pins + +int8_t get_headphone_detect_gpio(void) { return HEADPHONE_GPIO; } + +int8_t get_pa_enable_gpio(void) { return PA_ENABLE_GPIO; } + +// adc button + +int8_t get_adc_detect_gpio(void) { return ADC_DETECT_GPIO; } + +int8_t get_input_rec_id(void) { return BUTTON_REC_ID; } + +int8_t get_input_mode_id(void) { return BUTTON_MODE_ID; } + +int8_t get_input_play_id(void) { return BUTTON_PLAY_ID; } + +int8_t get_input_set_id(void) { return BUTTON_SET_ID; } + +int8_t get_input_volup_id(void) { return BUTTON_VOLUP_ID; } + +int8_t get_input_voldown_id(void) { return BUTTON_VOLDOWN_ID; } + +// board related + +int8_t get_reset_codec_gpio(void) { return CODEC_RESET_GPIO; } + +int8_t get_reset_board_gpio(void) { return DSP_RESET_GPIO; } + +// led pins +int8_t get_green_led_gpio(void) { return GREEN_LED_GPIO; } diff --git a/components/audio_hal/CMakeLists.txt b/components/audio_hal/CMakeLists.txt index 2c511564..17c26127 100644 --- a/components/audio_hal/CMakeLists.txt +++ b/components/audio_hal/CMakeLists.txt @@ -2,41 +2,54 @@ set(COMPONENT_ADD_INCLUDEDIRS ./include ./driver/es8388 ./driver/es8374 ./driver/es8311 + ./driver/es8156 ./driver/es7243 ./driver/es7148 ./driver/es7210 + ./driver/es7243e ./driver/tas5805m - #./driver/zl38063 - #./driver/zl38063/api_lib - #./driver/zl38063/example_apps - #./driver/zl38063/firmware - ./driver/include - ) + ./driver/include) +IF (NOT ((CONFIG_IDF_TARGET STREQUAL "esp32c3") OR (CONFIG_IDF_TARGET STREQUAL "esp32c6"))) + list(APPEND COMPONENT_ADD_INCLUDEDIRS + ./driver/zl38063 + ./driver/zl38063/api_lib + ./driver/zl38063/example_apps + ./driver/zl38063/firmware) +endif() # Edit following two lines to set component requirements (see docs) set(COMPONENT_REQUIRES ) -set(COMPONENT_PRIV_REQUIRES audio_sal audio_board mbedtls esp_peripherals) +set(COMPONENT_PRIV_REQUIRES audio_sal audio_board mbedtls esp_peripherals custom_board) set(COMPONENT_SRCS ./audio_hal.c + ./audio_volume.c ./driver/es8388/es8388.c ./driver/es8388/headphone_detect.c ./driver/es8374/es8374.c ./driver/es8311/es8311.c + ./driver/es8156/es8156.c ./driver/es7243/es7243.c ./driver/es7148/es7148.c ./driver/es7210/es7210.c + ./driver/es7243e/es7243e.c ./driver/tas5805m/tas5805m.c - #./driver/zl38063/zl38063.c - #./driver/zl38063/api_lib/vprocTwolf_access.c - #./driver/zl38063/api_lib/vproc_common.c - #./driver/zl38063/example_apps/tw_hal_verify.c - #./driver/zl38063/example_apps/tw_ldcfg.c - #./driver/zl38063/example_apps/tw_ldfw.c - #./driver/zl38063/example_apps/tw_ldfwcfg.c - #./driver/zl38063/example_apps/tw_spi_access.c ) +IF (NOT ((CONFIG_IDF_TARGET STREQUAL "esp32c3") OR (CONFIG_IDF_TARGET STREQUAL "esp32c6"))) + list(APPEND COMPONENT_SRCS + ./driver/zl38063/zl38063.c + ./driver/zl38063/api_lib/vprocTwolf_access.c + ./driver/zl38063/api_lib/vproc_common.c + ./driver/zl38063/example_apps/tw_hal_verify.c + ./driver/zl38063/example_apps/tw_ldcfg.c + ./driver/zl38063/example_apps/tw_ldfw.c + ./driver/zl38063/example_apps/tw_ldfwcfg.c + ./driver/zl38063/example_apps/tw_spi_access.c) +endif() + register_component() -#target_link_libraries(${COMPONENT_TARGET} INTERFACE "-L${CMAKE_CURRENT_LIST_DIR}/driver/zl38063/firmware") -#target_link_libraries(${COMPONENT_TARGET} INTERFACE firmware) +IF (NOT ((CONFIG_IDF_TARGET STREQUAL "esp32c3") OR (CONFIG_IDF_TARGET STREQUAL "esp32c6"))) + target_link_libraries(${COMPONENT_TARGET} INTERFACE "-L${CMAKE_CURRENT_LIST_DIR}/driver/zl38063/firmware") + target_link_libraries(${COMPONENT_TARGET} INTERFACE firmware) +ENDIF() diff --git a/components/audio_hal/audio_hal.c b/components/audio_hal/audio_hal.c index 83c42f5e..8ce2b1ca 100644 --- a/components/audio_hal/audio_hal.c +++ b/components/audio_hal/audio_hal.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,140 +18,132 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "audio_hal.h" -#include "driver/gpio.h" -#include "esp_log.h" + #include #include "audio_mem.h" #include "audio_mutex.h" +#include "driver/gpio.h" +#include "esp_log.h" static const char *TAG = "AUDIO_HAL"; -#define AUDIO_HAL_CHECK_NULL(a, format, b, ...) \ - if ((a) == 0) \ - { \ - ESP_LOGE (TAG, format, ##__VA_ARGS__); \ - return b; \ - } +#define AUDIO_HAL_CHECK_NULL(a, format, b, ...) \ + if ((a) == 0) { \ + ESP_LOGE(TAG, format, ##__VA_ARGS__); \ + return b; \ + } -audio_hal_handle_t -audio_hal_init (audio_hal_codec_config_t *audio_hal_conf, - audio_hal_func_t *audio_hal_func) -{ +audio_hal_handle_t audio_hal_init(audio_hal_codec_config_t *audio_hal_conf, + audio_hal_func_t *audio_hal_func) { esp_err_t ret = 0; - audio_hal_handle_t audio_hal - = (audio_hal_handle_t)audio_calloc (1, sizeof (audio_hal_func_t)); - AUDIO_MEM_CHECK (TAG, audio_hal, return NULL); - memcpy (audio_hal, audio_hal_func, sizeof (audio_hal_func_t)); - audio_hal->audio_hal_lock = mutex_create (); + audio_hal_handle_t audio_hal = + (audio_hal_handle_t)audio_calloc(1, sizeof(audio_hal_func_t)); + AUDIO_MEM_CHECK(TAG, audio_hal, return NULL); + memcpy(audio_hal, audio_hal_func, sizeof(audio_hal_func_t)); + audio_hal->audio_hal_lock = mutex_create(); - AUDIO_MEM_CHECK (TAG, audio_hal->audio_hal_lock, { - audio_free (audio_hal); + AUDIO_MEM_CHECK(TAG, audio_hal->audio_hal_lock, { + audio_free(audio_hal); return NULL; }); - mutex_lock (audio_hal->audio_hal_lock); - ret = audio_hal->audio_codec_initialize (audio_hal_conf); - if (ret == ESP_FAIL) - { - audio_free (audio_hal); - if (audio_hal_func->handle) - { - return audio_hal_func->handle; - } - else - { - ESP_LOGE (TAG, "codec init failed!"); - return NULL; - } + mutex_lock(audio_hal->audio_hal_lock); + ret = audio_hal->audio_codec_initialize(audio_hal_conf); + if (ret == ESP_FAIL) { + audio_free(audio_hal); + if (audio_hal_func->handle) { + return audio_hal_func->handle; + } else { + ESP_LOGE(TAG, "codec init failed!"); + return NULL; } - ret |= audio_hal->audio_codec_config_iface (audio_hal_conf->codec_mode, - &audio_hal_conf->i2s_iface); - ret |= audio_hal->audio_codec_set_volume (AUDIO_HAL_VOL_DEFAULT); + } + ret |= audio_hal->audio_codec_config_iface(audio_hal_conf->codec_mode, + &audio_hal_conf->i2s_iface); + ret |= audio_hal->audio_codec_set_volume(AUDIO_HAL_VOL_DEFAULT); + AUDIO_RET_ON_FALSE(TAG, ret, return NULL, "audio_hal_init failed"); audio_hal->handle = audio_hal; audio_hal_func->handle = audio_hal; - mutex_unlock (audio_hal->audio_hal_lock); + mutex_unlock(audio_hal->audio_hal_lock); return audio_hal; } -esp_err_t -audio_hal_deinit (audio_hal_handle_t audio_hal) -{ +esp_err_t audio_hal_deinit(audio_hal_handle_t audio_hal) { esp_err_t ret; - AUDIO_HAL_CHECK_NULL (audio_hal, "audio_hal handle is null", -1); - mutex_destroy (audio_hal->audio_hal_lock); - ret = audio_hal->audio_codec_deinitialize (); + AUDIO_HAL_CHECK_NULL(audio_hal, "audio_hal handle is null", -1); + mutex_destroy(audio_hal->audio_hal_lock); + ret = audio_hal->audio_codec_deinitialize(); audio_hal->audio_hal_lock = NULL; audio_hal->handle = NULL; - audio_free (audio_hal); + audio_free(audio_hal); audio_hal = NULL; return ret; } -esp_err_t -audio_hal_ctrl_codec (audio_hal_handle_t audio_hal, - audio_hal_codec_mode_t mode, - audio_hal_ctrl_t audio_hal_state) -{ +esp_err_t audio_hal_ctrl_codec(audio_hal_handle_t audio_hal, + audio_hal_codec_mode_t mode, + audio_hal_ctrl_t audio_hal_state) { esp_err_t ret; - AUDIO_HAL_CHECK_NULL (audio_hal, "audio_hal handle is null", -1); - mutex_lock (audio_hal->audio_hal_lock); - ESP_LOGI (TAG, "Codec mode is %d, Ctrl:%d", mode, audio_hal_state); - ret = audio_hal->audio_codec_ctrl (mode, audio_hal_state); - mutex_unlock (audio_hal->audio_hal_lock); + AUDIO_HAL_CHECK_NULL(audio_hal, "audio_hal handle is null", -1); + mutex_lock(audio_hal->audio_hal_lock); + ESP_LOGI(TAG, "Codec mode is %d, Ctrl:%d", mode, audio_hal_state); + ret = audio_hal->audio_codec_ctrl(mode, audio_hal_state); + mutex_unlock(audio_hal->audio_hal_lock); return ret; } -esp_err_t -audio_hal_codec_iface_config (audio_hal_handle_t audio_hal, - audio_hal_codec_mode_t mode, - audio_hal_codec_i2s_iface_t *iface) -{ +esp_err_t audio_hal_codec_iface_config(audio_hal_handle_t audio_hal, + audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface) { esp_err_t ret = 0; - AUDIO_HAL_CHECK_NULL (audio_hal, "audio_hal handle is null", -1); - AUDIO_HAL_CHECK_NULL (iface, "Get volume para is null", -1); - mutex_lock (audio_hal->audio_hal_lock); - ret = audio_hal->audio_codec_config_iface (mode, iface); - mutex_unlock (audio_hal->audio_hal_lock); + AUDIO_HAL_CHECK_NULL(audio_hal, "audio_hal handle is null", -1); + AUDIO_HAL_CHECK_NULL(iface, "Get volume para is null", -1); + mutex_lock(audio_hal->audio_hal_lock); + ret = audio_hal->audio_codec_config_iface(mode, iface); + mutex_unlock(audio_hal->audio_hal_lock); + return ret; +} + +esp_err_t audio_hal_set_mute(audio_hal_handle_t audio_hal, bool mute) { + esp_err_t ret; + AUDIO_HAL_CHECK_NULL(audio_hal, "audio_hal handle is null", -1); + mutex_lock(audio_hal->audio_hal_lock); + ret = audio_hal->audio_codec_set_mute(mute); + mutex_unlock(audio_hal->audio_hal_lock); return ret; } -esp_err_t -audio_hal_set_mute (audio_hal_handle_t audio_hal, bool mute) -{ +esp_err_t audio_hal_enable_pa(audio_hal_handle_t audio_hal, bool enable) { esp_err_t ret; - AUDIO_HAL_CHECK_NULL (audio_hal, "audio_hal handle is null", -1); - mutex_lock (audio_hal->audio_hal_lock); - ret = audio_hal->audio_codec_set_mute (mute); - mutex_unlock (audio_hal->audio_hal_lock); + AUDIO_HAL_CHECK_NULL(audio_hal, "audio_hal handle is null", -1); + mutex_lock(audio_hal->audio_hal_lock); + ret = audio_hal->audio_codec_enable_pa(enable); + mutex_unlock(audio_hal->audio_hal_lock); return ret; } -esp_err_t -audio_hal_set_volume (audio_hal_handle_t audio_hal, int volume) -{ +esp_err_t audio_hal_set_volume(audio_hal_handle_t audio_hal, int volume) { esp_err_t ret; - AUDIO_HAL_CHECK_NULL (audio_hal, "audio_hal handle is null", -1); - mutex_lock (audio_hal->audio_hal_lock); - ret = audio_hal->audio_codec_set_volume (volume); - mutex_unlock (audio_hal->audio_hal_lock); + AUDIO_HAL_CHECK_NULL(audio_hal, "audio_hal handle is null", -1); + mutex_lock(audio_hal->audio_hal_lock); + ret = audio_hal->audio_codec_set_volume(volume); + mutex_unlock(audio_hal->audio_hal_lock); return ret; } -esp_err_t -audio_hal_get_volume (audio_hal_handle_t audio_hal, int *volume) -{ +esp_err_t audio_hal_get_volume(audio_hal_handle_t audio_hal, int *volume) { esp_err_t ret; - AUDIO_HAL_CHECK_NULL (audio_hal, "audio_hal handle is null", -1); - AUDIO_HAL_CHECK_NULL (volume, "Get volume para is null", -1); - mutex_lock (audio_hal->audio_hal_lock); - ret = audio_hal->audio_codec_get_volume (volume); - mutex_unlock (audio_hal->audio_hal_lock); + AUDIO_HAL_CHECK_NULL(audio_hal, "audio_hal handle is null", -1); + AUDIO_HAL_CHECK_NULL(volume, "Get volume para is null", -1); + mutex_lock(audio_hal->audio_hal_lock); + ret = audio_hal->audio_codec_get_volume(volume); + mutex_unlock(audio_hal->audio_hal_lock); return ret; } diff --git a/components/audio_hal/audio_volume.c b/components/audio_hal/audio_volume.c new file mode 100644 index 00000000..5b3ae896 --- /dev/null +++ b/components/audio_hal/audio_volume.c @@ -0,0 +1,195 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2022 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +/* + * |----------------Digital Gain---------------------|--Analog + * Gain-| + * + * |--------------| |--------------------| |------------------| + * |---------| |----------------| | Audio Stream |--->| Audio Process Gain + * |--->| Codec DAC Volume |--->| PA Gain |--->| Speaker Output | + * |--------------| |--------------------| |------------------| + * |---------| |----------------| + * + * The speaker playback route is shown as the block diagram above. The speaker + * loudness is affected by both audio Digital Gain and Analog Gain. + * + * Digital Gain: + * Audio Process Gain: Audio Process, such as ALC, AGC, DRC target MAX Gain. + * Codec DAC Volume: The audio codec DAC volume control, such as ES8311 + * DAC_Volume control register. + * + * Analog Gain: + * PA Gain: The speaker power amplifier Gain, which is determined by the + * hardware circuit board. + * + * User can control the speaker playback volume by adjusting Codec DAC Volume. + * + * We use volume level (1-100) to represent the volume levels, level 100 is the + * MAX volume. We create a volume mapping index table for the user to set the + * volume level through Codec DAC volume. The default mapping table maps volume + * level(1-100) to Codec DAC Volume (-49.5dB, 0dB). The volume setting has 25 + * volume levels. Level step is 4, and the corresponding to Codec DAC Volume + * Gain is 2 dB step. Normally, Codec DAC volume -50 dB reproduces a minimal + * speaker loudness, and the 2 dB step allows the user to detect the volume + * change. + * + * Gain and Decibel Reference: + * https://www.espressif.com/zh-hans/media_overview/blog + * + */ + +#include "audio_volume.h" + +#include +#include + +#include "audio_mem.h" + +/** + * The speaker playback route gain (Audio Process Gain + Codec DAC Volume + PA + * Gain) needs to ensure that the speaker PA output is not saturated and exceeds + * the speaker rated power. We define the maximum route gain as MAX_GAIN. To + * ensure the speaker PA output is not saturated, MAX_GAIN can be calculated + * simply by the formula. MAX_GAIN = 20 * log(Vpa/Vdac) Vpa: PA power supply + * Vdac: Codec DAC power supply + * e.g., Vpa = 5V, Vdac = 3.3V, then MAX_GAIN = 20 * log(5/3.3) = 3.6 dB. + * If the speaker rated power is lower than the speaker PA MAX power, MAX_GAIN + * should be defined according to the speaker rated power. + * + */ +#define VPA (5.0) +#define VDAC (3.3) +#define MAX_GAIN (20.0 * log10(VPA / VDAC)) + +/* + * User can customize the volume setting by modifying the mapping table and + * adjust the volume step according to the speaker playback system, and the + * other volume levels shift the value accordingly. Integers are used instead of + * floating-point variables to reduce storage space. -80 means -40 dB, 0 means 0 + * dB. + */ +static const int8_t dac_volume_offset[] = { + -99, -98, -97, -96, -95, -94, -93, -92, -91, -90, -89, -88, -87, -86, -85, + -84, -83, -82, -81, -80, -79, -78, -77, -76, -75, -74, -73, -72, -71, -70, + -69, -68, -67, -66, -65, -64, -63, -62, -61, -60, -59, -58, -57, -56, -55, + -54, -53, -52, -51, -50, -49, -48, -47, -46, -45, -44, -43, -42, -41, -40, + -39, -38, -37, -36, -35, -34, -33, -32, -31, -30, -29, -28, -27, -26, -25, + -24, -23, -22, -21, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, + -9, -8, -7, -6, -5, -4, -3, -2, -1, 0}; + +/** + * @brief Get DAC volume offset from user set volume, you can use an array or + * function to finish this map + * + * @note The max DAC volume is 0 dB when the user volume is 100. 0 dB means + * there is no attenuation of the sound source, and it is the original sound + * source. It can not exceed 0 dB. Otherwise, there is a risk of clipping noise. + * @note For better audio dynamic range, we'd better use 0dB full scale digital + * gain and lower analog gain. + * @note DAC volume offset is positively correlated with the user volume. + * + * @param volume User set volume (1-100) + * + * @return + * - Codec DAC volume offset. The max value must be 0 dB. + */ +static inline float codec_get_dac_volume_offset(int volume) { + float offset = dac_volume_offset[volume - 1] / 2.0; + return offset; +} + +/** + * @brief The register value is linear to the dac_volume + */ +static inline uint8_t audio_codec_calculate_reg(volume_handle_t vol_handle, + float dac_volume) { + codec_dac_volume_config_t *handle = (codec_dac_volume_config_t *)vol_handle; + uint8_t reg = (uint8_t)(dac_volume / (handle->dac_vol_symbol * + handle->volume_accuracy) + + handle->zero_volume_reg); + return reg; +} + +volume_handle_t audio_codec_volume_init(codec_dac_volume_config_t *config) { + codec_dac_volume_config_t *handle = (codec_dac_volume_config_t *)audio_calloc( + 1, sizeof(codec_dac_volume_config_t)); + memcpy(handle, config, sizeof(codec_dac_volume_config_t)); + if (!handle->offset_conv_volume) { + handle->offset_conv_volume = codec_get_dac_volume_offset; + } + return (volume_handle_t)handle; +} + +/** + * @brief Take zero dac_volume as the origin and calculate the volume offset + * according to the register value + */ +float audio_codec_cal_dac_volume(volume_handle_t vol_handle) { + codec_dac_volume_config_t *handle = (codec_dac_volume_config_t *)vol_handle; + float dac_volume = handle->dac_vol_symbol * handle->volume_accuracy * + (handle->reg_value - handle->zero_volume_reg); + return dac_volume; +} + +uint8_t audio_codec_get_dac_reg_value(volume_handle_t vol_handle, int volume) { + float dac_volume = 0; + int user_volume = volume; + codec_dac_volume_config_t *handle = (codec_dac_volume_config_t *)vol_handle; + + if (user_volume < 0) { + user_volume = 0; + } else if (user_volume > 100) { + user_volume = 100; + } + + if (user_volume == 0) { + dac_volume = + handle->min_dac_volume; // Make sure the speaker voice is near silent + } else { + /* + * For better audio performance, at the max volume, we need to ensure: + * Audio Process Gain + Codec DAC Volume + PA Gain <= MAX_GAIN. + * The PA Gain and Audio Process Gain are known when the board design is + * fixed, so max Codec DAC Volume = MAX_GAIN - PA Gain - Audio Process + * Gain,then the volume mapping table shift accordingly. + */ + dac_volume = handle->offset_conv_volume(user_volume) + MAX_GAIN - + handle->board_pa_gain; + dac_volume = dac_volume < handle->max_dac_volume ? dac_volume + : handle->max_dac_volume; + } + handle->reg_value = audio_codec_calculate_reg(handle, dac_volume); + handle->user_volume = user_volume; + return handle->reg_value; +} + +void audio_codec_volume_deinit(volume_handle_t vol_handle) { + if (vol_handle) { + audio_free(vol_handle); + vol_handle = NULL; + } +} diff --git a/components/audio_hal/component.mk b/components/audio_hal/component.mk index 4d41c99b..d794d0e7 100644 --- a/components/audio_hal/component.mk +++ b/components/audio_hal/component.mk @@ -20,5 +20,5 @@ COMPONENT_ADD_LDFLAGS += -L$(COMPONENT_PATH)/driver/zl38063/firmware -lfirmware COMPONENT_ADD_INCLUDEDIRS += ./driver/tas5805m ./driver/es7148 COMPONENT_SRCDIRS += ./driver/tas5805m ./driver/es7148 -COMPONENT_ADD_INCLUDEDIRS += ./driver/es7210 -COMPONENT_SRCDIRS += ./driver/es7210 +COMPONENT_ADD_INCLUDEDIRS += ./driver/es7210 ./driver/es8156 ./driver/es7243e +COMPONENT_SRCDIRS += ./driver/es7210 ./driver/es8156 ./driver/es7243e diff --git a/components/audio_hal/driver/es7148/es7148.c b/components/audio_hal/driver/es7148/es7148.c index d25f212e..88430f3c 100644 --- a/components/audio_hal/driver/es7148/es7148.c +++ b/components/audio_hal/driver/es7148/es7148.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,13 +18,14 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "es7148.h" + #include "board.h" #include "driver/gpio.h" #include "esp_log.h" @@ -34,72 +35,52 @@ static const char *TAG = "es7148"; static bool codec_init_flag = 0; audio_hal_func_t AUDIO_CODEC_ES7148_DEFAULT_HANDLE = { - .audio_codec_initialize = es7148_codec_init, - .audio_codec_deinitialize = es7148_codec_deinit, - .audio_codec_ctrl = es7148_codec_ctrl_state, - .audio_codec_config_iface = es7148_codec_config_i2s, - .audio_codec_set_mute = es7148_codec_set_voice_mute, - .audio_codec_set_volume = es7148_codec_set_voice_volume, - .audio_codec_get_volume = es7148_codec_get_voice_volume, - .audio_hal_lock = NULL, - .handle = NULL, + .audio_codec_initialize = es7148_codec_init, + .audio_codec_deinitialize = es7148_codec_deinit, + .audio_codec_ctrl = es7148_codec_ctrl_state, + .audio_codec_config_iface = es7148_codec_config_i2s, + .audio_codec_set_mute = es7148_codec_set_voice_mute, + .audio_codec_set_volume = es7148_codec_set_voice_volume, + .audio_codec_get_volume = es7148_codec_get_voice_volume, + .audio_codec_enable_pa = NULL, + .audio_hal_lock = NULL, + .handle = NULL, }; -static bool -es7148_codec_initialized () -{ - return codec_init_flag; -} +static bool es7148_codec_initialized() { return codec_init_flag; } -esp_err_t -es7148_codec_init (audio_hal_codec_config_t *cfg) -{ - if (es7148_codec_initialized ()) - { - ESP_LOGW (TAG, "The es7148 codec has been already initialized"); - return ESP_OK; - } +esp_err_t es7148_codec_init(audio_hal_codec_config_t *cfg) { + if (es7148_codec_initialized()) { + ESP_LOGW(TAG, "The es7148 codec has been already initialized"); + return ESP_OK; + } codec_init_flag = true; return ESP_OK; } -esp_err_t -es7148_codec_deinit (void) -{ +esp_err_t es7148_codec_deinit(void) { codec_init_flag = false; return ESP_OK; } -esp_err_t -es7148_codec_ctrl_state (audio_hal_codec_mode_t mode, - audio_hal_ctrl_t ctrl_state) -{ +esp_err_t es7148_codec_ctrl_state(audio_hal_codec_mode_t mode, + audio_hal_ctrl_t ctrl_state) { return ESP_OK; } -esp_err_t -es7148_codec_config_i2s (audio_hal_codec_mode_t mode, - audio_hal_codec_i2s_iface_t *iface) -{ +esp_err_t es7148_codec_config_i2s(audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface) { return ESP_OK; } -esp_err_t -es7148_codec_set_voice_mute (bool mute) -{ - return ESP_OK; -} +esp_err_t es7148_codec_set_voice_mute(bool mute) { return ESP_OK; } -esp_err_t -es7148_codec_set_voice_volume (int volume) -{ +esp_err_t es7148_codec_set_voice_volume(int volume) { int ret = 0; return ret; } -esp_err_t -es7148_codec_get_voice_volume (int *volume) -{ +esp_err_t es7148_codec_get_voice_volume(int *volume) { int ret = 0; return ret; } diff --git a/components/audio_hal/driver/es7148/es7148.h b/components/audio_hal/driver/es7148/es7148.h index 6a7f768c..2f387e9c 100644 --- a/components/audio_hal/driver/es7148/es7148.h +++ b/components/audio_hal/driver/es7148/es7148.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -30,92 +30,91 @@ #include "audio_hal.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - /** - * @brief Initialize es7148 chip - * - * @param cfg configuration of es7148 - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es7148_codec_init (audio_hal_codec_config_t *cfg); - /** - * @brief Deinitialize es7148 chip - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es7148_codec_deinit (void); - /** - * The functions es7148_ctrl_state and es7148_config_i2s are not used by this - * driver. They are kept here to maintain the uniformity and convenience of - * the interface of the ADF project. These settings for es7148 are burned in - * firmware and configuration files. Default i2s configuration: 48000Hz, - * 16bit, Left-Right channels. Use resampling to be compatible with different - * file types. - * - * @brief Control es7148 chip - * - * @param mode codec mode - * @param ctrl_state start or stop decode or encode progress - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t es7148_codec_ctrl_state (audio_hal_codec_mode_t mode, - audio_hal_ctrl_t ctrl_state); - /** - * @brief Configure es7148 codec mode and I2S interface - * - * @param mode codec mode - * @param iface I2S config - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t es7148_codec_config_i2s (audio_hal_codec_mode_t mode, - audio_hal_codec_i2s_iface_t *iface); +/** + * @brief Initialize es7148 chip + * + * @param cfg configuration of es7148 + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es7148_codec_init(audio_hal_codec_config_t *cfg); +/** + * @brief Deinitialize es7148 chip + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es7148_codec_deinit(void); +/** + * The functions es7148_ctrl_state and es7148_config_i2s are not used by this + * driver. They are kept here to maintain the uniformity and convenience of the + * interface of the ADF project. These settings for es7148 are burned in + * firmware and configuration files. Default i2s configuration: 48000Hz, 16bit, + * Left-Right channels. Use resampling to be compatible with different file + * types. + * + * @brief Control es7148 chip + * + * @param mode codec mode + * @param ctrl_state start or stop decode or encode progress + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es7148_codec_ctrl_state(audio_hal_codec_mode_t mode, + audio_hal_ctrl_t ctrl_state); +/** + * @brief Configure es7148 codec mode and I2S interface + * + * @param mode codec mode + * @param iface I2S config + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es7148_codec_config_i2s(audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface); - /** - * @brief mute or unmute the codec - * - * @param mute: true, false - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es7148_codec_set_voice_mute (bool mute); +/** + * @brief mute or unmute the codec + * + * @param mute: true, false + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es7148_codec_set_voice_mute(bool mute); - /** - * @brief Set voice volume - * - * @param volume: voice volume (0~100) - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es7148_codec_set_voice_volume (int volume); +/** + * @brief Set voice volume + * + * @param volume: voice volume (0~100) + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es7148_codec_set_voice_volume(int volume); - /** - * @brief Get voice volume - * - * @param[out] *volume: voice volume (0~100) - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es7148_codec_get_voice_volume (int *volume); +/** + * @brief Get voice volume + * + * @param[out] *volume: voice volume (0~100) + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es7148_codec_get_voice_volume(int *volume); #ifdef __cplusplus } diff --git a/components/audio_hal/driver/es7210/es7210.c b/components/audio_hal/driver/es7210/es7210.c index 84139d79..ba798847 100644 --- a/components/audio_hal/driver/es7210/es7210.c +++ b/components/audio_hal/driver/es7210/es7210.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,22 +18,24 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "es7210.h" + +#include + #include "board.h" #include "esp_log.h" #include "i2c_bus.h" -#include #define I2S_DSP_MODE 0 #define MCLK_DIV_FRE 256 -/* ES7210 address*/ +/* ES7210 address */ #define ES7210_ADDR ES7210_AD1_AD0_00 #define ES7210_MCLK_SOURCE \ FROM_CLOCK_DOUBLE_PIN /* In master mode, 0 : MCLK from pad 1 : MCLK from \ @@ -41,25 +43,42 @@ #define FROM_PAD_PIN 0 #define FROM_CLOCK_DOUBLE_PIN 1 +/* ES7210 mic select */ +#if CONFIG_ESP32_S3_KORVO2_V3_BOARD +#define ES7210_MIC_SELECT \ + ES7210_INPUT_MIC1 | ES7210_INPUT_MIC2 | ES7210_INPUT_MIC3 +#else +#define ES7210_MIC_SELECT ES7210_INPUT_MIC1 | ES7210_INPUT_MIC2 +#endif +#define ENABLE_TDM_MAX_NUM 3 + +static char *TAG = "ES7210"; + +static struct { + i2c_bus_handle_t i2c_handle; + es7210_input_mics_t mic_select; + es7210_gain_value_t gain; +} es7210_handle; + /* * Operate function of ADC */ audio_hal_func_t AUDIO_CODEC_ES7210_DEFAULT_HANDLE = { - .audio_codec_initialize = es7210_adc_init, - .audio_codec_deinitialize = es7210_adc_deinit, - .audio_codec_ctrl = es7210_adc_ctrl_state, - .audio_codec_config_iface = es7210_adc_config_i2s, - .audio_codec_set_mute = es7210_set_mute, - .audio_codec_set_volume = es7210_adc_set_volume, - .audio_hal_lock = NULL, - .handle = NULL, + .audio_codec_initialize = es7210_adc_init, + .audio_codec_deinitialize = es7210_adc_deinit, + .audio_codec_ctrl = es7210_adc_ctrl_state, + .audio_codec_config_iface = es7210_adc_config_i2s, + .audio_codec_set_mute = es7210_set_mute, + .audio_codec_set_volume = es7210_adc_set_volume, + .audio_codec_enable_pa = NULL, + .audio_hal_lock = NULL, + .handle = NULL, }; /* * Clock coefficient structer */ -struct _coeff_div -{ +struct _coeff_div { uint32_t mclk; /* mclk frequency */ uint32_t lrck; /* lrck */ uint8_t ss_ds; @@ -72,11 +91,6 @@ struct _coeff_div uint32_t lrck_l; /* The low 8 bits of lrck */ }; -static char *TAG = "ES7210"; -static i2c_bus_handle_t i2c_handle; -static es7210_input_mics_t mic_select - = ES7210_INPUT_MIC1 | ES7210_INPUT_MIC2; /* Number of microphones */ - /* Codec hifi mclk clock divider coefficients * MEMBER REG * mclk: 0x03 @@ -91,125 +105,106 @@ static es7210_input_mics_t mic_select * lrckl: 0x05 */ static const struct _coeff_div coeff_div[] = { - // mclk lrck ss_ds adc_div dll doubler osr mclk_src lrckh lrckl - /* 8k */ - { 12288000, 8000, 0x00, 0x03, 0x01, 0x00, 0x20, 0x00, 0x06, 0x00 }, - { 16384000, 8000, 0x00, 0x04, 0x01, 0x00, 0x20, 0x00, 0x08, 0x00 }, - { 19200000, 8000, 0x00, 0x1e, 0x00, 0x01, 0x28, 0x00, 0x09, 0x60 }, - { 4096000, 8000, 0x00, 0x01, 0x01, 0x00, 0x20, 0x00, 0x02, 0x00 }, - - /* 11.025k */ - { 11289600, 11025, 0x00, 0x02, 0x01, 0x00, 0x20, 0x00, 0x01, 0x00 }, - - /* 12k */ - { 12288000, 12000, 0x00, 0x02, 0x01, 0x00, 0x20, 0x00, 0x04, 0x00 }, - { 19200000, 12000, 0x00, 0x14, 0x00, 0x01, 0x28, 0x00, 0x06, 0x40 }, - - /* 16k */ - { 4096000, 16000, 0x00, 0x01, 0x01, 0x01, 0x20, 0x00, 0x01, 0x00 }, - { 19200000, 16000, 0x00, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x80 }, - { 16384000, 16000, 0x00, 0x02, 0x01, 0x00, 0x20, 0x00, 0x04, 0x00 }, - { 12288000, 16000, 0x00, 0x03, 0x01, 0x01, 0x20, 0x00, 0x03, 0x00 }, - - /* 22.05k */ - { 11289600, 22050, 0x00, 0x01, 0x01, 0x00, 0x20, 0x00, 0x02, 0x00 }, - - /* 24k */ - { 12288000, 24000, 0x00, 0x01, 0x01, 0x00, 0x20, 0x00, 0x02, 0x00 }, - { 19200000, 24000, 0x00, 0x0a, 0x00, 0x01, 0x28, 0x00, 0x03, 0x20 }, - - /* 32k */ - { 12288000, 32000, 0x00, 0x03, 0x00, 0x00, 0x20, 0x00, 0x01, 0x80 }, - { 16384000, 32000, 0x00, 0x01, 0x01, 0x00, 0x20, 0x00, 0x02, 0x00 }, - { 19200000, 32000, 0x00, 0x05, 0x00, 0x00, 0x1e, 0x00, 0x02, 0x58 }, - - /* 44.1k */ - { 11289600, 44100, 0x00, 0x01, 0x01, 0x01, 0x20, 0x00, 0x01, 0x00 }, - - /* 48k */ - { 12288000, 48000, 0x00, 0x01, 0x01, 0x01, 0x20, 0x00, 0x01, 0x00 }, - { 19200000, 48000, 0x00, 0x05, 0x00, 0x01, 0x28, 0x00, 0x01, 0x90 }, - - /* 64k */ - { 16384000, 64000, 0x01, 0x01, 0x01, 0x00, 0x20, 0x00, 0x01, 0x00 }, - { 19200000, 64000, 0x00, 0x05, 0x00, 0x01, 0x1e, 0x00, 0x01, 0x2c }, - - /* 88.2k */ - { 11289600, 88200, 0x01, 0x01, 0x01, 0x01, 0x20, 0x00, 0x00, 0x80 }, - - /* 96k */ - { 12288000, 96000, 0x01, 0x01, 0x01, 0x01, 0x20, 0x00, 0x00, 0x80 }, - { 19200000, 96000, 0x01, 0x05, 0x00, 0x01, 0x28, 0x00, 0x00, 0xc8 }, + // mclk lrck ss_ds adc_div dll doubler osr mclk_src lrckh lrckl + /* 8k */ + {12288000, 8000, 0x00, 0x03, 0x01, 0x00, 0x20, 0x00, 0x06, 0x00}, + {16384000, 8000, 0x00, 0x04, 0x01, 0x00, 0x20, 0x00, 0x08, 0x00}, + {19200000, 8000, 0x00, 0x1e, 0x00, 0x01, 0x28, 0x00, 0x09, 0x60}, + {4096000, 8000, 0x00, 0x01, 0x01, 0x00, 0x20, 0x00, 0x02, 0x00}, + + /* 11.025k */ + {11289600, 11025, 0x00, 0x02, 0x01, 0x00, 0x20, 0x00, 0x01, 0x00}, + + /* 12k */ + {12288000, 12000, 0x00, 0x02, 0x01, 0x00, 0x20, 0x00, 0x04, 0x00}, + {19200000, 12000, 0x00, 0x14, 0x00, 0x01, 0x28, 0x00, 0x06, 0x40}, + + /* 16k */ + {4096000, 16000, 0x00, 0x01, 0x01, 0x01, 0x20, 0x00, 0x01, 0x00}, + {19200000, 16000, 0x00, 0x0a, 0x00, 0x00, 0x1e, 0x00, 0x04, 0x80}, + {16384000, 16000, 0x00, 0x02, 0x01, 0x00, 0x20, 0x00, 0x04, 0x00}, + {12288000, 16000, 0x00, 0x03, 0x01, 0x01, 0x20, 0x00, 0x03, 0x00}, + + /* 22.05k */ + {11289600, 22050, 0x00, 0x01, 0x01, 0x00, 0x20, 0x00, 0x02, 0x00}, + + /* 24k */ + {12288000, 24000, 0x00, 0x01, 0x01, 0x00, 0x20, 0x00, 0x02, 0x00}, + {19200000, 24000, 0x00, 0x0a, 0x00, 0x01, 0x28, 0x00, 0x03, 0x20}, + + /* 32k */ + {12288000, 32000, 0x00, 0x03, 0x00, 0x00, 0x20, 0x00, 0x01, 0x80}, + {16384000, 32000, 0x00, 0x01, 0x01, 0x00, 0x20, 0x00, 0x02, 0x00}, + {19200000, 32000, 0x00, 0x05, 0x00, 0x00, 0x1e, 0x00, 0x02, 0x58}, + + /* 44.1k */ + {11289600, 44100, 0x00, 0x01, 0x01, 0x01, 0x20, 0x00, 0x01, 0x00}, + + /* 48k */ + {12288000, 48000, 0x00, 0x01, 0x01, 0x01, 0x20, 0x00, 0x01, 0x00}, + {19200000, 48000, 0x00, 0x05, 0x00, 0x01, 0x28, 0x00, 0x01, 0x90}, + + /* 64k */ + {16384000, 64000, 0x01, 0x01, 0x01, 0x00, 0x20, 0x00, 0x01, 0x00}, + {19200000, 64000, 0x00, 0x05, 0x00, 0x01, 0x1e, 0x00, 0x01, 0x2c}, + + /* 88.2k */ + {11289600, 88200, 0x01, 0x01, 0x01, 0x01, 0x20, 0x00, 0x00, 0x80}, + + /* 96k */ + {12288000, 96000, 0x01, 0x01, 0x01, 0x01, 0x20, 0x00, 0x00, 0x80}, + {19200000, 96000, 0x01, 0x05, 0x00, 0x01, 0x28, 0x00, 0x00, 0xc8}, }; -static esp_err_t -es7210_write_reg (uint8_t reg_addr, uint8_t data) -{ - return i2c_bus_write_bytes (i2c_handle, ES7210_ADDR, ®_addr, - sizeof (reg_addr), &data, sizeof (data)); +static esp_err_t es7210_write_reg(uint8_t reg_addr, uint8_t data) { + return i2c_bus_write_bytes(es7210_handle.i2c_handle, ES7210_ADDR, ®_addr, + sizeof(reg_addr), &data, sizeof(data)); } -static esp_err_t -es7210_update_reg_bit (uint8_t reg_addr, uint8_t update_bits, uint8_t data) -{ +static esp_err_t es7210_update_reg_bit(uint8_t reg_addr, uint8_t update_bits, + uint8_t data) { uint8_t regv; - regv = es7210_read_reg (reg_addr); + regv = es7210_read_reg(reg_addr); regv = (regv & (~update_bits)) | (update_bits & data); - return es7210_write_reg (reg_addr, regv); + return es7210_write_reg(reg_addr, regv); } -static int -i2c_init () -{ +static int i2c_init() { int ret = 0; i2c_config_t es_i2c_cfg = { - .mode = I2C_MODE_MASTER, - .sda_pullup_en = GPIO_PULLUP_ENABLE, - .scl_pullup_en = GPIO_PULLUP_ENABLE, - .master.clk_speed = 100000, + .mode = I2C_MODE_MASTER, + .sda_pullup_en = GPIO_PULLUP_ENABLE, + .scl_pullup_en = GPIO_PULLUP_ENABLE, + .master.clk_speed = 100000, }; - ret = get_i2c_pins (I2C_NUM_0, &es_i2c_cfg); - AUDIO_CHECK (TAG, !ret, return ESP_FAIL;, "getting i2c pins error"); - i2c_handle = i2c_bus_create (I2C_NUM_0, &es_i2c_cfg); + ret = get_i2c_pins(I2C_NUM_0, &es_i2c_cfg); + AUDIO_RET_ON_FALSE(TAG, ret, return ESP_FAIL, "getting i2c pins error"); + es7210_handle.i2c_handle = i2c_bus_create(I2C_NUM_0, &es_i2c_cfg); return ret; } -static int -get_coeff (uint32_t mclk, uint32_t lrck) -{ - for (int i = 0; i < (sizeof (coeff_div) / sizeof (coeff_div[0])); i++) - { - if (coeff_div[i].lrck == lrck && coeff_div[i].mclk == mclk) - return i; - } +static int get_coeff(uint32_t mclk, uint32_t lrck) { + for (int i = 0; i < (sizeof(coeff_div) / sizeof(coeff_div[0])); i++) { + if (coeff_div[i].lrck == lrck && coeff_div[i].mclk == mclk) return i; + } return -1; } -int8_t -get_es7210_mclk_src (void) -{ - return ES7210_MCLK_SOURCE; -} +int8_t get_es7210_mclk_src(void) { return ES7210_MCLK_SOURCE; } -int -es7210_read_reg (uint8_t reg_addr) -{ +int es7210_read_reg(uint8_t reg_addr) { uint8_t data; - i2c_bus_read_bytes (i2c_handle, ES7210_ADDR, ®_addr, sizeof (reg_addr), - &data, sizeof (data)); + i2c_bus_read_bytes(es7210_handle.i2c_handle, ES7210_ADDR, ®_addr, + sizeof(reg_addr), &data, sizeof(data)); return (int)data; } -esp_err_t -es7210_config_sample (audio_hal_iface_samples_t sample) -{ - uint8_t regv; +esp_err_t es7210_config_sample(audio_hal_iface_samples_t sample) { int coeff; int sample_fre = 0; int mclk_fre = 0; esp_err_t ret = ESP_OK; - switch (sample) - { + switch (sample) { case AUDIO_HAL_08K_SAMPLES: sample_fre = 8000; break; @@ -235,205 +230,202 @@ es7210_config_sample (audio_hal_iface_samples_t sample) sample_fre = 48000; break; default: - ESP_LOGE (TAG, "Unable to configure sample rate %dHz", sample_fre); + ESP_LOGE(TAG, "Unable to configure sample rate %dHz", sample_fre); break; - } + } mclk_fre = sample_fre * MCLK_DIV_FRE; - coeff = get_coeff (mclk_fre, sample_fre); - if (coeff < 0) - { - ESP_LOGE (TAG, "Unable to configure sample rate %dHz with %dHz MCLK", - sample_fre, mclk_fre); - return ESP_FAIL; - } + coeff = get_coeff(mclk_fre, sample_fre); + if (coeff < 0) { + ESP_LOGE(TAG, "Unable to configure sample rate %dHz with %dHz MCLK", + sample_fre, mclk_fre); + return ESP_FAIL; + } /* Set clock parammeters */ - if (coeff >= 0) - { - /* Set adc_div & doubler & dll */ - regv = es7210_read_reg (ES7210_MAINCLK_REG02) & 0x00; - regv |= coeff_div[coeff].adc_div; - regv |= coeff_div[coeff].doubler << 6; - regv |= coeff_div[coeff].dll << 7; - ret |= es7210_write_reg (ES7210_MAINCLK_REG02, regv); - /* Set osr */ - regv = coeff_div[coeff].osr; - ret |= es7210_write_reg (ES7210_OSR_REG07, regv); - /* Set lrck */ - regv = coeff_div[coeff].lrck_h; - ret |= es7210_write_reg (ES7210_LRCK_DIVH_REG04, regv); - regv = coeff_div[coeff].lrck_l; - ret |= es7210_write_reg (ES7210_LRCK_DIVL_REG05, regv); - } + if (coeff >= 0) { + /* Set adc_div & doubler & dll */ + uint8_t regv; + regv = es7210_read_reg(ES7210_MAINCLK_REG02) & 0x00; + regv |= coeff_div[coeff].adc_div; + regv |= coeff_div[coeff].doubler << 6; + regv |= coeff_div[coeff].dll << 7; + ret |= es7210_write_reg(ES7210_MAINCLK_REG02, regv); + /* Set osr */ + regv = coeff_div[coeff].osr; + ret |= es7210_write_reg(ES7210_OSR_REG07, regv); + /* Set lrck */ + regv = coeff_div[coeff].lrck_h; + ret |= es7210_write_reg(ES7210_LRCK_DIVH_REG04, regv); + regv = coeff_div[coeff].lrck_l; + ret |= es7210_write_reg(ES7210_LRCK_DIVL_REG05, regv); + } return ret; } -esp_err_t -es7210_mic_select (es7210_input_mics_t mic) -{ +esp_err_t es7210_mic_select(es7210_input_mics_t mic) { esp_err_t ret = ESP_OK; - mic_select = mic; - if (mic_select - & (ES7210_INPUT_MIC1 | ES7210_INPUT_MIC2 | ES7210_INPUT_MIC3 - | ES7210_INPUT_MIC4)) - { - for (int i = 0; i < 4; i++) - { - ret |= es7210_update_reg_bit (ES7210_MIC1_GAIN_REG43 + i, 0x10, - 0x00); - } - ret |= es7210_write_reg (ES7210_MIC12_POWER_REG4B, 0xff); - ret |= es7210_write_reg (ES7210_MIC34_POWER_REG4C, 0xff); - if (mic_select & ES7210_INPUT_MIC1) - { - ESP_LOGI (TAG, "Enable ES7210_INPUT_MIC1"); - ret |= es7210_update_reg_bit (ES7210_CLOCK_OFF_REG01, 0x0b, 0x00); - ret |= es7210_write_reg (ES7210_MIC12_POWER_REG4B, 0x00); - ret |= es7210_update_reg_bit (ES7210_MIC1_GAIN_REG43, 0x10, 0x10); - } - if (mic_select & ES7210_INPUT_MIC2) - { - ESP_LOGI (TAG, "Enable ES7210_INPUT_MIC2"); - ret |= es7210_update_reg_bit (ES7210_CLOCK_OFF_REG01, 0x0b, 0x00); - ret |= es7210_write_reg (ES7210_MIC12_POWER_REG4B, 0x00); - ret |= es7210_update_reg_bit (ES7210_MIC2_GAIN_REG44, 0x10, 0x10); - } - if (mic_select & ES7210_INPUT_MIC3) - { - ESP_LOGI (TAG, "Enable ES7210_INPUT_MIC3"); - ret |= es7210_update_reg_bit (ES7210_CLOCK_OFF_REG01, 0x15, 0x00); - ret |= es7210_write_reg (ES7210_MIC34_POWER_REG4C, 0x00); - ret |= es7210_update_reg_bit (ES7210_MIC3_GAIN_REG45, 0x10, 0x10); - } - if (mic_select & ES7210_INPUT_MIC4) - { - ESP_LOGI (TAG, "Enable ES7210_INPUT_MIC4"); - ret |= es7210_update_reg_bit (ES7210_CLOCK_OFF_REG01, 0x15, 0x00); - ret |= es7210_write_reg (ES7210_MIC34_POWER_REG4C, 0x00); - ret |= es7210_update_reg_bit (ES7210_MIC4_GAIN_REG46, 0x10, 0x10); - } + uint16_t mic_num = 0; + es7210_handle.mic_select = mic; + if (es7210_handle.mic_select & (ES7210_INPUT_MIC1 | ES7210_INPUT_MIC2 | + ES7210_INPUT_MIC3 | ES7210_INPUT_MIC4)) { + for (int i = 0; i < 4; i++) { + ret |= es7210_update_reg_bit(ES7210_MIC1_GAIN_REG43 + i, 0x10, 0x00); + } + ret |= es7210_write_reg(ES7210_MIC12_POWER_REG4B, 0xff); + ret |= es7210_write_reg(ES7210_MIC34_POWER_REG4C, 0xff); + if (es7210_handle.mic_select & ES7210_INPUT_MIC1) { + ESP_LOGI(TAG, "Enable ES7210_INPUT_MIC1"); + ret |= es7210_update_reg_bit(ES7210_CLOCK_OFF_REG01, 0x0b, 0x00); + ret |= es7210_write_reg(ES7210_MIC12_POWER_REG4B, 0x00); + ret |= es7210_update_reg_bit(ES7210_MIC1_GAIN_REG43, 0x10, 0x10); + ret |= es7210_update_reg_bit(ES7210_MIC1_GAIN_REG43, 0x0f, + es7210_handle.gain); + } + if (es7210_handle.mic_select & ES7210_INPUT_MIC2) { + ESP_LOGI(TAG, "Enable ES7210_INPUT_MIC2"); + ret |= es7210_update_reg_bit(ES7210_CLOCK_OFF_REG01, 0x0b, 0x00); + ret |= es7210_write_reg(ES7210_MIC12_POWER_REG4B, 0x00); + ret |= es7210_update_reg_bit(ES7210_MIC2_GAIN_REG44, 0x10, 0x10); + ret |= es7210_update_reg_bit(ES7210_MIC2_GAIN_REG44, 0x0f, + es7210_handle.gain); + } + if (es7210_handle.mic_select & ES7210_INPUT_MIC3) { + ESP_LOGI(TAG, "Enable ES7210_INPUT_MIC3"); + ret |= es7210_update_reg_bit(ES7210_CLOCK_OFF_REG01, 0x15, 0x00); + ret |= es7210_write_reg(ES7210_MIC34_POWER_REG4C, 0x00); + ret |= es7210_update_reg_bit(ES7210_MIC3_GAIN_REG45, 0x10, 0x10); + ret |= es7210_update_reg_bit(ES7210_MIC3_GAIN_REG45, 0x0f, + es7210_handle.gain); + } + if (es7210_handle.mic_select & ES7210_INPUT_MIC4) { + ESP_LOGI(TAG, "Enable ES7210_INPUT_MIC4"); + ret |= es7210_update_reg_bit(ES7210_CLOCK_OFF_REG01, 0x15, 0x00); + ret |= es7210_write_reg(ES7210_MIC34_POWER_REG4C, 0x00); + ret |= es7210_update_reg_bit(ES7210_MIC4_GAIN_REG46, 0x10, 0x10); + ret |= es7210_update_reg_bit(ES7210_MIC4_GAIN_REG46, 0x0f, + es7210_handle.gain); } - else - { - ESP_LOGE (TAG, "Microphone selection error"); - return ESP_FAIL; + } else { + ESP_LOGE(TAG, "Microphone selection error"); + return ESP_FAIL; + } + + for (int i = ES7210_INPUT_MIC1; i <= ES7210_INPUT_MIC4; i = i << 1) { + if (es7210_handle.mic_select & i) { + mic_num++; } + } + if (mic_num >= ENABLE_TDM_MAX_NUM) { + ret |= es7210_write_reg(ES7210_SDP_INTERFACE2_REG12, 0x02); + ESP_LOGW(TAG, "Enable TDM mode. ES7210_SDP_INTERFACE2_REG12: %X", + es7210_read_reg(ES7210_SDP_INTERFACE2_REG12)); + } else { + ret |= es7210_write_reg(ES7210_SDP_INTERFACE2_REG12, 0x00); + ESP_LOGW(TAG, "Disable TDM mode. ES7210_SDP_INTERFACE2_REG12: %X", + es7210_read_reg(ES7210_SDP_INTERFACE2_REG12)); + } return ret; } -esp_err_t -es7210_adc_init (audio_hal_codec_config_t *codec_cfg) -{ +esp_err_t es7210_adc_init(audio_hal_codec_config_t *codec_cfg) { esp_err_t ret = ESP_OK; - i2c_init (); - ret |= es7210_write_reg (ES7210_RESET_REG00, 0xff); - ret |= es7210_write_reg (ES7210_RESET_REG00, 0x41); - ret |= es7210_write_reg (ES7210_CLOCK_OFF_REG01, 0x1f); - ret |= es7210_write_reg (ES7210_TIME_CONTROL0_REG09, - 0x30); /* Set chip state cycle */ - ret |= es7210_write_reg (ES7210_TIME_CONTROL1_REG0A, - 0x30); /* Set power on state cycle */ - ret |= es7210_write_reg (ES7210_ADC12_HPF2_REG23, 0x2a); /* Quick setup */ - ret |= es7210_write_reg (ES7210_ADC12_HPF1_REG22, 0x0a); - ret |= es7210_write_reg (ES7210_ADC34_HPF2_REG20, 0x0a); - ret |= es7210_write_reg (ES7210_ADC34_HPF1_REG21, 0x2a); + i2c_init(); + ret |= es7210_write_reg(ES7210_RESET_REG00, 0xff); + ret |= es7210_write_reg(ES7210_RESET_REG00, 0x41); + ret |= es7210_write_reg(ES7210_CLOCK_OFF_REG01, 0x3f); + ret |= es7210_write_reg(ES7210_TIME_CONTROL0_REG09, + 0x30); /* Set chip state cycle */ + ret |= es7210_write_reg(ES7210_TIME_CONTROL1_REG0A, + 0x30); /* Set power on state cycle */ + ret |= es7210_write_reg(ES7210_ADC12_HPF2_REG23, 0x2a); /* Quick setup */ + ret |= es7210_write_reg(ES7210_ADC12_HPF1_REG22, 0x0a); + ret |= es7210_write_reg(ES7210_ADC34_HPF2_REG20, 0x0a); + ret |= es7210_write_reg(ES7210_ADC34_HPF1_REG21, 0x2a); /* Set master/slave audio interface */ audio_hal_codec_i2s_iface_t *i2s_cfg = &(codec_cfg->i2s_iface); - switch (i2s_cfg->mode) - { + switch (i2s_cfg->mode) { case AUDIO_HAL_MODE_MASTER: /* MASTER MODE */ - ESP_LOGI (TAG, "ES7210 in Master mode"); - ret |= es7210_update_reg_bit (ES7210_MODE_CONFIG_REG08, 0x01, 0x01); + ESP_LOGI(TAG, "ES7210 in Master mode"); + ret |= es7210_update_reg_bit(ES7210_MODE_CONFIG_REG08, 0x01, 0x01); /* Select clock source for internal mclk */ - switch (get_es7210_mclk_src ()) - { + switch (get_es7210_mclk_src()) { case FROM_PAD_PIN: - ret |= es7210_update_reg_bit (ES7210_MASTER_CLK_REG03, 0x80, 0x00); + ret |= es7210_update_reg_bit(ES7210_MASTER_CLK_REG03, 0x80, 0x00); break; case FROM_CLOCK_DOUBLE_PIN: - ret |= es7210_update_reg_bit (ES7210_MASTER_CLK_REG03, 0x80, 0x80); + ret |= es7210_update_reg_bit(ES7210_MASTER_CLK_REG03, 0x80, 0x80); break; default: - ret |= es7210_update_reg_bit (ES7210_MASTER_CLK_REG03, 0x80, 0x00); + ret |= es7210_update_reg_bit(ES7210_MASTER_CLK_REG03, 0x80, 0x00); break; - } + } break; case AUDIO_HAL_MODE_SLAVE: /* SLAVE MODE */ - ESP_LOGI (TAG, "ES7210 in Slave mode"); - ret |= es7210_update_reg_bit (ES7210_MODE_CONFIG_REG08, 0x01, 0x00); + ESP_LOGI(TAG, "ES7210 in Slave mode"); + ret |= es7210_update_reg_bit(ES7210_MODE_CONFIG_REG08, 0x01, 0x00); break; default: - ret |= es7210_update_reg_bit (ES7210_MODE_CONFIG_REG08, 0x01, 0x00); - } - ret |= es7210_write_reg (ES7210_ANALOG_REG40, - 0x43); /* Select power off analog, vdda = 3.3V, - close vx20ff, VMID select 5KΩ start */ - ret |= es7210_write_reg (ES7210_MIC12_BIAS_REG41, 0x70); /* Select 2.87v */ - ret |= es7210_write_reg (ES7210_MIC34_BIAS_REG42, 0x70); /* Select 2.87v */ - ret |= es7210_write_reg (ES7210_OSR_REG07, 0x20); - ret |= es7210_write_reg ( + ret |= es7210_update_reg_bit(ES7210_MODE_CONFIG_REG08, 0x01, 0x00); + } + ret |= es7210_write_reg(ES7210_ANALOG_REG40, + 0x43); /* Select power off analog, vdda = 3.3V, close + vx20ff, VMID select 5KΩ start */ + ret |= es7210_write_reg(ES7210_MIC12_BIAS_REG41, 0x70); /* Select 2.87v */ + ret |= es7210_write_reg(ES7210_MIC34_BIAS_REG42, 0x70); /* Select 2.87v */ + ret |= es7210_write_reg(ES7210_OSR_REG07, 0x20); + ret |= es7210_write_reg( ES7210_MAINCLK_REG02, 0xc1); /* Set the frequency division coefficient and use dll except clock doubler, and need to set 0xc1 to clear the state */ - ret |= es7210_config_sample (i2s_cfg->samples); - ret |= es7210_mic_select (mic_select); - ret |= es7210_adc_set_gain (GAIN_30DB); + ret |= es7210_config_sample(i2s_cfg->samples); + ret |= es7210_mic_select(ES7210_MIC_SELECT); + ret |= es7210_adc_set_gain(GAIN_24DB); return ESP_OK; } -esp_err_t -es7210_adc_deinit () -{ - i2c_bus_delete (i2c_handle); +esp_err_t es7210_adc_deinit() { + i2c_bus_delete(es7210_handle.i2c_handle); return ESP_OK; } -esp_err_t -es7210_config_fmt (audio_hal_iface_format_t fmt) -{ +esp_err_t es7210_config_fmt(audio_hal_iface_format_t fmt) { esp_err_t ret = ESP_OK; uint8_t adc_iface = 0; - adc_iface = es7210_read_reg (ES7210_SDP_INTERFACE1_REG11); + adc_iface = es7210_read_reg(ES7210_SDP_INTERFACE1_REG11); adc_iface &= 0xfc; - switch (fmt) - { + switch (fmt) { case AUDIO_HAL_I2S_NORMAL: - ESP_LOGD (TAG, "ES7210 in I2S Format"); + ESP_LOGD(TAG, "ES7210 in I2S Format"); adc_iface |= 0x00; break; case AUDIO_HAL_I2S_LEFT: case AUDIO_HAL_I2S_RIGHT: - ESP_LOGD (TAG, "ES7210 in LJ Format"); + ESP_LOGD(TAG, "ES7210 in LJ Format"); adc_iface |= 0x01; break; case AUDIO_HAL_I2S_DSP: - if (I2S_DSP_MODE) - { - ESP_LOGD (TAG, "ES7210 in DSP-A Format"); - adc_iface |= 0x13; - } - else - { - ESP_LOGD (TAG, "ES7210 in DSP-B Format"); - adc_iface |= 0x03; - } + if (I2S_DSP_MODE) { + ESP_LOGD(TAG, "ES7210 in DSP-A Format"); + adc_iface |= 0x13; + } else { + ESP_LOGD(TAG, "ES7210 in DSP-B Format"); + adc_iface |= 0x03; + } break; default: adc_iface &= 0xfc; break; - } - ret |= es7210_write_reg (ES7210_SDP_INTERFACE1_REG11, adc_iface); + } + ret |= es7210_write_reg(ES7210_SDP_INTERFACE1_REG11, adc_iface); + ESP_LOGI(TAG, "config fmt %X", adc_iface); return ret; } -esp_err_t -es7210_set_bits (audio_hal_iface_bits_t bits) -{ +esp_err_t es7210_set_bits(audio_hal_iface_bits_t bits) { esp_err_t ret = ESP_OK; uint8_t adc_iface = 0; - adc_iface = es7210_read_reg (ES7210_SDP_INTERFACE1_REG11); + adc_iface = es7210_read_reg(ES7210_SDP_INTERFACE1_REG11); adc_iface &= 0x1f; - switch (bits) - { + switch (bits) { case AUDIO_HAL_BIT_LENGTH_16BITS: adc_iface |= 0x60; break; @@ -446,169 +438,132 @@ es7210_set_bits (audio_hal_iface_bits_t bits) default: adc_iface |= 0x60; break; - } - ret |= es7210_write_reg (ES7210_SDP_INTERFACE1_REG11, adc_iface); + } + ret |= es7210_write_reg(ES7210_SDP_INTERFACE1_REG11, adc_iface); return ret; } -esp_err_t -es7210_adc_config_i2s (audio_hal_codec_mode_t mode, - audio_hal_codec_i2s_iface_t *iface) -{ +esp_err_t es7210_adc_config_i2s(audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface) { esp_err_t ret = ESP_OK; - ret |= es7210_set_bits (iface->bits); - ret |= es7210_config_fmt (iface->fmt); - ret |= es7210_config_sample (iface->samples); + ret |= es7210_set_bits(iface->bits); + ret |= es7210_config_fmt(iface->fmt); + ret |= es7210_config_sample(iface->samples); return ret; } -esp_err_t -es7210_start (uint8_t clock_reg_value) -{ +esp_err_t es7210_start(uint8_t clock_reg_value) { esp_err_t ret = ESP_OK; - ret |= es7210_write_reg (ES7210_CLOCK_OFF_REG01, clock_reg_value); - ret |= es7210_write_reg (ES7210_POWER_DOWN_REG06, 0x00); - ret |= es7210_write_reg (ES7210_ANALOG_REG40, 0x43); - ret |= es7210_write_reg (ES7210_MIC1_POWER_REG47, 0x00); - ret |= es7210_write_reg (ES7210_MIC2_POWER_REG48, 0x00); - ret |= es7210_write_reg (ES7210_MIC3_POWER_REG49, 0x00); - ret |= es7210_write_reg (ES7210_MIC4_POWER_REG4A, 0x00); - ret |= es7210_mic_select (mic_select); + ret |= es7210_write_reg(ES7210_CLOCK_OFF_REG01, clock_reg_value); + ret |= es7210_write_reg(ES7210_POWER_DOWN_REG06, 0x00); + ret |= es7210_write_reg(ES7210_ANALOG_REG40, 0x43); + ret |= es7210_write_reg(ES7210_MIC1_POWER_REG47, 0x08); + ret |= es7210_write_reg(ES7210_MIC2_POWER_REG48, 0x08); + ret |= es7210_write_reg(ES7210_MIC3_POWER_REG49, 0x08); + ret |= es7210_write_reg(ES7210_MIC4_POWER_REG4A, 0x08); + ret |= es7210_mic_select(es7210_handle.mic_select); return ret; } -esp_err_t -es7210_stop (void) -{ +esp_err_t es7210_stop(void) { esp_err_t ret = ESP_OK; - ret |= es7210_write_reg (ES7210_MIC1_POWER_REG47, 0xff); - ret |= es7210_write_reg (ES7210_MIC2_POWER_REG48, 0xff); - ret |= es7210_write_reg (ES7210_MIC3_POWER_REG49, 0xff); - ret |= es7210_write_reg (ES7210_MIC4_POWER_REG4A, 0xff); - ret |= es7210_write_reg (ES7210_MIC12_POWER_REG4B, 0xff); - ret |= es7210_write_reg (ES7210_MIC34_POWER_REG4C, 0xff); - ret |= es7210_write_reg (ES7210_ANALOG_REG40, 0xc0); - ret |= es7210_write_reg (ES7210_CLOCK_OFF_REG01, 0x7f); - ret |= es7210_write_reg (ES7210_POWER_DOWN_REG06, 0x07); + ret |= es7210_write_reg(ES7210_MIC1_POWER_REG47, 0xff); + ret |= es7210_write_reg(ES7210_MIC2_POWER_REG48, 0xff); + ret |= es7210_write_reg(ES7210_MIC3_POWER_REG49, 0xff); + ret |= es7210_write_reg(ES7210_MIC4_POWER_REG4A, 0xff); + ret |= es7210_write_reg(ES7210_MIC12_POWER_REG4B, 0xff); + ret |= es7210_write_reg(ES7210_MIC34_POWER_REG4C, 0xff); + ret |= es7210_write_reg(ES7210_ANALOG_REG40, 0xc0); + ret |= es7210_write_reg(ES7210_CLOCK_OFF_REG01, 0x7f); + ret |= es7210_write_reg(ES7210_POWER_DOWN_REG06, 0x07); return ret; } -esp_err_t -es7210_adc_ctrl_state (audio_hal_codec_mode_t mode, - audio_hal_ctrl_t ctrl_state) -{ +esp_err_t es7210_adc_ctrl_state(audio_hal_codec_mode_t mode, + audio_hal_ctrl_t ctrl_state) { static uint8_t regv; esp_err_t ret = ESP_OK; - ESP_LOGW (TAG, "ES7210 only supports ADC mode"); - ret = es7210_read_reg (ES7210_CLOCK_OFF_REG01); - if ((ret != 0x7f) && (ret != 0xff)) - { - regv = es7210_read_reg (ES7210_CLOCK_OFF_REG01); - } - if (ctrl_state == AUDIO_HAL_CTRL_START) - { - ESP_LOGI (TAG, "The ES7210_CLOCK_OFF_REG01 value before stop is %x", - regv); - ret |= es7210_start (regv); - } - else - { - ESP_LOGW (TAG, "The codec is about to stop"); - regv = es7210_read_reg (ES7210_CLOCK_OFF_REG01); - ret |= es7210_stop (); - } + ESP_LOGW(TAG, "ES7210 only supports ADC mode"); + ret = es7210_read_reg(ES7210_CLOCK_OFF_REG01); + if ((ret != 0x7f) && (ret != 0xff)) { + regv = es7210_read_reg(ES7210_CLOCK_OFF_REG01); + } + if (ctrl_state == AUDIO_HAL_CTRL_START) { + ESP_LOGI(TAG, "The ES7210_CLOCK_OFF_REG01 value before stop is %x", regv); + ret |= es7210_start(regv); + } else { + ESP_LOGW(TAG, "The codec is about to stop"); + regv = es7210_read_reg(ES7210_CLOCK_OFF_REG01); + ret |= es7210_stop(); + } return ret; } -esp_err_t -es7210_adc_set_gain (es7210_gain_value_t gain) -{ +esp_err_t es7210_adc_set_gain(es7210_gain_value_t gain) { esp_err_t ret = ESP_OK; uint32_t max_gain_vaule = 14; - if (gain < 0) - { - gain = 0; - } - else if (gain > max_gain_vaule) - { - gain = max_gain_vaule; - } - ESP_LOGD (TAG, "SET: gain:%d", gain); - if (mic_select & ES7210_INPUT_MIC1) - { - ret |= es7210_update_reg_bit (ES7210_MIC1_GAIN_REG43, 0x0f, gain); - } - if (mic_select & ES7210_INPUT_MIC2) - { - ret |= es7210_update_reg_bit (ES7210_MIC2_GAIN_REG44, 0x0f, gain); - } - if (mic_select & ES7210_INPUT_MIC3) - { - ret |= es7210_update_reg_bit (ES7210_MIC3_GAIN_REG45, 0x0f, gain); - } - if (mic_select & ES7210_INPUT_MIC4) - { - ret |= es7210_update_reg_bit (ES7210_MIC4_GAIN_REG46, 0x0f, gain); - } + if (gain < 0) { + gain = 0; + } else if (gain > max_gain_vaule) { + gain = max_gain_vaule; + } + ESP_LOGD(TAG, "SET: gain:%d", gain); + if (es7210_handle.mic_select & ES7210_INPUT_MIC1) { + ret |= es7210_update_reg_bit(ES7210_MIC1_GAIN_REG43, 0x0f, gain); + } + if (es7210_handle.mic_select & ES7210_INPUT_MIC2) { + ret |= es7210_update_reg_bit(ES7210_MIC2_GAIN_REG44, 0x0f, gain); + } + if (es7210_handle.mic_select & ES7210_INPUT_MIC3) { + ret |= es7210_update_reg_bit(ES7210_MIC3_GAIN_REG45, 0x0f, gain); + } + if (es7210_handle.mic_select & ES7210_INPUT_MIC4) { + ret |= es7210_update_reg_bit(ES7210_MIC4_GAIN_REG46, 0x0f, gain); + } + es7210_handle.gain = gain; return ret; } -esp_err_t -es7210_adc_get_gain (void) -{ +esp_err_t es7210_adc_get_gain(void) { int regv = 0; uint8_t gain_value; - if (mic_select & ES7210_INPUT_MIC1) - { - regv = es7210_read_reg (ES7210_MIC1_GAIN_REG43); - } - else if (mic_select & ES7210_INPUT_MIC2) - { - regv = es7210_read_reg (ES7210_MIC2_GAIN_REG44); - } - else if (mic_select & ES7210_INPUT_MIC3) - { - regv = es7210_read_reg (ES7210_MIC3_GAIN_REG45); - } - else if (mic_select & ES7210_INPUT_MIC4) - { - regv = es7210_read_reg (ES7210_MIC4_GAIN_REG46); - } - else - { - ESP_LOGE (TAG, "No MIC selected"); - return ESP_FAIL; - } - if (regv == ESP_FAIL) - { - return regv; - } + if (es7210_handle.mic_select & ES7210_INPUT_MIC1) { + regv = es7210_read_reg(ES7210_MIC1_GAIN_REG43); + } else if (es7210_handle.mic_select & ES7210_INPUT_MIC2) { + regv = es7210_read_reg(ES7210_MIC2_GAIN_REG44); + } else if (es7210_handle.mic_select & ES7210_INPUT_MIC3) { + regv = es7210_read_reg(ES7210_MIC3_GAIN_REG45); + } else if (es7210_handle.mic_select & ES7210_INPUT_MIC4) { + regv = es7210_read_reg(ES7210_MIC4_GAIN_REG46); + } else { + ESP_LOGE(TAG, "No MIC selected"); + return ESP_FAIL; + } + if (regv == ESP_FAIL) { + return regv; + } gain_value = (regv & 0x0f); /* Retain the last four bits for gain */ - ESP_LOGI (TAG, "GET: gain_value:%d", gain_value); + ESP_LOGI(TAG, "GET: gain_value:%d", gain_value); return gain_value; } -esp_err_t -es7210_adc_set_volume (int volume) -{ - esp_err_t ret = ESP_OK; - ESP_LOGD (TAG, "ADC can adjust gain"); +esp_err_t es7210_adc_set_volume(int volume) { + ESP_LOGD(TAG, "ADC can adjust gain"); + if (volume > GAIN_37_5DB) { + volume = GAIN_37_5DB; + } + esp_err_t ret = es7210_adc_set_gain(volume); return ret; } -esp_err_t -es7210_set_mute (bool enable) -{ - ESP_LOGD (TAG, "ES7210 SetMute :%d", enable); +esp_err_t es7210_set_mute(bool enable) { + ESP_LOGD(TAG, "ES7210 SetMute :%d", enable); return ESP_OK; } -void -es7210_read_all (void) -{ - for (int i = 0; i <= 0x4E; i++) - { - uint8_t reg = es7210_read_reg (i); - ets_printf ("REG:%02x, %02x\n", reg, i); - } +void es7210_read_all(void) { + for (int i = 0; i <= 0x4E; i++) { + uint8_t reg = es7210_read_reg(i); + ESP_LOGI(TAG, "REG:%02x, %02x", reg, i); + } } diff --git a/components/audio_hal/driver/es7210/es7210.h b/components/audio_hal/driver/es7210/es7210.h index 0721429f..639785de 100644 --- a/components/audio_hal/driver/es7210/es7210.h +++ b/components/audio_hal/driver/es7210/es7210.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -30,8 +30,7 @@ #include "audio_hal.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif #define ES7210_RESET_REG00 0x00 /* Reset control */ @@ -67,165 +66,162 @@ extern "C" #define ES7210_MIC12_POWER_REG4B 0x4B /* MICBias & ADC & PGA Power */ #define ES7210_MIC34_POWER_REG4C 0x4C - typedef enum - { - ES7210_AD1_AD0_00 = 0x80, - ES7210_AD1_AD0_01 = 0x82, - ES7210_AD1_AD0_10 = 0x84, - ES7210_AD1_AD0_11 = 0x86 - } es7210_address_t; - - typedef enum - { - ES7210_INPUT_MIC1 = 0x01, - ES7210_INPUT_MIC2 = 0x02, - ES7210_INPUT_MIC3 = 0x04, - ES7210_INPUT_MIC4 = 0x08 - } es7210_input_mics_t; - - typedef enum gain_value - { - GAIN_0DB = 0, - GAIN_3DB, - GAIN_6DB, - GAIN_9DB, - GAIN_12DB, - GAIN_15DB, - GAIN_18DB, - GAIN_21DB, - GAIN_24DB, - GAIN_27DB, - GAIN_30DB, - GAIN_33DB, - GAIN_34_5DB, - GAIN_36DB, - GAIN_37_5DB, - } es7210_gain_value_t; - - /* - * @brief Initialize ES7210 ADC chip - * - * @param[in] codec_cfg: configuration of ES7210 - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es7210_adc_init (audio_hal_codec_config_t *codec_cfg); - - /** - * @brief Deinitialize ES7210 ADC chip - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es7210_adc_deinit (); - - /** - * @brief Configure ES7210 ADC mode and I2S interface - * - * @param[in] mode: codec mode - * @param[in] iface: I2S config - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t es7210_adc_config_i2s (audio_hal_codec_mode_t mode, - audio_hal_codec_i2s_iface_t *iface); - - /** - * @brief Control ES7210 ADC chip - * - * @param[in] mode: codec mode - * @param[in] ctrl_state: start or stop progress - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t es7210_adc_ctrl_state (audio_hal_codec_mode_t mode, - audio_hal_ctrl_t ctrl_state); - - /** - * @brief Set gain (Note: the enabled microphone sets the same gain) - * - * @param[in] gain: gain - * - * gain : value - * GAIN_0DB : 1 - * GAIN_3DB : 2 - * GAIN_6DB : 3 - * · - * · - * · - * GAIN_30DB : 10 - * GAIN_33DB : 11 - * GAIN_34_5DB : 12 - * GAIN_36DB : 13 - * GAIN_37_5DB : 14 - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es7210_adc_set_gain (es7210_gain_value_t gain); - - /** - * @brief Get gain - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es7210_adc_get_gain (void); - - /** - * @brief Set volume - * - * @param[in] volume: volume - * - * @return - * - ESP_OK - */ - esp_err_t es7210_adc_set_volume (int volume); - - /** - * @brief Set ES7210 ADC mute status - * - * @return - * - ESP_FAIL - * - ESP_OK - */ - esp_err_t es7210_set_mute (bool enable); - - /** - * @brief Select ES7210 mic - * - * @param[in] mic: mics - * - * @return - * - ESP_FAIL - * - ESP_OK - */ - esp_err_t es7210_mic_select (es7210_input_mics_t mic); - - /** - * @brief Read regs of ES7210 - * - * @param[in] reg_addr: reg_addr - * - * @return - * - ESP_FAIL - * - ESP_OK - */ - int es7210_read_reg (uint8_t reg_addr); - - /** - * @brief Read all regs of ES7210 - */ - void es7210_read_all (void); +typedef enum { + ES7210_AD1_AD0_00 = 0x80, + ES7210_AD1_AD0_01 = 0x82, + ES7210_AD1_AD0_10 = 0x84, + ES7210_AD1_AD0_11 = 0x86 +} es7210_address_t; + +typedef enum { + ES7210_INPUT_MIC1 = 0x01, + ES7210_INPUT_MIC2 = 0x02, + ES7210_INPUT_MIC3 = 0x04, + ES7210_INPUT_MIC4 = 0x08 +} es7210_input_mics_t; + +typedef enum gain_value { + GAIN_0DB = 0, + GAIN_3DB, + GAIN_6DB, + GAIN_9DB, + GAIN_12DB, + GAIN_15DB, + GAIN_18DB, + GAIN_21DB, + GAIN_24DB, + GAIN_27DB, + GAIN_30DB, + GAIN_33DB, + GAIN_34_5DB, + GAIN_36DB, + GAIN_37_5DB, +} es7210_gain_value_t; + +/* + * @brief Initialize ES7210 ADC chip + * + * @param[in] codec_cfg: configuration of ES7210 + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es7210_adc_init(audio_hal_codec_config_t *codec_cfg); + +/** + * @brief Deinitialize ES7210 ADC chip + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es7210_adc_deinit(); + +/** + * @brief Configure ES7210 ADC mode and I2S interface + * + * @param[in] mode: codec mode + * @param[in] iface: I2S config + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es7210_adc_config_i2s(audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface); + +/** + * @brief Control ES7210 ADC chip + * + * @param[in] mode: codec mode + * @param[in] ctrl_state: start or stop progress + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es7210_adc_ctrl_state(audio_hal_codec_mode_t mode, + audio_hal_ctrl_t ctrl_state); + +/** + * @brief Set gain (Note: the enabled microphone sets the same gain) + * + * @param[in] gain: gain + * + * gain : value + * GAIN_0DB : 1 + * GAIN_3DB : 2 + * GAIN_6DB : 3 + * · + * · + * · + * GAIN_30DB : 10 + * GAIN_33DB : 11 + * GAIN_34_5DB : 12 + * GAIN_36DB : 13 + * GAIN_37_5DB : 14 + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es7210_adc_set_gain(es7210_gain_value_t gain); + +/** + * @brief Get gain + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es7210_adc_get_gain(void); + +/** + * @brief Set volume + * + * @param[in] volume: volume + * + * @return + * - ESP_OK + */ +esp_err_t es7210_adc_set_volume(int volume); + +/** + * @brief Set ES7210 ADC mute status + * + * @return + * - ESP_FAIL + * - ESP_OK + */ +esp_err_t es7210_set_mute(bool enable); + +/** + * @brief Select ES7210 mic + * + * @param[in] mic: mics + * + * @return + * - ESP_FAIL + * - ESP_OK + */ +esp_err_t es7210_mic_select(es7210_input_mics_t mic); + +/** + * @brief Read regs of ES7210 + * + * @param[in] reg_addr: reg_addr + * + * @return + * - ESP_FAIL + * - ESP_OK + */ +int es7210_read_reg(uint8_t reg_addr); + +/** + * @brief Read all regs of ES7210 + */ +void es7210_read_all(void); #ifdef __cplusplus } diff --git a/components/audio_hal/driver/es7243/es7243.c b/components/audio_hal/driver/es7243/es7243.c index e51f2a0e..6e59ece5 100644 --- a/components/audio_hal/driver/es7243/es7243.c +++ b/components/audio_hal/driver/es7243/es7243.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,193 +18,165 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "es7243.h" + +#include + #include "board.h" #include "esp_log.h" #include "i2c_bus.h" -#include #define MCLK_PULSES_NUMBER (20) -#define ES_ASSERT(a, format, b, ...) \ - if ((a) != 0) \ - { \ - ESP_LOGE (TAG, format, ##__VA_ARGS__); \ - return b; \ - } +#define ES_ASSERT(a, format, b, ...) \ + if ((a) != 0) { \ + ESP_LOGE(TAG, format, ##__VA_ARGS__); \ + return b; \ + } static char *TAG = "DRV7243"; static i2c_bus_handle_t i2c_handle; static int es7243_addr = 0x26; audio_hal_func_t AUDIO_CODEC_ES7243_DEFAULT_HANDLE = { - .audio_codec_initialize = es7243_adc_init, - .audio_codec_deinitialize = es7243_adc_deinit, - .audio_codec_ctrl = es7243_adc_ctrl_state, - .audio_codec_config_iface = es7243_adc_config_i2s, - .audio_codec_set_mute = es7243_adc_set_voice_mute, - .audio_codec_set_volume = es7243_adc_set_voice_volume, - .audio_codec_get_volume = es7243_adc_get_voice_volume, - .audio_hal_lock = NULL, - .handle = NULL, + .audio_codec_initialize = es7243_adc_init, + .audio_codec_deinitialize = es7243_adc_deinit, + .audio_codec_ctrl = es7243_adc_ctrl_state, + .audio_codec_config_iface = es7243_adc_config_i2s, + .audio_codec_set_mute = es7243_adc_set_voice_mute, + .audio_codec_set_volume = es7243_adc_set_voice_volume, + .audio_codec_get_volume = es7243_adc_get_voice_volume, + .audio_codec_enable_pa = NULL, + .audio_hal_lock = NULL, + .handle = NULL, }; -static esp_err_t -es7243_write_reg (uint8_t reg_add, uint8_t data) -{ - return i2c_bus_write_bytes (i2c_handle, es7243_addr, ®_add, - sizeof (reg_add), &data, sizeof (data)); +static esp_err_t es7243_write_reg(uint8_t reg_add, uint8_t data) { + return i2c_bus_write_bytes(i2c_handle, es7243_addr, ®_add, sizeof(reg_add), + &data, sizeof(data)); } -static int -i2c_init () -{ +static int i2c_init() { int res = 0; i2c_config_t es_i2c_cfg = { - .mode = I2C_MODE_MASTER, - .sda_pullup_en = GPIO_PULLUP_ENABLE, - .scl_pullup_en = GPIO_PULLUP_ENABLE, - .master.clk_speed = 100000, + .mode = I2C_MODE_MASTER, + .sda_pullup_en = GPIO_PULLUP_ENABLE, + .scl_pullup_en = GPIO_PULLUP_ENABLE, + .master.clk_speed = 100000, }; - res = get_i2c_pins (I2C_NUM_0, &es_i2c_cfg); - ES_ASSERT (res, "getting i2c pins error", -1); - i2c_handle = i2c_bus_create (I2C_NUM_0, &es_i2c_cfg); + res = get_i2c_pins(I2C_NUM_0, &es_i2c_cfg); + ES_ASSERT(res, "getting i2c pins error", -1); + i2c_handle = i2c_bus_create(I2C_NUM_0, &es_i2c_cfg); return res; } -esp_err_t -es7243_adc_set_addr (int addr) -{ +esp_err_t es7243_adc_set_addr(int addr) { es7243_addr = addr; return ESP_OK; } -static esp_err_t -es7243_mclk_active (uint8_t mclk_gpio) -{ - gpio_pad_select_gpio (mclk_gpio); - gpio_set_direction (mclk_gpio, GPIO_MODE_OUTPUT); +static esp_err_t es7243_mclk_active(uint8_t mclk_gpio) { +#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)) + esp_rom_gpio_pad_select_gpio(mclk_gpio); +#else + gpio_pad_select_gpio(mclk_gpio); +#endif + gpio_set_direction(mclk_gpio, GPIO_MODE_OUTPUT); /* Before initializing es7243, it is necessary to output mclk to es7243 to activate the I2C configuration. So give some clocks to active es7243. */ - for (int i = 0; i < MCLK_PULSES_NUMBER; ++i) - { - gpio_set_level (mclk_gpio, 0); - vTaskDelay (1 / portTICK_PERIOD_MS); - gpio_set_level (mclk_gpio, 1); - vTaskDelay (1 / portTICK_PERIOD_MS); - } + for (int i = 0; i < MCLK_PULSES_NUMBER; ++i) { + gpio_set_level(mclk_gpio, 0); + vTaskDelay(1 / portTICK_PERIOD_MS); + gpio_set_level(mclk_gpio, 1); + vTaskDelay(1 / portTICK_PERIOD_MS); + } return ESP_OK; } -esp_err_t -es7243_adc_init (audio_hal_codec_config_t *codec_cfg) -{ +esp_err_t es7243_adc_init(audio_hal_codec_config_t *codec_cfg) { esp_err_t ret = ESP_OK; - es7243_mclk_active (get_es7243_mclk_gpio ()); - i2c_init (); - ret |= es7243_write_reg (0x00, 0x01); - ret |= es7243_write_reg (0x06, 0x00); - ret |= es7243_write_reg (0x05, 0x1B); - ret |= es7243_write_reg (0x01, 0x0C); - ret |= es7243_write_reg (0x08, 0x43); - ret |= es7243_write_reg (0x05, 0x13); - if (ret) - { - ESP_LOGE (TAG, "Es7243 initialize failed!"); - return ESP_FAIL; - } + es7243_mclk_active(get_es7243_mclk_gpio()); + i2c_init(); + ret |= es7243_write_reg(0x00, 0x01); + ret |= es7243_write_reg(0x06, 0x00); + ret |= es7243_write_reg(0x05, 0x1B); + ret |= es7243_write_reg(0x01, 0x0C); + ret |= es7243_write_reg(0x08, 0x43); + ret |= es7243_write_reg(0x05, 0x13); + if (ret) { + ESP_LOGE(TAG, "Es7243 initialize failed!"); + return ESP_FAIL; + } return ret; } -esp_err_t -es7243_adc_deinit (void) -{ - return ESP_OK; -} +esp_err_t es7243_adc_deinit(void) { return ESP_OK; } -esp_err_t -es7243_adc_ctrl_state (audio_hal_codec_mode_t mode, - audio_hal_ctrl_t ctrl_state) -{ +esp_err_t es7243_adc_ctrl_state(audio_hal_codec_mode_t mode, + audio_hal_ctrl_t ctrl_state) { return ESP_OK; } -esp_err_t -es7243_adc_config_i2s (audio_hal_codec_mode_t mode, - audio_hal_codec_i2s_iface_t *iface) -{ +esp_err_t es7243_adc_config_i2s(audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface) { return ESP_OK; } -esp_err_t -es7243_adc_set_voice_mute (bool mute) -{ - ESP_LOGI (TAG, "Enter into es7243_mute(), mute = %d\n", mute); - if (mute) - { - es7243_write_reg (0x05, 0x1B); - } - else - { - es7243_write_reg (0x05, 0x13); - } +esp_err_t es7243_adc_set_voice_mute(bool mute) { + ESP_LOGI(TAG, "Enter into es7243_mute(), mute = %d\n", mute); + if (mute) { + es7243_write_reg(0x05, 0x1B); + } else { + es7243_write_reg(0x05, 0x13); + } return ESP_OK; } -esp_err_t -es7243_adc_set_voice_volume (int volume) -{ +esp_err_t es7243_adc_set_voice_volume(int volume) { esp_err_t ret = ESP_OK; - if (volume > 100) - { - volume = 100; - } - if (volume < 0) - { - volume = 0; - } - switch (volume) - { + if (volume > 100) { + volume = 100; + } + if (volume < 0) { + volume = 0; + } + switch (volume) { case 0 ... 12: - ret |= es7243_write_reg (0x08, 0x11); // 1db + ret |= es7243_write_reg(0x08, 0x11); // 1db break; case 13 ... 25: - ret |= es7243_write_reg (0x08, 0x13); // 3.5db + ret |= es7243_write_reg(0x08, 0x13); // 3.5db break; case 26 ... 38: - ret |= es7243_write_reg (0x08, 0x21); // 18db + ret |= es7243_write_reg(0x08, 0x21); // 18db break; case 39 ... 51: - ret |= es7243_write_reg (0x08, 0x23); // 20.5db + ret |= es7243_write_reg(0x08, 0x23); // 20.5db break; case 52 ... 65: - ret |= es7243_write_reg (0x08, 0x06); // 22.5db + ret |= es7243_write_reg(0x08, 0x06); // 22.5db break; case 66 ... 80: - ret |= es7243_write_reg (0x08, 0x41); // 24.5db + ret |= es7243_write_reg(0x08, 0x41); // 24.5db break; case 81 ... 90: - ret |= es7243_write_reg (0x08, 0x07); // 25db + ret |= es7243_write_reg(0x08, 0x07); // 25db break; case 91 ... 100: - ret |= es7243_write_reg (0x08, 0x43); // 27db + ret |= es7243_write_reg(0x08, 0x43); // 27db break; default: break; - } + } return ESP_OK; } -esp_err_t -es7243_adc_get_voice_volume (int *volume) -{ - return ESP_OK; -} +esp_err_t es7243_adc_get_voice_volume(int *volume) { return ESP_OK; } diff --git a/components/audio_hal/driver/es7243/es7243.h b/components/audio_hal/driver/es7243/es7243.h index 14b820b1..f52fd7fc 100644 --- a/components/audio_hal/driver/es7243/es7243.h +++ b/components/audio_hal/driver/es7243/es7243.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -31,99 +31,98 @@ #include "esp_err.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - /** - * @brief Initialize ES7243 adc chip - * - * @param codec_cfg configuration of ES7243 - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es7243_adc_init (audio_hal_codec_config_t *codec_cfg); +/** + * @brief Initialize ES7243 adc chip + * + * @param codec_cfg configuration of ES7243 + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es7243_adc_init(audio_hal_codec_config_t *codec_cfg); - /** - * @brief Deinitialize ES7243 adc chip - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es7243_adc_deinit (void); +/** + * @brief Deinitialize ES7243 adc chip + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es7243_adc_deinit(void); - /** - * @brief Control ES7243 adc chip - * - * @param mode adc mode - * @param ctrl_state start or stop decode or encode progress - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t es7243_adc_ctrl_state (audio_hal_codec_mode_t mode, - audio_hal_ctrl_t ctrl_state); +/** + * @brief Control ES7243 adc chip + * + * @param mode adc mode + * @param ctrl_state start or stop decode or encode progress + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es7243_adc_ctrl_state(audio_hal_codec_mode_t mode, + audio_hal_ctrl_t ctrl_state); - /** - * @brief Configure ES7243 adc mode and I2S interface - * - * @param mode codec mode - * @param iface I2S config - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t es7243_adc_config_i2s (audio_hal_codec_mode_t mode, - audio_hal_codec_i2s_iface_t *iface); +/** + * @brief Configure ES7243 adc mode and I2S interface + * + * @param mode codec mode + * @param iface I2S config + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es7243_adc_config_i2s(audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface); - /** - * @brief Set mute - * - * @param mute true, false - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es7243_adc_set_voice_mute (bool mute); +/** + * @brief Set mute + * + * @param mute true, false + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es7243_adc_set_voice_mute(bool mute); - /** - * @brief Set adc gain - * - * @param volume value of gain (0~100) - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es7243_adc_set_voice_volume (int volume); +/** + * @brief Set adc gain + * + * @param volume value of gain (0~100) + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es7243_adc_set_voice_volume(int volume); - /** - * @brief Get adc gain - * - * @param[out] *volume: value of gain (0~100) - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es7243_adc_get_voice_volume (int *volume); +/** + * @brief Get adc gain + * + * @param[out] *volume: value of gain (0~100) + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es7243_adc_get_voice_volume(int *volume); - /** - * @brief Set adc I2C address - * - * @param[in] addr: value of I2C address - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es7243_adc_set_addr (int addr); +/** + * @brief Set adc I2C address + * + * @param[in] addr: value of I2C address + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es7243_adc_set_addr(int addr); #ifdef __cplusplus } diff --git a/components/audio_hal/driver/es7243e/es7243e.c b/components/audio_hal/driver/es7243e/es7243e.c new file mode 100644 index 00000000..ca83fbb2 --- /dev/null +++ b/components/audio_hal/driver/es7243e/es7243e.c @@ -0,0 +1,167 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2021 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include "es7243e.h" + +#include "board.h" +#include "esp_log.h" +#include "i2c_bus.h" + +static char *TAG = "DRV7243E"; +static i2c_bus_handle_t i2c_handle; +static int es7243e_addr = 0x20; + +audio_hal_func_t AUDIO_CODEC_ES7243E_DEFAULT_HANDLE = { + .audio_codec_initialize = es7243e_adc_init, + .audio_codec_deinitialize = es7243e_adc_deinit, + .audio_codec_ctrl = es7243e_adc_ctrl_state, + .audio_codec_config_iface = es7243e_adc_config_i2s, + .audio_codec_set_mute = NULL, + .audio_codec_set_volume = es7243e_adc_set_voice_volume, + .audio_codec_get_volume = es7243e_adc_get_voice_volume, + .audio_codec_enable_pa = NULL, + .audio_hal_lock = NULL, + .handle = NULL, +}; + +static esp_err_t es7243e_write_reg(uint8_t reg_add, uint8_t data) { + return i2c_bus_write_bytes(i2c_handle, es7243e_addr, ®_add, + sizeof(reg_add), &data, sizeof(data)); +} + +static int i2c_init() { + int res = 0; + i2c_config_t es_i2c_cfg = { + .mode = I2C_MODE_MASTER, + .sda_pullup_en = GPIO_PULLUP_ENABLE, + .scl_pullup_en = GPIO_PULLUP_ENABLE, + .master.clk_speed = 100000, + }; + res = get_i2c_pins(I2C_NUM_0, &es_i2c_cfg); + if (res != ESP_OK) { + ESP_LOGE(TAG, "getting i2c pins error"); + } + i2c_handle = i2c_bus_create(I2C_NUM_0, &es_i2c_cfg); + return res; +} + +esp_err_t es7243e_adc_set_addr(int addr) { + es7243e_addr = addr; + return ESP_OK; +} + +esp_err_t es7243e_adc_init(audio_hal_codec_config_t *codec_cfg) { + esp_err_t ret = ESP_OK; + i2c_init(); + ret |= es7243e_write_reg(0x01, 0x3A); + ret |= es7243e_write_reg(0x00, 0x80); + ret |= es7243e_write_reg(0xF9, 0x00); + ret |= es7243e_write_reg(0x04, 0x02); + ret |= es7243e_write_reg(0x04, 0x01); + ret |= es7243e_write_reg(0xF9, 0x01); + ret |= es7243e_write_reg(0x00, 0x1E); + ret |= es7243e_write_reg(0x01, 0x00); + + ret |= es7243e_write_reg(0x02, 0x00); + ret |= es7243e_write_reg(0x03, 0x20); + ret |= es7243e_write_reg(0x04, 0x01); + ret |= es7243e_write_reg(0x0D, 0x00); + ret |= es7243e_write_reg(0x05, 0x00); + ret |= es7243e_write_reg(0x06, 0x03); // SCLK=MCLK/4 + ret |= es7243e_write_reg(0x07, 0x00); // LRCK=MCLK/256 + ret |= es7243e_write_reg(0x08, 0xFF); // LRCK=MCLK/256 + + ret |= es7243e_write_reg(0x09, 0xCA); + ret |= es7243e_write_reg(0x0A, 0x85); + ret |= es7243e_write_reg(0x0B, 0x00); + ret |= es7243e_write_reg(0x0E, 0xBF); + ret |= es7243e_write_reg(0x0F, 0x80); + ret |= es7243e_write_reg(0x14, 0x0C); + ret |= es7243e_write_reg(0x15, 0x0C); + ret |= es7243e_write_reg(0x17, 0x02); + ret |= es7243e_write_reg(0x18, 0x26); + ret |= es7243e_write_reg(0x19, 0x77); + ret |= es7243e_write_reg(0x1A, 0xF4); + ret |= es7243e_write_reg(0x1B, 0x66); + ret |= es7243e_write_reg(0x1C, 0x44); + ret |= es7243e_write_reg(0x1E, 0x00); + ret |= es7243e_write_reg(0x1F, 0x0C); + ret |= es7243e_write_reg(0x20, 0x1A); // PGA gain +30dB + ret |= es7243e_write_reg(0x21, 0x1A); // PGA gain +30dB + + ret |= es7243e_write_reg(0x00, 0x80); // Slave Mode + ret |= es7243e_write_reg(0x01, 0x3A); + ret |= es7243e_write_reg(0x16, 0x3F); + ret |= es7243e_write_reg(0x16, 0x00); + if (ret) { + ESP_LOGE(TAG, "Es7243e initialize failed!"); + return ESP_FAIL; + } + return ret; +} + +esp_err_t es7243e_adc_deinit(void) { return ESP_OK; } + +esp_err_t es7243e_adc_ctrl_state(audio_hal_codec_mode_t mode, + audio_hal_ctrl_t ctrl_state) { + esp_err_t ret = ESP_OK; + if (ctrl_state == AUDIO_HAL_CTRL_START) { + ret |= es7243e_write_reg(0xF9, 0x00); + ret |= es7243e_write_reg(0x04, 0x01); + ret |= es7243e_write_reg(0x17, 0x01); + ret |= es7243e_write_reg(0x20, 0x10); + ret |= es7243e_write_reg(0x21, 0x10); + ret |= es7243e_write_reg(0x00, 0x80); + ret |= es7243e_write_reg(0x01, 0x3A); + ret |= es7243e_write_reg(0x16, 0x3F); + ret |= es7243e_write_reg(0x16, 0x00); + } else { + ESP_LOGW(TAG, "The codec going to stop"); + ret |= es7243e_write_reg(0x04, 0x02); + ret |= es7243e_write_reg(0x04, 0x01); + ret |= es7243e_write_reg(0xF7, 0x30); + ret |= es7243e_write_reg(0xF9, 0x01); + ret |= es7243e_write_reg(0x16, 0xFF); + ret |= es7243e_write_reg(0x17, 0x00); + ret |= es7243e_write_reg(0x01, 0x38); + ret |= es7243e_write_reg(0x20, 0x00); + ret |= es7243e_write_reg(0x21, 0x00); + ret |= es7243e_write_reg(0x00, 0x00); + ret |= es7243e_write_reg(0x00, 0x1E); + ret |= es7243e_write_reg(0x01, 0x30); + ret |= es7243e_write_reg(0x01, 0x00); + } + return ret; +} + +esp_err_t es7243e_adc_config_i2s(audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface) { + return ESP_OK; +} + +esp_err_t es7243e_adc_set_voice_volume(int volume) { return ESP_OK; } + +esp_err_t es7243e_adc_get_voice_volume(int *volume) { return ESP_OK; } diff --git a/components/audio_hal/driver/es7243e/es7243e.h b/components/audio_hal/driver/es7243e/es7243e.h new file mode 100644 index 00000000..b40aadf5 --- /dev/null +++ b/components/audio_hal/driver/es7243e/es7243e.h @@ -0,0 +1,120 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2021 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _ES7243E_H_ +#define _ES7243E_H_ + +#include "audio_hal.h" +#include "esp_err.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Initialize ES7243E adc chip + * + * @param codec_cfg configuration of ES7243E + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es7243e_adc_init(audio_hal_codec_config_t *codec_cfg); + +/** + * @brief Deinitialize ES7243E adc chip + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es7243e_adc_deinit(void); + +/** + * @brief Control ES7243E adc chip + * + * @param mode adc mode + * @param ctrl_state start or stop decode or encode progress + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es7243e_adc_ctrl_state(audio_hal_codec_mode_t mode, + audio_hal_ctrl_t ctrl_state); + +/** + * @brief Configure ES7243E adc mode and I2S interface + * + * @param mode codec mode + * @param iface I2S config + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es7243e_adc_config_i2s(audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface); + +/** + * @brief Set adc gain + * + * @param volume value of gain (0~100) + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es7243e_adc_set_voice_volume(int volume); + +/** + * @brief Get adc gain + * + * @param[out] *volume: value of gain (0~100) + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es7243e_adc_get_voice_volume(int *volume); + +/** + * @brief Set adc I2C address + * + * @param[in] addr: value of I2C address + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es7243e_adc_set_addr(int addr); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/components/audio_hal/driver/es8156/es8156.c b/components/audio_hal/driver/es8156/es8156.c new file mode 100644 index 00000000..f13fe40b --- /dev/null +++ b/components/audio_hal/driver/es8156/es8156.c @@ -0,0 +1,248 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2021 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include "es8156.h" + +#include "audio_volume.h" +#include "board.h" +#include "driver/gpio.h" +#include "esp_log.h" +#include "i2c_bus.h" +#include "string.h" + +#define ES8156_ADDR 0x10 + +static const char *TAG = "DRV8156"; +static bool codec_init_flag = 0; +static i2c_bus_handle_t i2c_handle; +static codec_dac_volume_config_t *dac_vol_handle; + +#define ES8156_DAC_VOL_CFG_DEFAULT() \ + { \ + .max_dac_volume = 32, .min_dac_volume = -95.5, \ + .board_pa_gain = BOARD_PA_GAIN, .volume_accuracy = 0.5, \ + .dac_vol_symbol = 1, .zero_volume_reg = 0xBF, .reg_value = 0, \ + .user_volume = 0, .offset_conv_volume = NULL, \ + } + +audio_hal_func_t AUDIO_CODEC_ES8156_DEFAULT_HANDLE = { + .audio_codec_initialize = es8156_codec_init, + .audio_codec_deinitialize = es8156_codec_deinit, + .audio_codec_ctrl = es8156_codec_ctrl_state, + .audio_codec_config_iface = es8156_codec_config_i2s, + .audio_codec_set_mute = es8156_codec_set_voice_mute, + .audio_codec_set_volume = es8156_codec_set_voice_volume, + .audio_codec_get_volume = es8156_codec_get_voice_volume, + .audio_codec_enable_pa = es8156_pa_power, + .audio_hal_lock = NULL, + .handle = NULL, +}; + +static bool es8156_codec_initialized() { return codec_init_flag; } + +static esp_err_t es8156_write_reg(uint8_t reg_addr, uint8_t data) { + return i2c_bus_write_bytes(i2c_handle, ES8156_ADDR, ®_addr, + sizeof(reg_addr), &data, sizeof(data)); +} + +static int es8156_read_reg(uint8_t reg_addr) { + uint8_t data; + i2c_bus_read_bytes(i2c_handle, ES8156_ADDR, ®_addr, sizeof(reg_addr), + &data, sizeof(data)); + return (int)data; +} + +static int i2c_init() { + int res = 0; + i2c_config_t es_i2c_cfg = { + .mode = I2C_MODE_MASTER, + .sda_pullup_en = GPIO_PULLUP_ENABLE, + .scl_pullup_en = GPIO_PULLUP_ENABLE, + .master.clk_speed = 100000, + }; + res = get_i2c_pins(I2C_NUM_0, &es_i2c_cfg); + if (res != ESP_OK) { + ESP_LOGE(TAG, "getting i2c pins error"); + } + i2c_handle = i2c_bus_create(I2C_NUM_0, &es_i2c_cfg); + return res; +} + +static esp_err_t es8156_standby(void) { + esp_err_t ret = 0; + ret = es8156_write_reg(0x14, 0x00); + ret |= es8156_write_reg(0x19, 0x02); + ret |= es8156_write_reg(0x21, 0x1F); + ret |= es8156_write_reg(0x22, 0x02); + ret |= es8156_write_reg(0x25, 0x21); + ret |= es8156_write_reg(0x25, 0xA1); + ret |= es8156_write_reg(0x18, 0x01); + ret |= es8156_write_reg(0x09, 0x02); + ret |= es8156_write_reg(0x09, 0x01); + ret |= es8156_write_reg(0x08, 0x00); + return ret; +} + +static esp_err_t es8156_resume(void) { + esp_err_t ret = 0; + ret |= es8156_write_reg(0x08, 0x3F); + ret |= es8156_write_reg(0x09, 0x00); + ret |= es8156_write_reg(0x18, 0x00); + + ret |= es8156_write_reg(0x25, 0x20); + ret |= es8156_write_reg(0x22, 0x00); + ret |= es8156_write_reg(0x21, 0x3C); + ret |= es8156_write_reg(0x19, 0x20); + ret |= es8156_write_reg(0x14, 179); + return ret; +} + +esp_err_t es8156_pa_power(bool enable) { + esp_err_t ret = ESP_OK; + if (enable) { + ret = gpio_set_level(get_pa_enable_gpio(), 1); + } else { + ret = gpio_set_level(get_pa_enable_gpio(), 0); + } + return ret; +} + +esp_err_t es8156_codec_init(audio_hal_codec_config_t *cfg) { + if (es8156_codec_initialized()) { + ESP_LOGW(TAG, "The es8156 DAC has been already initialized"); + return ESP_OK; + } + codec_init_flag = true; + + i2c_init(); + es8156_write_reg(0x02, 0x04); + es8156_write_reg(0x20, 0x2A); + es8156_write_reg(0x21, 0x3C); + es8156_write_reg(0x22, 0x00); + es8156_write_reg(0x24, 0x07); + es8156_write_reg(0x23, 0x00); + + es8156_write_reg(0x0A, 0x01); + es8156_write_reg(0x0B, 0x01); + es8156_write_reg(0x11, 0x00); + es8156_write_reg(0x14, 179); // volume 70% + + es8156_write_reg(0x0D, 0x14); + es8156_write_reg(0x18, 0x00); + es8156_write_reg(0x08, 0x3F); + es8156_write_reg(0x00, 0x02); + es8156_write_reg(0x00, 0x03); + es8156_write_reg(0x25, 0x20); + + gpio_config_t io_conf; + memset(&io_conf, 0, sizeof(io_conf)); + io_conf.mode = GPIO_MODE_OUTPUT; + io_conf.pin_bit_mask = BIT64(get_pa_enable_gpio()); + io_conf.pull_down_en = 0; + io_conf.pull_up_en = 0; + gpio_config(&io_conf); + es8156_pa_power(true); + + codec_dac_volume_config_t vol_cfg = ES8156_DAC_VOL_CFG_DEFAULT(); + dac_vol_handle = audio_codec_volume_init(&vol_cfg); + return ESP_OK; +} + +esp_err_t es8156_codec_deinit(void) { + codec_init_flag = false; + audio_codec_volume_deinit(dac_vol_handle); + return ESP_OK; +} + +esp_err_t es8156_codec_ctrl_state(audio_hal_codec_mode_t mode, + audio_hal_ctrl_t ctrl_state) { + esp_err_t ret = ESP_OK; + if (ctrl_state == AUDIO_HAL_CTRL_START) { + ret = es8156_resume(); + } else { + ESP_LOGW(TAG, "The codec going to stop"); + ret = es8156_standby(); + } + return ret; +} + +esp_err_t es8156_codec_config_i2s(audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface) { + return ESP_OK; +} + +esp_err_t es8156_codec_set_voice_mute(bool enable) { + int regv = es8156_read_reg(ES8156_DAC_MUTE_REG13); + if (enable) { + regv = regv | BIT(1) | BIT(2); + } else { + regv = regv & (~(BIT(1) | BIT(2))); + } + es8156_write_reg(ES8156_DAC_MUTE_REG13, regv); + return ESP_OK; +} + +/** + * @brief Set voice volume + * + * @note Register values. 0x00: -95.5 dB, 0x5B: -50 dB, 0xBF: 0 dB, 0xFF: 32 dB + * @note Accuracy of gain is 0.5 dB + * + * @param volume: voice volume (0~100) + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8156_codec_set_voice_volume(int volume) { + int ret = 0; + uint8_t reg = 0; + reg = audio_codec_get_dac_reg_value(dac_vol_handle, volume); + ret = es8156_write_reg(ES8156_VOLUME_CONTROL_REG14, reg); + ESP_LOGD(TAG, "Set volume:%.2d reg_value:0x%.2x dB:%.1f", + dac_vol_handle->user_volume, reg, + audio_codec_cal_dac_volume(dac_vol_handle)); + return ret; +} + +esp_err_t es8156_codec_get_voice_volume(int *volume) { + int ret = 0; + int regv = 0; + *volume = 0; + regv = es8156_read_reg(ES8156_VOLUME_CONTROL_REG14); + if (regv == ESP_FAIL) { + ret = ESP_FAIL; + } else { + if (regv == dac_vol_handle->reg_value) { + *volume = dac_vol_handle->user_volume; + } else { + *volume = 0; + ret = ESP_FAIL; + } + } + ESP_LOGD(TAG, "Get volume:%.2d reg_value:0x%.2x", *volume, regv); + return ret; +} diff --git a/components/audio_hal/driver/es8156/es8156.h b/components/audio_hal/driver/es8156/es8156.h new file mode 100644 index 00000000..dfd61de4 --- /dev/null +++ b/components/audio_hal/driver/es8156/es8156.h @@ -0,0 +1,190 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2021 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _ES8156_H +#define _ES8156_H + +#include "audio_hal.h" +#include "esp_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* ES8156 register space */ +/* + * RESET Control + */ +#define ES8156_RESET_REG00 0x00 +/* + * Clock Managerment + */ +#define ES8156_MAINCLOCK_CTL_REG01 0x01 +#define ES8156_SCLK_MODE_REG02 0x02 +#define ES8156_LRCLK_DIV_H_REG03 0x03 +#define ES8156_LRCLK_DIV_L_REG04 0x04 +#define ES8156_SCLK_DIV_REG05 0x05 +#define ES8156_NFS_CONFIG_REG06 0x06 +#define ES8156_MISC_CONTROL1_REG07 0x07 +#define ES8156_CLOCK_ON_OFF_REG08 0x08 +#define ES8156_MISC_CONTROL2_REG09 0x09 +#define ES8156_TIME_CONTROL1_REG0A 0x0a +#define ES8156_TIME_CONTROL2_REG0B 0x0b +/* + * System Control + */ +#define ES8156_CHIP_STATUS_REG0C 0x0c +#define ES8156_P2S_CONTROL_REG0D 0x0d +#define ES8156_DAC_OSR_COUNTER_REG10 0x10 +/* + * SDP Control + */ +#define ES8156_DAC_SDP_REG11 0x11 +#define ES8156_AUTOMUTE_SET_REG12 0x12 +#define ES8156_DAC_MUTE_REG13 0x13 +#define ES8156_VOLUME_CONTROL_REG14 0x14 + +/* + * ALC Control + */ +#define ES8156_ALC_CONFIG1_REG15 0x15 +#define ES8156_ALC_CONFIG2_REG16 0x16 +#define ES8156_ALC_CONFIG3_REG17 0x17 +#define ES8156_MISC_CONTROL3_REG18 0x18 +#define ES8156_EQ_CONTROL1_REG19 0x19 +#define ES8156_EQ_CONTROL2_REG1A 0x1a +/* + * Analog System Control + */ +#define ES8156_ANALOG_SYS1_REG20 0x20 +#define ES8156_ANALOG_SYS2_REG21 0x21 +#define ES8156_ANALOG_SYS3_REG22 0x22 +#define ES8156_ANALOG_SYS4_REG23 0x23 +#define ES8156_ANALOG_LP_REG24 0x24 +#define ES8156_ANALOG_SYS5_REG25 0x25 +/* + * Chip Information + */ +#define ES8156_I2C_PAGESEL_REGFC 0xFC +#define ES8156_CHIPID1_REGFD 0xFD +#define ES8156_CHIPID0_REGFE 0xFE +#define ES8156_CHIP_VERSION_REGFF 0xFF + +/* + * @brief Enables or disables PA + * + * @param enable true/false + * + * @return + * - ESP_ERR_INVALID_ARG + * - ESP_OK + */ +esp_err_t es8156_pa_power(bool enable); + +/* + * @brief Initialize ES8156 codec chip + * + * @param codec_cfg configuration of ES8156 + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8156_codec_init(audio_hal_codec_config_t *codec_cfg); + +/** + * @brief Deinitialize ES8156 codec chip + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8156_codec_deinit(void); + +/** + * @brief Control ES8156 codec chip + * + * @param mode codec mode + * @param ctrl_state start or stop decode or encode progress + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es8156_codec_ctrl_state(audio_hal_codec_mode_t mode, + audio_hal_ctrl_t ctrl_state); + +/** + * @brief Configure ES8156 codec mode and I2S interface + * + * @param mode codec mode + * @param iface I2S config + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es8156_codec_config_i2s(audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface); + +/** + * @brief Configure ES8156 DAC mute or not. Basically you can use this function + * to mute the output or unmute + * + * @param enable enable(1) or disable(0) + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es8156_codec_set_voice_mute(bool enable); + +/** + * @brief Set voice volume + * + * @param volume: voice volume (0~100) + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8156_codec_set_voice_volume(int volume); + +/** + * @brief Get voice volume + * + * @param[out] *volume: voice volume (0~100) + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8156_codec_get_voice_volume(int *volume); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/components/audio_hal/driver/es8311/es8311.c b/components/audio_hal/driver/es8311/es8311.c index c543e9e8..82195090 100644 --- a/components/audio_hal/driver/es8311/es8311.c +++ b/components/audio_hal/driver/es8311/es8311.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,17 +18,20 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "es8311.h" + +#include + +#include "audio_volume.h" #include "board.h" #include "esp_log.h" #include "i2c_bus.h" -#include /* ES8311 address * 0x32:CE=1;0x30:CE=0 @@ -44,35 +47,44 @@ /* * to define whether to reverse the clock */ -#define INVERT_MCLK 0 // do not invert +#define INVERT_MCLK 0 // do not invert #define INVERT_SCLK 0 -#define IS_DMIC 0 // Is it a digital microphone +#define IS_DMIC 0 // Is it a digital microphone #define MCLK_DIV_FRE 256 static i2c_bus_handle_t i2c_handle; +static codec_dac_volume_config_t *dac_vol_handle; + +#define ES8311_DAC_VOL_CFG_DEFAULT() \ + { \ + .max_dac_volume = 32, .min_dac_volume = -95.5, \ + .board_pa_gain = BOARD_PA_GAIN, .volume_accuracy = 0.5, \ + .dac_vol_symbol = 1, .zero_volume_reg = 0xBF, .reg_value = 0, \ + .user_volume = 0, .offset_conv_volume = NULL, \ + } /* * operate function of codec */ audio_hal_func_t AUDIO_CODEC_ES8311_DEFAULT_HANDLE = { - .audio_codec_initialize = es8311_codec_init, - .audio_codec_deinitialize = es8311_codec_deinit, - .audio_codec_ctrl = es8311_codec_ctrl_state, - .audio_codec_config_iface = es8311_codec_config_i2s, - .audio_codec_set_mute = es8311_set_voice_mute, - .audio_codec_set_volume = es8311_codec_set_voice_volume, - .audio_codec_get_volume = es8311_codec_get_voice_volume, - .audio_hal_lock = NULL, - .handle = NULL, + .audio_codec_initialize = es8311_codec_init, + .audio_codec_deinitialize = es8311_codec_deinit, + .audio_codec_ctrl = es8311_codec_ctrl_state, + .audio_codec_config_iface = es8311_codec_config_i2s, + .audio_codec_set_mute = es8311_set_voice_mute, + .audio_codec_set_volume = es8311_codec_set_voice_volume, + .audio_codec_get_volume = es8311_codec_get_voice_volume, + .audio_codec_enable_pa = es8311_pa_power, + .audio_hal_lock = NULL, + .handle = NULL, }; /* * Clock coefficient structer */ -struct _coeff_div -{ +struct _coeff_div { uint32_t mclk; /* mclk frequency */ uint32_t rate; /* sample rate */ uint8_t pre_div; /* the pre divider with range from 1 to 8 */ @@ -89,237 +101,219 @@ struct _coeff_div /* codec hifi mclk clock divider coefficients */ static const struct _coeff_div coeff_div[] = { - // mclk rate pre_div mult adc_div dac_div fs_mode lrch lrcl bckdiv - // osr - /* 8k */ - { 12288000, 8000, 0x06, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 18432000, 8000, 0x03, 0x02, 0x03, 0x03, 0x00, 0x05, 0xff, 0x18, 0x10, - 0x10 }, - { 16384000, 8000, 0x08, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 8192000, 8000, 0x04, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 6144000, 8000, 0x03, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 4096000, 8000, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 3072000, 8000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 2048000, 8000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 1536000, 8000, 0x03, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 1024000, 8000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - - /* 11.025k */ - { 11289600, 11025, 0x04, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 5644800, 11025, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 2822400, 11025, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 1411200, 11025, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - - /* 12k */ - { 12288000, 12000, 0x04, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 6144000, 12000, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 3072000, 12000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 1536000, 12000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - - /* 16k */ - { 12288000, 16000, 0x03, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 18432000, 16000, 0x03, 0x02, 0x03, 0x03, 0x00, 0x02, 0xff, 0x0c, 0x10, - 0x10 }, - { 16384000, 16000, 0x04, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 8192000, 16000, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 6144000, 16000, 0x03, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 4096000, 16000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 3072000, 16000, 0x03, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 2048000, 16000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 1536000, 16000, 0x03, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 1024000, 16000, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - - /* 22.05k */ - { 11289600, 22050, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 5644800, 22050, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 2822400, 22050, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 1411200, 22050, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - - /* 24k */ - { 12288000, 24000, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 18432000, 24000, 0x03, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 6144000, 24000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 3072000, 24000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 1536000, 24000, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - - /* 32k */ - { 12288000, 32000, 0x03, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 18432000, 32000, 0x03, 0x04, 0x03, 0x03, 0x00, 0x02, 0xff, 0x0c, 0x10, - 0x10 }, - { 16384000, 32000, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 8192000, 32000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 6144000, 32000, 0x03, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 4096000, 32000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 3072000, 32000, 0x03, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 2048000, 32000, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 1536000, 32000, 0x03, 0x08, 0x01, 0x01, 0x01, 0x00, 0x7f, 0x02, 0x10, - 0x10 }, - { 1024000, 32000, 0x01, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - - /* 44.1k */ - { 11289600, 44100, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 5644800, 44100, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 2822400, 44100, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 1411200, 44100, 0x01, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - - /* 48k */ - { 12288000, 48000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 18432000, 48000, 0x03, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 6144000, 48000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 3072000, 48000, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 1536000, 48000, 0x01, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - - /* 64k */ - { 12288000, 64000, 0x03, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 18432000, 64000, 0x03, 0x04, 0x03, 0x03, 0x01, 0x01, 0x7f, 0x06, 0x10, - 0x10 }, - { 16384000, 64000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 8192000, 64000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 6144000, 64000, 0x01, 0x04, 0x03, 0x03, 0x01, 0x01, 0x7f, 0x06, 0x10, - 0x10 }, - { 4096000, 64000, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 3072000, 64000, 0x01, 0x08, 0x03, 0x03, 0x01, 0x01, 0x7f, 0x06, 0x10, - 0x10 }, - { 2048000, 64000, 0x01, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 1536000, 64000, 0x01, 0x08, 0x01, 0x01, 0x01, 0x00, 0xbf, 0x03, 0x18, - 0x18 }, - { 1024000, 64000, 0x01, 0x08, 0x01, 0x01, 0x01, 0x00, 0x7f, 0x02, 0x10, - 0x10 }, - - /* 88.2k */ - { 11289600, 88200, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 5644800, 88200, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 2822400, 88200, 0x01, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 1411200, 88200, 0x01, 0x08, 0x01, 0x01, 0x01, 0x00, 0x7f, 0x02, 0x10, - 0x10 }, - - /* 96k */ - { 12288000, 96000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 18432000, 96000, 0x03, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 6144000, 96000, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 3072000, 96000, 0x01, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, - 0x10 }, - { 1536000, 96000, 0x01, 0x08, 0x01, 0x01, 0x01, 0x00, 0x7f, 0x02, 0x10, - 0x10 }, + // mclk rate pre_div mult adc_div dac_div fs_mode lrch lrcl bckdiv + // osr + /* 8k */ + {12288000, 8000, 0x06, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x20}, + {18432000, 8000, 0x03, 0x02, 0x03, 0x03, 0x00, 0x05, 0xff, 0x18, 0x10, + 0x20}, + {16384000, 8000, 0x08, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x20}, + {8192000, 8000, 0x04, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20}, + {6144000, 8000, 0x03, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20}, + {4096000, 8000, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20}, + {3072000, 8000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20}, + {2048000, 8000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20}, + {1536000, 8000, 0x03, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20}, + {1024000, 8000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, 0x20}, + + /* 11.025k */ + {11289600, 11025, 0x04, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x20}, + {5644800, 11025, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x20}, + {2822400, 11025, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x20}, + {1411200, 11025, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x20}, + + /* 12k */ + {12288000, 12000, 0x04, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x20}, + {6144000, 12000, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x20}, + {3072000, 12000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x20}, + {1536000, 12000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x20}, + + /* 16k */ + {12288000, 16000, 0x03, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x20}, + {18432000, 16000, 0x03, 0x02, 0x03, 0x03, 0x00, 0x02, 0xff, 0x0c, 0x10, + 0x20}, + {16384000, 16000, 0x04, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x20}, + {8192000, 16000, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x20}, + {6144000, 16000, 0x03, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x20}, + {4096000, 16000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x20}, + {3072000, 16000, 0x03, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x20}, + {2048000, 16000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x20}, + {1536000, 16000, 0x03, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x20}, + {1024000, 16000, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x20}, + + /* 22.05k */ + {11289600, 22050, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {5644800, 22050, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {2822400, 22050, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {1411200, 22050, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + + /* 24k */ + {12288000, 24000, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {18432000, 24000, 0x03, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {6144000, 24000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {3072000, 24000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {1536000, 24000, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + + /* 32k */ + {12288000, 32000, 0x03, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {18432000, 32000, 0x03, 0x04, 0x03, 0x03, 0x00, 0x02, 0xff, 0x0c, 0x10, + 0x10}, + {16384000, 32000, 0x02, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {8192000, 32000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {6144000, 32000, 0x03, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {4096000, 32000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {3072000, 32000, 0x03, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {2048000, 32000, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {1536000, 32000, 0x03, 0x08, 0x01, 0x01, 0x01, 0x00, 0x7f, 0x02, 0x10, + 0x10}, + {1024000, 32000, 0x01, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + + /* 44.1k */ + {11289600, 44100, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {5644800, 44100, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {2822400, 44100, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {1411200, 44100, 0x01, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + + /* 48k */ + {12288000, 48000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {18432000, 48000, 0x03, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {6144000, 48000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {3072000, 48000, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {1536000, 48000, 0x01, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + + /* 64k */ + {12288000, 64000, 0x03, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {18432000, 64000, 0x03, 0x04, 0x03, 0x03, 0x01, 0x01, 0x7f, 0x06, 0x10, + 0x10}, + {16384000, 64000, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {8192000, 64000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {6144000, 64000, 0x01, 0x04, 0x03, 0x03, 0x01, 0x01, 0x7f, 0x06, 0x10, + 0x10}, + {4096000, 64000, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {3072000, 64000, 0x01, 0x08, 0x03, 0x03, 0x01, 0x01, 0x7f, 0x06, 0x10, + 0x10}, + {2048000, 64000, 0x01, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {1536000, 64000, 0x01, 0x08, 0x01, 0x01, 0x01, 0x00, 0xbf, 0x03, 0x18, + 0x18}, + {1024000, 64000, 0x01, 0x08, 0x01, 0x01, 0x01, 0x00, 0x7f, 0x02, 0x10, + 0x10}, + + /* 88.2k */ + {11289600, 88200, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {5644800, 88200, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {2822400, 88200, 0x01, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {1411200, 88200, 0x01, 0x08, 0x01, 0x01, 0x01, 0x00, 0x7f, 0x02, 0x10, + 0x10}, + + /* 96k */ + {12288000, 96000, 0x01, 0x02, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {18432000, 96000, 0x03, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {6144000, 96000, 0x01, 0x04, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {3072000, 96000, 0x01, 0x08, 0x01, 0x01, 0x00, 0x00, 0xff, 0x04, 0x10, + 0x10}, + {1536000, 96000, 0x01, 0x08, 0x01, 0x01, 0x01, 0x00, 0x7f, 0x02, 0x10, + 0x10}, }; static char *TAG = "DRV8311"; -#define ES_ASSERT(a, format, b, ...) \ - if ((a) != 0) \ - { \ - ESP_LOGE (TAG, format, ##__VA_ARGS__); \ - return b; \ - } +#define ES_ASSERT(a, format, b, ...) \ + if ((a) != 0) { \ + ESP_LOGE(TAG, format, ##__VA_ARGS__); \ + return b; \ + } -int8_t get_es8311_mclk_src (void); +int8_t get_es8311_mclk_src(void); -static esp_err_t -es8311_write_reg (uint8_t reg_addr, uint8_t data) -{ - return i2c_bus_write_bytes (i2c_handle, ES8311_ADDR, ®_addr, - sizeof (reg_addr), &data, sizeof (data)); +static esp_err_t es8311_write_reg(uint8_t reg_addr, uint8_t data) { + return i2c_bus_write_bytes(i2c_handle, ES8311_ADDR, ®_addr, + sizeof(reg_addr), &data, sizeof(data)); } -static int -es8311_read_reg (uint8_t reg_addr) -{ +static int es8311_read_reg(uint8_t reg_addr) { uint8_t data; - i2c_bus_read_bytes (i2c_handle, ES8311_ADDR, ®_addr, sizeof (reg_addr), - &data, sizeof (data)); + i2c_bus_read_bytes(i2c_handle, ES8311_ADDR, ®_addr, sizeof(reg_addr), + &data, sizeof(data)); return (int)data; } -static int -i2c_init () -{ +static int i2c_init() { int res = 0; i2c_config_t es_i2c_cfg = { - .mode = I2C_MODE_MASTER, - .sda_pullup_en = GPIO_PULLUP_ENABLE, - .scl_pullup_en = GPIO_PULLUP_ENABLE, - .master.clk_speed = 100000, + .mode = I2C_MODE_MASTER, + .sda_pullup_en = GPIO_PULLUP_ENABLE, + .scl_pullup_en = GPIO_PULLUP_ENABLE, + .master.clk_speed = 100000, }; - res = get_i2c_pins (I2C_NUM_0, &es_i2c_cfg); - ES_ASSERT (res, "getting i2c pins error", -1); - i2c_handle = i2c_bus_create (I2C_NUM_0, &es_i2c_cfg); + res = get_i2c_pins(I2C_NUM_0, &es_i2c_cfg); + ES_ASSERT(res, "getting i2c pins error", -1); + i2c_handle = i2c_bus_create(I2C_NUM_0, &es_i2c_cfg); return res; } /* * look for the coefficient in coeff_div[] table */ -static int -get_coeff (uint32_t mclk, uint32_t rate) -{ - for (int i = 0; i < (sizeof (coeff_div) / sizeof (coeff_div[0])); i++) - { - if (coeff_div[i].rate == rate && coeff_div[i].mclk == mclk) - return i; - } +static int get_coeff(uint32_t mclk, uint32_t rate) { + for (int i = 0; i < (sizeof(coeff_div) / sizeof(coeff_div[0])); i++) { + if (coeff_div[i].rate == rate && coeff_div[i].mclk == mclk) return i; + } return -1; } @@ -328,135 +322,112 @@ get_coeff (uint32_t mclk, uint32_t rate) * if mute = 0, dac un-mute * if mute = 1, dac mute */ -static void -es8311_mute (int mute) -{ +static void es8311_mute(int mute) { uint8_t regv; - ESP_LOGI (TAG, "Enter into es8311_mute(), mute = %d\n", mute); - regv = es8311_read_reg (ES8311_DAC_REG31) & 0x9f; - if (mute) - { - es8311_write_reg (ES8311_SYSTEM_REG12, 0x02); - es8311_write_reg (ES8311_DAC_REG31, regv | 0x60); - es8311_write_reg (ES8311_DAC_REG32, 0x00); - es8311_write_reg (ES8311_DAC_REG37, 0x08); - } - else - { - es8311_write_reg (ES8311_DAC_REG31, regv); - es8311_write_reg (ES8311_SYSTEM_REG12, 0x00); - } + ESP_LOGI(TAG, "Enter into es8311_mute(), mute = %d\n", mute); + regv = es8311_read_reg(ES8311_DAC_REG31) & 0x9f; + if (mute) { + es8311_write_reg(ES8311_SYSTEM_REG12, 0x02); + es8311_write_reg(ES8311_DAC_REG31, regv | 0x60); + es8311_write_reg(ES8311_DAC_REG32, 0x00); + es8311_write_reg(ES8311_DAC_REG37, 0x08); + } else { + es8311_write_reg(ES8311_DAC_REG31, regv); + es8311_write_reg(ES8311_SYSTEM_REG12, 0x00); + } } /* * set es8311 into suspend mode */ -static void -es8311_suspend (void) -{ - ESP_LOGI (TAG, "Enter into es8311_suspend()"); - es8311_write_reg (ES8311_DAC_REG32, 0x00); - es8311_write_reg (ES8311_ADC_REG17, 0x00); - es8311_write_reg (ES8311_SYSTEM_REG0E, 0xFF); - es8311_write_reg (ES8311_SYSTEM_REG12, 0x02); - es8311_write_reg (ES8311_SYSTEM_REG14, 0x00); - es8311_write_reg (ES8311_SYSTEM_REG0D, 0xFA); - es8311_write_reg (ES8311_ADC_REG15, 0x00); - es8311_write_reg (ES8311_DAC_REG37, 0x08); - es8311_write_reg (ES8311_GP_REG45, 0x01); +static void es8311_suspend(void) { + ESP_LOGI(TAG, "Enter into es8311_suspend()"); + es8311_write_reg(ES8311_DAC_REG32, 0x00); + es8311_write_reg(ES8311_ADC_REG17, 0x00); + es8311_write_reg(ES8311_SYSTEM_REG0E, 0xFF); + es8311_write_reg(ES8311_SYSTEM_REG12, 0x02); + es8311_write_reg(ES8311_SYSTEM_REG14, 0x00); + es8311_write_reg(ES8311_SYSTEM_REG0D, 0xFA); + es8311_write_reg(ES8311_ADC_REG15, 0x00); + es8311_write_reg(ES8311_DAC_REG37, 0x08); + es8311_write_reg(ES8311_GP_REG45, 0x01); } /* * enable pa power */ -void -es8311_pa_power (bool enable) -{ - gpio_config_t io_conf; - memset (&io_conf, 0, sizeof (io_conf)); - io_conf.intr_type = GPIO_PIN_INTR_DISABLE; - io_conf.mode = GPIO_MODE_OUTPUT; - io_conf.pin_bit_mask = BIT64 (get_pa_enable_gpio ()); - io_conf.pull_down_en = 0; - io_conf.pull_up_en = 0; - gpio_config (&io_conf); - if (enable) - { - gpio_set_level (get_pa_enable_gpio (), 1); - } - else - { - gpio_set_level (get_pa_enable_gpio (), 0); - } +esp_err_t es8311_pa_power(bool enable) { + esp_err_t ret = ESP_OK; + if (enable) { + ret = gpio_set_level(get_pa_enable_gpio(), 1); + } else { + ret = gpio_set_level(get_pa_enable_gpio(), 0); + } + return ret; } -esp_err_t -es8311_codec_init (audio_hal_codec_config_t *codec_cfg) -{ +esp_err_t es8311_codec_init(audio_hal_codec_config_t *codec_cfg) { uint8_t datmp, regv; int coeff; esp_err_t ret = ESP_OK; - i2c_init (); // ESP32 in master mode - - ret |= es8311_write_reg (ES8311_CLK_MANAGER_REG01, 0x30); - ret |= es8311_write_reg (ES8311_CLK_MANAGER_REG02, 0x00); - ret |= es8311_write_reg (ES8311_CLK_MANAGER_REG03, 0x10); - ret |= es8311_write_reg (ES8311_ADC_REG16, 0x24); - ret |= es8311_write_reg (ES8311_CLK_MANAGER_REG04, 0x10); - ret |= es8311_write_reg (ES8311_CLK_MANAGER_REG05, 0x00); - ret |= es8311_write_reg (ES8311_SYSTEM_REG0B, 0x00); - ret |= es8311_write_reg (ES8311_SYSTEM_REG0C, 0x00); - ret |= es8311_write_reg (ES8311_SYSTEM_REG10, 0x1F); - ret |= es8311_write_reg (ES8311_SYSTEM_REG11, 0x7F); - ret |= es8311_write_reg (ES8311_RESET_REG00, 0x80); + i2c_init(); // ESP32 in master mode + + ret |= es8311_write_reg(ES8311_CLK_MANAGER_REG01, 0x30); + ret |= es8311_write_reg(ES8311_CLK_MANAGER_REG02, 0x00); + ret |= es8311_write_reg(ES8311_CLK_MANAGER_REG03, 0x10); + ret |= es8311_write_reg(ES8311_ADC_REG16, 0x24); + ret |= es8311_write_reg(ES8311_CLK_MANAGER_REG04, 0x10); + ret |= es8311_write_reg(ES8311_CLK_MANAGER_REG05, 0x00); + ret |= es8311_write_reg(ES8311_SYSTEM_REG0B, 0x00); + ret |= es8311_write_reg(ES8311_SYSTEM_REG0C, 0x00); + ret |= es8311_write_reg(ES8311_SYSTEM_REG10, 0x1F); + ret |= es8311_write_reg(ES8311_SYSTEM_REG11, 0x7F); + ret |= es8311_write_reg(ES8311_RESET_REG00, 0x80); /* * Set Codec into Master or Slave mode */ - regv = es8311_read_reg (ES8311_RESET_REG00); + regv = es8311_read_reg(ES8311_RESET_REG00); /* * Set master/slave audio interface */ audio_hal_codec_i2s_iface_t *i2s_cfg = &(codec_cfg->i2s_iface); - switch (i2s_cfg->mode) - { + switch (i2s_cfg->mode) { case AUDIO_HAL_MODE_MASTER: /* MASTER MODE */ - ESP_LOGI (TAG, "ES8311 in Master mode"); + ESP_LOGI(TAG, "ES8311 in Master mode"); regv |= 0x40; break; case AUDIO_HAL_MODE_SLAVE: /* SLAVE MODE */ - ESP_LOGI (TAG, "ES8311 in Slave mode"); + ESP_LOGI(TAG, "ES8311 in Slave mode"); regv &= 0xBF; break; default: regv &= 0xBF; - } - ret |= es8311_write_reg (ES8311_RESET_REG00, regv); - ret |= es8311_write_reg (ES8311_CLK_MANAGER_REG01, 0x3F); + } + ret |= es8311_write_reg(ES8311_RESET_REG00, regv); + ret |= es8311_write_reg(ES8311_CLK_MANAGER_REG01, 0x3F); /* * Select clock source for internal mclk */ - switch (get_es8311_mclk_src ()) - { + switch (get_es8311_mclk_src()) { case FROM_MCLK_PIN: - regv = es8311_read_reg (ES8311_CLK_MANAGER_REG01); + regv = es8311_read_reg(ES8311_CLK_MANAGER_REG01); regv &= 0x7F; - ret |= es8311_write_reg (ES8311_CLK_MANAGER_REG01, regv); + ret |= es8311_write_reg(ES8311_CLK_MANAGER_REG01, regv); break; case FROM_SCLK_PIN: - regv = es8311_read_reg (ES8311_CLK_MANAGER_REG01); + regv = es8311_read_reg(ES8311_CLK_MANAGER_REG01); regv |= 0x80; - ret |= es8311_write_reg (ES8311_CLK_MANAGER_REG01, regv); + ret |= es8311_write_reg(ES8311_CLK_MANAGER_REG01, regv); break; default: - regv = es8311_read_reg (ES8311_CLK_MANAGER_REG01); + regv = es8311_read_reg(ES8311_CLK_MANAGER_REG01); regv &= 0x7F; - ret |= es8311_write_reg (ES8311_CLK_MANAGER_REG01, regv); + ret |= es8311_write_reg(ES8311_CLK_MANAGER_REG01, regv); break; - } + } int sample_fre = 0; int mclk_fre = 0; - switch (i2s_cfg->samples) - { + switch (i2s_cfg->samples) { case AUDIO_HAL_08K_SAMPLES: sample_fre = 8000; break; @@ -482,154 +453,150 @@ es8311_codec_init (audio_hal_codec_config_t *codec_cfg) sample_fre = 48000; break; default: - ESP_LOGE (TAG, "Unable to configure sample rate %dHz", sample_fre); + ESP_LOGE(TAG, "Unable to configure sample rate %dHz", sample_fre); break; - } + } mclk_fre = sample_fre * MCLK_DIV_FRE; - coeff = get_coeff (mclk_fre, sample_fre); - if (coeff < 0) - { - ESP_LOGE (TAG, "Unable to configure sample rate %dHz with %dHz MCLK", - sample_fre, mclk_fre); - return ESP_FAIL; - } + coeff = get_coeff(mclk_fre, sample_fre); + if (coeff < 0) { + ESP_LOGE(TAG, "Unable to configure sample rate %dHz with %dHz MCLK", + sample_fre, mclk_fre); + return ESP_FAIL; + } /* * Set clock parammeters */ - if (coeff >= 0) - { - regv = es8311_read_reg (ES8311_CLK_MANAGER_REG02) & 0x07; - regv |= (coeff_div[coeff].pre_div - 1) << 5; - datmp = 0; - switch (coeff_div[coeff].pre_multi) - { - case 1: - datmp = 0; - break; - case 2: - datmp = 1; - break; - case 4: - datmp = 2; - break; - case 8: - datmp = 3; - break; - default: - break; - } - - if (get_es8311_mclk_src () == FROM_SCLK_PIN) - { - datmp = 3; /* DIG_MCLK = LRCK * 256 = BCLK * 8 */ - } - regv |= (datmp) << 3; - ret |= es8311_write_reg (ES8311_CLK_MANAGER_REG02, regv); - - regv = es8311_read_reg (ES8311_CLK_MANAGER_REG05) & 0x00; - regv |= (coeff_div[coeff].adc_div - 1) << 4; - regv |= (coeff_div[coeff].dac_div - 1) << 0; - ret |= es8311_write_reg (ES8311_CLK_MANAGER_REG05, regv); - - regv = es8311_read_reg (ES8311_CLK_MANAGER_REG03) & 0x80; - regv |= coeff_div[coeff].fs_mode << 6; - regv |= coeff_div[coeff].adc_osr << 0; - ret |= es8311_write_reg (ES8311_CLK_MANAGER_REG03, regv); - - regv = es8311_read_reg (ES8311_CLK_MANAGER_REG04) & 0x80; - regv |= coeff_div[coeff].dac_osr << 0; - ret |= es8311_write_reg (ES8311_CLK_MANAGER_REG04, regv); - - regv = es8311_read_reg (ES8311_CLK_MANAGER_REG07) & 0xC0; - regv |= coeff_div[coeff].lrck_h << 0; - ret |= es8311_write_reg (ES8311_CLK_MANAGER_REG07, regv); - - regv = es8311_read_reg (ES8311_CLK_MANAGER_REG08) & 0x00; - regv |= coeff_div[coeff].lrck_l << 0; - ret |= es8311_write_reg (ES8311_CLK_MANAGER_REG08, regv); - - regv = es8311_read_reg (ES8311_CLK_MANAGER_REG06) & 0xE0; - if (coeff_div[coeff].bclk_div < 19) - { - regv |= (coeff_div[coeff].bclk_div - 1) << 0; - } - else - { - regv |= (coeff_div[coeff].bclk_div) << 0; - } - ret |= es8311_write_reg (ES8311_CLK_MANAGER_REG06, regv); + if (coeff >= 0) { + regv = es8311_read_reg(ES8311_CLK_MANAGER_REG02) & 0x07; + regv |= (coeff_div[coeff].pre_div - 1) << 5; + datmp = 0; + switch (coeff_div[coeff].pre_multi) { + case 1: + datmp = 0; + break; + case 2: + datmp = 1; + break; + case 4: + datmp = 2; + break; + case 8: + datmp = 3; + break; + default: + break; } + if (get_es8311_mclk_src() == FROM_SCLK_PIN) { + datmp = 3; /* DIG_MCLK = LRCK * 256 = BCLK * 8 */ + } + regv |= (datmp) << 3; + ret |= es8311_write_reg(ES8311_CLK_MANAGER_REG02, regv); + + regv = es8311_read_reg(ES8311_CLK_MANAGER_REG05) & 0x00; + regv |= (coeff_div[coeff].adc_div - 1) << 4; + regv |= (coeff_div[coeff].dac_div - 1) << 0; + ret |= es8311_write_reg(ES8311_CLK_MANAGER_REG05, regv); + + regv = es8311_read_reg(ES8311_CLK_MANAGER_REG03) & 0x80; + regv |= coeff_div[coeff].fs_mode << 6; + regv |= coeff_div[coeff].adc_osr << 0; + ret |= es8311_write_reg(ES8311_CLK_MANAGER_REG03, regv); + + regv = es8311_read_reg(ES8311_CLK_MANAGER_REG04) & 0x80; + regv |= coeff_div[coeff].dac_osr << 0; + ret |= es8311_write_reg(ES8311_CLK_MANAGER_REG04, regv); + + regv = es8311_read_reg(ES8311_CLK_MANAGER_REG07) & 0xC0; + regv |= coeff_div[coeff].lrck_h << 0; + ret |= es8311_write_reg(ES8311_CLK_MANAGER_REG07, regv); + + regv = es8311_read_reg(ES8311_CLK_MANAGER_REG08) & 0x00; + regv |= coeff_div[coeff].lrck_l << 0; + ret |= es8311_write_reg(ES8311_CLK_MANAGER_REG08, regv); + + regv = es8311_read_reg(ES8311_CLK_MANAGER_REG06) & 0xE0; + if (coeff_div[coeff].bclk_div < 19) { + regv |= (coeff_div[coeff].bclk_div - 1) << 0; + } else { + regv |= (coeff_div[coeff].bclk_div) << 0; + } + ret |= es8311_write_reg(ES8311_CLK_MANAGER_REG06, regv); + } + /* * mclk inverted or not */ - if (INVERT_MCLK) - { - regv = es8311_read_reg (ES8311_CLK_MANAGER_REG01); - regv |= 0x40; - ret |= es8311_write_reg (ES8311_CLK_MANAGER_REG01, regv); - } - else - { - regv = es8311_read_reg (ES8311_CLK_MANAGER_REG01); - regv &= ~(0x40); - ret |= es8311_write_reg (ES8311_CLK_MANAGER_REG01, regv); - } + if (INVERT_MCLK) { + regv = es8311_read_reg(ES8311_CLK_MANAGER_REG01); + regv |= 0x40; + ret |= es8311_write_reg(ES8311_CLK_MANAGER_REG01, regv); + } else { + regv = es8311_read_reg(ES8311_CLK_MANAGER_REG01); + regv &= ~(0x40); + ret |= es8311_write_reg(ES8311_CLK_MANAGER_REG01, regv); + } /* * sclk inverted or not */ - if (INVERT_SCLK) - { - regv = es8311_read_reg (ES8311_CLK_MANAGER_REG06); - regv |= 0x20; - ret |= es8311_write_reg (ES8311_CLK_MANAGER_REG06, regv); - } - else - { - regv = es8311_read_reg (ES8311_CLK_MANAGER_REG06); - regv &= ~(0x20); - ret |= es8311_write_reg (ES8311_CLK_MANAGER_REG06, regv); - } - - ret |= es8311_write_reg (ES8311_SYSTEM_REG13, 0x10); - ret |= es8311_write_reg (ES8311_ADC_REG1B, 0x0A); - ret |= es8311_write_reg (ES8311_ADC_REG1C, 0x6A); + if (INVERT_SCLK) { + regv = es8311_read_reg(ES8311_CLK_MANAGER_REG06); + regv |= 0x20; + ret |= es8311_write_reg(ES8311_CLK_MANAGER_REG06, regv); + } else { + regv = es8311_read_reg(ES8311_CLK_MANAGER_REG06); + regv &= ~(0x20); + ret |= es8311_write_reg(ES8311_CLK_MANAGER_REG06, regv); + } + + ret |= es8311_write_reg(ES8311_SYSTEM_REG13, 0x10); + ret |= es8311_write_reg(ES8311_ADC_REG1B, 0x0A); + ret |= es8311_write_reg(ES8311_ADC_REG1C, 0x6A); + AUDIO_RET_ON_FALSE(TAG, ret, return ret, "es8311 initialize failed"); + + /* pa power gpio init */ + gpio_config_t io_conf; + memset(&io_conf, 0, sizeof(io_conf)); + io_conf.mode = GPIO_MODE_OUTPUT; + io_conf.pin_bit_mask = BIT64(get_pa_enable_gpio()); + io_conf.pull_down_en = 0; + io_conf.pull_up_en = 0; + gpio_config(&io_conf); + /* enable pa power */ + es8311_pa_power(true); - es8311_pa_power (true); + codec_dac_volume_config_t vol_cfg = ES8311_DAC_VOL_CFG_DEFAULT(); + dac_vol_handle = audio_codec_volume_init(&vol_cfg); return ESP_OK; } -esp_err_t -es8311_codec_deinit () -{ - i2c_bus_delete (i2c_handle); +esp_err_t es8311_codec_deinit() { + i2c_bus_delete(i2c_handle); + audio_codec_volume_deinit(dac_vol_handle); return ESP_OK; } -esp_err_t -es8311_config_fmt (es_i2s_fmt_t fmt) -{ +esp_err_t es8311_config_fmt(es_i2s_fmt_t fmt) { esp_err_t ret = ESP_OK; uint8_t adc_iface = 0, dac_iface = 0; - dac_iface = es8311_read_reg (ES8311_SDPIN_REG09); - adc_iface = es8311_read_reg (ES8311_SDPOUT_REG0A); - switch (fmt) - { + dac_iface = es8311_read_reg(ES8311_SDPIN_REG09); + adc_iface = es8311_read_reg(ES8311_SDPOUT_REG0A); + switch (fmt) { case AUDIO_HAL_I2S_NORMAL: - ESP_LOGD (TAG, "ES8311 in I2S Format"); + ESP_LOGD(TAG, "ES8311 in I2S Format"); dac_iface &= 0xFC; adc_iface &= 0xFC; break; case AUDIO_HAL_I2S_LEFT: case AUDIO_HAL_I2S_RIGHT: - ESP_LOGD (TAG, "ES8311 in LJ Format"); + ESP_LOGD(TAG, "ES8311 in LJ Format"); adc_iface &= 0xFC; dac_iface &= 0xFC; adc_iface |= 0x01; dac_iface |= 0x01; break; case AUDIO_HAL_I2S_DSP: - ESP_LOGD (TAG, "ES8311 in DSP-A Format"); + ESP_LOGD(TAG, "ES8311 in DSP-A Format"); adc_iface &= 0xDC; dac_iface &= 0xDC; adc_iface |= 0x03; @@ -639,22 +606,19 @@ es8311_config_fmt (es_i2s_fmt_t fmt) dac_iface &= 0xFC; adc_iface &= 0xFC; break; - } - ret |= es8311_write_reg (ES8311_SDPIN_REG09, dac_iface); - ret |= es8311_write_reg (ES8311_SDPOUT_REG0A, adc_iface); + } + ret |= es8311_write_reg(ES8311_SDPIN_REG09, dac_iface); + ret |= es8311_write_reg(ES8311_SDPOUT_REG0A, adc_iface); return ret; } -esp_err_t -es8311_set_bits_per_sample (audio_hal_iface_bits_t bits) -{ +esp_err_t es8311_set_bits_per_sample(audio_hal_iface_bits_t bits) { esp_err_t ret = ESP_OK; uint8_t adc_iface = 0, dac_iface = 0; - dac_iface = es8311_read_reg (ES8311_SDPIN_REG09); - adc_iface = es8311_read_reg (ES8311_SDPOUT_REG0A); - switch (bits) - { + dac_iface = es8311_read_reg(ES8311_SDPIN_REG09); + adc_iface = es8311_read_reg(ES8311_SDPOUT_REG0A); + switch (bits) { case AUDIO_HAL_BIT_LENGTH_16BITS: dac_iface |= 0x0c; adc_iface |= 0x0c; @@ -669,32 +633,27 @@ es8311_set_bits_per_sample (audio_hal_iface_bits_t bits) dac_iface |= 0x0c; adc_iface |= 0x0c; break; - } - ret |= es8311_write_reg (ES8311_SDPIN_REG09, dac_iface); - ret |= es8311_write_reg (ES8311_SDPOUT_REG0A, adc_iface); + } + ret |= es8311_write_reg(ES8311_SDPIN_REG09, dac_iface); + ret |= es8311_write_reg(ES8311_SDPOUT_REG0A, adc_iface); return ret; } -esp_err_t -es8311_codec_config_i2s (audio_hal_codec_mode_t mode, - audio_hal_codec_i2s_iface_t *iface) -{ +esp_err_t es8311_codec_config_i2s(audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface) { int ret = ESP_OK; - ret |= es8311_set_bits_per_sample (iface->bits); - ret |= es8311_config_fmt (iface->fmt); + ret |= es8311_set_bits_per_sample(iface->bits); + ret |= es8311_config_fmt(iface->fmt); return ret; } -esp_err_t -es8311_codec_ctrl_state (audio_hal_codec_mode_t mode, - audio_hal_ctrl_t ctrl_state) -{ +esp_err_t es8311_codec_ctrl_state(audio_hal_codec_mode_t mode, + audio_hal_ctrl_t ctrl_state) { esp_err_t ret = ESP_OK; es_module_t es_mode = ES_MODULE_MIN; - switch (mode) - { + switch (mode) { case AUDIO_HAL_CODEC_MODE_ENCODE: es_mode = ES_MODULE_ADC; break; @@ -709,162 +668,147 @@ es8311_codec_ctrl_state (audio_hal_codec_mode_t mode, break; default: es_mode = ES_MODULE_DAC; - ESP_LOGW (TAG, "Codec mode not support, default is decode mode"); + ESP_LOGW(TAG, "Codec mode not support, default is decode mode"); break; - } + } - if (ctrl_state == AUDIO_HAL_CTRL_START) - { - ret |= es8311_start (es_mode); - } - else - { - ESP_LOGW (TAG, "The codec is about to stop"); - ret |= es8311_stop (es_mode); - } + if (ctrl_state == AUDIO_HAL_CTRL_START) { + ret |= es8311_start(es_mode); + } else { + ESP_LOGW(TAG, "The codec is about to stop"); + ret |= es8311_stop(es_mode); + } return ret; } -esp_err_t -es8311_start (es_module_t mode) -{ +esp_err_t es8311_start(es_module_t mode) { esp_err_t ret = ESP_OK; uint8_t adc_iface = 0, dac_iface = 0; - dac_iface = es8311_read_reg (ES8311_SDPIN_REG09) & 0xBF; - adc_iface = es8311_read_reg (ES8311_SDPOUT_REG0A) & 0xBF; - adc_iface |= BIT (6); - dac_iface |= BIT (6); - - if (mode == ES_MODULE_LINE) - { - ESP_LOGE (TAG, "The codec es8311 doesn't support ES_MODULE_LINE mode"); - return ESP_FAIL; - } - if (mode == ES_MODULE_ADC || mode == ES_MODULE_ADC_DAC) - { - adc_iface &= ~(BIT (6)); - } - if (mode == ES_MODULE_DAC || mode == ES_MODULE_ADC_DAC) - { - dac_iface &= ~(BIT (6)); - } - - ret |= es8311_write_reg (ES8311_SDPIN_REG09, dac_iface); - ret |= es8311_write_reg (ES8311_SDPOUT_REG0A, adc_iface); - - ret |= es8311_write_reg (ES8311_ADC_REG17, 0xBF); - ret |= es8311_write_reg (ES8311_SYSTEM_REG0E, 0x02); - ret |= es8311_write_reg (ES8311_SYSTEM_REG12, 0x00); - ret |= es8311_write_reg (ES8311_SYSTEM_REG14, 0x1A); + dac_iface = es8311_read_reg(ES8311_SDPIN_REG09) & 0xBF; + adc_iface = es8311_read_reg(ES8311_SDPOUT_REG0A) & 0xBF; + adc_iface |= BIT(6); + dac_iface |= BIT(6); + + if (mode == ES_MODULE_LINE) { + ESP_LOGE(TAG, "The codec es8311 doesn't support ES_MODULE_LINE mode"); + return ESP_FAIL; + } + if (mode == ES_MODULE_ADC || mode == ES_MODULE_ADC_DAC) { + adc_iface &= ~(BIT(6)); + } + if (mode == ES_MODULE_DAC || mode == ES_MODULE_ADC_DAC) { + dac_iface &= ~(BIT(6)); + } + + ret |= es8311_write_reg(ES8311_SDPIN_REG09, dac_iface); + ret |= es8311_write_reg(ES8311_SDPOUT_REG0A, adc_iface); + + ret |= es8311_write_reg(ES8311_ADC_REG17, 0xBF); + ret |= es8311_write_reg(ES8311_SYSTEM_REG0E, 0x02); + ret |= es8311_write_reg(ES8311_SYSTEM_REG12, 0x00); + ret |= es8311_write_reg(ES8311_SYSTEM_REG14, 0x1A); /* * pdm dmic enable or disable */ int regv = 0; - if (IS_DMIC) - { - regv = es8311_read_reg (ES8311_SYSTEM_REG14); - regv |= 0x40; - ret |= es8311_write_reg (ES8311_SYSTEM_REG14, regv); - } - else - { - regv = es8311_read_reg (ES8311_SYSTEM_REG14); - regv &= ~(0x40); - ret |= es8311_write_reg (ES8311_SYSTEM_REG14, regv); - } - - ret |= es8311_write_reg (ES8311_SYSTEM_REG0D, 0x01); - ret |= es8311_write_reg (ES8311_ADC_REG15, 0x40); - ret |= es8311_write_reg (ES8311_DAC_REG37, 0x48); - ret |= es8311_write_reg (ES8311_GP_REG45, 0x00); + if (IS_DMIC) { + regv = es8311_read_reg(ES8311_SYSTEM_REG14); + regv |= 0x40; + ret |= es8311_write_reg(ES8311_SYSTEM_REG14, regv); + } else { + regv = es8311_read_reg(ES8311_SYSTEM_REG14); + regv &= ~(0x40); + ret |= es8311_write_reg(ES8311_SYSTEM_REG14, regv); + } + + ret |= es8311_write_reg(ES8311_SYSTEM_REG0D, 0x01); + ret |= es8311_write_reg(ES8311_ADC_REG15, 0x40); + ret |= es8311_write_reg(ES8311_DAC_REG37, 0x48); + ret |= es8311_write_reg(ES8311_GP_REG45, 0x00); + + /* set internal reference signal (ADCL + DACR) */ + ret |= es8311_write_reg(ES8311_GPIO_REG44, 0x50); return ret; } -esp_err_t -es8311_stop (es_module_t mode) -{ +esp_err_t es8311_stop(es_module_t mode) { esp_err_t ret = ESP_OK; - es8311_suspend (); + es8311_suspend(); return ret; } -esp_err_t -es8311_codec_set_voice_volume (int volume) -{ +/** + * @brief Set voice volume + * + * @note Register values. 0x00: -95.5 dB, 0x5B: -50 dB, 0xBF: 0 dB, 0xFF: 32 dB + * @note Accuracy of gain is 0.5 dB + * + * @param volume: voice volume (0~100) + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8311_codec_set_voice_volume(int volume) { esp_err_t res = ESP_OK; - if (volume < 0) - { - volume = 0; - } - else if (volume > 100) - { - volume = 100; - } - int vol = (volume)*2550 / 1000; - ESP_LOGD (TAG, "SET: volume:%d", vol); - es8311_write_reg (ES8311_DAC_REG32, vol); + uint8_t reg = 0; + reg = audio_codec_get_dac_reg_value(dac_vol_handle, volume); + res = es8311_write_reg(ES8311_DAC_REG32, reg); + ESP_LOGD(TAG, "Set volume:%.2d reg_value:0x%.2x dB:%.1f", + dac_vol_handle->user_volume, reg, + audio_codec_cal_dac_volume(dac_vol_handle)); return res; } -esp_err_t -es8311_codec_get_voice_volume (int *volume) -{ +esp_err_t es8311_codec_get_voice_volume(int *volume) { esp_err_t res = ESP_OK; int regv = 0; - regv = es8311_read_reg (ES8311_DAC_REG32); - if (regv == ESP_FAIL) - { + regv = es8311_read_reg(ES8311_DAC_REG32); + if (regv == ESP_FAIL) { + *volume = 0; + res = ESP_FAIL; + } else { + if (regv == dac_vol_handle->reg_value) { + *volume = dac_vol_handle->user_volume; + } else { *volume = 0; res = ESP_FAIL; } - else - { - *volume = regv * 100 / 256; - } - ESP_LOGD (TAG, "GET: res:%d, volume:%d", regv, *volume); + } + ESP_LOGD(TAG, "Get volume:%.2d reg_value:0x%.2x", *volume, regv); return res; } -esp_err_t -es8311_set_voice_mute (bool enable) -{ - ESP_LOGD (TAG, "Es8311SetVoiceMute volume:%d", enable); - es8311_mute (enable); +esp_err_t es8311_set_voice_mute(bool enable) { + ESP_LOGD(TAG, "Es8311SetVoiceMute volume:%d", enable); + es8311_mute(enable); return ESP_OK; } -esp_err_t -es8311_get_voice_mute (int *mute) -{ +esp_err_t es8311_get_voice_mute(int *mute) { esp_err_t res = ESP_OK; uint8_t reg = 0; - res = es8311_read_reg (ES8311_DAC_REG31); - if (res != ESP_FAIL) - { - reg = (res & 0x20) >> 5; - } + res = es8311_read_reg(ES8311_DAC_REG31); + if (res != ESP_FAIL) { + reg = (res & 0x20) >> 5; + } *mute = reg; return res; } -esp_err_t -es8311_set_mic_gain (es8311_mic_gain_t gain_db) -{ +esp_err_t es8311_set_mic_gain(es8311_mic_gain_t gain_db) { esp_err_t res = ESP_OK; - res = es8311_write_reg (ES8311_ADC_REG16, gain_db); // MIC gain scale + res = es8311_write_reg(ES8311_ADC_REG16, gain_db); // MIC gain scale return res; } -void -es8311_read_all () -{ - for (int i = 0; i < 0x4A; i++) - { - uint8_t reg = es8311_read_reg (i); - ets_printf ("REG:%02x, %02x\n", reg, i); - } +void es8311_read_all() { + for (int i = 0; i < 0x4A; i++) { + uint8_t reg = es8311_read_reg(i); + ESP_LOGI(TAG, "REG:%02x, %02x", reg, i); + } } diff --git a/components/audio_hal/driver/es8311/es8311.h b/components/audio_hal/driver/es8311/es8311.h index 55dce693..076dc70d 100644 --- a/components/audio_hal/driver/es8311/es8311.h +++ b/components/audio_hal/driver/es8311/es8311.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -32,8 +32,7 @@ #include "esxxx_common.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif /* @@ -44,7 +43,7 @@ extern "C" /* * Clock Scheme Register definition */ -#define ES8311_CLK_MANAGER_REG01 \ +#define ES8311_CLK_MANAGER_REG01 \ 0x01 /* select clk src for mclk, enable clock for codec */ #define ES8311_CLK_MANAGER_REG02 0x02 /* clk divider and clk multiplier */ #define ES8311_CLK_MANAGER_REG03 0x03 /* adc fsmode and osr */ @@ -70,7 +69,7 @@ extern "C" #define ES8311_SYSTEM_REG11 0x11 /* system */ #define ES8311_SYSTEM_REG12 0x12 /* system, Enable DAC */ #define ES8311_SYSTEM_REG13 0x13 /* system */ -#define ES8311_SYSTEM_REG14 \ +#define ES8311_SYSTEM_REG14 \ 0x14 /* system, select DMIC, select analog pga gain */ /* * ADC @@ -107,173 +106,183 @@ extern "C" #define ES8311_MAX_REGISTER 0xFF - typedef enum - { - ES8311_MIC_GAIN_MIN = -1, - ES8311_MIC_GAIN_0DB, - ES8311_MIC_GAIN_6DB, - ES8311_MIC_GAIN_12DB, - ES8311_MIC_GAIN_18DB, - ES8311_MIC_GAIN_24DB, - ES8311_MIC_GAIN_30DB, - ES8311_MIC_GAIN_36DB, - ES8311_MIC_GAIN_42DB, - ES8311_MIC_GAIN_MAX - } es8311_mic_gain_t; +typedef enum { + ES8311_MIC_GAIN_MIN = -1, + ES8311_MIC_GAIN_0DB, + ES8311_MIC_GAIN_6DB, + ES8311_MIC_GAIN_12DB, + ES8311_MIC_GAIN_18DB, + ES8311_MIC_GAIN_24DB, + ES8311_MIC_GAIN_30DB, + ES8311_MIC_GAIN_36DB, + ES8311_MIC_GAIN_42DB, + ES8311_MIC_GAIN_MAX +} es8311_mic_gain_t; - /* - * @brief Initialize ES8311 codec chip - * - * @param codec_cfg configuration of ES8311 - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es8311_codec_init (audio_hal_codec_config_t *codec_cfg); +/* + * @brief Enables or disables PA + * + * @param enable true/false + * + * @return + * - ESP_ERR_INVALID_ARG + * - ESP_OK + */ +esp_err_t es8311_pa_power(bool enable); - /** - * @brief Deinitialize ES8311 codec chip - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es8311_codec_deinit (void); +/* + * @brief Initialize ES8311 codec chip + * + * @param codec_cfg configuration of ES8311 + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8311_codec_init(audio_hal_codec_config_t *codec_cfg); - /** - * @brief Control ES8311 codec chip - * - * @param mode codec mode - * @param ctrl_state start or stop decode or encode progress - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t es8311_codec_ctrl_state (audio_hal_codec_mode_t mode, - audio_hal_ctrl_t ctrl_state); +/** + * @brief Deinitialize ES8311 codec chip + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8311_codec_deinit(void); - /** - * @brief Configure ES8311 codec mode and I2S interface - * - * @param mode codec mode - * @param iface I2S config - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t es8311_codec_config_i2s (audio_hal_codec_mode_t mode, - audio_hal_codec_i2s_iface_t *iface); +/** + * @brief Control ES8311 codec chip + * + * @param mode codec mode + * @param ctrl_state start or stop decode or encode progress + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es8311_codec_ctrl_state(audio_hal_codec_mode_t mode, + audio_hal_ctrl_t ctrl_state); - /** - * @brief Configure ES8311 DAC mute or not. Basically you can use this - * function to mute the output or unmute - * - * @param enable enable(1) or disable(0) - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t es8311_set_voice_mute (bool enable); +/** + * @brief Configure ES8311 codec mode and I2S interface + * + * @param mode codec mode + * @param iface I2S config + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es8311_codec_config_i2s(audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface); - /** - * @brief Set voice volume - * - * @param volume: voice volume (0~100) - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es8311_codec_set_voice_volume (int volume); +/** + * @brief Configure ES8311 DAC mute or not. Basically you can use this function + * to mute the output or unmute + * + * @param enable enable(1) or disable(0) + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es8311_set_voice_mute(bool enable); - /** - * @brief Get voice volume - * - * @param[out] *volume: voice volume (0~100) - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es8311_codec_get_voice_volume (int *volume); +/** + * @brief Set voice volume + * + * @param volume: voice volume (0~100) + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8311_codec_set_voice_volume(int volume); - /** - * @brief Configure ES8311 I2S format - * - * @param mod: set ADC or DAC or both - * @param cfg: ES8388 I2S format - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es8311_config_fmt (es_i2s_fmt_t fmt); +/** + * @brief Get voice volume + * + * @param[out] *volume: voice volume (0~100) + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8311_codec_get_voice_volume(int *volume); - /** - * @brief Configure ES8311 data sample bits - * - * @param mode: set ADC or DAC or both - * @param bit_per_sample: bit number of per sample - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es8311_set_bits_per_sample (audio_hal_iface_bits_t bits); +/** + * @brief Configure ES8311 I2S format + * + * @param mod: set ADC or DAC or both + * @param cfg: ES8388 I2S format + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8311_config_fmt(es_i2s_fmt_t fmt); - /** - * @brief Start ES8311 codec chip - * - * @param mode: set ADC or DAC or both - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es8311_start (es_module_t mode); +/** + * @brief Configure ES8311 data sample bits + * + * @param mode: set ADC or DAC or both + * @param bit_per_sample: bit number of per sample + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8311_set_bits_per_sample(audio_hal_iface_bits_t bits); + +/** + * @brief Start ES8311 codec chip + * + * @param mode: set ADC or DAC or both + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8311_start(es_module_t mode); - /** - * @brief Stop ES8311 codec chip - * - * @param mode: set ADC or DAC or both - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es8311_stop (es_module_t mode); +/** + * @brief Stop ES8311 codec chip + * + * @param mode: set ADC or DAC or both + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8311_stop(es_module_t mode); - /** - * @brief Get ES8311 DAC mute status - * - * @return - * - ESP_FAIL - * - ESP_OK - */ - esp_err_t es8311_get_voice_mute (int *mute); +/** + * @brief Get ES8311 DAC mute status + * + * @return + * - ESP_FAIL + * - ESP_OK + */ +esp_err_t es8311_get_voice_mute(int *mute); - /** - * @brief Set ES8311 mic gain - * - * @param gain db of mic gain - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t es8311_set_mic_gain (es8311_mic_gain_t gain_db); +/** + * @brief Set ES8311 mic gain + * + * @param gain db of mic gain + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es8311_set_mic_gain(es8311_mic_gain_t gain_db); - /** - * @brief Print all ES8311 registers - * - * @return - * - void - */ - void es8311_read_all (); +/** + * @brief Print all ES8311 registers + * + * @return + * - void + */ +void es8311_read_all(); #ifdef __cplusplus } diff --git a/components/audio_hal/driver/es8374/es8374.c b/components/audio_hal/driver/es8374/es8374.c index 82566ab7..1817fb76 100644 --- a/components/audio_hal/driver/es8374/es8374.c +++ b/components/audio_hal/driver/es8374/es8374.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,431 +18,382 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "es8374.h" + +#include + #include "board_pins_config.h" #include "esp_log.h" #include "esp_system.h" #include "i2c_bus.h" -#include #define ES8374_TAG "ES8374_DRIVER" -#define ES_ASSERT(a, format, b, ...) \ - if ((a) != 0) \ - { \ - ESP_LOGE (ES8374_TAG, format, ##__VA_ARGS__); \ - return b; \ - } +#define ES_ASSERT(a, format, b, ...) \ + if ((a) != 0) { \ + ESP_LOGE(ES8374_TAG, format, ##__VA_ARGS__); \ + return b; \ + } -#define LOG_8374(fmt, ...) ESP_LOGW (ES8374_TAG, fmt, ##__VA_ARGS__) +#define LOG_8374(fmt, ...) ESP_LOGW(ES8374_TAG, fmt, ##__VA_ARGS__) static int codec_init_flag = 0; static i2c_bus_handle_t i2c_handle; audio_hal_func_t AUDIO_CODEC_ES8374_DEFAULT_HANDLE = { - .audio_codec_initialize = es8374_codec_init, - .audio_codec_deinitialize = es8374_codec_deinit, - .audio_codec_ctrl = es8374_codec_ctrl_state, - .audio_codec_config_iface = es8374_codec_config_i2s, - .audio_codec_set_mute = es8374_set_voice_mute, - .audio_codec_set_volume = es8374_codec_set_voice_volume, - .audio_codec_get_volume = es8374_codec_get_voice_volume, - .audio_hal_lock = NULL, - .handle = NULL, + .audio_codec_initialize = es8374_codec_init, + .audio_codec_deinitialize = es8374_codec_deinit, + .audio_codec_ctrl = es8374_codec_ctrl_state, + .audio_codec_config_iface = es8374_codec_config_i2s, + .audio_codec_set_mute = es8374_set_voice_mute, + .audio_codec_set_volume = es8374_codec_set_voice_volume, + .audio_codec_get_volume = es8374_codec_get_voice_volume, + .audio_codec_enable_pa = es8374_pa_power, + .audio_hal_lock = NULL, + .handle = NULL, }; -static bool -es8374_codec_initialized () -{ - return codec_init_flag; -} +static bool es8374_codec_initialized() { return codec_init_flag; } -static esp_err_t -es_write_reg (uint8_t slave_addr, uint8_t reg_add, uint8_t data) -{ - return i2c_bus_write_bytes (i2c_handle, slave_addr, ®_add, - sizeof (reg_add), &data, sizeof (data)); +static esp_err_t es_write_reg(uint8_t slave_addr, uint8_t reg_add, + uint8_t data) { + return i2c_bus_write_bytes(i2c_handle, slave_addr, ®_add, sizeof(reg_add), + &data, sizeof(data)); } -static esp_err_t -es_read_reg (uint8_t slave_addr, uint8_t reg_add, uint8_t *p_data) -{ - return i2c_bus_read_bytes (i2c_handle, slave_addr, ®_add, - sizeof (reg_add), p_data, 1); +static esp_err_t es_read_reg(uint8_t slave_addr, uint8_t reg_add, + uint8_t *p_data) { + return i2c_bus_read_bytes(i2c_handle, slave_addr, ®_add, sizeof(reg_add), + p_data, 1); } -static int -i2c_init () -{ +static int i2c_init() { int res; - i2c_config_t es_i2c_cfg = { .mode = I2C_MODE_MASTER, - .sda_pullup_en = GPIO_PULLUP_ENABLE, - .scl_pullup_en = GPIO_PULLUP_ENABLE, - .master.clk_speed = 100000 }; - res = get_i2c_pins (I2C_NUM_0, &es_i2c_cfg); - ES_ASSERT (res, "getting i2c pins error", -1); - i2c_handle = i2c_bus_create (I2C_NUM_0, &es_i2c_cfg); + i2c_config_t es_i2c_cfg = {.mode = I2C_MODE_MASTER, + .sda_pullup_en = GPIO_PULLUP_ENABLE, + .scl_pullup_en = GPIO_PULLUP_ENABLE, + .master.clk_speed = 100000}; + res = get_i2c_pins(I2C_NUM_0, &es_i2c_cfg); + ES_ASSERT(res, "getting i2c pins error", -1); + i2c_handle = i2c_bus_create(I2C_NUM_0, &es_i2c_cfg); return res; } -esp_err_t -es8374_write_reg (uint8_t reg_add, uint8_t data) -{ - return es_write_reg (ES8374_ADDR, reg_add, data); +esp_err_t es8374_write_reg(uint8_t reg_add, uint8_t data) { + return es_write_reg(ES8374_ADDR, reg_add, data); } -int -es8374_read_reg (uint8_t reg_add, uint8_t *regv) -{ +int es8374_read_reg(uint8_t reg_add, uint8_t *regv) { uint8_t regdata = 0xFF; uint8_t res = 0; - if (es_read_reg (ES8374_ADDR, reg_add, ®data) == 0) - { - *regv = regdata; - return res; - } - else - { - LOG_8374 ("Read Audio Codec Register Failed!"); - res = -1; - return res; - } + if (es_read_reg(ES8374_ADDR, reg_add, ®data) == 0) { + *regv = regdata; + return res; + } else { + LOG_8374("Read Audio Codec Register Failed!"); + res = -1; + return res; + } } -void -es8374_read_all () -{ - for (int i = 0; i < 50; i++) - { - uint8_t reg = 0; - es8374_read_reg (i, ®); - ESP_LOGI (ES8374_TAG, "%x: %x", i, reg); - } +void es8374_read_all() { + for (int i = 0; i < 50; i++) { + uint8_t reg = 0; + es8374_read_reg(i, ®); + ESP_LOGI(ES8374_TAG, "%x: %x", i, reg); + } } -esp_err_t -es8374_set_voice_mute (bool enable) -{ +esp_err_t es8374_set_voice_mute(bool enable) { esp_err_t res = ESP_OK; uint8_t reg = 0; - res |= es8374_read_reg (0x36, ®); - if (res == 0) - { - reg = reg & 0xdf; - res |= es8374_write_reg (0x36, reg | (((int)enable) << 5)); - } + res |= es8374_read_reg(0x36, ®); + if (res == 0) { + reg = reg & 0xdf; + res |= es8374_write_reg(0x36, reg | (((int)enable) << 5)); + } return res; } -esp_err_t -es8374_get_voice_mute (void) -{ +esp_err_t es8374_get_voice_mute(void) { esp_err_t res = ESP_OK; uint8_t reg = 0; - res |= es8374_read_reg (0x36, ®); - if (res == ESP_OK) - { - reg = reg & 0x40; - } + res |= es8374_read_reg(0x36, ®); + if (res == ESP_OK) { + reg = reg & 0x40; + } return res == ESP_OK ? reg : res; } -esp_err_t -es8374_set_bits_per_sample (es_module_t mode, es_bits_length_t bit_per_sample) -{ +esp_err_t es8374_set_bits_per_sample(es_module_t mode, + es_bits_length_t bit_per_sample) { esp_err_t res = ESP_OK; uint8_t reg = 0; int bits = (int)bit_per_sample & 0x0f; - if (mode == ES_MODULE_ADC || mode == ES_MODULE_ADC_DAC) - { - res |= es8374_read_reg (0x10, ®); - if (res == 0) - { - reg = reg & 0xe3; - res |= es8374_write_reg (0x10, reg | (bits << 2)); - } + if (mode == ES_MODULE_ADC || mode == ES_MODULE_ADC_DAC) { + res |= es8374_read_reg(0x10, ®); + if (res == 0) { + reg = reg & 0xe3; + res |= es8374_write_reg(0x10, reg | (bits << 2)); } - if (mode == ES_MODULE_DAC || mode == ES_MODULE_ADC_DAC) - { - res |= es8374_read_reg (0x11, ®); - if (res == 0) - { - reg = reg & 0xe3; - res |= es8374_write_reg (0x11, reg | (bits << 2)); - } + } + if (mode == ES_MODULE_DAC || mode == ES_MODULE_ADC_DAC) { + res |= es8374_read_reg(0x11, ®); + if (res == 0) { + reg = reg & 0xe3; + res |= es8374_write_reg(0x11, reg | (bits << 2)); } + } return res; } -esp_err_t -es8374_config_fmt (es_module_t mode, es_i2s_fmt_t fmt) -{ +esp_err_t es8374_config_fmt(es_module_t mode, es_i2s_fmt_t fmt) { esp_err_t res = ESP_OK; uint8_t reg = 0; int fmt_tmp, fmt_i2s; fmt_tmp = ((fmt & 0xf0) >> 4); fmt_i2s = fmt & 0x0f; - if (mode == ES_MODULE_ADC || mode == ES_MODULE_ADC_DAC) - { - res |= es8374_read_reg (0x10, ®); - if (res == 0) - { - reg = reg & 0xfc; - res |= es8374_write_reg (0x10, reg | fmt_i2s); - res |= es8374_set_bits_per_sample (mode, fmt_tmp); - } - } - if (mode == ES_MODULE_DAC || mode == ES_MODULE_ADC_DAC) - { - res |= es8374_read_reg (0x11, ®); - if (res == 0) - { - reg = reg & 0xfc; - res |= es8374_write_reg (0x11, reg | (fmt_i2s)); - res |= es8374_set_bits_per_sample (mode, fmt_tmp); - } - } + if (mode == ES_MODULE_ADC || mode == ES_MODULE_ADC_DAC) { + res |= es8374_read_reg(0x10, ®); + if (res == 0) { + reg = reg & 0xfc; + res |= es8374_write_reg(0x10, reg | fmt_i2s); + res |= es8374_set_bits_per_sample(mode, fmt_tmp); + } + } + if (mode == ES_MODULE_DAC || mode == ES_MODULE_ADC_DAC) { + res |= es8374_read_reg(0x11, ®); + if (res == 0) { + reg = reg & 0xfc; + res |= es8374_write_reg(0x11, reg | (fmt_i2s)); + res |= es8374_set_bits_per_sample(mode, fmt_tmp); + } + } return res; } -esp_err_t -es8374_start (es_module_t mode) -{ +esp_err_t es8374_start(es_module_t mode) { esp_err_t res = ESP_OK; uint8_t reg = 0; - if (mode == ES_MODULE_LINE) - { - res |= es8374_read_reg (0x1a, ®); // set monomixer - reg |= 0x60; - reg |= 0x20; - reg &= 0xf7; - res |= es8374_write_reg (0x1a, reg); - res |= es8374_read_reg (0x1c, ®); // set spk mixer - reg |= 0x40; - res |= es8374_write_reg (0x1c, reg); - res |= es8374_write_reg (0x1D, 0x02); // spk set - res |= es8374_write_reg (0x1F, 0x00); // spk set - res |= es8374_write_reg (0x1E, 0xA0); // spk on - } - if (mode == ES_MODULE_ADC || mode == ES_MODULE_ADC_DAC - || mode == ES_MODULE_LINE) - { - res |= es8374_read_reg (0x21, ®); // power up adc and input - reg &= 0x3f; - res |= es8374_write_reg (0x21, reg); - res |= es8374_read_reg (0x10, ®); // power up adc and input - reg &= 0x3f; - res |= es8374_write_reg (0x10, reg); - } - - if (mode == ES_MODULE_DAC || mode == ES_MODULE_ADC_DAC - || mode == ES_MODULE_LINE) - { - res |= es8374_read_reg (0x1a, ®); // disable lout - reg |= 0x08; - res |= es8374_write_reg (0x1a, reg); - reg &= 0xdf; - res |= es8374_write_reg (0x1a, reg); - res |= es8374_write_reg (0x1D, 0x12); // mute speaker - res |= es8374_write_reg (0x1E, 0x20); // disable class d - res |= es8374_read_reg (0x15, ®); // power up dac - reg &= 0xdf; - res |= es8374_write_reg (0x15, reg); - res |= es8374_read_reg (0x1a, ®); // disable lout - reg |= 0x20; - res |= es8374_write_reg (0x1a, reg); - reg &= 0xf7; - res |= es8374_write_reg (0x1a, reg); - res |= es8374_write_reg (0x1D, 0x02); // mute speaker - res |= es8374_write_reg (0x1E, 0xa0); // disable class d - - res |= es8374_set_voice_mute (false); - } + if (mode == ES_MODULE_LINE) { + res |= es8374_read_reg(0x1a, ®); // set monomixer + reg |= 0x60; + reg |= 0x20; + reg &= 0xf7; + res |= es8374_write_reg(0x1a, reg); + res |= es8374_read_reg(0x1c, ®); // set spk mixer + reg |= 0x40; + res |= es8374_write_reg(0x1c, reg); + res |= es8374_write_reg(0x1D, 0x02); // spk set + res |= es8374_write_reg(0x1F, 0x00); // spk set + res |= es8374_write_reg(0x1E, 0xA0); // spk on + } + if (mode == ES_MODULE_ADC || mode == ES_MODULE_ADC_DAC || + mode == ES_MODULE_LINE) { + res |= es8374_read_reg(0x21, ®); // power up adc and input + reg &= 0x3f; + res |= es8374_write_reg(0x21, reg); + res |= es8374_read_reg(0x10, ®); // power up adc and input + reg &= 0x3f; + res |= es8374_write_reg(0x10, reg); + } + + if (mode == ES_MODULE_DAC || mode == ES_MODULE_ADC_DAC || + mode == ES_MODULE_LINE) { + res |= es8374_read_reg(0x1a, ®); // disable lout + reg |= 0x08; + res |= es8374_write_reg(0x1a, reg); + reg &= 0xdf; + res |= es8374_write_reg(0x1a, reg); + res |= es8374_write_reg(0x1D, 0x12); // mute speaker + res |= es8374_write_reg(0x1E, 0x20); // disable class d + res |= es8374_read_reg(0x15, ®); // power up dac + reg &= 0xdf; + res |= es8374_write_reg(0x15, reg); + res |= es8374_read_reg(0x1a, ®); // disable lout + reg |= 0x20; + res |= es8374_write_reg(0x1a, reg); + reg &= 0xf7; + res |= es8374_write_reg(0x1a, reg); + res |= es8374_write_reg(0x1D, 0x02); // mute speaker + res |= es8374_write_reg(0x1E, 0xa0); // disable class d + + res |= es8374_set_voice_mute(false); + } return res; } -esp_err_t -es8374_stop (es_module_t mode) -{ +esp_err_t es8374_stop(es_module_t mode) { esp_err_t res = ESP_OK; uint8_t reg = 0; - if (mode == ES_MODULE_LINE) - { - res |= es8374_read_reg (0x1a, ®); // disable lout - reg |= 0x08; - res |= es8374_write_reg (0x1a, reg); - reg &= 0x9f; - res |= es8374_write_reg (0x1a, reg); - res |= es8374_write_reg (0x1D, 0x12); // mute speaker - res |= es8374_write_reg (0x1E, 0x20); // disable class d - res |= es8374_read_reg (0x1c, ®); // disable spkmixer - reg &= 0xbf; - res |= es8374_write_reg (0x1c, reg); - res |= es8374_write_reg (0x1F, 0x00); // spk set - } - if (mode == ES_MODULE_DAC || mode == ES_MODULE_ADC_DAC) - { - res |= es8374_set_voice_mute (true); - - res |= es8374_read_reg (0x1a, ®); // disable lout - reg |= 0x08; - res |= es8374_write_reg (0x1a, reg); - reg &= 0xdf; - res |= es8374_write_reg (0x1a, reg); - res |= es8374_write_reg (0x1D, 0x12); // mute speaker - res |= es8374_write_reg (0x1E, 0x20); // disable class d - res |= es8374_read_reg (0x15, ®); // power up dac - reg |= 0x20; - res |= es8374_write_reg (0x15, reg); - } - if (mode == ES_MODULE_ADC || mode == ES_MODULE_ADC_DAC) - { - - res |= es8374_read_reg (0x10, ®); // power up adc and input - reg |= 0xc0; - res |= es8374_write_reg (0x10, reg); - res |= es8374_read_reg (0x21, ®); // power up adc and input - reg |= 0xc0; - res |= es8374_write_reg (0x21, reg); - } + if (mode == ES_MODULE_LINE) { + res |= es8374_read_reg(0x1a, ®); // disable lout + reg |= 0x08; + res |= es8374_write_reg(0x1a, reg); + reg &= 0x9f; + res |= es8374_write_reg(0x1a, reg); + res |= es8374_write_reg(0x1D, 0x12); // mute speaker + res |= es8374_write_reg(0x1E, 0x20); // disable class d + res |= es8374_read_reg(0x1c, ®); // disable spkmixer + reg &= 0xbf; + res |= es8374_write_reg(0x1c, reg); + res |= es8374_write_reg(0x1F, 0x00); // spk set + } + if (mode == ES_MODULE_DAC || mode == ES_MODULE_ADC_DAC) { + res |= es8374_set_voice_mute(true); + + res |= es8374_read_reg(0x1a, ®); // disable lout + reg |= 0x08; + res |= es8374_write_reg(0x1a, reg); + reg &= 0xdf; + res |= es8374_write_reg(0x1a, reg); + res |= es8374_write_reg(0x1D, 0x12); // mute speaker + res |= es8374_write_reg(0x1E, 0x20); // disable class d + res |= es8374_read_reg(0x15, ®); // power up dac + reg |= 0x20; + res |= es8374_write_reg(0x15, reg); + } + if (mode == ES_MODULE_ADC || mode == ES_MODULE_ADC_DAC) { + res |= es8374_read_reg(0x10, ®); // power up adc and input + reg |= 0xc0; + res |= es8374_write_reg(0x10, reg); + res |= es8374_read_reg(0x21, ®); // power up adc and input + reg |= 0xc0; + res |= es8374_write_reg(0x21, reg); + } return res; } -esp_err_t -es8374_i2s_config_clock (es_i2s_clock_t cfg) -{ - +esp_err_t es8374_i2s_config_clock(es_i2s_clock_t cfg) { esp_err_t res = ESP_OK; uint8_t reg = 0; - res |= es8374_read_reg (0x0f, ®); // power up adc and input + res |= es8374_read_reg(0x0f, ®); // power up adc and input reg &= 0xe0; int divratio = 0; - switch (cfg.sclk_div) - { + switch (cfg.sclk_div) { case MCLK_DIV_1: divratio = 1; break; - case MCLK_DIV_2: // = 2, + case MCLK_DIV_2: // = 2, divratio = 2; break; - case MCLK_DIV_3: // = 3, + case MCLK_DIV_3: // = 3, divratio = 3; break; - case MCLK_DIV_4: // = 4, + case MCLK_DIV_4: // = 4, divratio = 4; break; - case MCLK_DIV_5: // = 20, + case MCLK_DIV_5: // = 20, divratio = 5; break; - case MCLK_DIV_6: // = 5, + case MCLK_DIV_6: // = 5, divratio = 6; break; - case MCLK_DIV_7: // = 29, + case MCLK_DIV_7: // = 29, divratio = 7; break; - case MCLK_DIV_8: // = 6, + case MCLK_DIV_8: // = 6, divratio = 8; break; - case MCLK_DIV_9: // = 7, + case MCLK_DIV_9: // = 7, divratio = 9; break; - case MCLK_DIV_10: // = 21, + case MCLK_DIV_10: // = 21, divratio = 10; break; - case MCLK_DIV_11: // = 8, + case MCLK_DIV_11: // = 8, divratio = 11; break; - case MCLK_DIV_12: // = 9, + case MCLK_DIV_12: // = 9, divratio = 12; break; - case MCLK_DIV_13: // = 30, + case MCLK_DIV_13: // = 30, divratio = 13; break; - case MCLK_DIV_14: // = 31 + case MCLK_DIV_14: // = 31 divratio = 14; break; - case MCLK_DIV_15: // = 22, + case MCLK_DIV_15: // = 22, divratio = 15; break; - case MCLK_DIV_16: // = 10, + case MCLK_DIV_16: // = 10, divratio = 16; break; - case MCLK_DIV_17: // = 23, + case MCLK_DIV_17: // = 23, divratio = 17; break; - case MCLK_DIV_18: // = 11, + case MCLK_DIV_18: // = 11, divratio = 18; break; - case MCLK_DIV_20: // = 24, + case MCLK_DIV_20: // = 24, divratio = 19; break; - case MCLK_DIV_22: // = 12, + case MCLK_DIV_22: // = 12, divratio = 20; break; - case MCLK_DIV_24: // = 13, + case MCLK_DIV_24: // = 13, divratio = 21; break; - case MCLK_DIV_25: // = 25, + case MCLK_DIV_25: // = 25, divratio = 22; break; - case MCLK_DIV_30: // = 26, + case MCLK_DIV_30: // = 26, divratio = 23; break; - case MCLK_DIV_32: // = 27, + case MCLK_DIV_32: // = 27, divratio = 24; break; - case MCLK_DIV_33: // = 14, + case MCLK_DIV_33: // = 14, divratio = 25; break; - case MCLK_DIV_34: // = 28, + case MCLK_DIV_34: // = 28, divratio = 26; break; - case MCLK_DIV_36: // = 15, + case MCLK_DIV_36: // = 15, divratio = 27; break; - case MCLK_DIV_44: // = 16, + case MCLK_DIV_44: // = 16, divratio = 28; break; - case MCLK_DIV_48: // = 17, + case MCLK_DIV_48: // = 17, divratio = 29; break; - case MCLK_DIV_66: // = 18, + case MCLK_DIV_66: // = 18, divratio = 30; break; - case MCLK_DIV_72: // = 19, + case MCLK_DIV_72: // = 19, divratio = 31; break; default: break; - } + } reg |= divratio; - res |= es8374_write_reg (0x0f, reg); + res |= es8374_write_reg(0x0f, reg); int dacratio_l = 0; int dacratio_h = 0; - switch (cfg.lclk_div) - { + switch (cfg.lclk_div) { case LCLK_DIV_128: dacratio_l = 128 % 256; dacratio_h = 128 / 256; @@ -545,314 +496,268 @@ es8374_i2s_config_clock (es_i2s_clock_t cfg) break; default: break; - } - res |= es8374_write_reg (0x06, - dacratio_h); // ADCFsMode,singel SPEED,RATIO=256 - res |= es8374_write_reg (0x07, - dacratio_l); // ADCFsMode,singel SPEED,RATIO=256 + } + res |= es8374_write_reg(0x06, dacratio_h); // ADCFsMode,singel + // SPEED,RATIO=256 + res |= es8374_write_reg(0x07, dacratio_l); // ADCFsMode,singel + // SPEED,RATIO=256 return res; } -esp_err_t -es8374_config_dac_output (es_dac_output_t output) -{ +esp_err_t es8374_config_dac_output(es_dac_output_t output) { esp_err_t res = ESP_OK; uint8_t reg = 0; reg = 0x1d; - res = es8374_write_reg (reg, 0x02); - res |= es8374_read_reg (0x1c, ®); // set spk mixer + res = es8374_write_reg(reg, 0x02); + res |= es8374_read_reg(0x1c, ®); // set spk mixer reg |= 0x80; - res |= es8374_write_reg (0x1c, reg); - res |= es8374_write_reg (0x1D, 0x02); // spk set - res |= es8374_write_reg (0x1F, 0x00); // spk set - res |= es8374_write_reg (0x1E, 0xA0); // spk on + res |= es8374_write_reg(0x1c, reg); + res |= es8374_write_reg(0x1D, 0x02); // spk set + res |= es8374_write_reg(0x1F, 0x00); // spk set + res |= es8374_write_reg(0x1E, 0xA0); // spk on return res; } -esp_err_t -es8374_config_adc_input (es_adc_input_t input) -{ +esp_err_t es8374_config_adc_input(es_adc_input_t input) { esp_err_t res = ESP_OK; uint8_t reg = 0; - res |= es8374_read_reg (0x21, ®); - if (res == 0) - { - reg = (reg & 0xcf) | 0x14; - res |= es8374_write_reg (0x21, reg); - } + res |= es8374_read_reg(0x21, ®); + if (res == 0) { + reg = (reg & 0xcf) | 0x14; + res |= es8374_write_reg(0x21, reg); + } return res; } -esp_err_t -es8374_set_mic_gain (es_mic_gain_t gain) -{ +esp_err_t es8374_set_mic_gain(es_mic_gain_t gain) { esp_err_t res = ESP_OK; - if (gain > MIC_GAIN_MIN && gain < MIC_GAIN_24DB) - { - int gain_n = 0; - gain_n = (int)gain / 3; - res = es8374_write_reg (0x22, gain_n | (gain_n << 4)); // MIC PGA - } - else - { - res = -1; - LOG_8374 ("invalid microphone gain!"); - } + if (gain > MIC_GAIN_MIN && gain < MIC_GAIN_24DB) { + int gain_n = 0; + gain_n = (int)gain / 3; + res = es8374_write_reg(0x22, gain_n | (gain_n << 4)); // MIC PGA + } else { + res = -1; + LOG_8374("invalid microphone gain!"); + } return res; } -esp_err_t -es8374_codec_set_voice_volume (int volume) -{ +esp_err_t es8374_codec_set_voice_volume(int volume) { esp_err_t res = ESP_OK; - if (volume < 0) - { - volume = 192; - } - else if (volume > 96) - { - volume = 0; - } - else - { - volume = 192 - volume * 2; - } + if (volume < 0) { + volume = 192; + } else if (volume > 96) { + volume = 0; + } else { + volume = 192 - volume * 2; + } - res = es8374_write_reg (0x38, volume); + res = es8374_write_reg(0x38, volume); return res; } -esp_err_t -es8374_codec_get_voice_volume (int *volume) -{ +esp_err_t es8374_codec_get_voice_volume(int *volume) { esp_err_t res = 0; uint8_t reg = 0; - res = es8374_read_reg (0x38, ®); + res = es8374_read_reg(0x38, ®); - if (res == ESP_FAIL) - { - *volume = 0; - } - else - { - *volume = (192 - reg) / 2; - if (*volume > 96) - { - *volume = 100; - } + if (res == ESP_FAIL) { + *volume = 0; + } else { + *volume = (192 - reg) / 2; + if (*volume > 96) { + *volume = 100; } + } return res; } -static int -es8374_set_adc_dac_volume (int mode, int volume, int dot) -{ +static int es8374_set_adc_dac_volume(int mode, int volume, int dot) { int res = 0; - if (volume < -96 || volume > 0) - { - LOG_8374 ("Warning: volume < -96! or > 0!"); - if (volume < -96) - { - volume = -96; - } - else - { - volume = 0; - } + if (volume < -96 || volume > 0) { + LOG_8374("Warning: volume < -96! or > 0!"); + if (volume < -96) { + volume = -96; + } else { + volume = 0; } + } dot = (dot >= 5 ? 1 : 0); volume = (-volume << 1) + dot; - if (mode == ES_MODULE_ADC || mode == ES_MODULE_ADC_DAC) - { - res |= es8374_write_reg (0x25, volume); - } - if (mode == ES_MODULE_DAC || mode == ES_MODULE_ADC_DAC) - { - res |= es8374_write_reg (0x38, volume); - } + if (mode == ES_MODULE_ADC || mode == ES_MODULE_ADC_DAC) { + res |= es8374_write_reg(0x25, volume); + } + if (mode == ES_MODULE_DAC || mode == ES_MODULE_ADC_DAC) { + res |= es8374_write_reg(0x38, volume); + } return res; } -static int -es8374_set_d2se_pga (es_d2se_pga_t gain) -{ +static int es8374_set_d2se_pga(es_d2se_pga_t gain) { int res = 0; uint8_t reg = 0; - if (gain > D2SE_PGA_GAIN_MIN && gain < D2SE_PGA_GAIN_MAX) - { - res = es8374_read_reg (0x21, ®); - reg &= 0xfb; - reg |= gain << 2; - res = es8374_write_reg (0x21, reg); // MIC PGA - } - else - { - res = 0xff; - LOG_8374 ("invalid microphone gain!"); - } + if (gain > D2SE_PGA_GAIN_MIN && gain < D2SE_PGA_GAIN_MAX) { + res = es8374_read_reg(0x21, ®); + reg &= 0xfb; + reg |= gain << 2; + res |= es8374_write_reg(0x21, reg); // MIC PGA + } else { + res = 0xff; + LOG_8374("invalid microphone gain!"); + } return res; } -static int -es8374_init_reg (audio_hal_codec_mode_t ms_mode, es_i2s_fmt_t fmt, - es_i2s_clock_t cfg, es_dac_output_t out_channel, - es_adc_input_t in_channel) -{ +static int es8374_init_reg(audio_hal_codec_mode_t ms_mode, es_i2s_fmt_t fmt, + es_i2s_clock_t cfg, es_dac_output_t out_channel, + es_adc_input_t in_channel) { int res = 0; uint8_t reg; - res |= es8374_write_reg (0x00, 0x3F); // IC Rst start - res |= es8374_write_reg (0x00, 0x03); // IC Rst stop - res |= es8374_write_reg (0x01, 0x7F); // IC clk on + res |= es8374_write_reg(0x00, 0x3F); // IC Rst start + res |= es8374_write_reg(0x00, 0x03); // IC Rst stop + res |= es8374_write_reg(0x01, 0x7F); // IC clk on - res |= es8374_read_reg (0x0F, ®); + res |= es8374_read_reg(0x0F, ®); reg &= 0x7f; reg |= (ms_mode << 7); - res |= es8374_write_reg (0x0f, reg); // CODEC IN I2S SLAVE MODE - - res |= es8374_write_reg (0x6F, 0xA0); // pll set:mode enable - res |= es8374_write_reg (0x72, 0x41); // pll set:mode set - res |= es8374_write_reg (0x09, 0x01); // pll set:reset on ,set start - res |= es8374_write_reg (0x0C, 0x22); // pll set:k - res |= es8374_write_reg (0x0D, 0x2E); // pll set:k - res |= es8374_write_reg (0x0E, 0xC6); // pll set:k - res |= es8374_write_reg (0x0A, 0x3A); // pll set: - res |= es8374_write_reg (0x0B, 0x07); // pll set:n - res |= es8374_write_reg (0x09, 0x41); // pll set:reset off ,set stop - - res |= es8374_i2s_config_clock (cfg); - - res |= es8374_write_reg (0x24, 0x08); // adc set - res |= es8374_write_reg (0x36, 0x00); // dac set - res |= es8374_write_reg (0x12, 0x30); // timming set - res |= es8374_write_reg (0x13, 0x20); // timming set - - res |= es8374_config_fmt (ES_MODULE_ADC, fmt); - res |= es8374_config_fmt (ES_MODULE_DAC, fmt); - - res |= es8374_write_reg (0x21, 0x50); // adc set: SEL LIN1 CH+PGAGAIN=0DB - res |= es8374_write_reg (0x22, 0xFF); // adc set: PGA GAIN=0DB - res |= es8374_write_reg (0x21, 0x14); // adc set: SEL LIN1 CH+PGAGAIN=18DB - res |= es8374_write_reg (0x22, 0x55); // pga = +15db - res |= es8374_write_reg (0x08, - 0x21); // set class d divider = 33, to avoid the - // high frequency tone on laudspeaker - res |= es8374_write_reg (0x00, 0x80); // IC START - - res |= es8374_set_adc_dac_volume (ES_MODULE_ADC, 0, 0); // 0db - res |= es8374_set_adc_dac_volume (ES_MODULE_DAC, 0, 0); // 0db - - res |= es8374_write_reg (0x14, 0x8A); // IC START - res |= es8374_write_reg (0x15, 0x40); // IC START - res |= es8374_write_reg (0x1A, 0xA0); // monoout set - res |= es8374_write_reg (0x1B, 0x19); // monoout set - res |= es8374_write_reg (0x1C, 0x90); // spk set - res |= es8374_write_reg (0x1D, 0x01); // spk set - res |= es8374_write_reg (0x1F, 0x00); // spk set - res |= es8374_write_reg (0x1E, 0x20); // spk on - res |= es8374_write_reg (0x28, 0x00); // alc set - res |= es8374_write_reg (0x25, 0x00); // ADCVOLUME on - res |= es8374_write_reg (0x38, 0x00); // DACVOLUME on - res |= es8374_write_reg (0x37, 0x30); // dac set - res |= es8374_write_reg ( - 0x6D, 0x60); // SEL:GPIO1=DMIC CLK OUT+SEL:GPIO2=PLL CLK OUT - res |= es8374_write_reg (0x71, 0x05); // for automute setting - res |= es8374_write_reg (0x73, 0x70); - - res |= es8374_config_dac_output ( - out_channel); // 0x3c Enable DAC and Enable Lout/Rout/1/2 - res |= es8374_config_adc_input ( - in_channel); // 0x00 LINSEL & RINSEL, LIN1/RIN1 as ADC Input; DSSEL,use - // one DS Reg11; DSR, LINPUT1-RINPUT1 - res |= es8374_codec_set_voice_volume (0); - - res |= es8374_write_reg (0x37, 0x00); // dac set + res |= es8374_write_reg(0x0f, reg); // CODEC IN I2S SLAVE MODE + + res |= es8374_write_reg(0x6F, 0xA0); // pll set:mode enable + res |= es8374_write_reg(0x72, 0x41); // pll set:mode set + res |= es8374_write_reg(0x09, 0x01); // pll set:reset on ,set start + res |= es8374_write_reg(0x0C, 0x22); // pll set:k + res |= es8374_write_reg(0x0D, 0x2E); // pll set:k + res |= es8374_write_reg(0x0E, 0xC6); // pll set:k + res |= es8374_write_reg(0x0A, 0x3A); // pll set: + res |= es8374_write_reg(0x0B, 0x07); // pll set:n + res |= es8374_write_reg(0x09, 0x41); // pll set:reset off ,set stop + + res |= es8374_i2s_config_clock(cfg); + + res |= es8374_write_reg(0x24, 0x08); // adc set + res |= es8374_write_reg(0x36, 0x00); // dac set + res |= es8374_write_reg(0x12, 0x30); // timming set + res |= es8374_write_reg(0x13, 0x20); // timming set + + res |= es8374_config_fmt(ES_MODULE_ADC, fmt); + res |= es8374_config_fmt(ES_MODULE_DAC, fmt); + + res |= es8374_write_reg(0x21, 0x50); // adc set: SEL LIN1 CH+PGAGAIN=0DB + res |= es8374_write_reg(0x22, 0xFF); // adc set: PGA GAIN=0DB + res |= es8374_write_reg(0x21, 0x14); // adc set: SEL LIN1 CH+PGAGAIN=18DB + res |= es8374_write_reg(0x22, 0x55); // pga = +15db + res |= + es8374_write_reg(0x08, 0x21); // set class d divider = 33, to avoid the + // high frequency tone on laudspeaker + res |= es8374_write_reg(0x00, 0x80); // IC START + + res |= es8374_set_adc_dac_volume(ES_MODULE_ADC, 0, 0); // 0db + res |= es8374_set_adc_dac_volume(ES_MODULE_DAC, 0, 0); // 0db + + res |= es8374_write_reg(0x14, 0x8A); // IC START + res |= es8374_write_reg(0x15, 0x40); // IC START + res |= es8374_write_reg(0x1A, 0xA0); // monoout set + res |= es8374_write_reg(0x1B, 0x19); // monoout set + res |= es8374_write_reg(0x1C, 0x90); // spk set + res |= es8374_write_reg(0x1D, 0x01); // spk set + res |= es8374_write_reg(0x1F, 0x00); // spk set + res |= es8374_write_reg(0x1E, 0x20); // spk on + res |= es8374_write_reg(0x28, 0x00); // alc set + res |= es8374_write_reg(0x25, 0x00); // ADCVOLUME on + res |= es8374_write_reg(0x38, 0x00); // DACVOLUME on + res |= es8374_write_reg(0x37, 0x30); // dac set + res |= es8374_write_reg( + 0x6D, 0x60); // SEL:GPIO1=DMIC CLK OUT+SEL:GPIO2=PLL CLK OUT + res |= es8374_write_reg(0x71, 0x05); // for automute setting + res |= es8374_write_reg(0x73, 0x70); + + res |= es8374_config_dac_output( + out_channel); // 0x3c Enable DAC and Enable Lout/Rout/1/2 + res |= es8374_config_adc_input( + in_channel); // 0x00 LINSEL & RINSEL, LIN1/RIN1 as ADC Input; DSSEL,use + // one DS Reg11; DSR, LINPUT1-RINPUT1 + res |= es8374_codec_set_voice_volume(0); + + res |= es8374_write_reg(0x37, 0x00); // dac set return res; } -esp_err_t -es8374_codec_init (audio_hal_codec_config_t *cfg) -{ - if (es8374_codec_initialized ()) - { - ESP_LOGW (ES8374_TAG, "The es8374 codec has already been initialized!"); - return ESP_FAIL; - } +esp_err_t es8374_codec_init(audio_hal_codec_config_t *cfg) { + if (es8374_codec_initialized()) { + ESP_LOGW(ES8374_TAG, "The es8374 codec has already been initialized!"); + return ESP_FAIL; + } esp_err_t res = ESP_OK; es_i2s_clock_t clkdiv; clkdiv.lclk_div = LCLK_DIV_256; clkdiv.sclk_div = MCLK_DIV_4; - i2c_init (); // ESP32 in master mode + i2c_init(); // ESP32 in master mode - res |= es8374_stop (cfg->codec_mode); - res |= es8374_init_reg (cfg->i2s_iface.mode, - (BIT_LENGTH_16BITS << 4) | cfg->i2s_iface.fmt, - clkdiv, cfg->dac_output, cfg->adc_input); - res |= es8374_set_mic_gain (MIC_GAIN_15DB); - res |= es8374_set_d2se_pga (D2SE_PGA_GAIN_EN); - res |= es8374_config_fmt (cfg->codec_mode, cfg->i2s_iface.fmt); - res |= es8374_codec_config_i2s (cfg->codec_mode, &(cfg->i2s_iface)); + res |= es8374_stop(cfg->codec_mode); + res |= es8374_init_reg(cfg->i2s_iface.mode, + (BIT_LENGTH_16BITS << 4) | cfg->i2s_iface.fmt, clkdiv, + cfg->dac_output, cfg->adc_input); + res |= es8374_set_mic_gain(MIC_GAIN_15DB); + res |= es8374_set_d2se_pga(D2SE_PGA_GAIN_EN); + res |= es8374_config_fmt(cfg->codec_mode, cfg->i2s_iface.fmt); + res |= es8374_codec_config_i2s(cfg->codec_mode, &(cfg->i2s_iface)); codec_init_flag = 1; return res; } -esp_err_t -es8374_codec_deinit (void) -{ +esp_err_t es8374_codec_deinit(void) { + if (!es8374_codec_initialized()) { + ESP_LOGW(ES8374_TAG, "The es8374 codec has already been deinit!"); + return ESP_FAIL; + } + esp_err_t res = ESP_OK; codec_init_flag = 0; - i2c_bus_delete (i2c_handle); - return es8374_write_reg (0x00, 0x7F); // IC Reset and STOP + res = es8374_write_reg(0x00, 0x7F); // IC Reset and STOP + res |= i2c_bus_delete(i2c_handle); + return res; } -esp_err_t -es8374_codec_config_i2s (audio_hal_codec_mode_t mode, - audio_hal_codec_i2s_iface_t *iface) -{ + +esp_err_t es8374_codec_config_i2s(audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface) { esp_err_t res = ESP_OK; int tmp = 0; - res |= es8374_config_fmt (ES_MODULE_ADC_DAC, iface->fmt); - if (iface->bits == AUDIO_HAL_BIT_LENGTH_16BITS) - { - tmp = BIT_LENGTH_16BITS; - } - else if (iface->bits == AUDIO_HAL_BIT_LENGTH_24BITS) - { - tmp = BIT_LENGTH_24BITS; - } - else - { - tmp = BIT_LENGTH_32BITS; - } - res |= es8374_set_bits_per_sample (ES_MODULE_ADC_DAC, tmp); + res |= es8374_config_fmt(ES_MODULE_ADC_DAC, iface->fmt); + if (iface->bits == AUDIO_HAL_BIT_LENGTH_16BITS) { + tmp = BIT_LENGTH_16BITS; + } else if (iface->bits == AUDIO_HAL_BIT_LENGTH_24BITS) { + tmp = BIT_LENGTH_24BITS; + } else { + tmp = BIT_LENGTH_32BITS; + } + res |= es8374_set_bits_per_sample(ES_MODULE_ADC_DAC, tmp); return res; } -esp_err_t -es8374_codec_ctrl_state (audio_hal_codec_mode_t mode, - audio_hal_ctrl_t ctrl_state) -{ +esp_err_t es8374_codec_ctrl_state(audio_hal_codec_mode_t mode, + audio_hal_ctrl_t ctrl_state) { esp_err_t res = ESP_OK; int es_mode_t = 0; - switch (mode) - { + switch (mode) { case AUDIO_HAL_CODEC_MODE_ENCODE: es_mode_t = ES_MODULE_ADC; break; @@ -867,38 +772,31 @@ es8374_codec_ctrl_state (audio_hal_codec_mode_t mode, break; default: es_mode_t = ES_MODULE_DAC; - ESP_LOGW (ES8374_TAG, "Codec mode not support, default is decode mode"); - break; - } - if (AUDIO_HAL_CTRL_STOP == ctrl_state) - { - res = es8374_stop (es_mode_t); - } - else - { - res = es8374_start (es_mode_t); - ESP_LOGD (ES8374_TAG, "start default is decode mode:%d", es_mode_t); - } + ESP_LOGW(ES8374_TAG, "Codec mode not support, default is decode mode"); + break; + } + if (AUDIO_HAL_CTRL_STOP == ctrl_state) { + res = es8374_stop(es_mode_t); + } else { + res = es8374_start(es_mode_t); + ESP_LOGD(ES8374_TAG, "start default is decode mode:%d", es_mode_t); + } return res; } -void -es8374_pa_power (bool enable) -{ +esp_err_t es8374_pa_power(bool enable) { + esp_err_t ret = ESP_OK; gpio_config_t io_conf; - memset (&io_conf, 0, sizeof (io_conf)); - io_conf.intr_type = GPIO_PIN_INTR_DISABLE; + memset(&io_conf, 0, sizeof(io_conf)); io_conf.mode = GPIO_MODE_OUTPUT; - io_conf.pin_bit_mask = BIT64 (get_pa_enable_gpio ()); + io_conf.pin_bit_mask = BIT64(get_pa_enable_gpio()); io_conf.pull_down_en = 0; io_conf.pull_up_en = 0; - gpio_config (&io_conf); - if (enable) - { - gpio_set_level (get_pa_enable_gpio (), 1); - } - else - { - gpio_set_level (get_pa_enable_gpio (), 0); - } + gpio_config(&io_conf); + if (enable) { + ret = gpio_set_level(get_pa_enable_gpio(), 1); + } else { + ret = gpio_set_level(get_pa_enable_gpio(), 0); + } + return ret; } diff --git a/components/audio_hal/driver/es8374/es8374.h b/components/audio_hal/driver/es8374/es8374.h index 76f9a8a1..f8d245b0 100644 --- a/components/audio_hal/driver/es8374/es8374.h +++ b/components/audio_hal/driver/es8374/es8374.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -32,225 +32,225 @@ #include "esxxx_common.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif /* ES8374 address */ -#define ES8374_ADDR 0x20 // 0x22:CE=1;0x20:CE=0 +#define ES8374_ADDR 0x20 // 0x22:CE=1;0x20:CE=0 - /** - * @brief Initialize ES8374 codec chip - * - * @param cfg configuration of ES8374 - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es8374_codec_init (audio_hal_codec_config_t *cfg); +/** + * @brief Initialize ES8374 codec chip + * + * @param cfg configuration of ES8374 + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8374_codec_init(audio_hal_codec_config_t *cfg); - /** - * @brief Deinitialize ES8374 codec chip - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es8374_codec_deinit (void); +/** + * @brief Deinitialize ES8374 codec chip + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8374_codec_deinit(void); - /** - * @brief Configure ES8374 I2S format - * - * @param mode: set ADC or DAC or both - * @param fmt: ES8374 I2S format - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es8374_config_fmt (es_module_t mode, es_i2s_fmt_t fmt); +/** + * @brief Configure ES8374 I2S format + * + * @param mode: set ADC or DAC or both + * @param fmt: ES8374 I2S format + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8374_config_fmt(es_module_t mode, es_i2s_fmt_t fmt); - /** - * @brief Configure I2S clock in MSATER mode - * - * @param cfg: set bits clock and WS clock - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es8374_i2s_config_clock (es_i2s_clock_t cfg); +/** + * @brief Configure I2S clock in MSATER mode + * + * @param cfg: set bits clock and WS clock + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8374_i2s_config_clock(es_i2s_clock_t cfg); - /** - * @brief Configure ES8374 data sample bits - * - * @param mode: set ADC or DAC or both - * @param bit_per_sample: bit number of per sample - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es8374_set_bits_per_sample (es_module_t mode, - es_bits_length_t bit_per_sample); +/** + * @brief Configure ES8374 data sample bits + * + * @param mode: set ADC or DAC or both + * @param bit_per_sample: bit number of per sample + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8374_set_bits_per_sample(es_module_t mode, + es_bits_length_t bit_per_sample); - /** - * @brief Start ES8374 codec chip - * - * @param mode: set ADC or DAC or both - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es8374_start (es_module_t mode); +/** + * @brief Start ES8374 codec chip + * + * @param mode: set ADC or DAC or both + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8374_start(es_module_t mode); - /** - * @brief Stop ES8374 codec chip - * - * @param mode: set ADC or DAC or both - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es8374_stop (es_module_t mode); +/** + * @brief Stop ES8374 codec chip + * + * @param mode: set ADC or DAC or both + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8374_stop(es_module_t mode); - /** - * @brief Set voice volume - * - * @param volume: voice volume (0~100) - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es8374_codec_set_voice_volume (int volume); +/** + * @brief Set voice volume + * + * @param volume: voice volume (0~100) + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8374_codec_set_voice_volume(int volume); - /** - * @brief Get voice volume - * - * @param[out] *volume: voice volume (0~100) - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es8374_codec_get_voice_volume (int *volume); +/** + * @brief Get voice volume + * + * @param[out] *volume: voice volume (0~100) + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8374_codec_get_voice_volume(int *volume); - /** - * @brief Mute or unmute ES8374 DAC. Basically you can use this function to - * mute or unmute the output - * - * @param enable mute(1) or unmute(0) - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t es8374_set_voice_mute (bool enable); +/** + * @brief Mute or unmute ES8374 DAC. Basically you can use this function to mute + * or unmute the output + * + * @param enable mute(1) or unmute(0) + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es8374_set_voice_mute(bool enable); - /** - * @brief Get ES8374 DAC mute status - * - * @return - * - ESP_FAIL - * - ESP_OK - */ - esp_err_t es8374_get_voice_mute (void); +/** + * @brief Get ES8374 DAC mute status + * + * @return + * - ESP_FAIL + * - ESP_OK + */ +esp_err_t es8374_get_voice_mute(void); - /** - * @brief Set ES8374 mic gain - * - * @param gain db of mic gain - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t es8374_set_mic_gain (es_mic_gain_t gain); +/** + * @brief Set ES8374 mic gain + * + * @param gain db of mic gain + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es8374_set_mic_gain(es_mic_gain_t gain); - /** - * @brief Set ES8374 ADC input mode - * - * @param input adc input mode - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t es8374_config_adc_input (es_adc_input_t input); +/** + * @brief Set ES8374 ADC input mode + * + * @param input adc input mode + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es8374_config_adc_input(es_adc_input_t input); - /** - * @brief Set ES8374 DAC output mode - * - * @param output dac output mode - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t es8374_config_dac_output (es_dac_output_t output); +/** + * @brief Set ES8374 DAC output mode + * + * @param output dac output mode + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es8374_config_dac_output(es_dac_output_t output); - /** - * @brief Write ES8374 register - * - * @param reg_add address of register - * @param data data of register - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t es8374_write_reg (uint8_t reg_add, uint8_t data); +/** + * @brief Write ES8374 register + * + * @param reg_add address of register + * @param data data of register + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es8374_write_reg(uint8_t reg_add, uint8_t data); - /** - * @brief Print all ES8374 registers - * - * @return - * - void - */ - void es8374_read_all (); +/** + * @brief Print all ES8374 registers + * + * @return + * - void + */ +void es8374_read_all(); - /** - * @brief Configure ES8374 codec mode and I2S interface - * - * @param mode codec mode - * @param iface I2S config - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t es8374_codec_config_i2s (audio_hal_codec_mode_t mode, - audio_hal_codec_i2s_iface_t *iface); +/** + * @brief Configure ES8374 codec mode and I2S interface + * + * @param mode codec mode + * @param iface I2S config + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es8374_codec_config_i2s(audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface); - /** - * @brief Control ES8374 codec chip - * - * @param mode codec mode - * @param ctrl_state start or stop decode or encode progress - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t es8374_codec_ctrl_state (audio_hal_codec_mode_t mode, - audio_hal_ctrl_t ctrl_state); +/** + * @brief Control ES8374 codec chip + * + * @param mode codec mode + * @param ctrl_state start or stop decode or encode progress + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es8374_codec_ctrl_state(audio_hal_codec_mode_t mode, + audio_hal_ctrl_t ctrl_state); - /** - * @brief Set ES8374 PA power - * - * @param enable true for enable PA power, false for disable PA power - * - * @return - * - void - */ - void es8374_pa_power (bool enable); +/** + * @brief Set ES8374 PA power + * + * @param enable true for enable PA power, false for disable PA power + * + * @return + * - ESP_ERR_INVALID_ARG + * - ESP_OK + */ +esp_err_t es8374_pa_power(bool enable); #ifdef __cplusplus } #endif -#endif //__ES8374_H__ +#endif //__ES8374_H__ diff --git a/components/audio_hal/driver/es8388/es8388.c b/components/audio_hal/driver/es8388/es8388.c index 1e234d10..2795142a 100644 --- a/components/audio_hal/driver/es8388/es8388.c +++ b/components/audio_hal/driver/es8388/es8388.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,87 +18,90 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "es8388.h" -#include "board_pins_config.h" + +#include + +#include "audio_volume.h" +#include "board.h" #include "esp_log.h" #include "i2c_bus.h" -#include -#if defined(CONFIG_ESP_LYRAT_V4_3_BOARD) || defined(CONFIG_ESP_AI_THINKER_ES8388_BOARD) +#if defined(CONFIG_ESP_LYRAT_V4_3_BOARD) || \ + defined(CONFIG_ESP_AI_THINKER_ES8388_BOARD) #include "headphone_detect.h" #endif static const char *ES_TAG = "ES8388_DRIVER"; static i2c_bus_handle_t i2c_handle; +static codec_dac_volume_config_t *dac_vol_handle; + +#define ES8388_DAC_VOL_CFG_DEFAULT() \ + { \ + .max_dac_volume = 0, .min_dac_volume = -96, \ + .board_pa_gain = BOARD_PA_GAIN, .volume_accuracy = 0.5, \ + .dac_vol_symbol = -1, .zero_volume_reg = 0, .reg_value = 0, \ + .user_volume = 0, .offset_conv_volume = NULL, \ + } -#define ES_ASSERT(a, format, b, ...) \ - if ((a) != 0) \ - { \ - ESP_LOGE (ES_TAG, format, ##__VA_ARGS__); \ - return b; \ - } +#define ES_ASSERT(a, format, b, ...) \ + if ((a) != 0) { \ + ESP_LOGE(ES_TAG, format, ##__VA_ARGS__); \ + return b; \ + } audio_hal_func_t AUDIO_CODEC_ES8388_DEFAULT_HANDLE = { - .audio_codec_initialize = es8388_init, - .audio_codec_deinitialize = es8388_deinit, - .audio_codec_ctrl = es8388_ctrl_state, - .audio_codec_config_iface = es8388_config_i2s, - .audio_codec_set_mute = es8388_set_voice_mute, - .audio_codec_set_volume = es8388_set_voice_volume, - .audio_codec_get_volume = es8388_get_voice_volume, - .audio_hal_lock = NULL, - .handle = NULL, + .audio_codec_initialize = es8388_init, + .audio_codec_deinitialize = es8388_deinit, + .audio_codec_ctrl = es8388_ctrl_state, + .audio_codec_config_iface = es8388_config_i2s, + .audio_codec_set_mute = es8388_set_voice_mute, + .audio_codec_set_volume = es8388_set_voice_volume, + .audio_codec_get_volume = es8388_get_voice_volume, + .audio_codec_enable_pa = es8388_pa_power, + .audio_hal_lock = NULL, + .handle = NULL, }; -static esp_err_t -es_write_reg (uint8_t slave_addr, uint8_t reg_add, uint8_t data) -{ - return i2c_bus_write_bytes (i2c_handle, slave_addr, ®_add, - sizeof (reg_add), &data, sizeof (data)); +static esp_err_t es_write_reg(uint8_t slave_addr, uint8_t reg_add, + uint8_t data) { + return i2c_bus_write_bytes(i2c_handle, slave_addr, ®_add, sizeof(reg_add), + &data, sizeof(data)); } -static esp_err_t -es_read_reg (uint8_t reg_add, uint8_t *p_data) -{ - return i2c_bus_read_bytes (i2c_handle, ES8388_ADDR, ®_add, - sizeof (reg_add), p_data, 1); +static esp_err_t es_read_reg(uint8_t reg_add, uint8_t *p_data) { + return i2c_bus_read_bytes(i2c_handle, ES8388_ADDR, ®_add, sizeof(reg_add), + p_data, 1); } -static int -i2c_init () -{ +static int i2c_init() { int res; - i2c_config_t es_i2c_cfg = { .mode = I2C_MODE_MASTER, - .sda_pullup_en = GPIO_PULLUP_ENABLE, - .scl_pullup_en = GPIO_PULLUP_ENABLE, - .master.clk_speed = 100000 }; - res = get_i2c_pins (I2C_NUM_0, &es_i2c_cfg); - ES_ASSERT (res, "getting i2c pins error", -1); - i2c_handle = i2c_bus_create (I2C_NUM_0, &es_i2c_cfg); + i2c_config_t es_i2c_cfg = {.mode = I2C_MODE_MASTER, + .sda_pullup_en = GPIO_PULLUP_ENABLE, + .scl_pullup_en = GPIO_PULLUP_ENABLE, + .master.clk_speed = 100000}; + res = get_i2c_pins(I2C_NUM_0, &es_i2c_cfg); + ES_ASSERT(res, "getting i2c pins error", -1); + i2c_handle = i2c_bus_create(I2C_NUM_0, &es_i2c_cfg); return res; } -void -es8388_read_all () -{ - for (int i = 0; i < 50; i++) - { - uint8_t reg = 0; - es_read_reg (i, ®); - ets_printf ("%x: %x\n", i, reg); - } +void es8388_read_all() { + for (int i = 0; i < 50; i++) { + uint8_t reg = 0; + es_read_reg(i, ®); + ESP_LOGI(ES_TAG, "%x: %x", i, reg); + } } -esp_err_t -es8388_write_reg (uint8_t reg_add, uint8_t data) -{ - return es_write_reg (ES8388_ADDR, reg_add, data); +esp_err_t es8388_write_reg(uint8_t reg_add, uint8_t data) { + return es_write_reg(ES8388_ADDR, reg_add, data); } /** @@ -115,31 +118,26 @@ es8388_write_reg (uint8_t reg_add, uint8_t data) * - (-1) Parameter error * - (0) Success */ -static int -es8388_set_adc_dac_volume (int mode, int volume, int dot) -{ +static int es8388_set_adc_dac_volume(int mode, int volume, int dot) { int res = 0; - if (volume < -96 || volume > 0) - { - ESP_LOGW (ES_TAG, "Warning: volume < -96! or > 0!\n"); - if (volume < -96) - volume = -96; - else - volume = 0; - } + if (volume < -96 || volume > 0) { + ESP_LOGW(ES_TAG, "Warning: volume < -96! or > 0!\n"); + if (volume < -96) + volume = -96; + else + volume = 0; + } dot = (dot >= 5 ? 1 : 0); volume = (-volume << 1) + dot; - if (mode == ES_MODULE_ADC || mode == ES_MODULE_ADC_DAC) - { - res |= es_write_reg (ES8388_ADDR, ES8388_ADCCONTROL8, volume); - res |= es_write_reg (ES8388_ADDR, ES8388_ADCCONTROL9, - volume); // ADC Right Volume=0db - } - if (mode == ES_MODULE_DAC || mode == ES_MODULE_ADC_DAC) - { - res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL5, volume); - res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL4, volume); - } + if (mode == ES_MODULE_ADC || mode == ES_MODULE_ADC_DAC) { + res |= es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL8, volume); + res |= es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL9, + volume); // ADC Right Volume=0db + } + if (mode == ES_MODULE_DAC || mode == ES_MODULE_ADC_DAC) { + res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL5, volume); + res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL4, volume); + } return res; } @@ -154,57 +152,47 @@ es8388_set_adc_dac_volume (int mode, int volume, int dot) * - (-1) Error * - (0) Success */ -esp_err_t -es8388_start (es_module_t mode) -{ +esp_err_t es8388_start(es_module_t mode) { esp_err_t res = ESP_OK; uint8_t prev_data = 0, data = 0; - es_read_reg (ES8388_DACCONTROL21, &prev_data); - if (mode == ES_MODULE_LINE) - { - res |= es_write_reg ( - ES8388_ADDR, ES8388_DACCONTROL16, - 0x09); // 0x00 audio on LIN1&RIN1, 0x09 LIN2&RIN2 by pass enable - res |= es_write_reg ( - ES8388_ADDR, ES8388_DACCONTROL17, - 0x50); // left DAC to left mixer enable and LIN signal to left - // mixer enable 0db : bupass enable - res |= es_write_reg ( - ES8388_ADDR, ES8388_DACCONTROL20, - 0x50); // right DAC to right mixer enable and LIN signal to right - // mixer enable 0db : bupass enable - res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL21, - 0xC0); // enable adc - } - else - { - res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL21, - 0x80); // enable dac - } - es_read_reg (ES8388_DACCONTROL21, &data); - if (prev_data != data) - { - res |= es_write_reg (ES8388_ADDR, ES8388_CHIPPOWER, - 0xF0); // start state machine - // res |= es_write_reg(ES8388_ADDR, ES8388_CONTROL1, 0x16); - // res |= es_write_reg(ES8388_ADDR, ES8388_CONTROL2, 0x50); - res |= es_write_reg (ES8388_ADDR, ES8388_CHIPPOWER, - 0x00); // start state machine - } - if (mode == ES_MODULE_ADC || mode == ES_MODULE_ADC_DAC - || mode == ES_MODULE_LINE) - { - res |= es_write_reg (ES8388_ADDR, ES8388_ADCPOWER, - 0x00); // power up adc and line in - } - if (mode == ES_MODULE_DAC || mode == ES_MODULE_ADC_DAC - || mode == ES_MODULE_LINE) - { - res |= es_write_reg (ES8388_ADDR, ES8388_DACPOWER, - 0x3c); // power up dac and line out - res |= es8388_set_voice_mute (false); - ESP_LOGD (ES_TAG, "es8388_start default is mode:%d", mode); - } + es_read_reg(ES8388_DACCONTROL21, &prev_data); + if (mode == ES_MODULE_LINE) { + res |= es_write_reg( + ES8388_ADDR, ES8388_DACCONTROL16, + 0x09); // 0x00 audio on LIN1&RIN1, 0x09 LIN2&RIN2 by pass enable + res |= + es_write_reg(ES8388_ADDR, ES8388_DACCONTROL17, + 0x50); // left DAC to left mixer enable and LIN signal + // to left mixer enable 0db : bupass enable + res |= + es_write_reg(ES8388_ADDR, ES8388_DACCONTROL20, + 0x50); // right DAC to right mixer enable and LIN signal + // to right mixer enable 0db : bupass enable + res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL21, 0xC0); // enable adc + } else { + res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL21, 0x80); // enable dac + } + es_read_reg(ES8388_DACCONTROL21, &data); + if (prev_data != data) { + res |= es_write_reg(ES8388_ADDR, ES8388_CHIPPOWER, + 0xF0); // start state machine + // res |= es_write_reg(ES8388_ADDR, ES8388_CONTROL1, 0x16); + // res |= es_write_reg(ES8388_ADDR, ES8388_CONTROL2, 0x50); + res |= es_write_reg(ES8388_ADDR, ES8388_CHIPPOWER, + 0x00); // start state machine + } + if (mode == ES_MODULE_ADC || mode == ES_MODULE_ADC_DAC || + mode == ES_MODULE_LINE) { + res |= es_write_reg(ES8388_ADDR, ES8388_ADCPOWER, + 0x00); // power up adc and line in + } + if (mode == ES_MODULE_DAC || mode == ES_MODULE_ADC_DAC || + mode == ES_MODULE_LINE) { + res |= es_write_reg(ES8388_ADDR, ES8388_DACPOWER, + 0x3c); // power up dac and line out + res |= es8388_set_voice_mute(false); + ESP_LOGD(ES_TAG, "es8388_start default is mode:%d", mode); + } return res; } @@ -220,45 +208,39 @@ es8388_start (es_module_t mode) * - (-1) Error * - (0) Success */ -esp_err_t -es8388_stop (es_module_t mode) -{ +esp_err_t es8388_stop(es_module_t mode) { esp_err_t res = ESP_OK; - if (mode == ES_MODULE_LINE) - { - res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL21, - 0x80); // enable dac - res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL16, - 0x00); // 0x00 audio on LIN1&RIN1, 0x09 LIN2&RIN2 - res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL17, - 0x90); // only left DAC to left mixer enable 0db - res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL20, - 0x90); // only right DAC to right mixer enable 0db - return res; - } - if (mode == ES_MODULE_DAC || mode == ES_MODULE_ADC_DAC) - { - res |= es_write_reg (ES8388_ADDR, ES8388_DACPOWER, 0x00); - res |= es8388_set_voice_mute ( - true); // res |= Es8388SetAdcDacVolume(ES_MODULE_DAC, -96, 5); // 0db - // res |= es_write_reg(ES8388_ADDR, ES8388_DACPOWER, 0xC0); //power down - // dac and line out - } - if (mode == ES_MODULE_ADC || mode == ES_MODULE_ADC_DAC) - { - // res |= Es8388SetAdcDacVolume(ES_MODULE_ADC, -96, 5); // 0db - res |= es_write_reg (ES8388_ADDR, ES8388_ADCPOWER, - 0xFF); // power down adc and line in - } - if (mode == ES_MODULE_ADC_DAC) - { - res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL21, - 0x9C); // disable mclk - // res |= es_write_reg(ES8388_ADDR, ES8388_CONTROL1, 0x00); - // res |= es_write_reg(ES8388_ADDR, ES8388_CONTROL2, 0x58); - // res |= es_write_reg(ES8388_ADDR, ES8388_CHIPPOWER, 0xF3); - // //stop state machine - } + if (mode == ES_MODULE_LINE) { + res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL21, 0x80); // enable dac + res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL16, + 0x00); // 0x00 audio on LIN1&RIN1, 0x09 LIN2&RIN2 + res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL17, + 0x90); // only left DAC to left mixer enable 0db + res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL20, + 0x90); // only right DAC to right mixer enable 0db + return res; + } + if (mode == ES_MODULE_DAC || mode == ES_MODULE_ADC_DAC) { + res |= es_write_reg(ES8388_ADDR, ES8388_DACPOWER, 0x00); + res |= es8388_set_voice_mute( + true); // res |= Es8388SetAdcDacVolume(ES_MODULE_DAC, -96, 5); // + // 0db + // res |= es_write_reg(ES8388_ADDR, ES8388_DACPOWER, 0xC0); //power down + // dac and line out + } + if (mode == ES_MODULE_ADC || mode == ES_MODULE_ADC_DAC) { + // res |= Es8388SetAdcDacVolume(ES_MODULE_ADC, -96, 5); // 0db + res |= es_write_reg(ES8388_ADDR, ES8388_ADCPOWER, + 0xFF); // power down adc and line in + } + if (mode == ES_MODULE_ADC_DAC) { + res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL21, 0x9C); // disable + // mclk + // res |= es_write_reg(ES8388_ADDR, ES8388_CONTROL1, 0x00); + // res |= es_write_reg(ES8388_ADDR, ES8388_CONTROL2, 0x58); + // res |= es_write_reg(ES8388_ADDR, ES8388_CHIPPOWER, 0xF3); //stop + // state machine + } return res; } @@ -273,29 +255,31 @@ es8388_stop (es_module_t mode) * - (-1) Error * - (0) Success */ -esp_err_t -es8388_i2s_config_clock (es_i2s_clock_t cfg) -{ +esp_err_t es8388_i2s_config_clock(es_i2s_clock_t cfg) { esp_err_t res = ESP_OK; - res |= es_write_reg (ES8388_ADDR, ES8388_MASTERMODE, cfg.sclk_div); - res |= es_write_reg (ES8388_ADDR, ES8388_ADCCONTROL5, - cfg.lclk_div); // ADCFsMode,singel SPEED,RATIO=256 - res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL2, - cfg.lclk_div); // ADCFsMode,singel SPEED,RATIO=256 + res |= es_write_reg(ES8388_ADDR, ES8388_MASTERMODE, cfg.sclk_div); + res |= es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL5, + cfg.lclk_div); // ADCFsMode,singel SPEED,RATIO=256 + res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL2, + cfg.lclk_div); // ADCFsMode,singel SPEED,RATIO=256 return res; } -esp_err_t -es8388_deinit (void) -{ +esp_err_t es8388_deinit(void) { int res = 0; - res = es_write_reg (ES8388_ADDR, ES8388_CHIPPOWER, - 0xFF); // reset and stop es8388 - i2c_bus_delete (i2c_handle); -#if defined(CONFIG_ESP_LYRAT_V4_3_BOARD) || defined(CONFIG_ESP_AI_THINKER_ES8388_BOARD) - headphone_detect_deinit (); + + res = es_write_reg(ES8388_ADDR, ES8388_CHIPPOWER, + 0xFF); // reset and stop es8388 + i2c_bus_delete(i2c_handle); +#if defined(CONFIG_ESP_LYRAT_V4_3_BOARD) || \ + defined(CONFIG_ESP_AI_THINKER_ES8388_BOARD) + headphone_detect_deinit(); + res = es_write_reg(ES8388_ADDR, ES8388_CHIPPOWER, + 0xFF); // reset and stop es8388 + i2c_bus_delete(i2c_handle); #endif + audio_codec_volume_deinit(dac_vol_handle); return res; } @@ -304,103 +288,112 @@ es8388_deinit (void) * - (-1) Error * - (0) Success */ -esp_err_t -es8388_init (audio_hal_codec_config_t *cfg) -{ +esp_err_t es8388_init(audio_hal_codec_config_t *cfg) { int res = 0; -#if defined(CONFIG_ESP_LYRAT_V4_3_BOARD) || defined(CONFIG_ESP_AI_THINKER_ES8388_BOARD) - headphone_detect_init (get_headphone_detect_gpio ()); + +#if defined(CONFIG_ESP_LYRAT_V4_3_BOARD) || \ + defined(CONFIG_ESP_AI_THINKER_ES8388_BOARD) + headphone_detect_init(get_headphone_detect_gpio()); #endif - res = i2c_init (); // ESP32 in master mode + res = i2c_init(); // ESP32 in master mode - res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL3, - 0x04); // 0x04 mute/0x00 unmute&ramp;DAC unmute and + res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL3, + 0x04); // 0x04 mute/0x00 unmute&ramp;DAC unmute and // disabled digital volume control soft ramp /* Chip Control and Power Management */ - res |= es_write_reg (ES8388_ADDR, ES8388_CONTROL2, 0x50); - res |= es_write_reg (ES8388_ADDR, ES8388_CHIPPOWER, - 0x00); // normal all and power up all - res |= es_write_reg (ES8388_ADDR, ES8388_MASTERMODE, - cfg->i2s_iface.mode); // CODEC IN I2S SLAVE MODE + res |= es_write_reg(ES8388_ADDR, ES8388_CONTROL2, 0x50); + res |= es_write_reg(ES8388_ADDR, ES8388_CHIPPOWER, + 0x00); // normal all and power up all + + // Disable the internal DLL to improve 8K sample rate + res |= es_write_reg(ES8388_ADDR, 0x35, 0xA0); + res |= es_write_reg(ES8388_ADDR, 0x37, 0xD0); + res |= es_write_reg(ES8388_ADDR, 0x39, 0xD0); + + res |= es_write_reg(ES8388_ADDR, ES8388_MASTERMODE, + cfg->i2s_iface.mode); // CODEC IN I2S SLAVE MODE /* dac */ - res |= es_write_reg (ES8388_ADDR, ES8388_DACPOWER, - 0xC0); // disable DAC and disable Lout/Rout/1/2 - res |= es_write_reg ( - ES8388_ADDR, ES8388_CONTROL1, - 0x12); // Enfr=0,Play&Record Mode,(0x17-both of mic&paly) + res |= es_write_reg(ES8388_ADDR, ES8388_DACPOWER, + 0xC0); // disable DAC and disable Lout/Rout/1/2 + res |= es_write_reg(ES8388_ADDR, ES8388_CONTROL1, + 0x12); // Enfr=0,Play&Record Mode,(0x17-both of mic&paly) // res |= es_write_reg(ES8388_ADDR, ES8388_CONTROL2, 0); // //LPVrefBuf=0,Pdn_ana=0 - res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL1, - 0x18); // 1a 0x18:16bit iis , 0x00:24 - res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL2, - 0x02); // DACFsMode,SINGLE SPEED; DACFsRatio,256 - res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL16, - 0x00); // 0x00 audio on LIN1&RIN1, 0x09 LIN2&RIN2 - res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL17, - 0x90); // only left DAC to left mixer enable 0db - res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL20, - 0x90); // only right DAC to right mixer enable 0db - res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL21, - 0x80); // set internal ADC and DAC use the same LRCK + res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL1, + 0x18); // 1a 0x18:16bit iis , 0x00:24 + res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL2, + 0x02); // DACFsMode,SINGLE SPEED; DACFsRatio,256 + res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL16, + 0x00); // 0x00 audio on LIN1&RIN1, 0x09 LIN2&RIN2 + res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL17, + 0x90); // only left DAC to left mixer enable 0db + res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL20, + 0x90); // only right DAC to right mixer enable 0db + res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL21, + 0x80); // set internal ADC and DAC use the same LRCK // clock, ADC LRCK as internal LRCK - res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL23, 0x00); // vroi=0 - res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL24, 0x1E); // Set L1 R1 L2 R2 volume. 0x00: -30dB, 0x1E: 0dB, 0x21: 3dB - res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL25, 0x1E); - res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL26, 0x1E); - res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL27, 0x1E); - res |= es8388_set_adc_dac_volume (ES_MODULE_DAC, 0, 0); // 0db + + res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL23, 0x00); // vroi=0 + res |= es_write_reg( + ES8388_ADDR, ES8388_DACCONTROL24, + 0x1E); // Set L1 R1 L2 R2 volume. 0x00: -30dB, 0x1E: 0dB, 0x21: 3dB + res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL25, 0x1E); + res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL26, 0x1E); + res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL27, 0x1E); + res |= es8388_set_adc_dac_volume(ES_MODULE_DAC, 0, 0); // 0db int tmp = 0; - if (AUDIO_HAL_DAC_OUTPUT_LINE2 == cfg->dac_output) - { - tmp = DAC_OUTPUT_LOUT1 | DAC_OUTPUT_ROUT1; - } - else if (AUDIO_HAL_DAC_OUTPUT_LINE1 == cfg->dac_output) - { - tmp = DAC_OUTPUT_LOUT2 | DAC_OUTPUT_ROUT2; - } - else - { - tmp = DAC_OUTPUT_LOUT1 | DAC_OUTPUT_LOUT2 | DAC_OUTPUT_ROUT1 - | DAC_OUTPUT_ROUT2; - } - res |= es_write_reg (ES8388_ADDR, ES8388_DACPOWER, - tmp); // 0x3c Enable DAC and Enable Lout/Rout/1/2 + if (AUDIO_HAL_DAC_OUTPUT_LINE2 == cfg->dac_output) { + tmp = DAC_OUTPUT_LOUT1 | DAC_OUTPUT_ROUT1; + } else if (AUDIO_HAL_DAC_OUTPUT_LINE1 == cfg->dac_output) { + tmp = DAC_OUTPUT_LOUT2 | DAC_OUTPUT_ROUT2; + } else { + tmp = DAC_OUTPUT_LOUT1 | DAC_OUTPUT_LOUT2 | DAC_OUTPUT_ROUT1 | + DAC_OUTPUT_ROUT2; + } + res |= es_write_reg(ES8388_ADDR, ES8388_DACPOWER, + tmp); // 0x3c Enable DAC and Enable Lout/Rout/1/2 /* adc */ - res |= es_write_reg (ES8388_ADDR, ES8388_ADCPOWER, 0xFF); - res |= es_write_reg (ES8388_ADDR, ES8388_ADCCONTROL1, - 0xbb); // MIC Left and Right channel PGA gain + res |= es_write_reg(ES8388_ADDR, ES8388_ADCPOWER, 0xFF); + res |= es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL1, + 0xbb); // MIC Left and Right channel PGA gain tmp = 0; - if (AUDIO_HAL_ADC_INPUT_LINE1 == cfg->adc_input) - { - tmp = ADC_INPUT_LINPUT1_RINPUT1; - } - else if (AUDIO_HAL_ADC_INPUT_LINE2 == cfg->adc_input) - { - tmp = ADC_INPUT_LINPUT2_RINPUT2; - } - else - { - tmp = ADC_INPUT_DIFFERENCE; - } - res |= es_write_reg (ES8388_ADDR, ES8388_ADCCONTROL2, - tmp); // 0x00 LINSEL & RINSEL, LIN1/RIN1 as ADC Input; + if (AUDIO_HAL_ADC_INPUT_LINE1 == cfg->adc_input) { + tmp = ADC_INPUT_LINPUT1_RINPUT1; + } else if (AUDIO_HAL_ADC_INPUT_LINE2 == cfg->adc_input) { + tmp = ADC_INPUT_LINPUT2_RINPUT2; + } else { + tmp = ADC_INPUT_DIFFERENCE; + } + res |= es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL2, + tmp); // 0x00 LINSEL & RINSEL, LIN1/RIN1 as ADC Input; // DSSEL,use one DS Reg11; DSR, LINPUT1-RINPUT1 - res |= es_write_reg (ES8388_ADDR, ES8388_ADCCONTROL3, 0x02); - res |= es_write_reg (ES8388_ADDR, ES8388_ADCCONTROL4, - 0x0d); // Left/Right data, Left/Right justified mode, - // Bits length, I2S format - res |= es_write_reg (ES8388_ADDR, ES8388_ADCCONTROL5, - 0x02); // ADCFsMode,singel SPEED,RATIO=256 + res |= es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL3, 0x02); + res |= es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL4, + 0x0c); // 16 Bits length and I2S serial audio data format + res |= es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL5, + 0x02); // ADCFsMode,singel SPEED,RATIO=256 // ALC for Microphone - res |= es8388_set_adc_dac_volume (ES_MODULE_ADC, 0, 0); // 0db - res |= es_write_reg (ES8388_ADDR, ES8388_ADCPOWER, - 0x09); // Power on ADC, Enable LIN&RIN, Power off - // MICBIAS, set int1lp to low power mode + res |= es8388_set_adc_dac_volume(ES_MODULE_ADC, 0, 0); // 0db + res |= es_write_reg(ES8388_ADDR, ES8388_ADCPOWER, + 0x09); // Power on ADC, enable LIN&RIN, power off + // MICBIAS, and set int1lp to low power mode + + /* es8388 PA gpio_config */ + gpio_config_t io_conf; + memset(&io_conf, 0, sizeof(io_conf)); + io_conf.mode = GPIO_MODE_OUTPUT; + io_conf.pin_bit_mask = BIT64(get_pa_enable_gpio()); + io_conf.pull_down_en = 0; + io_conf.pull_up_en = 0; + gpio_config(&io_conf); /* enable es8388 PA */ - es8388_pa_power (true); - ESP_LOGI (ES_TAG, "init,out:%02x, in:%02x", cfg->dac_output, cfg->adc_input); + es8388_pa_power(true); + + codec_dac_volume_config_t vol_cfg = ES8388_DAC_VOL_CFG_DEFAULT(); + dac_vol_handle = audio_codec_volume_init(&vol_cfg); + ESP_LOGI(ES_TAG, "init,out:%02x, in:%02x", cfg->dac_output, cfg->adc_input); return res; } @@ -414,41 +407,45 @@ es8388_init (audio_hal_codec_config_t *cfg) * - (-1) Error * - (0) Success */ -esp_err_t -es8388_config_fmt (es_module_t mode, es_i2s_fmt_t fmt) -{ +esp_err_t es8388_config_fmt(es_module_t mode, es_i2s_fmt_t fmt) { esp_err_t res = ESP_OK; uint8_t reg = 0; - if (mode == ES_MODULE_ADC || mode == ES_MODULE_ADC_DAC) - { - res = es_read_reg (ES8388_ADCCONTROL4, ®); - reg = reg & 0xfc; - res |= es_write_reg (ES8388_ADDR, ES8388_ADCCONTROL4, reg | fmt); - } - if (mode == ES_MODULE_DAC || mode == ES_MODULE_ADC_DAC) - { - res = es_read_reg (ES8388_DACCONTROL1, ®); - reg = reg & 0xf9; - res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL1, reg | (fmt << 1)); - } + if (mode == ES_MODULE_ADC || mode == ES_MODULE_ADC_DAC) { + res = es_read_reg(ES8388_ADCCONTROL4, ®); + reg = reg & 0xfc; + res |= es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL4, reg | fmt); + } + if (mode == ES_MODULE_DAC || mode == ES_MODULE_ADC_DAC) { + res = es_read_reg(ES8388_DACCONTROL1, ®); + reg = reg & 0xf9; + res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL1, reg | (fmt << 1)); + } return res; } /** - * @param volume: 0 ~ 100 + * @brief Set voice volume + * + * @note Register values. 0xC0: -96 dB, 0x64: -50 dB, 0x00: 0 dB + * @note Accuracy of gain is 0.5 dB + * + * @param volume: voice volume (0~100) * * @return - * - (-1) Error - * - (0) Success + * - ESP_OK + * - ESP_FAIL */ -esp_err_t -es8388_set_voice_volume (int volume) -{ +esp_err_t es8388_set_voice_volume(int volume) { esp_err_t res = ESP_OK; - if (volume < 0) - volume = 0; - else if (volume > 100) - volume = 100; + uint8_t reg = 0; + + reg = audio_codec_get_dac_reg_value(dac_vol_handle, volume); + res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL5, reg); + res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL4, reg); + ESP_LOGD(ES_TAG, "Set volume:%.2d reg_value:0x%.2x dB:%.1f", + (int)dac_vol_handle->user_volume, reg, + audio_codec_cal_dac_volume(dac_vol_handle)); + /* Audio Settings can be checked here: * https://dl.radxa.com/rock2/docs/hw/ds/ES8388%20user%20Guide.pdf * @@ -462,43 +459,46 @@ es8388_set_voice_volume (int volume) */ // restrict range from 0-46 instead of 0-192 - int inv_volume = -0.46 * volume + 46; - if (volume == 0) { - // if volume is 0, set to -96dB - inv_volume = 192; - } - res = es_write_reg (ES8388_ADDR, ES8388_DACCONTROL5, inv_volume); - res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL4, inv_volume); + // int inv_volume = -0.46 * volume + 46; + // if (volume == 0) { + // // if volume is 0, set to -96dB + // inv_volume = 192; + // } + // res = es_write_reg (ES8388_ADDR, ES8388_DACCONTROL5, inv_volume); + // res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL4, inv_volume); return res; } -/** - * - * @return - * volume - */ -esp_err_t -es8388_get_voice_volume (int *volume) -{ +esp_err_t es8388_get_voice_volume(int *volume) { esp_err_t res = ESP_OK; uint8_t reg = 0; - res = es_read_reg (ES8388_DACCONTROL4, ®); - if (res == ESP_FAIL) - { + + res = es_read_reg(ES8388_DACCONTROL4, ®); + if (res == ESP_FAIL) { + *volume = 0; + } else { + if (reg == dac_vol_handle->reg_value) { + *volume = dac_vol_handle->user_volume; + } else { *volume = 0; + res = ESP_FAIL; } - else - { - // 0 = 0dB, 192 = -96dB - // max is 0, min is 46 - // interpolate to 0-100 - if (reg == 192) { - *volume = 0; - } - else { - *volume = -(50/23) * reg + 100; - } - } + } + ESP_LOGD(ES_TAG, "Get volume:%.2d reg_value:0x%.2x", *volume, reg); + + // else + // { + // // 0 = 0dB, 192 = -96dB + // // max is 0, min is 46 + // // interpolate to 0-100 + // if (reg == 192) { + // *volume = 0; + // } + // else { + // *volume = -(50/23) * reg + 100; + // } + // } + return res; } @@ -512,25 +512,22 @@ es8388_get_voice_volume (int *volume) * - (-1) Parameter error * - (0) Success */ -esp_err_t -es8388_set_bits_per_sample (es_module_t mode, es_bits_length_t bits_length) -{ +esp_err_t es8388_set_bits_per_sample(es_module_t mode, + es_bits_length_t bits_length) { esp_err_t res = ESP_OK; uint8_t reg = 0; int bits = (int)bits_length; - if (mode == ES_MODULE_ADC || mode == ES_MODULE_ADC_DAC) - { - res = es_read_reg (ES8388_ADCCONTROL4, ®); - reg = reg & 0xe3; - res |= es_write_reg (ES8388_ADDR, ES8388_ADCCONTROL4, reg | (bits << 2)); - } - if (mode == ES_MODULE_DAC || mode == ES_MODULE_ADC_DAC) - { - res = es_read_reg (ES8388_DACCONTROL1, ®); - reg = reg & 0xc7; - res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL1, reg | (bits << 3)); - } + if (mode == ES_MODULE_ADC || mode == ES_MODULE_ADC_DAC) { + res = es_read_reg(ES8388_ADCCONTROL4, ®); + reg = reg & 0xe3; + res |= es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL4, reg | (bits << 2)); + } + if (mode == ES_MODULE_DAC || mode == ES_MODULE_ADC_DAC) { + res = es_read_reg(ES8388_DACCONTROL1, ®); + reg = reg & 0xc7; + res |= es_write_reg(ES8388_ADDR, ES8388_DACCONTROL1, reg | (bits << 3)); + } return res; } @@ -544,28 +541,23 @@ es8388_set_bits_per_sample (es_module_t mode, es_bits_length_t bits_length) * - (-1) Parameter error * - (0) Success */ -esp_err_t -es8388_set_voice_mute (bool enable) -{ +esp_err_t es8388_set_voice_mute(bool enable) { esp_err_t res = ESP_OK; uint8_t reg = 0; - res = es_read_reg (ES8388_DACCONTROL3, ®); + res = es_read_reg(ES8388_DACCONTROL3, ®); reg = reg & 0xFB; - res |= es_write_reg (ES8388_ADDR, ES8388_DACCONTROL3, - reg | (((int)enable) << 2)); + res |= + es_write_reg(ES8388_ADDR, ES8388_DACCONTROL3, reg | (((int)enable) << 2)); return res; } -esp_err_t -es8388_get_voice_mute (void) -{ +esp_err_t es8388_get_voice_mute(void) { esp_err_t res = ESP_OK; uint8_t reg = 0; - res = es_read_reg (ES8388_DACCONTROL3, ®); - if (res == ESP_OK) - { - reg = (reg & 0x04) >> 2; - } + res = es_read_reg(ES8388_DACCONTROL3, ®); + if (res == ESP_OK) { + reg = (reg & 0x04) >> 2; + } return res == ESP_OK ? reg : res; } @@ -576,14 +568,12 @@ es8388_get_voice_mute (void) * - (-1) Parameter error * - (0) Success */ -esp_err_t -es8388_config_dac_output (int output) -{ +esp_err_t es8388_config_dac_output(int output) { esp_err_t res; uint8_t reg = 0; - res = es_read_reg (ES8388_DACPOWER, ®); + res = es_read_reg(ES8388_DACPOWER, ®); reg = reg & 0xc3; - res |= es_write_reg (ES8388_ADDR, ES8388_DACPOWER, reg | output); + res |= es_write_reg(ES8388_ADDR, ES8388_DACPOWER, reg | output); return res; } @@ -594,14 +584,12 @@ es8388_config_dac_output (int output) * - (-1) Parameter error * - (0) Success */ -esp_err_t -es8388_config_adc_input (es_adc_input_t input) -{ +esp_err_t es8388_config_adc_input(es_adc_input_t input) { esp_err_t res; uint8_t reg = 0; - res = es_read_reg (ES8388_ADCCONTROL2, ®); + res = es_read_reg(ES8388_ADCCONTROL2, ®); reg = reg & 0x0f; - res |= es_write_reg (ES8388_ADDR, ES8388_ADCCONTROL2, reg | input); + res |= es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL2, reg | input); return res; } @@ -612,23 +600,19 @@ es8388_config_adc_input (es_adc_input_t input) * - (-1) Parameter error * - (0) Success */ -esp_err_t -es8388_set_mic_gain (es_mic_gain_t gain) -{ +esp_err_t es8388_set_mic_gain(es_mic_gain_t gain) { esp_err_t res, gain_n; gain_n = (int)gain / 3; gain_n = (gain_n << 4) + gain_n; - res = es_write_reg (ES8388_ADDR, ES8388_ADCCONTROL1, gain_n); // MIC PGA + res = es_write_reg(ES8388_ADDR, ES8388_ADCCONTROL1, gain_n); // MIC PGA return res; } -int -es8388_ctrl_state (audio_hal_codec_mode_t mode, audio_hal_ctrl_t ctrl_state) -{ +int es8388_ctrl_state(audio_hal_codec_mode_t mode, + audio_hal_ctrl_t ctrl_state) { int res = 0; int es_mode_t = 0; - switch (mode) - { + switch (mode) { case AUDIO_HAL_CODEC_MODE_ENCODE: es_mode_t = ES_MODULE_ADC; break; @@ -643,61 +627,40 @@ es8388_ctrl_state (audio_hal_codec_mode_t mode, audio_hal_ctrl_t ctrl_state) break; default: es_mode_t = ES_MODULE_DAC; - ESP_LOGW (ES_TAG, "Codec mode not support, default is decode mode"); + ESP_LOGW(ES_TAG, "Codec mode not support, default is decode mode"); break; - } - if (AUDIO_HAL_CTRL_STOP == ctrl_state) - { - res = es8388_stop (es_mode_t); - } - else - { - res = es8388_start (es_mode_t); - ESP_LOGD (ES_TAG, "start default is decode mode:%d", es_mode_t); - } + } + if (AUDIO_HAL_CTRL_STOP == ctrl_state) { + res = es8388_stop(es_mode_t); + } else { + res = es8388_start(es_mode_t); + ESP_LOGD(ES_TAG, "start default is decode mode:%d", es_mode_t); + } return res; } -esp_err_t -es8388_config_i2s (audio_hal_codec_mode_t mode, - audio_hal_codec_i2s_iface_t *iface) -{ +esp_err_t es8388_config_i2s(audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface) { esp_err_t res = ESP_OK; int tmp = 0; - res |= es8388_config_fmt (ES_MODULE_ADC_DAC, iface->fmt); - if (iface->bits == AUDIO_HAL_BIT_LENGTH_16BITS) - { - tmp = BIT_LENGTH_16BITS; - } - else if (iface->bits == AUDIO_HAL_BIT_LENGTH_24BITS) - { - tmp = BIT_LENGTH_24BITS; - } - else - { - tmp = BIT_LENGTH_32BITS; - } - res |= es8388_set_bits_per_sample (ES_MODULE_ADC_DAC, tmp); + res |= es8388_config_fmt(ES_MODULE_ADC_DAC, iface->fmt); + if (iface->bits == AUDIO_HAL_BIT_LENGTH_16BITS) { + tmp = BIT_LENGTH_16BITS; + } else if (iface->bits == AUDIO_HAL_BIT_LENGTH_24BITS) { + tmp = BIT_LENGTH_24BITS; + } else { + tmp = BIT_LENGTH_32BITS; + } + res |= es8388_set_bits_per_sample(ES_MODULE_ADC_DAC, tmp); return res; } -void -es8388_pa_power (bool enable) -{ - gpio_config_t io_conf; - memset (&io_conf, 0, sizeof (io_conf)); - io_conf.intr_type = GPIO_PIN_INTR_DISABLE; - io_conf.mode = GPIO_MODE_OUTPUT; - io_conf.pin_bit_mask = BIT64 (get_pa_enable_gpio ()); - io_conf.pull_down_en = 0; - io_conf.pull_up_en = 0; - gpio_config (&io_conf); - if (enable) - { - gpio_set_level (get_pa_enable_gpio (), 1); - } - else - { - gpio_set_level (get_pa_enable_gpio (), 0); - } +esp_err_t es8388_pa_power(bool enable) { + esp_err_t res = ESP_OK; + if (enable) { + res = gpio_set_level(get_pa_enable_gpio(), 1); + } else { + res = gpio_set_level(get_pa_enable_gpio(), 0); + } + return res; } diff --git a/components/audio_hal/driver/es8388/es8388.h b/components/audio_hal/driver/es8388/es8388.h index 1e9e0f10..eaaeb1f3 100644 --- a/components/audio_hal/driver/es8388/es8388.h +++ b/components/audio_hal/driver/es8388/es8388.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -33,8 +33,7 @@ #include "esxxx_common.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif /* ES8388 address */ @@ -102,218 +101,219 @@ extern "C" #define ES8388_DACCONTROL29 0x33 #define ES8388_DACCONTROL30 0x34 - /** - * @brief Initialize ES8388 codec chip - * - * @param cfg configuration of ES8388 - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es8388_init (audio_hal_codec_config_t *cfg); +/** + * @brief Initialize ES8388 codec chip + * + * @param cfg configuration of ES8388 + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8388_init(audio_hal_codec_config_t *cfg); - /** - * @brief Deinitialize ES8388 codec chip - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es8388_deinit (void); +/** + * @brief Deinitialize ES8388 codec chip + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8388_deinit(void); - /** - * @brief Configure ES8388 I2S format - * - * @param mod: set ADC or DAC or both - * @param cfg: ES8388 I2S format - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es8388_config_fmt (es_module_t mod, es_i2s_fmt_t cfg); +/** + * @brief Configure ES8388 I2S format + * + * @param mod: set ADC or DAC or both + * @param cfg: ES8388 I2S format + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8388_config_fmt(es_module_t mod, es_i2s_fmt_t cfg); - /** - * @brief Configure I2s clock in MSATER mode - * - * @param cfg: set bits clock and WS clock - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es8388_i2s_config_clock (es_i2s_clock_t cfg); +/** + * @brief Configure I2s clock in MSATER mode + * + * @param cfg: set bits clock and WS clock + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8388_i2s_config_clock(es_i2s_clock_t cfg); - /** - * @brief Configure ES8388 data sample bits - * - * @param mode: set ADC or DAC or both - * @param bit_per_sample: bit number of per sample - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es8388_set_bits_per_sample (es_module_t mode, - es_bits_length_t bit_per_sample); +/** + * @brief Configure ES8388 data sample bits + * + * @param mode: set ADC or DAC or both + * @param bit_per_sample: bit number of per sample + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8388_set_bits_per_sample(es_module_t mode, + es_bits_length_t bit_per_sample); - /** - * @brief Start ES8388 codec chip - * - * @param mode: set ADC or DAC or both - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es8388_start (es_module_t mode); +/** + * @brief Start ES8388 codec chip + * + * @param mode: set ADC or DAC or both + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8388_start(es_module_t mode); - /** - * @brief Stop ES8388 codec chip - * - * @param mode: set ADC or DAC or both - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es8388_stop (es_module_t mode); +/** + * @brief Stop ES8388 codec chip + * + * @param mode: set ADC or DAC or both + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8388_stop(es_module_t mode); - /** - * @brief Set voice volume - * - * @param volume: voice volume (0~100) - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es8388_set_voice_volume (int volume); +/** + * @brief Set voice volume + * + * @param volume: voice volume (0~100) + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8388_set_voice_volume(int volume); - /** - * @brief Get voice volume - * - * @param[out] *volume: voice volume (0~100) - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t es8388_get_voice_volume (int *volume); +/** + * @brief Get voice volume + * + * @param[out] *volume: voice volume (0~100) + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t es8388_get_voice_volume(int *volume); - /** - * @brief Configure ES8388 DAC mute or not. Basically you can use this - * function to mute the output or unmute - * - * @param enable enable(1) or disable(0) - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t es8388_set_voice_mute (bool enable); +/** + * @brief Configure ES8388 DAC mute or not. Basically you can use this function + * to mute the output or unmute + * + * @param enable enable(1) or disable(0) + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es8388_set_voice_mute(bool enable); - /** - * @brief Get ES8388 DAC mute status - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t es8388_get_voice_mute (void); +/** + * @brief Get ES8388 DAC mute status + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es8388_get_voice_mute(void); - /** - * @brief Set ES8388 mic gain - * - * @param gain db of mic gain - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t es8388_set_mic_gain (es_mic_gain_t gain); +/** + * @brief Set ES8388 mic gain + * + * @param gain db of mic gain + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es8388_set_mic_gain(es_mic_gain_t gain); - /** - * @brief Set ES8388 adc input mode - * - * @param input adc input mode - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t es8388_config_adc_input (es_adc_input_t input); +/** + * @brief Set ES8388 adc input mode + * + * @param input adc input mode + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es8388_config_adc_input(es_adc_input_t input); - /** - * @brief Set ES8388 dac output mode - * - * @param output dac output mode - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t es8388_config_dac_output (es_dac_output_t output); +/** + * @brief Set ES8388 dac output mode + * + * @param output dac output mode + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es8388_config_dac_output(es_dac_output_t output); - /** - * @brief Write ES8388 register - * - * @param reg_add address of register - * @param data data of register - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t es8388_write_reg (uint8_t reg_add, uint8_t data); +/** + * @brief Write ES8388 register + * + * @param reg_add address of register + * @param data data of register + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es8388_write_reg(uint8_t reg_add, uint8_t data); - /** - * @brief Print all ES8388 registers - * - * @return - * - void - */ - void es8388_read_all (); +/** + * @brief Print all ES8388 registers + * + * @return + * - void + */ +void es8388_read_all(); - /** - * @brief Configure ES8388 codec mode and I2S interface - * - * @param mode codec mode - * @param iface I2S config - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t es8388_config_i2s (audio_hal_codec_mode_t mode, - audio_hal_codec_i2s_iface_t *iface); +/** + * @brief Configure ES8388 codec mode and I2S interface + * + * @param mode codec mode + * @param iface I2S config + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es8388_config_i2s(audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface); - /** - * @brief Control ES8388 codec chip - * - * @param mode codec mode - * @param ctrl_state start or stop decode or encode progress - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t es8388_ctrl_state (audio_hal_codec_mode_t mode, - audio_hal_ctrl_t ctrl_state); +/** + * @brief Control ES8388 codec chip + * + * @param mode codec mode + * @param ctrl_state start or stop decode or encode progress + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t es8388_ctrl_state(audio_hal_codec_mode_t mode, + audio_hal_ctrl_t ctrl_state); - /** - * @brief Set ES8388 PA power - * - * @param enable true for enable PA power, false for disable PA power - * - * @return - * - void - */ - void es8388_pa_power (bool enable); +/** + * @brief Set ES8388 PA power + * + * @param enable true for enable PA power, false for disable PA power + * + * @return + * - ESP_ERR_INVALID_ARG + * - ESP_OK + */ +esp_err_t es8388_pa_power(bool enable); #ifdef __cplusplus } #endif -#endif //__ES8388_H__ +#endif //__ES8388_H__ diff --git a/components/audio_hal/driver/es8388/headphone_detect.c b/components/audio_hal/driver/es8388/headphone_detect.c index f97927bf..3490fcea 100644 --- a/components/audio_hal/driver/es8388/headphone_detect.c +++ b/components/audio_hal/driver/es8388/headphone_detect.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -40,71 +40,56 @@ #define HP_DELAY_TIME_MS 1000 -static char *TAG = "HEADPHONE"; +static const char *TAG = "HEADPHONE"; static xTimerHandle timer_headphone; -static void -hp_timer_cb (TimerHandle_t xTimer) -{ - int num = (int)pvTimerGetTimerID (xTimer); - int res = gpio_get_level (num); - es8388_pa_power (res); - ESP_LOGW (TAG, "Headphone jack %s", res ? "removed" : "inserted"); +static void hp_timer_cb(TimerHandle_t xTimer) { + int num = (int)pvTimerGetTimerID(xTimer); + int res = gpio_get_level(num); + es8388_pa_power(res); } -static int -hp_timer_init (int num) -{ - timer_headphone - = xTimerCreate ("hp_timer0", HP_DELAY_TIME_MS / portTICK_RATE_MS, - pdFALSE, (void *)num, hp_timer_cb); - if (timer_headphone == NULL) - { - ESP_LOGE (TAG, "hp_timer create err"); - return ESP_FAIL; - } +static int hp_timer_init(int num) { + timer_headphone = + xTimerCreate("hp_timer0", HP_DELAY_TIME_MS / portTICK_RATE_MS, pdFALSE, + (void *)num, hp_timer_cb); + if (timer_headphone == NULL) { + ESP_LOGE(TAG, "hp_timer create err"); + return ESP_FAIL; + } return ESP_OK; } -static void IRAM_ATTR -headphone_gpio_intr_handler (void *arg) -{ +static void IRAM_ATTR headphone_gpio_intr_handler(void *arg) { BaseType_t xHigherPriorityTaskWoken = pdFALSE; - xTimerResetFromISR (timer_headphone, &xHigherPriorityTaskWoken); - if (xHigherPriorityTaskWoken != pdFALSE) - { - portYIELD_FROM_ISR (); - } + xTimerResetFromISR(timer_headphone, &xHigherPriorityTaskWoken); + if (xHigherPriorityTaskWoken != pdFALSE) { + portYIELD_FROM_ISR(); + } } -void -headphone_detect_deinit () -{ - xTimerDelete (timer_headphone, HP_DELAY_TIME_MS / portTICK_RATE_MS); - gpio_uninstall_isr_service (); +void headphone_detect_deinit() { + xTimerDelete(timer_headphone, HP_DELAY_TIME_MS / portTICK_RATE_MS); + gpio_uninstall_isr_service(); timer_headphone = NULL; } -int -headphone_status_get () -{ - return gpio_get_level (0); +int headphone_status_get() { + return gpio_get_level(get_headphone_detect_gpio()); } -void -headphone_detect_init (int num) -{ - hp_timer_init (num); +void headphone_detect_init(int num) { + hp_timer_init(num); gpio_config_t io_conf; - memset (&io_conf, 0, sizeof (io_conf)); + memset(&io_conf, 0, sizeof(io_conf)); io_conf.intr_type = GPIO_INTR_ANYEDGE; io_conf.mode = GPIO_MODE_INPUT; - io_conf.pin_bit_mask = BIT64 (num); + io_conf.pin_bit_mask = BIT64(num); io_conf.pull_down_en = 0; io_conf.pull_up_en = 1; - gpio_config (&io_conf); + gpio_config(&io_conf); - gpio_install_isr_service (0); - gpio_isr_handler_add (num, headphone_gpio_intr_handler, (void *)num); + gpio_install_isr_service(0); + gpio_isr_handler_add(num, headphone_gpio_intr_handler, (void *)num); } #endif /* defined(CONFIG_ESP_LYRAT_V4_3_BOARD) || defined(CONFIG_ESP_AI_THINKER_ES8388_BOARD) */ diff --git a/components/audio_hal/driver/es8388/headphone_detect.h b/components/audio_hal/driver/es8388/headphone_detect.h index 7bbaa0e9..4ca41616 100644 --- a/components/audio_hal/driver/es8388/headphone_detect.h +++ b/components/audio_hal/driver/es8388/headphone_detect.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,46 +18,45 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ -#ifndef _AUDIO_HEADPHONE_DETEC_H_ -#define _AUDIO_HEADPHONE_DETEC_H_ +#ifndef _AUDIO_HEADPHONE_DETECT_H_ +#define _AUDIO_HEADPHONE_DETECT_H_ #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - /** - * @brief Get headphone insertion status - * - * @param None. - * - * @return int, 0:headphone inserted, 1:headphone not inserted. - */ - int headphone_status_get (); +/** + * @brief Get headphone insertion status + * + * @param None. + * + * @return int, 0:headphone inserted, 1:headphone not inserted. + */ +int headphone_status_get(); - /** - * @brief Initialize headphone detect gpio. - * - * @param None. - * - * @return None. - */ - void headphone_detect_init (int num); +/** + * @brief Initialize headphone detect gpio. + * + * @param None. + * + * @return None. + */ +void headphone_detect_init(int num); - /** - * @brief Delete headphone detect timer. - * - * @param None. - * - * @return None. - */ - void headphone_detect_deinit (); +/** + * @brief Delete headphone detect timer. + * + * @param None. + * + * @return None. + */ +void headphone_detect_deinit(); #ifdef __cplusplus } diff --git a/components/audio_hal/driver/include/esxxx_common.h b/components/audio_hal/driver/include/esxxx_common.h index 5b84e857..badf6178 100644 --- a/components/audio_hal/driver/include/esxxx_common.h +++ b/components/audio_hal/driver/include/esxxx_common.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -28,172 +28,160 @@ #define _ESXXX_COMMON_H_ #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - typedef enum - { - BIT_LENGTH_MIN = -1, - BIT_LENGTH_16BITS = 0x03, - BIT_LENGTH_18BITS = 0x02, - BIT_LENGTH_20BITS = 0x01, - BIT_LENGTH_24BITS = 0x00, - BIT_LENGTH_32BITS = 0x04, - BIT_LENGTH_MAX, - } es_bits_length_t; - - typedef enum - { - MCLK_DIV_MIN = -1, - MCLK_DIV_1 = 1, - MCLK_DIV_2 = 2, - MCLK_DIV_3 = 3, - MCLK_DIV_4 = 4, - MCLK_DIV_6 = 5, - MCLK_DIV_8 = 6, - MCLK_DIV_9 = 7, - MCLK_DIV_11 = 8, - MCLK_DIV_12 = 9, - MCLK_DIV_16 = 10, - MCLK_DIV_18 = 11, - MCLK_DIV_22 = 12, - MCLK_DIV_24 = 13, - MCLK_DIV_33 = 14, - MCLK_DIV_36 = 15, - MCLK_DIV_44 = 16, - MCLK_DIV_48 = 17, - MCLK_DIV_66 = 18, - MCLK_DIV_72 = 19, - MCLK_DIV_5 = 20, - MCLK_DIV_10 = 21, - MCLK_DIV_15 = 22, - MCLK_DIV_17 = 23, - MCLK_DIV_20 = 24, - MCLK_DIV_25 = 25, - MCLK_DIV_30 = 26, - MCLK_DIV_32 = 27, - MCLK_DIV_34 = 28, - MCLK_DIV_7 = 29, - MCLK_DIV_13 = 30, - MCLK_DIV_14 = 31, - MCLK_DIV_MAX, - } es_sclk_div_t; - - typedef enum - { - LCLK_DIV_MIN = -1, - LCLK_DIV_128 = 0, - LCLK_DIV_192 = 1, - LCLK_DIV_256 = 2, - LCLK_DIV_384 = 3, - LCLK_DIV_512 = 4, - LCLK_DIV_576 = 5, - LCLK_DIV_768 = 6, - LCLK_DIV_1024 = 7, - LCLK_DIV_1152 = 8, - LCLK_DIV_1408 = 9, - LCLK_DIV_1536 = 10, - LCLK_DIV_2112 = 11, - LCLK_DIV_2304 = 12, - - LCLK_DIV_125 = 16, - LCLK_DIV_136 = 17, - LCLK_DIV_250 = 18, - LCLK_DIV_272 = 19, - LCLK_DIV_375 = 20, - LCLK_DIV_500 = 21, - LCLK_DIV_544 = 22, - LCLK_DIV_750 = 23, - LCLK_DIV_1000 = 24, - LCLK_DIV_1088 = 25, - LCLK_DIV_1496 = 26, - LCLK_DIV_1500 = 27, - LCLK_DIV_MAX, - } es_lclk_div_t; - - typedef enum - { - D2SE_PGA_GAIN_MIN = -1, - D2SE_PGA_GAIN_DIS = 0, - D2SE_PGA_GAIN_EN = 1, - D2SE_PGA_GAIN_MAX = 2, - } es_d2se_pga_t; - - typedef enum - { - ADC_INPUT_MIN = -1, - ADC_INPUT_LINPUT1_RINPUT1 = 0x00, - ADC_INPUT_MIC1 = 0x05, - ADC_INPUT_MIC2 = 0x06, - ADC_INPUT_LINPUT2_RINPUT2 = 0x50, - ADC_INPUT_DIFFERENCE = 0xf0, - ADC_INPUT_MAX, - } es_adc_input_t; - - typedef enum - { - DAC_OUTPUT_MIN = -1, - DAC_OUTPUT_LOUT1 = 0x04, - DAC_OUTPUT_LOUT2 = 0x08, - DAC_OUTPUT_SPK = 0x09, - DAC_OUTPUT_ROUT1 = 0x10, - DAC_OUTPUT_ROUT2 = 0x20, - DAC_OUTPUT_ALL = 0x3c, - DAC_OUTPUT_MAX, - } es_dac_output_t; - - typedef enum - { - MIC_GAIN_MIN = -1, - MIC_GAIN_0DB = 0, - MIC_GAIN_3DB = 3, - MIC_GAIN_6DB = 6, - MIC_GAIN_9DB = 9, - MIC_GAIN_12DB = 12, - MIC_GAIN_15DB = 15, - MIC_GAIN_18DB = 18, - MIC_GAIN_21DB = 21, - MIC_GAIN_24DB = 24, - MIC_GAIN_MAX, - } es_mic_gain_t; - - typedef enum - { - ES_MODULE_MIN = -1, - ES_MODULE_ADC = 0x01, - ES_MODULE_DAC = 0x02, - ES_MODULE_ADC_DAC = 0x03, - ES_MODULE_LINE = 0x04, - ES_MODULE_MAX - } es_module_t; - - typedef enum - { - ES_MODE_MIN = -1, - ES_MODE_SLAVE = 0x00, - ES_MODE_MASTER = 0x01, - ES_MODE_MAX, - } es_mode_t; - - typedef enum - { - ES_I2S_MIN = -1, - ES_I2S_NORMAL = 0, - ES_I2S_LEFT = 1, - ES_I2S_RIGHT = 2, - ES_I2S_DSP = 3, - ES_I2S_MAX - } es_i2s_fmt_t; - - /** - * @brief Configure ES8388 clock - */ - typedef struct - { - es_sclk_div_t sclk_div; /*!< bits clock divide */ - es_lclk_div_t lclk_div; /*!< WS clock divide */ - } es_i2s_clock_t; +typedef enum { + BIT_LENGTH_MIN = -1, + BIT_LENGTH_16BITS = 0x03, + BIT_LENGTH_18BITS = 0x02, + BIT_LENGTH_20BITS = 0x01, + BIT_LENGTH_24BITS = 0x00, + BIT_LENGTH_32BITS = 0x04, + BIT_LENGTH_MAX, +} es_bits_length_t; + +typedef enum { + MCLK_DIV_MIN = -1, + MCLK_DIV_1 = 1, + MCLK_DIV_2 = 2, + MCLK_DIV_3 = 3, + MCLK_DIV_4 = 4, + MCLK_DIV_6 = 5, + MCLK_DIV_8 = 6, + MCLK_DIV_9 = 7, + MCLK_DIV_11 = 8, + MCLK_DIV_12 = 9, + MCLK_DIV_16 = 10, + MCLK_DIV_18 = 11, + MCLK_DIV_22 = 12, + MCLK_DIV_24 = 13, + MCLK_DIV_33 = 14, + MCLK_DIV_36 = 15, + MCLK_DIV_44 = 16, + MCLK_DIV_48 = 17, + MCLK_DIV_66 = 18, + MCLK_DIV_72 = 19, + MCLK_DIV_5 = 20, + MCLK_DIV_10 = 21, + MCLK_DIV_15 = 22, + MCLK_DIV_17 = 23, + MCLK_DIV_20 = 24, + MCLK_DIV_25 = 25, + MCLK_DIV_30 = 26, + MCLK_DIV_32 = 27, + MCLK_DIV_34 = 28, + MCLK_DIV_7 = 29, + MCLK_DIV_13 = 30, + MCLK_DIV_14 = 31, + MCLK_DIV_MAX, +} es_sclk_div_t; + +typedef enum { + LCLK_DIV_MIN = -1, + LCLK_DIV_128 = 0, + LCLK_DIV_192 = 1, + LCLK_DIV_256 = 2, + LCLK_DIV_384 = 3, + LCLK_DIV_512 = 4, + LCLK_DIV_576 = 5, + LCLK_DIV_768 = 6, + LCLK_DIV_1024 = 7, + LCLK_DIV_1152 = 8, + LCLK_DIV_1408 = 9, + LCLK_DIV_1536 = 10, + LCLK_DIV_2112 = 11, + LCLK_DIV_2304 = 12, + + LCLK_DIV_125 = 16, + LCLK_DIV_136 = 17, + LCLK_DIV_250 = 18, + LCLK_DIV_272 = 19, + LCLK_DIV_375 = 20, + LCLK_DIV_500 = 21, + LCLK_DIV_544 = 22, + LCLK_DIV_750 = 23, + LCLK_DIV_1000 = 24, + LCLK_DIV_1088 = 25, + LCLK_DIV_1496 = 26, + LCLK_DIV_1500 = 27, + LCLK_DIV_MAX, +} es_lclk_div_t; + +typedef enum { + D2SE_PGA_GAIN_MIN = -1, + D2SE_PGA_GAIN_DIS = 0, + D2SE_PGA_GAIN_EN = 1, + D2SE_PGA_GAIN_MAX = 2, +} es_d2se_pga_t; + +typedef enum { + ADC_INPUT_MIN = -1, + ADC_INPUT_LINPUT1_RINPUT1 = 0x00, + ADC_INPUT_MIC1 = 0x05, + ADC_INPUT_MIC2 = 0x06, + ADC_INPUT_LINPUT2_RINPUT2 = 0x50, + ADC_INPUT_DIFFERENCE = 0xf0, + ADC_INPUT_MAX, +} es_adc_input_t; + +typedef enum { + DAC_OUTPUT_MIN = -1, + DAC_OUTPUT_LOUT1 = 0x04, + DAC_OUTPUT_LOUT2 = 0x08, + DAC_OUTPUT_SPK = 0x09, + DAC_OUTPUT_ROUT1 = 0x10, + DAC_OUTPUT_ROUT2 = 0x20, + DAC_OUTPUT_ALL = 0x3c, + DAC_OUTPUT_MAX, +} es_dac_output_t; + +typedef enum { + MIC_GAIN_MIN = -1, + MIC_GAIN_0DB = 0, + MIC_GAIN_3DB = 3, + MIC_GAIN_6DB = 6, + MIC_GAIN_9DB = 9, + MIC_GAIN_12DB = 12, + MIC_GAIN_15DB = 15, + MIC_GAIN_18DB = 18, + MIC_GAIN_21DB = 21, + MIC_GAIN_24DB = 24, + MIC_GAIN_MAX, +} es_mic_gain_t; + +typedef enum { + ES_MODULE_MIN = -1, + ES_MODULE_ADC = 0x01, + ES_MODULE_DAC = 0x02, + ES_MODULE_ADC_DAC = 0x03, + ES_MODULE_LINE = 0x04, + ES_MODULE_MAX +} es_module_t; + +typedef enum { + ES_MODE_MIN = -1, + ES_MODE_SLAVE = 0x00, + ES_MODE_MASTER = 0x01, + ES_MODE_MAX, +} es_mode_t; + +typedef enum { + ES_I2S_MIN = -1, + ES_I2S_NORMAL = 0, + ES_I2S_LEFT = 1, + ES_I2S_RIGHT = 2, + ES_I2S_DSP = 3, + ES_I2S_MAX +} es_i2s_fmt_t; + +/** + * @brief Configure ES8388 clock + */ +typedef struct { + es_sclk_div_t sclk_div; /*!< bits clock divide */ + es_lclk_div_t lclk_div; /*!< WS clock divide */ +} es_i2s_clock_t; #ifdef __cplusplus } diff --git a/components/audio_hal/driver/tas5805m/tas5805m.c b/components/audio_hal/driver/tas5805m/tas5805m.c index 0e7ee7e8..80593134 100644 --- a/components/audio_hal/driver/tas5805m/tas5805m.c +++ b/components/audio_hal/driver/tas5805m/tas5805m.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,13 +18,15 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "tas5805m.h" + +#include "audio_volume.h" #include "board.h" #include "esp_log.h" #include "i2c_bus.h" @@ -33,212 +35,205 @@ static const char *TAG = "TAS5805M"; #define TAS5805M_ADDR 0x5c -#define TAS5805M_RST_GPIO get_pa_enable_gpio () -#define TAS5805M_VOLUME_MAX 100 -#define TAS5805M_VOLUME_MIN 0 - -#define TAS5805M_ASSERT(a, format, b, ...) \ - if ((a) != 0) \ - { \ - ESP_LOGE (TAG, format, ##__VA_ARGS__); \ - return b; \ - } +#define TAS5805M_RST_GPIO get_pa_enable_gpio() + +#define TAS5805M_ASSERT(a, format, b, ...) \ + if ((a) != 0) { \ + ESP_LOGE(TAG, format, ##__VA_ARGS__); \ + return b; \ + } -esp_err_t tas5805m_ctrl (audio_hal_codec_mode_t mode, - audio_hal_ctrl_t ctrl_state); -esp_err_t tas5805m_conig_iface (audio_hal_codec_mode_t mode, +esp_err_t tas5805m_ctrl(audio_hal_codec_mode_t mode, + audio_hal_ctrl_t ctrl_state); +esp_err_t tas5805m_config_iface(audio_hal_codec_mode_t mode, audio_hal_codec_i2s_iface_t *iface); + static i2c_bus_handle_t i2c_handler; +static codec_dac_volume_config_t *dac_vol_handle; + +#define TAS5805M_DAC_VOL_CFG_DEFAULT() \ + { \ + .max_dac_volume = 24, .min_dac_volume = -103, \ + .board_pa_gain = BOARD_PA_GAIN, .volume_accuracy = 0.5, \ + .dac_vol_symbol = -1, .zero_volume_reg = 0x30, .reg_value = 0, \ + .user_volume = 0, .offset_conv_volume = NULL, \ + } /* * i2c default configuration */ static i2c_config_t i2c_cfg = { - .mode = I2C_MODE_MASTER, - .sda_pullup_en = GPIO_PULLUP_ENABLE, - .scl_pullup_en = GPIO_PULLUP_ENABLE, - .master.clk_speed = 100000, + .mode = I2C_MODE_MASTER, + .sda_pullup_en = GPIO_PULLUP_ENABLE, + .scl_pullup_en = GPIO_PULLUP_ENABLE, + .master.clk_speed = 100000, }; /* * Operate fuction of PA */ audio_hal_func_t AUDIO_CODEC_TAS5805M_DEFAULT_HANDLE = { - .audio_codec_initialize = tas5805m_init, - .audio_codec_deinitialize = tas5805m_deinit, - .audio_codec_ctrl = tas5805m_ctrl, - .audio_codec_config_iface = tas5805m_conig_iface, - .audio_codec_set_mute = tas5805m_set_mute, - .audio_codec_set_volume = tas5805m_set_volume, - .audio_codec_get_volume = tas5805m_get_volume, - .audio_hal_lock = NULL, - .handle = NULL, + .audio_codec_initialize = tas5805m_init, + .audio_codec_deinitialize = tas5805m_deinit, + .audio_codec_ctrl = tas5805m_ctrl, + .audio_codec_config_iface = tas5805m_config_iface, + .audio_codec_set_mute = tas5805m_set_mute, + .audio_codec_set_volume = tas5805m_set_volume, + .audio_codec_get_volume = tas5805m_get_volume, + .audio_codec_enable_pa = NULL, + .audio_hal_lock = NULL, + .handle = NULL, }; -static esp_err_t -tas5805m_transmit_registers (const tas5805m_cfg_reg_t *conf_buf, int size) -{ +static esp_err_t tas5805m_transmit_registers(const tas5805m_cfg_reg_t *conf_buf, + int size) { int i = 0; esp_err_t ret = ESP_OK; - while (i < size) - { - switch (conf_buf[i].offset) - { - case CFG_META_SWITCH: - // Used in legacy applications. Ignored here. - break; - case CFG_META_DELAY: - vTaskDelay (conf_buf[i].value / portTICK_RATE_MS); - break; - case CFG_META_BURST: - ret = i2c_bus_write_bytes ( - i2c_handler, TAS5805M_ADDR, - (unsigned char *)(&conf_buf[i + 1].offset), 1, - (unsigned char *)(&conf_buf[i + 1].value), conf_buf[i].value); - i += (conf_buf[i].value / 2) + 1; - break; - case CFG_END_1: - if (CFG_END_2 == conf_buf[i + 1].offset - && CFG_END_3 == conf_buf[i + 2].offset) - { - ESP_LOGI (TAG, "End of tms5805m reg: %d\n", i); - } - break; - default: - ret = i2c_bus_write_bytes (i2c_handler, TAS5805M_ADDR, - (unsigned char *)(&conf_buf[i].offset), 1, - (unsigned char *)(&conf_buf[i].value), 1); - break; + while (i < size) { + switch (conf_buf[i].offset) { + case CFG_META_SWITCH: + // Used in legacy applications. Ignored here. + break; + case CFG_META_DELAY: + vTaskDelay(conf_buf[i].value / portTICK_RATE_MS); + break; + case CFG_META_BURST: + ret = i2c_bus_write_bytes(i2c_handler, TAS5805M_ADDR, + (unsigned char *)(&conf_buf[i + 1].offset), 1, + (unsigned char *)(&conf_buf[i + 1].value), + conf_buf[i].value); + i += (conf_buf[i].value / 2) + 1; + break; + case CFG_END_1: + if (CFG_END_2 == conf_buf[i + 1].offset && + CFG_END_3 == conf_buf[i + 2].offset) { + ESP_LOGI(TAG, "End of tms5805m reg: %d\n", i); } - i++; - } - if (ret != ESP_OK) - { - ESP_LOGE (TAG, "Fail to load configuration to tas5805m"); - return ESP_FAIL; + break; + default: + ret = i2c_bus_write_bytes(i2c_handler, TAS5805M_ADDR, + (unsigned char *)(&conf_buf[i].offset), 1, + (unsigned char *)(&conf_buf[i].value), 1); + break; } - ESP_LOGI (TAG, "%s: write %d reg done", __FUNCTION__, i); + i++; + } + if (ret != ESP_OK) { + ESP_LOGE(TAG, "Fail to load configuration to tas5805m"); + return ESP_FAIL; + } + ESP_LOGI(TAG, "%s: write %d reg done", __FUNCTION__, i); return ret; } -esp_err_t -tas5805m_init (audio_hal_codec_config_t *codec_cfg) -{ +esp_err_t tas5805m_init(audio_hal_codec_config_t *codec_cfg) { esp_err_t ret = ESP_OK; - ESP_LOGI (TAG, "Power ON CODEC with GPIO %d", TAS5805M_RST_GPIO); + ESP_LOGI(TAG, "Power ON CODEC with GPIO %d", TAS5805M_RST_GPIO); gpio_config_t io_conf; - io_conf.pin_bit_mask = BIT64 (TAS5805M_RST_GPIO); + io_conf.pin_bit_mask = BIT64(TAS5805M_RST_GPIO); io_conf.mode = GPIO_MODE_OUTPUT; io_conf.intr_type = GPIO_INTR_DISABLE; - gpio_config (&io_conf); - gpio_set_level (TAS5805M_RST_GPIO, 0); - vTaskDelay (20 / portTICK_RATE_MS); - gpio_set_level (TAS5805M_RST_GPIO, 1); - vTaskDelay (200 / portTICK_RATE_MS); - - ret = get_i2c_pins (I2C_NUM_0, &i2c_cfg); - i2c_handler = i2c_bus_create (I2C_NUM_0, &i2c_cfg); - if (i2c_handler == NULL) - { - ESP_LOGW (TAG, "failed to create i2c bus handler\n"); - return ESP_FAIL; - } + gpio_config(&io_conf); + gpio_set_level(TAS5805M_RST_GPIO, 0); + vTaskDelay(20 / portTICK_RATE_MS); + gpio_set_level(TAS5805M_RST_GPIO, 1); + vTaskDelay(200 / portTICK_RATE_MS); - ret |= tas5805m_transmit_registers (tas5805m_registers, - sizeof (tas5805m_registers) - / sizeof (tas5805m_registers[0])); + ret = get_i2c_pins(I2C_NUM_0, &i2c_cfg); + i2c_handler = i2c_bus_create(I2C_NUM_0, &i2c_cfg); + if (i2c_handler == NULL) { + ESP_LOGW(TAG, "failed to create i2c bus handler\n"); + return ESP_FAIL; + } - TAS5805M_ASSERT (ret, "Fail to iniitialize tas5805m PA", ESP_FAIL); - return ret; -} + ret |= tas5805m_transmit_registers( + tas5805m_registers, + sizeof(tas5805m_registers) / sizeof(tas5805m_registers[0])); -esp_err_t -tas5805m_set_volume (int vol) -{ - int vol_idx = 0; + TAS5805M_ASSERT(ret, "Fail to iniitialize tas5805m PA", ESP_FAIL); - if (vol < TAS5805M_VOLUME_MIN) - { - vol = TAS5805M_VOLUME_MIN; - } - if (vol > TAS5805M_VOLUME_MAX) - { - vol = TAS5805M_VOLUME_MAX; - } - vol_idx = vol / 5; + codec_dac_volume_config_t vol_cfg = TAS5805M_DAC_VOL_CFG_DEFAULT(); + dac_vol_handle = audio_codec_volume_init(&vol_cfg); + return ret; +} - uint8_t cmd[2] = { 0, 0 }; +/** + * @brief Set voice volume + * + * @note Register values. 0xFE: -103 dB, 0x94: -50 dB, 0x30: 0 dB, 0x00: 24 dB + * @note Accuracy of gain is 0.5 dB + * + * @param volume: voice volume (0~100) + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t tas5805m_set_volume(int volume) { + uint8_t reg = 0; + uint8_t cmd[2] = {0, 0}; esp_err_t ret = ESP_OK; + reg = audio_codec_get_dac_reg_value(dac_vol_handle, volume); + cmd[0] = MASTER_VOL_REG_ADDR; - cmd[1] = tas5805m_volume[vol_idx]; - ret = i2c_bus_write_bytes (i2c_handler, TAS5805M_ADDR, &cmd[0], 1, &cmd[1], - 1); - ESP_LOGW (TAG, "volume = 0x%x", cmd[1]); + cmd[1] = reg; + + ret = i2c_bus_write_bytes(i2c_handler, TAS5805M_ADDR, &cmd[0], 1, &cmd[1], 1); + + ESP_LOGD(TAG, "Set volume:%.2d reg_value:0x%.2x dB:%.1f", + (int)dac_vol_handle->user_volume, reg, + audio_codec_cal_dac_volume(dac_vol_handle)); return ret; } -esp_err_t -tas5805m_get_volume (int *value) -{ +esp_err_t tas5805m_get_volume(int *volume) { /// FIXME: Got the digit volume is not right. - uint8_t cmd[2] = { MASTER_VOL_REG_ADDR, 0x00 }; - esp_err_t ret = i2c_bus_read_bytes (i2c_handler, TAS5805M_ADDR, &cmd[0], 1, - &cmd[1], 1); - TAS5805M_ASSERT (ret, "Fail to get volume", ESP_FAIL); - int i; - for (i = 0; i < sizeof (tas5805m_volume); i++) - { - if (cmd[1] >= tas5805m_volume[i]) - break; - } - ESP_LOGI (TAG, "Volume is %d", i * 5); - *value = 5 * i; + uint8_t cmd[2] = {MASTER_VOL_REG_ADDR, 0x00}; + esp_err_t ret = + i2c_bus_read_bytes(i2c_handler, TAS5805M_ADDR, &cmd[0], 1, &cmd[1], 1); + TAS5805M_ASSERT(ret, "Fail to get volume", ESP_FAIL); + if (cmd[1] == dac_vol_handle->reg_value) { + *volume = dac_vol_handle->user_volume; + } else { + *volume = 0; + ret = ESP_FAIL; + } + ESP_LOGD(TAG, "Get volume:%.2d reg_value:0x%.2x", *volume, cmd[1]); return ret; } -esp_err_t -tas5805m_set_mute (bool enable) -{ +esp_err_t tas5805m_set_mute(bool enable) { esp_err_t ret = ESP_OK; - uint8_t cmd[2] = { TAS5805M_REG_03, 0x00 }; - ret |= i2c_bus_read_bytes (i2c_handler, TAS5805M_ADDR, &cmd[0], 1, &cmd[1], - 1); + uint8_t cmd[2] = {TAS5805M_REG_03, 0x00}; + ret |= i2c_bus_read_bytes(i2c_handler, TAS5805M_ADDR, &cmd[0], 1, &cmd[1], 1); - if (enable) - { - cmd[1] |= 0x8; - } - else - { - cmd[1] &= (~0x08); - } - ret |= i2c_bus_write_bytes (i2c_handler, TAS5805M_ADDR, &cmd[0], 1, &cmd[1], - 1); + if (enable) { + cmd[1] |= 0x8; + } else { + cmd[1] &= (~0x08); + } + ret |= + i2c_bus_write_bytes(i2c_handler, TAS5805M_ADDR, &cmd[0], 1, &cmd[1], 1); - TAS5805M_ASSERT (ret, "Fail to set mute", ESP_FAIL); + TAS5805M_ASSERT(ret, "Fail to set mute", ESP_FAIL); return ret; } -esp_err_t -tas5805m_get_mute (int *value) -{ +esp_err_t tas5805m_get_mute(int *value) { esp_err_t ret = ESP_OK; - uint8_t cmd[2] = { TAS5805M_REG_03, 0x00 }; - ret |= i2c_bus_read_bytes (i2c_handler, TAS5805M_ADDR, &cmd[0], 1, &cmd[1], - 1); + uint8_t cmd[2] = {TAS5805M_REG_03, 0x00}; + ret |= i2c_bus_read_bytes(i2c_handler, TAS5805M_ADDR, &cmd[0], 1, &cmd[1], 1); - TAS5805M_ASSERT (ret, "Fail to get mute", ESP_FAIL); + TAS5805M_ASSERT(ret, "Fail to get mute", ESP_FAIL); *value = (cmd[1] & 0x08) >> 4; - ESP_LOGI (TAG, "Get mute value: 0x%x", *value); + ESP_LOGI(TAG, "Get mute value: 0x%x", *value); return ret; } -esp_err_t -tas5805m_set_mute_fade (int value) -{ +esp_err_t tas5805m_set_mute_fade(int value) { esp_err_t ret = 0; - unsigned char cmd[2] = { MUTE_TIME_REG_ADDR, 0x00 }; + unsigned char cmd[2] = {MUTE_TIME_REG_ADDR, 0x00}; /* Time for register value * 000: 11.5 ms * 001: 53 ms @@ -249,75 +244,55 @@ tas5805m_set_mute_fade (int value) * 110: 2.665 sec * 111: 5.33 sec */ - if (value <= 12) - { - cmd[1] = 0; - } - else if (value <= 53) - { - cmd[1] = 1; - } - else if (value <= 107) - { - cmd[1] = 2; - } - else if (value <= 267) - { - cmd[1] = 3; - } - else if (value <= 535) - { - cmd[1] = 4; - } - else if (value <= 1065) - { - cmd[1] = 5; - } - else if (value <= 2665) - { - cmd[1] = 6; - } - else - { - cmd[1] = 7; - } + if (value <= 12) { + cmd[1] = 0; + } else if (value <= 53) { + cmd[1] = 1; + } else if (value <= 107) { + cmd[1] = 2; + } else if (value <= 267) { + cmd[1] = 3; + } else if (value <= 535) { + cmd[1] = 4; + } else if (value <= 1065) { + cmd[1] = 5; + } else if (value <= 2665) { + cmd[1] = 6; + } else { + cmd[1] = 7; + } cmd[1] |= (cmd[1] << 4); - ret |= i2c_bus_write_bytes (i2c_handler, TAS5805M_ADDR, &cmd[0], 1, &cmd[1], - 1); - TAS5805M_ASSERT (ret, "Fail to set mute fade", ESP_FAIL); - ESP_LOGI (TAG, "Set mute fade, value:%d, 0x%x", value, cmd[1]); + ret |= + i2c_bus_write_bytes(i2c_handler, TAS5805M_ADDR, &cmd[0], 1, &cmd[1], 1); + TAS5805M_ASSERT(ret, "Fail to set mute fade", ESP_FAIL); + ESP_LOGI(TAG, "Set mute fade, value:%d, 0x%x", value, cmd[1]); return ret; } -esp_err_t -tas5805m_set_damp_mode (int value) -{ - unsigned char cmd[2] = { 0 }; +esp_err_t tas5805m_set_damp_mode(int value) { + unsigned char cmd[2] = {0}; cmd[0] = TAS5805M_REG_02; cmd[1] = 0x10 | value; - return i2c_bus_write_bytes (i2c_handler, TAS5805M_ADDR, &cmd[0], 1, &cmd[1], - 1); + return i2c_bus_write_bytes(i2c_handler, TAS5805M_ADDR, &cmd[0], 1, &cmd[1], + 1); } -esp_err_t -tas5805m_deinit (void) -{ +esp_err_t tas5805m_deinit(void) { // TODO + i2c_bus_delete(i2c_handler); + audio_codec_volume_deinit(dac_vol_handle); return ESP_OK; } -esp_err_t -tas5805m_ctrl (audio_hal_codec_mode_t mode, audio_hal_ctrl_t ctrl_state) -{ +esp_err_t tas5805m_ctrl(audio_hal_codec_mode_t mode, + audio_hal_ctrl_t ctrl_state) { // TODO return ESP_OK; } -esp_err_t -tas5805m_conig_iface (audio_hal_codec_mode_t mode, - audio_hal_codec_i2s_iface_t *iface) -{ +esp_err_t tas5805m_config_iface(audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface) { // TODO return ESP_OK; } diff --git a/components/audio_hal/driver/tas5805m/tas5805m.h b/components/audio_hal/driver/tas5805m/tas5805m.h index 249721e0..3a5ab394 100644 --- a/components/audio_hal/driver/tas5805m/tas5805m.h +++ b/components/audio_hal/driver/tas5805m/tas5805m.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -31,8 +31,7 @@ #include "esp_err.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif #define TAS5805M_REG_00 0x00 @@ -62,91 +61,91 @@ extern "C" #define TAS5805M_DAMP_MODE_BTL 0x0 #define TAS5805M_DAMP_MODE_PBTL 0x04 - /** - * @brief Initialize TAS5805 codec chip - * - * @param cfg configuration of TAS5805 - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t tas5805m_init (audio_hal_codec_config_t *codec_cfg); - - /** - * @brief Deinitialize TAS5805 codec chip - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t tas5805m_deinit (void); - - /** - * @brief Set voice volume - * - * @param volume: voice volume (0~100) - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t tas5805m_set_volume (int vol); - - /** - * @brief Get voice volume - * - * @param[out] *volume: voice volume (0~100) - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t tas5805m_get_volume (int *value); - - /** - * @brief Set TAS5805 mute or not - * Continuously call should have an interval time determined by - * tas5805m_set_mute_fade() - * - * @param enable enable(1) or disable(0) - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t tas5805m_set_mute (bool enable); - - /** - * @brief Mute gradually by (value)ms - * - * @param value Time for mute with millisecond. - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - * - */ - esp_err_t tas5805m_set_mute_fade (int value); - - /** - * @brief Get TAS5805 mute status - * - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - */ - esp_err_t tas5805m_get_mute (int *value); - - /** - * @brief Set DAMP mode - * - * @param value TAS5805M_DAMP_MODE_BTL or TAS5805M_DAMP_MODE_PBTL - * @return - * - ESP_FAIL Parameter error - * - ESP_OK Success - * - */ - esp_err_t tas5805m_set_damp_mode (int value); +/** + * @brief Initialize TAS5805 codec chip + * + * @param cfg configuration of TAS5805 + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t tas5805m_init(audio_hal_codec_config_t *codec_cfg); + +/** + * @brief Deinitialize TAS5805 codec chip + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t tas5805m_deinit(void); + +/** + * @brief Set voice volume + * + * @param volume: voice volume (0~100) + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t tas5805m_set_volume(int vol); + +/** + * @brief Get voice volume + * + * @param[out] *volume: voice volume (0~100) + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t tas5805m_get_volume(int *value); + +/** + * @brief Set TAS5805 mute or not + * Continuously call should have an interval time determined by + * tas5805m_set_mute_fade() + * + * @param enable enable(1) or disable(0) + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t tas5805m_set_mute(bool enable); + +/** + * @brief Mute gradually by (value)ms + * + * @param value Time for mute with millisecond. + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + * + */ +esp_err_t tas5805m_set_mute_fade(int value); + +/** + * @brief Get TAS5805 mute status + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t tas5805m_get_mute(int *value); + +/** + * @brief Set DAMP mode + * + * @param value TAS5805M_DAMP_MODE_BTL or TAS5805M_DAMP_MODE_PBTL + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + * + */ +esp_err_t tas5805m_set_damp_mode(int value); #ifdef __cplusplus } diff --git a/components/audio_hal/driver/tas5805m/tas5805m_reg_cfg.h b/components/audio_hal/driver/tas5805m/tas5805m_reg_cfg.h index aeedb3cd..dc8235c0 100644 --- a/components/audio_hal/driver/tas5805m/tas5805m_reg_cfg.h +++ b/components/audio_hal/driver/tas5805m/tas5805m_reg_cfg.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -28,8 +28,7 @@ #define _TAS5805M_REG_CFG_ #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif #define CFG_META_SWITCH (255) @@ -39,1708 +38,1707 @@ extern "C" #define CFG_END_2 (0Xcc) #define CFG_END_3 (0Xee) - typedef struct - { - uint8_t offset; - uint8_t value; - } tas5805m_cfg_reg_t; +typedef struct { + uint8_t offset; + uint8_t value; +} tas5805m_cfg_reg_t; - static const uint8_t tas5805m_volume[] - = { 0xff, 0x9f, 0x8f, 0x7f, 0x6f, 0x5f, 0x5c, 0x5a, 0x58, 0x54, 0x50, - 0x4c, 0x4a, 0x48, 0x44, 0x40, 0x3d, 0x3b, 0x39, 0x37, 0x35 }; +static const uint8_t tas5805m_volume[] = { + 0xff, 0x9f, 0x8f, 0x7f, 0x6f, 0x5f, 0x5c, 0x5a, 0x58, 0x54, 0x50, + 0x4c, 0x4a, 0x48, 0x44, 0x40, 0x3d, 0x3b, 0x39, 0x37, 0x35}; - static const tas5805m_cfg_reg_t tas5805m_registers[] = { +static const tas5805m_cfg_reg_t tas5805m_registers[] = { // RESET - { 0x00, 0x00 }, - { 0x7f, 0x00 }, - { 0x03, 0x02 }, - { 0x01, 0x11 }, - { 0x00, 0x00 }, - { 0x00, 0x00 }, - { 0x00, 0x00 }, - { 0x00, 0x00 }, - { 0x00, 0x00 }, - { 0x7f, 0x00 }, - { 0x03, 0x02 }, - { CFG_META_DELAY, 5 }, - { 0x00, 0x00 }, - { 0x7f, 0x00 }, - { 0x03, 0x00 }, - { 0x00, 0x00 }, - { 0x7f, 0x00 }, - { 0x46, 0x11 }, + {0x00, 0x00}, + {0x7f, 0x00}, + {0x03, 0x02}, + {0x01, 0x11}, + {0x00, 0x00}, + {0x00, 0x00}, + {0x00, 0x00}, + {0x00, 0x00}, + {0x00, 0x00}, + {0x7f, 0x00}, + {0x03, 0x02}, + {CFG_META_DELAY, 5}, + {0x00, 0x00}, + {0x7f, 0x00}, + {0x03, 0x00}, + {0x00, 0x00}, + {0x7f, 0x00}, + {0x46, 0x11}, - { 0x00, 0x00 }, - { 0x7f, 0x00 }, - { 0x03, 0x02 }, - { 0x00, 0x00 }, - { 0x7f, 0x00 }, - { 0x78, 0x80 }, + {0x00, 0x00}, + {0x7f, 0x00}, + {0x03, 0x02}, + {0x00, 0x00}, + {0x7f, 0x00}, + {0x78, 0x80}, - { 0x00, 0x00 }, - { 0x7f, 0x00 }, - { 0x61, 0x0b }, - { 0x60, 0x01 }, - { 0x7d, 0x11 }, - { 0x7e, 0xff }, - { 0x00, 0x01 }, - { 0x51, 0x05 }, + {0x00, 0x00}, + {0x7f, 0x00}, + {0x61, 0x0b}, + {0x60, 0x01}, + {0x7d, 0x11}, + {0x7e, 0xff}, + {0x00, 0x01}, + {0x51, 0x05}, - { 0x00, 0x00 }, + {0x00, 0x00}, #if CONFIG_ESP32_KORVO_DU1906_BOARD - { 0x02, 0x10 }, + {0x02, 0x10}, #else - { 0x02, 0x14 }, + {0x02, 0x14}, #endif - { 0x53, 0x00 }, - { 0x54, 0x13 }, - { 0x00, 0x00 }, - { 0x00, 0x00 }, - { 0x00, 0x00 }, - { 0x00, 0x00 }, + {0x53, 0x00}, + {0x54, 0x13}, + {0x00, 0x00}, + {0x00, 0x00}, + {0x00, 0x00}, + {0x00, 0x00}, - { 0x00, 0x00 }, - { 0x7f, 0x00 }, - { 0x66, 0x86 }, - { 0x7f, 0x8c }, - { 0x00, 0x29 }, - { 0x18, 0x00 }, - { 0x19, 0x40 }, - { 0x1a, 0x26 }, - { 0x1b, 0xe7 }, - { 0x1c, 0x00 }, - { 0x1d, 0x40 }, - { 0x1e, 0x26 }, - { 0x1f, 0xe7 }, - { 0x20, 0x00 }, - { 0x21, 0x00 }, - { 0x22, 0x00 }, - { 0x23, 0x00 }, - { 0x24, 0x00 }, - { 0x25, 0x00 }, - { 0x26, 0x00 }, - { 0x27, 0x00 }, - { 0x00, 0x2a }, - { 0x24, 0x00 }, - { 0x25, 0x65 }, - { 0x26, 0xac }, - { 0x27, 0x8c }, - { 0x28, 0x00 }, - { 0x29, 0x65 }, - { 0x2a, 0xac }, - { 0x2b, 0x8c }, - { 0x30, 0x00 }, - { 0x31, 0xe2 }, - { 0x32, 0xc4 }, - { 0x33, 0x6b }, - { 0x00, 0x2c }, - { 0x0c, 0x00 }, - { 0x0d, 0x00 }, - { 0x0e, 0x00 }, - { 0x0f, 0x00 }, - { 0x10, 0x00 }, - { 0x11, 0x00 }, - { 0x12, 0x00 }, - { 0x13, 0x00 }, - { 0x14, 0x00 }, - { 0x15, 0x80 }, - { 0x16, 0x00 }, - { 0x17, 0x00 }, - { 0x18, 0x00 }, - { 0x19, 0x00 }, - { 0x1a, 0x00 }, - { 0x1b, 0x00 }, - { 0x1c, 0x00 }, - { 0x1d, 0x80 }, - { 0x1e, 0x00 }, - { 0x1f, 0x00 }, - { 0x20, 0x00 }, - { 0x21, 0x00 }, - { 0x22, 0x00 }, - { 0x23, 0x00 }, - { 0x28, 0x00 }, - { 0x29, 0x80 }, - { 0x2a, 0x00 }, - { 0x2b, 0x00 }, - { 0x2c, 0x00 }, - { 0x2d, 0x00 }, - { 0x2e, 0x00 }, - { 0x2f, 0x00 }, - { 0x34, 0x00 }, - { 0x35, 0x80 }, - { 0x36, 0x00 }, - { 0x37, 0x00 }, - { 0x38, 0x00 }, - { 0x39, 0x00 }, - { 0x3a, 0x00 }, - { 0x3b, 0x00 }, - { 0x48, 0x00 }, - { 0x49, 0x80 }, - { 0x4a, 0x00 }, - { 0x4b, 0x00 }, - { 0x4c, 0x00 }, - { 0x4d, 0x00 }, - { 0x4e, 0x00 }, - { 0x4f, 0x00 }, - { 0x5c, 0x00 }, - { 0x5d, 0x00 }, - { 0x5e, 0xae }, - { 0x5f, 0xc3 }, - { 0x60, 0x00 }, - { 0x61, 0x45 }, - { 0x62, 0xa1 }, - { 0x63, 0xcb }, - { 0x64, 0x04 }, - { 0x65, 0x0c }, - { 0x66, 0x37 }, - { 0x67, 0x14 }, - { 0x68, 0xc0 }, - { 0x69, 0x00 }, - { 0x6a, 0x00 }, - { 0x6b, 0x00 }, - { 0x6c, 0x04 }, - { 0x6d, 0xc1 }, - { 0x6e, 0xff }, - { 0x6f, 0x93 }, - { 0x74, 0x00 }, - { 0x75, 0x80 }, - { 0x76, 0x00 }, - { 0x77, 0x00 }, - { 0x00, 0x2d }, - { 0x18, 0x7b }, - { 0x19, 0x3e }, - { 0x1a, 0x00 }, - { 0x1b, 0x6d }, - { 0x1c, 0x00 }, - { 0x1d, 0x00 }, - { 0x1e, 0xae }, - { 0x1f, 0xc3 }, - { 0x20, 0x00 }, - { 0x21, 0x00 }, - { 0x22, 0x00 }, - { 0x23, 0x00 }, - { 0x24, 0x00 }, - { 0x25, 0x00 }, - { 0x26, 0x00 }, - { 0x27, 0x00 }, - { 0x28, 0x00 }, - { 0x29, 0x00 }, - { 0x2a, 0x00 }, - { 0x2b, 0x00 }, - { 0x2c, 0x00 }, - { 0x2d, 0x80 }, - { 0x2e, 0x00 }, - { 0x2f, 0x00 }, - { 0x00, 0x2e }, - { 0x24, 0x20 }, - { 0x25, 0x29 }, - { 0x26, 0x00 }, - { 0x27, 0x94 }, - { 0x00, 0x31 }, - { 0x48, 0x40 }, - { 0x49, 0x00 }, - { 0x4a, 0x00 }, - { 0x4b, 0x00 }, - { 0x4c, 0x00 }, - { 0x4d, 0x00 }, - { 0x4e, 0x00 }, - { 0x4f, 0x00 }, - { 0x50, 0x00 }, - { 0x51, 0x00 }, - { 0x52, 0x00 }, - { 0x53, 0x00 }, - { 0x54, 0x00 }, - { 0x55, 0x00 }, - { 0x56, 0x00 }, - { 0x57, 0x00 }, - { 0x58, 0x00 }, - { 0x59, 0x00 }, - { 0x5a, 0x00 }, - { 0x5b, 0x00 }, - { 0x5c, 0x00 }, - { 0x5d, 0x00 }, - { 0x5e, 0x00 }, - { 0x5f, 0x00 }, - { 0x60, 0x00 }, - { 0x61, 0x00 }, - { 0x62, 0x00 }, - { 0x63, 0x00 }, - { 0x64, 0x00 }, - { 0x65, 0x00 }, - { 0x66, 0x00 }, - { 0x67, 0x00 }, - { 0x68, 0x00 }, - { 0x69, 0x00 }, - { 0x6a, 0x00 }, - { 0x6b, 0x00 }, - { 0x6c, 0x00 }, - { 0x6d, 0x00 }, - { 0x6e, 0x00 }, - { 0x6f, 0x00 }, - { 0x70, 0x00 }, - { 0x71, 0x00 }, - { 0x72, 0x00 }, - { 0x73, 0x00 }, - { 0x74, 0x00 }, - { 0x75, 0x00 }, - { 0x76, 0x00 }, - { 0x77, 0x00 }, - { 0x78, 0x00 }, - { 0x79, 0x00 }, - { 0x7a, 0x00 }, - { 0x7b, 0x00 }, - { 0x7c, 0x00 }, - { 0x7d, 0x00 }, - { 0x7e, 0x00 }, - { 0x7f, 0x00 }, - { 0x00, 0x32 }, - { 0x08, 0x00 }, - { 0x09, 0x00 }, - { 0x0a, 0x00 }, - { 0x0b, 0x00 }, - { 0x0c, 0x00 }, - { 0x0d, 0x00 }, - { 0x0e, 0x00 }, - { 0x0f, 0x00 }, - { 0x10, 0x00 }, - { 0x11, 0x00 }, - { 0x12, 0x00 }, - { 0x13, 0x00 }, - { 0x14, 0x00 }, - { 0x15, 0x00 }, - { 0x16, 0x00 }, - { 0x17, 0x00 }, - { 0x18, 0x00 }, - { 0x19, 0x00 }, - { 0x1a, 0x00 }, - { 0x1b, 0x00 }, - { 0x1c, 0x00 }, - { 0x1d, 0x00 }, - { 0x1e, 0x00 }, - { 0x1f, 0x00 }, - { 0x20, 0x00 }, - { 0x21, 0x00 }, - { 0x22, 0x00 }, - { 0x23, 0x00 }, - { 0x24, 0x00 }, - { 0x25, 0x00 }, - { 0x26, 0x00 }, - { 0x27, 0x00 }, - { 0x28, 0x00 }, - { 0x29, 0x00 }, - { 0x2a, 0x00 }, - { 0x2b, 0x00 }, - { 0x2c, 0x00 }, - { 0x2d, 0x00 }, - { 0x2e, 0x00 }, - { 0x2f, 0x00 }, - { 0x30, 0x00 }, - { 0x31, 0x00 }, - { 0x32, 0x00 }, - { 0x33, 0x00 }, - { 0x34, 0x00 }, - { 0x35, 0x00 }, - { 0x36, 0x00 }, - { 0x37, 0x00 }, - { 0x38, 0x00 }, - { 0x39, 0x00 }, - { 0x3a, 0x00 }, - { 0x3b, 0x00 }, - { 0x3c, 0x00 }, - { 0x3d, 0x00 }, - { 0x3e, 0x00 }, - { 0x3f, 0x00 }, - { 0x40, 0x00 }, - { 0x41, 0x00 }, - { 0x42, 0x00 }, - { 0x43, 0x00 }, - { 0x44, 0x00 }, - { 0x45, 0x00 }, - { 0x46, 0x00 }, - { 0x47, 0x00 }, - { 0x48, 0x00 }, - { 0x49, 0x00 }, - { 0x4a, 0x00 }, - { 0x4b, 0x00 }, - { 0x4c, 0x00 }, - { 0x4d, 0x00 }, - { 0x4e, 0x00 }, - { 0x4f, 0x00 }, - { 0x50, 0x00 }, - { 0x51, 0x00 }, - { 0x52, 0x00 }, - { 0x53, 0x00 }, - { 0x54, 0x00 }, - { 0x55, 0x00 }, - { 0x56, 0x00 }, - { 0x57, 0x00 }, - { 0x58, 0x00 }, - { 0x59, 0x00 }, - { 0x5a, 0x00 }, - { 0x5b, 0x00 }, - { 0x5c, 0x00 }, - { 0x5d, 0x00 }, - { 0x5e, 0x00 }, - { 0x5f, 0x00 }, - { 0x60, 0x00 }, - { 0x61, 0x00 }, - { 0x62, 0x00 }, - { 0x63, 0x00 }, - { 0x64, 0x00 }, - { 0x65, 0x00 }, - { 0x66, 0x00 }, - { 0x67, 0x00 }, - { 0x68, 0x00 }, - { 0x69, 0x00 }, - { 0x6a, 0x00 }, - { 0x6b, 0x00 }, - { 0x6c, 0x00 }, - { 0x6d, 0x00 }, - { 0x6e, 0x00 }, - { 0x6f, 0x00 }, - { 0x70, 0x00 }, - { 0x71, 0x00 }, - { 0x72, 0x00 }, - { 0x73, 0x00 }, - { 0x74, 0x00 }, - { 0x75, 0x00 }, - { 0x76, 0x00 }, - { 0x77, 0x00 }, - { 0x78, 0x00 }, - { 0x79, 0x00 }, - { 0x7a, 0x00 }, - { 0x7b, 0x00 }, - { 0x7c, 0x00 }, - { 0x7d, 0x00 }, - { 0x7e, 0x00 }, - { 0x7f, 0x00 }, - { 0x00, 0x33 }, - { 0x08, 0x00 }, - { 0x09, 0x00 }, - { 0x0a, 0x00 }, - { 0x0b, 0x00 }, - { 0x0c, 0x00 }, - { 0x0d, 0x00 }, - { 0x0e, 0x00 }, - { 0x0f, 0x00 }, - { 0x10, 0x00 }, - { 0x11, 0x00 }, - { 0x12, 0x00 }, - { 0x13, 0x00 }, - { 0x14, 0x00 }, - { 0x15, 0x00 }, - { 0x16, 0x00 }, - { 0x17, 0x00 }, - { 0x18, 0x00 }, - { 0x19, 0x00 }, - { 0x1a, 0x00 }, - { 0x1b, 0x00 }, - { 0x1c, 0x00 }, - { 0x1d, 0x00 }, - { 0x1e, 0x00 }, - { 0x1f, 0x00 }, - { 0x20, 0x00 }, - { 0x21, 0x00 }, - { 0x22, 0x00 }, - { 0x23, 0x00 }, - { 0x24, 0x00 }, - { 0x25, 0x00 }, - { 0x26, 0x00 }, - { 0x27, 0x00 }, - { 0x28, 0x00 }, - { 0x29, 0x00 }, - { 0x2a, 0x00 }, - { 0x2b, 0x00 }, - { 0x2c, 0x00 }, - { 0x2d, 0x00 }, - { 0x2e, 0x00 }, - { 0x2f, 0x00 }, - { 0x30, 0x00 }, - { 0x31, 0x00 }, - { 0x32, 0x00 }, - { 0x33, 0x00 }, - { 0x34, 0x00 }, - { 0x35, 0x00 }, - { 0x36, 0x00 }, - { 0x37, 0x00 }, - { 0x38, 0x00 }, - { 0x39, 0x00 }, - { 0x3a, 0x00 }, - { 0x3b, 0x00 }, - { 0x3c, 0x00 }, - { 0x3d, 0x00 }, - { 0x3e, 0x00 }, - { 0x3f, 0x00 }, - { 0x40, 0x00 }, - { 0x41, 0x00 }, - { 0x42, 0x00 }, - { 0x43, 0x00 }, - { 0x44, 0x00 }, - { 0x45, 0x00 }, - { 0x46, 0x00 }, - { 0x47, 0x00 }, - { 0x48, 0x00 }, - { 0x49, 0x00 }, - { 0x4a, 0x00 }, - { 0x4b, 0x00 }, - { 0x4c, 0x00 }, - { 0x4d, 0x00 }, - { 0x4e, 0x00 }, - { 0x4f, 0x00 }, - { 0x50, 0x00 }, - { 0x51, 0x00 }, - { 0x52, 0x00 }, - { 0x53, 0x00 }, - { 0x54, 0x00 }, - { 0x55, 0x00 }, - { 0x56, 0x00 }, - { 0x57, 0x00 }, - { 0x58, 0x00 }, - { 0x59, 0x00 }, - { 0x5a, 0x00 }, - { 0x5b, 0x00 }, - { 0x5c, 0x00 }, - { 0x5d, 0x00 }, - { 0x5e, 0x00 }, - { 0x5f, 0x00 }, - { 0x60, 0x00 }, - { 0x61, 0x00 }, - { 0x62, 0x00 }, - { 0x63, 0x00 }, - { 0x64, 0x00 }, - { 0x65, 0x00 }, - { 0x66, 0x00 }, - { 0x67, 0x00 }, - { 0x68, 0x00 }, - { 0x69, 0x00 }, - { 0x6a, 0x00 }, - { 0x6b, 0x00 }, - { 0x6c, 0x00 }, - { 0x6d, 0x00 }, - { 0x6e, 0x00 }, - { 0x6f, 0x00 }, - { 0x70, 0x00 }, - { 0x71, 0x00 }, - { 0x72, 0x00 }, - { 0x73, 0x00 }, - { 0x74, 0x00 }, - { 0x75, 0x00 }, - { 0x76, 0x00 }, - { 0x77, 0x00 }, - { 0x78, 0x00 }, - { 0x79, 0x00 }, - { 0x7a, 0x00 }, - { 0x7b, 0x00 }, - { 0x7c, 0x00 }, - { 0x7d, 0x00 }, - { 0x7e, 0x00 }, - { 0x7f, 0x00 }, - { 0x00, 0x34 }, - { 0x08, 0x00 }, - { 0x09, 0x00 }, - { 0x0a, 0x00 }, - { 0x0b, 0x00 }, - { 0x0c, 0x00 }, - { 0x0d, 0x00 }, - { 0x0e, 0x00 }, - { 0x0f, 0x00 }, - { 0x10, 0x00 }, - { 0x11, 0x00 }, - { 0x12, 0x00 }, - { 0x13, 0x00 }, - { 0x14, 0x00 }, - { 0x15, 0x00 }, - { 0x16, 0x00 }, - { 0x17, 0x00 }, - { 0x18, 0x00 }, - { 0x19, 0x00 }, - { 0x1a, 0x00 }, - { 0x1b, 0x00 }, - { 0x1c, 0x00 }, - { 0x1d, 0x00 }, - { 0x1e, 0x00 }, - { 0x1f, 0x00 }, - { 0x20, 0x00 }, - { 0x21, 0x00 }, - { 0x22, 0x00 }, - { 0x23, 0x00 }, - { 0x24, 0x00 }, - { 0x25, 0x00 }, - { 0x26, 0x00 }, - { 0x27, 0x00 }, - { 0x28, 0x00 }, - { 0x29, 0x00 }, - { 0x2a, 0x00 }, - { 0x2b, 0x00 }, - { 0x2c, 0x00 }, - { 0x2d, 0x00 }, - { 0x2e, 0x00 }, - { 0x2f, 0x00 }, - { 0x30, 0x00 }, - { 0x31, 0x00 }, - { 0x32, 0x00 }, - { 0x33, 0x00 }, - { 0x34, 0x00 }, - { 0x35, 0x00 }, - { 0x36, 0x00 }, - { 0x37, 0x00 }, - { 0x38, 0x00 }, - { 0x39, 0x00 }, - { 0x3a, 0x00 }, - { 0x3b, 0x00 }, - { 0x3c, 0x00 }, - { 0x3d, 0x00 }, - { 0x3e, 0x00 }, - { 0x3f, 0x00 }, - { 0x40, 0x00 }, - { 0x41, 0x00 }, - { 0x42, 0x00 }, - { 0x43, 0x00 }, - { 0x44, 0x00 }, - { 0x45, 0x00 }, - { 0x46, 0x00 }, - { 0x47, 0x00 }, - { 0x48, 0x00 }, - { 0x49, 0x00 }, - { 0x4a, 0x00 }, - { 0x4b, 0x00 }, - { 0x4c, 0x00 }, - { 0x4d, 0x00 }, - { 0x4e, 0x00 }, - { 0x4f, 0x00 }, - { 0x50, 0x00 }, - { 0x51, 0x00 }, - { 0x52, 0x00 }, - { 0x53, 0x00 }, - { 0x54, 0x00 }, - { 0x55, 0x00 }, - { 0x56, 0x00 }, - { 0x57, 0x00 }, - { 0x58, 0x00 }, - { 0x59, 0x00 }, - { 0x5a, 0x00 }, - { 0x5b, 0x00 }, - { 0x5c, 0x00 }, - { 0x5d, 0x00 }, - { 0x5e, 0x00 }, - { 0x5f, 0x00 }, - { 0x60, 0x00 }, - { 0x61, 0x00 }, - { 0x62, 0x00 }, - { 0x63, 0x00 }, - { 0x64, 0x00 }, - { 0x65, 0x00 }, - { 0x66, 0x00 }, - { 0x67, 0x00 }, - { 0x68, 0x00 }, - { 0x69, 0x00 }, - { 0x6a, 0x00 }, - { 0x6b, 0x00 }, - { 0x6c, 0x00 }, - { 0x6d, 0x00 }, - { 0x6e, 0x00 }, - { 0x6f, 0x00 }, - { 0x70, 0x00 }, - { 0x71, 0x00 }, - { 0x72, 0x00 }, - { 0x73, 0x00 }, - { 0x74, 0x00 }, - { 0x75, 0x00 }, - { 0x76, 0x00 }, - { 0x77, 0x00 }, - { 0x78, 0x00 }, - { 0x79, 0x00 }, - { 0x7a, 0x00 }, - { 0x7b, 0x00 }, - { 0x7c, 0x00 }, - { 0x7d, 0x00 }, - { 0x7e, 0x00 }, - { 0x7f, 0x00 }, - { 0x00, 0x35 }, - { 0x08, 0x00 }, - { 0x09, 0x00 }, - { 0x0a, 0x00 }, - { 0x0b, 0x00 }, - { 0x0c, 0x00 }, - { 0x0d, 0x00 }, - { 0x0e, 0x00 }, - { 0x0f, 0x00 }, - { 0x10, 0x00 }, - { 0x11, 0x00 }, - { 0x12, 0x00 }, - { 0x13, 0x00 }, - { 0x14, 0x00 }, - { 0x15, 0x00 }, - { 0x16, 0x00 }, - { 0x17, 0x00 }, - { 0x18, 0x00 }, - { 0x19, 0x00 }, - { 0x1a, 0x00 }, - { 0x1b, 0x00 }, - { 0x1c, 0x00 }, - { 0x1d, 0x00 }, - { 0x1e, 0x00 }, - { 0x1f, 0x00 }, - { 0x20, 0x00 }, - { 0x21, 0x00 }, - { 0x22, 0x00 }, - { 0x23, 0x00 }, - { 0x24, 0x00 }, - { 0x25, 0x00 }, - { 0x26, 0x00 }, - { 0x27, 0x00 }, - { 0x28, 0x00 }, - { 0x29, 0x00 }, - { 0x2a, 0x00 }, - { 0x2b, 0x00 }, - { 0x2c, 0x00 }, - { 0x2d, 0x00 }, - { 0x2e, 0x00 }, - { 0x2f, 0x00 }, - { 0x30, 0x00 }, - { 0x31, 0x00 }, - { 0x32, 0x00 }, - { 0x33, 0x00 }, - { 0x34, 0x00 }, - { 0x35, 0x00 }, - { 0x36, 0x00 }, - { 0x37, 0x00 }, - { 0x38, 0x00 }, - { 0x39, 0x00 }, - { 0x3a, 0x00 }, - { 0x3b, 0x00 }, - { 0x3c, 0x00 }, - { 0x3d, 0x00 }, - { 0x3e, 0x00 }, - { 0x3f, 0x00 }, - { 0x40, 0x00 }, - { 0x41, 0x00 }, - { 0x42, 0x00 }, - { 0x43, 0x00 }, - { 0x44, 0x00 }, - { 0x45, 0x00 }, - { 0x46, 0x00 }, - { 0x47, 0x00 }, - { 0x48, 0x00 }, - { 0x49, 0x00 }, - { 0x4a, 0x00 }, - { 0x4b, 0x00 }, - { 0x4c, 0x00 }, - { 0x4d, 0x00 }, - { 0x4e, 0x00 }, - { 0x4f, 0x00 }, - { 0x50, 0x00 }, - { 0x51, 0x00 }, - { 0x52, 0x00 }, - { 0x53, 0x00 }, - { 0x54, 0x00 }, - { 0x55, 0x00 }, - { 0x56, 0x00 }, - { 0x57, 0x00 }, - { 0x58, 0x00 }, - { 0x59, 0x00 }, - { 0x5a, 0x00 }, - { 0x5b, 0x00 }, - { 0x5c, 0x00 }, - { 0x5d, 0x00 }, - { 0x5e, 0x00 }, - { 0x5f, 0x00 }, - { 0x60, 0x00 }, - { 0x61, 0x00 }, - { 0x62, 0x00 }, - { 0x63, 0x00 }, - { 0x64, 0x00 }, - { 0x65, 0x00 }, - { 0x66, 0x00 }, - { 0x67, 0x00 }, - { 0x00, 0x00 }, - { 0x7f, 0xaa }, - { 0x00, 0x24 }, - { 0x18, 0x07 }, - { 0x19, 0xf0 }, - { 0x1a, 0xe4 }, - { 0x1b, 0x16 }, - { 0x1c, 0xf0 }, - { 0x1d, 0x1e }, - { 0x1e, 0x37 }, - { 0x1f, 0xd3 }, - { 0x20, 0x07 }, - { 0x21, 0xf0 }, - { 0x22, 0xe4 }, - { 0x23, 0x16 }, - { 0x24, 0x0f }, - { 0x25, 0xe1 }, - { 0x26, 0xab }, - { 0x27, 0xa4 }, - { 0x28, 0xf8 }, - { 0x29, 0x1e }, - { 0x2a, 0x1b }, - { 0x2b, 0x4a }, - { 0x2c, 0x07 }, - { 0x2d, 0xf2 }, - { 0x2e, 0xc6 }, - { 0x2f, 0x03 }, - { 0x30, 0xf0 }, - { 0x31, 0x1a }, - { 0x32, 0x73 }, - { 0x33, 0xfa }, - { 0x34, 0x07 }, - { 0x35, 0xf2 }, - { 0x36, 0xc6 }, - { 0x37, 0x03 }, - { 0x38, 0x0f }, - { 0x39, 0xe5 }, - { 0x3a, 0x76 }, - { 0x3b, 0x28 }, - { 0x3c, 0xf8 }, - { 0x3d, 0x1a }, - { 0x3e, 0x5e }, - { 0x3f, 0x1c }, - { 0x40, 0x08 }, - { 0x41, 0x28 }, - { 0x42, 0x01 }, - { 0x43, 0xe1 }, - { 0x44, 0xf0 }, - { 0x45, 0x35 }, - { 0x46, 0x45 }, - { 0x47, 0x27 }, - { 0x48, 0x07 }, - { 0x49, 0xa3 }, - { 0x4a, 0x11 }, - { 0x4b, 0xa4 }, - { 0x4c, 0x0f }, - { 0x4d, 0xca }, - { 0x4e, 0xba }, - { 0x4f, 0xd9 }, - { 0x50, 0xf8 }, - { 0x51, 0x34 }, - { 0x52, 0xec }, - { 0x53, 0x7b }, - { 0x54, 0x07 }, - { 0x55, 0xfd }, - { 0x56, 0x56 }, - { 0x57, 0xbd }, - { 0x58, 0xf0 }, - { 0x59, 0x0d }, - { 0x5a, 0x69 }, - { 0x5b, 0xed }, - { 0x5c, 0x07 }, - { 0x5d, 0xf7 }, - { 0x5e, 0xfd }, - { 0x5f, 0xbb }, - { 0x60, 0x0f }, - { 0x61, 0xf2 }, - { 0x62, 0x96 }, - { 0x63, 0x13 }, - { 0x64, 0xf8 }, - { 0x65, 0x0a }, - { 0x66, 0xab }, - { 0x67, 0x87 }, - { 0x68, 0x07 }, - { 0x69, 0xe1 }, - { 0x6a, 0xc2 }, - { 0x6b, 0x69 }, - { 0x6c, 0xf0 }, - { 0x6d, 0xac }, - { 0x6e, 0x0d }, - { 0x6f, 0x58 }, - { 0x70, 0x07 }, - { 0x71, 0x94 }, - { 0x72, 0x0c }, - { 0x73, 0x4d }, - { 0x74, 0x0f }, - { 0x75, 0x53 }, - { 0x76, 0xf2 }, - { 0x77, 0xa8 }, - { 0x78, 0xf8 }, - { 0x79, 0x8a }, - { 0x7a, 0x31 }, - { 0x7b, 0x49 }, - { 0x7c, 0x08 }, - { 0x7d, 0x00 }, - { 0x7e, 0x00 }, - { 0x7f, 0x00 }, - { 0x00, 0x25 }, - { 0x08, 0x00 }, - { 0x09, 0x00 }, - { 0x0a, 0x00 }, - { 0x0b, 0x00 }, - { 0x0c, 0x00 }, - { 0x0d, 0x00 }, - { 0x0e, 0x00 }, - { 0x0f, 0x00 }, - { 0x10, 0x00 }, - { 0x11, 0x00 }, - { 0x12, 0x00 }, - { 0x13, 0x00 }, - { 0x14, 0x00 }, - { 0x15, 0x00 }, - { 0x16, 0x00 }, - { 0x17, 0x00 }, - { 0x18, 0x08 }, - { 0x19, 0x00 }, - { 0x1a, 0x00 }, - { 0x1b, 0x00 }, - { 0x1c, 0xf1 }, - { 0x1d, 0x79 }, - { 0x1e, 0xcb }, - { 0x1f, 0xec }, - { 0x20, 0x06 }, - { 0x21, 0xa6 }, - { 0x22, 0x49 }, - { 0x23, 0xa5 }, - { 0x24, 0x0e }, - { 0x25, 0x86 }, - { 0x26, 0x34 }, - { 0x27, 0x14 }, - { 0x28, 0xf9 }, - { 0x29, 0x59 }, - { 0x2a, 0xb6 }, - { 0x2b, 0x5b }, - { 0x2c, 0x09 }, - { 0x2d, 0x63 }, - { 0x2e, 0x61 }, - { 0x2f, 0x75 }, - { 0x30, 0xf8 }, - { 0x31, 0x28 }, - { 0x32, 0x33 }, - { 0x33, 0x32 }, - { 0x34, 0x02 }, - { 0x35, 0xcb }, - { 0x36, 0xa2 }, - { 0x37, 0x07 }, - { 0x38, 0x05 }, - { 0x39, 0xc8 }, - { 0x3a, 0x94 }, - { 0x3b, 0x61 }, - { 0x3c, 0xfd }, - { 0x3d, 0xe0 }, - { 0x3e, 0x34 }, - { 0x3f, 0xf0 }, - { 0x40, 0x08 }, - { 0x41, 0x00 }, - { 0x42, 0x00 }, - { 0x43, 0x00 }, - { 0x44, 0xf1 }, - { 0x45, 0x79 }, - { 0x46, 0xcb }, - { 0x47, 0xec }, - { 0x48, 0x06 }, - { 0x49, 0xa6 }, - { 0x4a, 0x49 }, - { 0x4b, 0xa5 }, - { 0x4c, 0x0e }, - { 0x4d, 0x86 }, - { 0x4e, 0x34 }, - { 0x4f, 0x14 }, - { 0x50, 0xf9 }, - { 0x51, 0x59 }, - { 0x52, 0xb6 }, - { 0x53, 0x5b }, - { 0x54, 0x07 }, - { 0x55, 0xd8 }, - { 0x56, 0xc2 }, - { 0x57, 0x5c }, - { 0x58, 0xf1 }, - { 0x59, 0x09 }, - { 0x5a, 0x84 }, - { 0x5b, 0x20 }, - { 0x5c, 0x07 }, - { 0x5d, 0xa4 }, - { 0x5e, 0xd9 }, - { 0x5f, 0x7a }, - { 0x60, 0x0e }, - { 0x61, 0xf6 }, - { 0x62, 0x7b }, - { 0x63, 0xe0 }, - { 0x64, 0xf8 }, - { 0x65, 0x82 }, - { 0x66, 0x64 }, - { 0x67, 0x2a }, - { 0x68, 0x07 }, - { 0x69, 0xc6 }, - { 0x6a, 0x16 }, - { 0x6b, 0x0b }, - { 0x6c, 0xf3 }, - { 0x6d, 0x04 }, - { 0x6e, 0x30 }, - { 0x6f, 0xd8 }, - { 0x70, 0x07 }, - { 0x71, 0x00 }, - { 0x72, 0x0d }, - { 0x73, 0xc1 }, - { 0x74, 0x0c }, - { 0x75, 0xfb }, - { 0x76, 0xcf }, - { 0x77, 0x28 }, - { 0x78, 0xf9 }, - { 0x79, 0x39 }, - { 0x7a, 0xdc }, - { 0x7b, 0x34 }, - { 0x7c, 0x07 }, - { 0x7d, 0xfc }, - { 0x7e, 0x8e }, - { 0x7f, 0xc5 }, - { 0x00, 0x26 }, - { 0x08, 0xf0 }, - { 0x09, 0x91 }, - { 0x0a, 0xb8 }, - { 0x0b, 0xc2 }, - { 0x0c, 0x07 }, - { 0x0d, 0xe1 }, - { 0x0e, 0xf7 }, - { 0x0f, 0xf1 }, - { 0x10, 0x0f }, - { 0x11, 0x6e }, - { 0x12, 0x47 }, - { 0x13, 0x3e }, - { 0x14, 0xf8 }, - { 0x15, 0x21 }, - { 0x16, 0x79 }, - { 0x17, 0x4a }, - { 0x18, 0x08 }, - { 0x19, 0x00 }, - { 0x1a, 0x00 }, - { 0x1b, 0x00 }, - { 0x1c, 0x00 }, - { 0x1d, 0x00 }, - { 0x1e, 0x00 }, - { 0x1f, 0x00 }, - { 0x20, 0x00 }, - { 0x21, 0x00 }, - { 0x22, 0x00 }, - { 0x23, 0x00 }, - { 0x24, 0x00 }, - { 0x25, 0x00 }, - { 0x26, 0x00 }, - { 0x27, 0x00 }, - { 0x28, 0x00 }, - { 0x29, 0x00 }, - { 0x2a, 0x00 }, - { 0x2b, 0x00 }, - { 0x2c, 0x08 }, - { 0x2d, 0x00 }, - { 0x2e, 0x00 }, - { 0x2f, 0x00 }, - { 0x30, 0x00 }, - { 0x31, 0x00 }, - { 0x32, 0x00 }, - { 0x33, 0x00 }, - { 0x34, 0x00 }, - { 0x35, 0x00 }, - { 0x36, 0x00 }, - { 0x37, 0x00 }, - { 0x38, 0x00 }, - { 0x39, 0x00 }, - { 0x3a, 0x00 }, - { 0x3b, 0x00 }, - { 0x3c, 0x00 }, - { 0x3d, 0x00 }, - { 0x3e, 0x00 }, - { 0x3f, 0x00 }, - { 0x40, 0x08 }, - { 0x41, 0x00 }, - { 0x42, 0x00 }, - { 0x43, 0x00 }, - { 0x44, 0x00 }, - { 0x45, 0x00 }, - { 0x46, 0x00 }, - { 0x47, 0x00 }, - { 0x48, 0x00 }, - { 0x49, 0x00 }, - { 0x4a, 0x00 }, - { 0x4b, 0x00 }, - { 0x4c, 0x00 }, - { 0x4d, 0x00 }, - { 0x4e, 0x00 }, - { 0x4f, 0x00 }, - { 0x50, 0x00 }, - { 0x51, 0x00 }, - { 0x52, 0x00 }, - { 0x53, 0x00 }, - { 0x54, 0x08 }, - { 0x55, 0x00 }, - { 0x56, 0x00 }, - { 0x57, 0x00 }, - { 0x58, 0x00 }, - { 0x59, 0x00 }, - { 0x5a, 0x00 }, - { 0x5b, 0x00 }, - { 0x5c, 0x00 }, - { 0x5d, 0x00 }, - { 0x5e, 0x00 }, - { 0x5f, 0x00 }, - { 0x60, 0x00 }, - { 0x61, 0x00 }, - { 0x62, 0x00 }, - { 0x63, 0x00 }, - { 0x64, 0x00 }, - { 0x65, 0x00 }, - { 0x66, 0x00 }, - { 0x67, 0x00 }, - { 0x68, 0x08 }, - { 0x69, 0x00 }, - { 0x6a, 0x00 }, - { 0x6b, 0x00 }, - { 0x6c, 0x00 }, - { 0x6d, 0x00 }, - { 0x6e, 0x00 }, - { 0x6f, 0x00 }, - { 0x70, 0x00 }, - { 0x71, 0x00 }, - { 0x72, 0x00 }, - { 0x73, 0x00 }, - { 0x74, 0x00 }, - { 0x75, 0x00 }, - { 0x76, 0x00 }, - { 0x77, 0x00 }, - { 0x78, 0x00 }, - { 0x79, 0x00 }, - { 0x7a, 0x00 }, - { 0x7b, 0x00 }, - { 0x7c, 0x08 }, - { 0x7d, 0x00 }, - { 0x7e, 0x00 }, - { 0x7f, 0x00 }, - { 0x00, 0x27 }, - { 0x08, 0x00 }, - { 0x09, 0x00 }, - { 0x0a, 0x00 }, - { 0x0b, 0x00 }, - { 0x0c, 0x00 }, - { 0x0d, 0x00 }, - { 0x0e, 0x00 }, - { 0x0f, 0x00 }, - { 0x10, 0x00 }, - { 0x11, 0x00 }, - { 0x12, 0x00 }, - { 0x13, 0x00 }, - { 0x14, 0x00 }, - { 0x15, 0x00 }, - { 0x16, 0x00 }, - { 0x17, 0x00 }, - { 0x18, 0x08 }, - { 0x19, 0x00 }, - { 0x1a, 0x00 }, - { 0x1b, 0x00 }, - { 0x1c, 0x00 }, - { 0x1d, 0x00 }, - { 0x1e, 0x00 }, - { 0x1f, 0x00 }, - { 0x20, 0x00 }, - { 0x21, 0x00 }, - { 0x22, 0x00 }, - { 0x23, 0x00 }, - { 0x24, 0x00 }, - { 0x25, 0x00 }, - { 0x26, 0x00 }, - { 0x27, 0x00 }, - { 0x28, 0x00 }, - { 0x29, 0x00 }, - { 0x2a, 0x00 }, - { 0x2b, 0x00 }, - { 0x2c, 0x08 }, - { 0x2d, 0x00 }, - { 0x2e, 0x00 }, - { 0x2f, 0x00 }, - { 0x30, 0x00 }, - { 0x31, 0x00 }, - { 0x32, 0x00 }, - { 0x33, 0x00 }, - { 0x34, 0x00 }, - { 0x35, 0x00 }, - { 0x36, 0x00 }, - { 0x37, 0x00 }, - { 0x38, 0x00 }, - { 0x39, 0x00 }, - { 0x3a, 0x00 }, - { 0x3b, 0x00 }, - { 0x3c, 0x00 }, - { 0x3d, 0x00 }, - { 0x3e, 0x00 }, - { 0x3f, 0x00 }, - { 0x40, 0x08 }, - { 0x41, 0x00 }, - { 0x42, 0x00 }, - { 0x43, 0x00 }, - { 0x44, 0x00 }, - { 0x45, 0x00 }, - { 0x46, 0x00 }, - { 0x47, 0x00 }, - { 0x48, 0x00 }, - { 0x49, 0x00 }, - { 0x4a, 0x00 }, - { 0x4b, 0x00 }, - { 0x4c, 0x00 }, - { 0x4d, 0x00 }, - { 0x4e, 0x00 }, - { 0x4f, 0x00 }, - { 0x50, 0x00 }, - { 0x51, 0x00 }, - { 0x52, 0x00 }, - { 0x53, 0x00 }, - { 0x54, 0x08 }, - { 0x55, 0x00 }, - { 0x56, 0x00 }, - { 0x57, 0x00 }, - { 0x58, 0x00 }, - { 0x59, 0x00 }, - { 0x5a, 0x00 }, - { 0x5b, 0x00 }, - { 0x5c, 0x00 }, - { 0x5d, 0x00 }, - { 0x5e, 0x00 }, - { 0x5f, 0x00 }, - { 0x60, 0x00 }, - { 0x61, 0x00 }, - { 0x62, 0x00 }, - { 0x63, 0x00 }, - { 0x64, 0x00 }, - { 0x65, 0x00 }, - { 0x66, 0x00 }, - { 0x67, 0x00 }, - { 0x68, 0x08 }, - { 0x69, 0x00 }, - { 0x6a, 0x00 }, - { 0x6b, 0x00 }, - { 0x6c, 0x00 }, - { 0x6d, 0x00 }, - { 0x6e, 0x00 }, - { 0x6f, 0x00 }, - { 0x70, 0x00 }, - { 0x71, 0x00 }, - { 0x72, 0x00 }, - { 0x73, 0x00 }, - { 0x74, 0x00 }, - { 0x75, 0x00 }, - { 0x76, 0x00 }, - { 0x77, 0x00 }, - { 0x78, 0x00 }, - { 0x79, 0x00 }, - { 0x7a, 0x00 }, - { 0x7b, 0x00 }, - { 0x7c, 0x08 }, - { 0x7d, 0x00 }, - { 0x7e, 0x00 }, - { 0x7f, 0x00 }, - { 0x00, 0x28 }, - { 0x08, 0x00 }, - { 0x09, 0x00 }, - { 0x0a, 0x00 }, - { 0x0b, 0x00 }, - { 0x0c, 0x00 }, - { 0x0d, 0x00 }, - { 0x0e, 0x00 }, - { 0x0f, 0x00 }, - { 0x10, 0x00 }, - { 0x11, 0x00 }, - { 0x12, 0x00 }, - { 0x13, 0x00 }, - { 0x14, 0x00 }, - { 0x15, 0x00 }, - { 0x16, 0x00 }, - { 0x17, 0x00 }, - { 0x18, 0x08 }, - { 0x19, 0x00 }, - { 0x1a, 0x00 }, - { 0x1b, 0x00 }, - { 0x1c, 0x00 }, - { 0x1d, 0x00 }, - { 0x1e, 0x00 }, - { 0x1f, 0x00 }, - { 0x20, 0x00 }, - { 0x21, 0x00 }, - { 0x22, 0x00 }, - { 0x23, 0x00 }, - { 0x24, 0x00 }, - { 0x25, 0x00 }, - { 0x26, 0x00 }, - { 0x27, 0x00 }, - { 0x28, 0x00 }, - { 0x29, 0x00 }, - { 0x2a, 0x00 }, - { 0x2b, 0x00 }, - { 0x2c, 0x08 }, - { 0x2d, 0x00 }, - { 0x2e, 0x00 }, - { 0x2f, 0x00 }, - { 0x30, 0x00 }, - { 0x31, 0x00 }, - { 0x32, 0x00 }, - { 0x33, 0x00 }, - { 0x34, 0x00 }, - { 0x35, 0x00 }, - { 0x36, 0x00 }, - { 0x37, 0x00 }, - { 0x38, 0x00 }, - { 0x39, 0x00 }, - { 0x3a, 0x00 }, - { 0x3b, 0x00 }, - { 0x3c, 0x00 }, - { 0x3d, 0x00 }, - { 0x3e, 0x00 }, - { 0x3f, 0x00 }, - { 0x40, 0x08 }, - { 0x41, 0x00 }, - { 0x42, 0x00 }, - { 0x43, 0x00 }, - { 0x44, 0x00 }, - { 0x45, 0x00 }, - { 0x46, 0x00 }, - { 0x47, 0x00 }, - { 0x48, 0x00 }, - { 0x49, 0x00 }, - { 0x4a, 0x00 }, - { 0x4b, 0x00 }, - { 0x4c, 0x00 }, - { 0x4d, 0x00 }, - { 0x4e, 0x00 }, - { 0x4f, 0x00 }, - { 0x50, 0x00 }, - { 0x51, 0x00 }, - { 0x52, 0x00 }, - { 0x53, 0x00 }, - { 0x54, 0x08 }, - { 0x55, 0x00 }, - { 0x56, 0x00 }, - { 0x57, 0x00 }, - { 0x58, 0x00 }, - { 0x59, 0x00 }, - { 0x5a, 0x00 }, - { 0x5b, 0x00 }, - { 0x5c, 0x00 }, - { 0x5d, 0x00 }, - { 0x5e, 0x00 }, - { 0x5f, 0x00 }, - { 0x60, 0x00 }, - { 0x61, 0x00 }, - { 0x62, 0x00 }, - { 0x63, 0x00 }, - { 0x64, 0x00 }, - { 0x65, 0x00 }, - { 0x66, 0x00 }, - { 0x67, 0x00 }, - { 0x68, 0x08 }, - { 0x69, 0x00 }, - { 0x6a, 0x00 }, - { 0x6b, 0x00 }, - { 0x6c, 0x00 }, - { 0x6d, 0x00 }, - { 0x6e, 0x00 }, - { 0x6f, 0x00 }, - { 0x70, 0x00 }, - { 0x71, 0x00 }, - { 0x72, 0x00 }, - { 0x73, 0x00 }, - { 0x74, 0x00 }, - { 0x75, 0x00 }, - { 0x76, 0x00 }, - { 0x77, 0x00 }, - { 0x78, 0x00 }, - { 0x79, 0x00 }, - { 0x7a, 0x00 }, - { 0x7b, 0x00 }, - { 0x7c, 0x08 }, - { 0x7d, 0x00 }, - { 0x7e, 0x00 }, - { 0x7f, 0x00 }, - { 0x00, 0x29 }, - { 0x08, 0x00 }, - { 0x09, 0x00 }, - { 0x0a, 0x00 }, - { 0x0b, 0x00 }, - { 0x0c, 0x00 }, - { 0x0d, 0x00 }, - { 0x0e, 0x00 }, - { 0x0f, 0x00 }, - { 0x10, 0x00 }, - { 0x11, 0x00 }, - { 0x12, 0x00 }, - { 0x13, 0x00 }, - { 0x14, 0x00 }, - { 0x15, 0x00 }, - { 0x16, 0x00 }, - { 0x17, 0x00 }, - { 0x00, 0x2e }, - { 0x7c, 0x08 }, - { 0x7d, 0x00 }, - { 0x7e, 0x00 }, - { 0x7f, 0x00 }, - { 0x00, 0x2f }, - { 0x08, 0x00 }, - { 0x09, 0x00 }, - { 0x0a, 0x00 }, - { 0x0b, 0x00 }, - { 0x0c, 0x00 }, - { 0x0d, 0x00 }, - { 0x0e, 0x00 }, - { 0x0f, 0x00 }, - { 0x10, 0x00 }, - { 0x11, 0x00 }, - { 0x12, 0x00 }, - { 0x13, 0x00 }, - { 0x14, 0x00 }, - { 0x15, 0x00 }, - { 0x16, 0x00 }, - { 0x17, 0x00 }, - { 0x1c, 0x08 }, - { 0x1d, 0x00 }, - { 0x1e, 0x00 }, - { 0x1f, 0x00 }, - { 0x20, 0x00 }, - { 0x21, 0x00 }, - { 0x22, 0x00 }, - { 0x23, 0x00 }, - { 0x24, 0x00 }, - { 0x25, 0x00 }, - { 0x26, 0x00 }, - { 0x27, 0x00 }, - { 0x28, 0x00 }, - { 0x29, 0x00 }, - { 0x2a, 0x00 }, - { 0x2b, 0x00 }, - { 0x2c, 0x00 }, - { 0x2d, 0x00 }, - { 0x2e, 0x00 }, - { 0x2f, 0x00 }, - { 0x00, 0x2a }, - { 0x48, 0x00 }, - { 0x49, 0x15 }, - { 0x4a, 0xa7 }, - { 0x4b, 0x04 }, - { 0x4c, 0x00 }, - { 0x4d, 0x15 }, - { 0x4e, 0xa7 }, - { 0x4f, 0x04 }, - { 0x50, 0x00 }, - { 0x51, 0x15 }, - { 0x52, 0xa7 }, - { 0x53, 0x04 }, - { 0x54, 0x7b }, - { 0x55, 0x43 }, - { 0x56, 0x52 }, - { 0x57, 0x44 }, - { 0x58, 0x89 }, - { 0x59, 0x22 }, - { 0x5a, 0xbf }, - { 0x5b, 0x66 }, - { 0x00, 0x00 }, - { 0x7f, 0x8c }, - { 0x00, 0x2b }, - { 0x34, 0x00 }, - { 0x35, 0x22 }, - { 0x36, 0x1d }, - { 0x37, 0x95 }, - { 0x38, 0x02 }, - { 0x39, 0xa3 }, - { 0x3a, 0x9a }, - { 0x3b, 0xcc }, - { 0x3c, 0x00 }, - { 0x3d, 0x06 }, - { 0x3e, 0xd3 }, - { 0x3f, 0x72 }, - { 0x40, 0x00 }, - { 0x41, 0x00 }, - { 0x42, 0x00 }, - { 0x43, 0x00 }, - { 0x44, 0x00 }, - { 0x45, 0x00 }, - { 0x46, 0x4e }, - { 0x47, 0xa5 }, - { 0x48, 0xff }, - { 0x49, 0x81 }, - { 0x4a, 0x47 }, - { 0x4b, 0xae }, - { 0x4c, 0xf9 }, - { 0x4d, 0x06 }, - { 0x4e, 0x21 }, - { 0x4f, 0xa9 }, - { 0x50, 0xfc }, - { 0x51, 0xc2 }, - { 0x52, 0xd8 }, - { 0x53, 0xc5 }, - { 0x54, 0x00 }, - { 0x55, 0x00 }, - { 0x56, 0x00 }, - { 0x57, 0x00 }, - { 0x58, 0x00 }, - { 0x59, 0x02 }, - { 0x5a, 0x4b }, - { 0x5b, 0xce }, - { 0x00, 0x2d }, - { 0x58, 0x02 }, - { 0x59, 0xa3 }, - { 0x5a, 0x9a }, - { 0x5b, 0xcc }, - { 0x5c, 0x02 }, - { 0x5d, 0xa3 }, - { 0x5e, 0x9a }, - { 0x5f, 0xcc }, - { 0x60, 0x00 }, - { 0x61, 0x44 }, - { 0x62, 0x32 }, - { 0x63, 0x13 }, - { 0x64, 0x00 }, - { 0x65, 0x00 }, - { 0x66, 0x00 }, - { 0x67, 0x00 }, - { 0x68, 0x00 }, - { 0x69, 0x00 }, - { 0x6a, 0x00 }, - { 0x6b, 0x00 }, - { 0x6c, 0xff }, - { 0x6d, 0x81 }, - { 0x6e, 0x47 }, - { 0x6f, 0xae }, - { 0x70, 0xf9 }, - { 0x71, 0x06 }, - { 0x72, 0x21 }, - { 0x73, 0xa9 }, - { 0x74, 0xfc }, - { 0x75, 0xad }, - { 0x76, 0x96 }, - { 0x77, 0x20 }, - { 0x78, 0x00 }, - { 0x79, 0x00 }, - { 0x7a, 0x00 }, - { 0x7b, 0x00 }, - { 0x7c, 0x00 }, - { 0x7d, 0x00 }, - { 0x7e, 0x00 }, - { 0x7f, 0x00 }, - { 0x00, 0x00 }, - { 0x7f, 0xaa }, - { 0x00, 0x2e }, - { 0x40, 0x58 }, - { 0x41, 0x3b }, - { 0x42, 0x2f }, - { 0x43, 0x3d }, - { 0x44, 0x58 }, - { 0x45, 0x3b }, - { 0x46, 0x2f }, - { 0x47, 0x3d }, - { 0x48, 0x58 }, - { 0x49, 0x3b }, - { 0x4a, 0x2f }, - { 0x4b, 0x3d }, - { 0x4c, 0xae }, - { 0x4d, 0x1a }, - { 0x4e, 0x80 }, - { 0x4f, 0x9b }, - { 0x50, 0xc2 }, - { 0x51, 0xde }, - { 0x52, 0x41 }, - { 0x53, 0xd5 }, - { 0x00, 0x2b }, - { 0x20, 0x06 }, - { 0x21, 0x55 }, - { 0x22, 0xaf }, - { 0x23, 0xd8 }, - { 0x24, 0xf9 }, - { 0x25, 0xaa }, - { 0x26, 0x50 }, - { 0x27, 0x28 }, - { 0x28, 0x06 }, - { 0x29, 0x55 }, - { 0x2a, 0xaf }, - { 0x2b, 0xd8 }, - { 0x2c, 0xae }, - { 0x2d, 0x1a }, - { 0x2e, 0x80 }, - { 0x2f, 0x9b }, - { 0x30, 0xc2 }, - { 0x31, 0xde }, - { 0x32, 0x41 }, - { 0x33, 0xd5 }, - { 0x0c, 0x06 }, - { 0x0d, 0x55 }, - { 0x0e, 0xaf }, - { 0x0f, 0xd8 }, - { 0x10, 0xf9 }, - { 0x11, 0xaa }, - { 0x12, 0x50 }, - { 0x13, 0x28 }, - { 0x14, 0x06 }, - { 0x15, 0x55 }, - { 0x16, 0xaf }, - { 0x17, 0xd8 }, - { 0x18, 0xae }, - { 0x19, 0x1a }, - { 0x1a, 0x80 }, - { 0x1b, 0x9b }, - { 0x1c, 0xc2 }, - { 0x1d, 0xde }, - { 0x1e, 0x41 }, - { 0x1f, 0xd5 }, - { 0x00, 0x2a }, - { 0x34, 0x00 }, - { 0x35, 0x15 }, - { 0x36, 0xa7 }, - { 0x37, 0x04 }, - { 0x38, 0x00 }, - { 0x39, 0x15 }, - { 0x3a, 0xa7 }, - { 0x3b, 0x04 }, - { 0x3c, 0x00 }, - { 0x3d, 0x15 }, - { 0x3e, 0xa7 }, - { 0x3f, 0x04 }, - { 0x40, 0x7b }, - { 0x41, 0x43 }, - { 0x42, 0x52 }, - { 0x43, 0x44 }, - { 0x44, 0x89 }, - { 0x45, 0x22 }, - { 0x46, 0xbf }, - { 0x47, 0x66 }, - { 0x00, 0x00 }, - { 0x7f, 0x8c }, - { 0x00, 0x2d }, - { 0x30, 0x02 }, - { 0x31, 0xa3 }, - { 0x32, 0x9a }, - { 0x33, 0xcc }, - { 0x34, 0x02 }, - { 0x35, 0xa3 }, - { 0x36, 0x9a }, - { 0x37, 0xcc }, - { 0x38, 0x00 }, - { 0x39, 0x06 }, - { 0x3a, 0xd3 }, - { 0x3b, 0x72 }, - { 0x3c, 0x00 }, - { 0x3d, 0x00 }, - { 0x3e, 0x00 }, - { 0x3f, 0x00 }, - { 0x40, 0x00 }, - { 0x41, 0x00 }, - { 0x42, 0x00 }, - { 0x43, 0x00 }, - { 0x44, 0xff }, - { 0x45, 0x81 }, - { 0x46, 0x47 }, - { 0x47, 0xae }, - { 0x48, 0xf9 }, - { 0x49, 0x06 }, - { 0x4a, 0x21 }, - { 0x4b, 0xa9 }, - { 0x4c, 0xfc }, - { 0x4d, 0xc2 }, - { 0x4e, 0xd8 }, - { 0x4f, 0xc5 }, - { 0x50, 0x00 }, - { 0x51, 0x00 }, - { 0x52, 0x00 }, - { 0x53, 0x00 }, - { 0x54, 0x00 }, - { 0x55, 0x00 }, - { 0x56, 0x00 }, - { 0x57, 0x00 }, - { 0x00, 0x00 }, - { 0x7f, 0xaa }, - { 0x00, 0x2a }, - { 0x5c, 0x7b }, - { 0x5d, 0x58 }, - { 0x5e, 0xf9 }, - { 0x5f, 0x48 }, - { 0x60, 0x84 }, - { 0x61, 0xa7 }, - { 0x62, 0x06 }, - { 0x63, 0xb8 }, - { 0x64, 0x7b }, - { 0x65, 0x58 }, - { 0x66, 0xf9 }, - { 0x67, 0x48 }, - { 0x68, 0x7b }, - { 0x69, 0x43 }, - { 0x6a, 0x52 }, - { 0x6b, 0x44 }, - { 0x6c, 0x89 }, - { 0x6d, 0x22 }, - { 0x6e, 0xbf }, - { 0x6f, 0x66 }, - { 0x70, 0x7b }, - { 0x71, 0x58 }, - { 0x72, 0xf9 }, - { 0x73, 0x48 }, - { 0x74, 0x84 }, - { 0x75, 0xa7 }, - { 0x76, 0x06 }, - { 0x77, 0xb8 }, - { 0x78, 0x7b }, - { 0x79, 0x58 }, - { 0x7a, 0xf9 }, - { 0x7b, 0x48 }, - { 0x7c, 0x7b }, - { 0x7d, 0x43 }, - { 0x7e, 0x52 }, - { 0x7f, 0x44 }, - { 0x00, 0x2b }, - { 0x08, 0x89 }, - { 0x09, 0x22 }, - { 0x0a, 0xbf }, - { 0x0b, 0x66 }, - { 0x00, 0x2e }, - { 0x54, 0x58 }, - { 0x55, 0x3b }, - { 0x56, 0x2f }, - { 0x57, 0x3d }, - { 0x58, 0x58 }, - { 0x59, 0x3b }, - { 0x5a, 0x2f }, - { 0x5b, 0x3d }, - { 0x5c, 0x58 }, - { 0x5d, 0x3b }, - { 0x5e, 0x2f }, - { 0x5f, 0x3d }, - { 0x60, 0xae }, - { 0x61, 0x1a }, - { 0x62, 0x80 }, - { 0x63, 0x9b }, - { 0x64, 0xc2 }, - { 0x65, 0xde }, - { 0x66, 0x41 }, - { 0x67, 0xd5 }, - { 0x00, 0x00 }, - { 0x7f, 0x8c }, - { 0x00, 0x2e }, - { 0x10, 0x00 }, - { 0x11, 0x80 }, - { 0x12, 0x00 }, - { 0x13, 0x00 }, - { 0x0c, 0x00 }, - { 0x0d, 0x80 }, - { 0x0e, 0x00 }, - { 0x0f, 0x00 }, - { 0x08, 0x00 }, - { 0x09, 0x80 }, - { 0x0a, 0x00 }, - { 0x0b, 0x00 }, - { 0x18, 0x00 }, - { 0x19, 0x80 }, - { 0x1a, 0x00 }, - { 0x1b, 0x00 }, - { 0x1c, 0x40 }, - { 0x1d, 0x00 }, - { 0x1e, 0x00 }, - { 0x1f, 0x00 }, - { 0x20, 0x40 }, - { 0x21, 0x00 }, - { 0x22, 0x00 }, - { 0x23, 0x00 }, + {0x00, 0x00}, + {0x7f, 0x00}, + {0x66, 0x86}, + {0x7f, 0x8c}, + {0x00, 0x29}, + {0x18, 0x00}, + {0x19, 0x40}, + {0x1a, 0x26}, + {0x1b, 0xe7}, + {0x1c, 0x00}, + {0x1d, 0x40}, + {0x1e, 0x26}, + {0x1f, 0xe7}, + {0x20, 0x00}, + {0x21, 0x00}, + {0x22, 0x00}, + {0x23, 0x00}, + {0x24, 0x00}, + {0x25, 0x00}, + {0x26, 0x00}, + {0x27, 0x00}, + {0x00, 0x2a}, + {0x24, 0x00}, + {0x25, 0x65}, + {0x26, 0xac}, + {0x27, 0x8c}, + {0x28, 0x00}, + {0x29, 0x65}, + {0x2a, 0xac}, + {0x2b, 0x8c}, + {0x30, 0x00}, + {0x31, 0xe2}, + {0x32, 0xc4}, + {0x33, 0x6b}, + {0x00, 0x2c}, + {0x0c, 0x00}, + {0x0d, 0x00}, + {0x0e, 0x00}, + {0x0f, 0x00}, + {0x10, 0x00}, + {0x11, 0x00}, + {0x12, 0x00}, + {0x13, 0x00}, + {0x14, 0x00}, + {0x15, 0x80}, + {0x16, 0x00}, + {0x17, 0x00}, + {0x18, 0x00}, + {0x19, 0x00}, + {0x1a, 0x00}, + {0x1b, 0x00}, + {0x1c, 0x00}, + {0x1d, 0x80}, + {0x1e, 0x00}, + {0x1f, 0x00}, + {0x20, 0x00}, + {0x21, 0x00}, + {0x22, 0x00}, + {0x23, 0x00}, + {0x28, 0x00}, + {0x29, 0x80}, + {0x2a, 0x00}, + {0x2b, 0x00}, + {0x2c, 0x00}, + {0x2d, 0x00}, + {0x2e, 0x00}, + {0x2f, 0x00}, + {0x34, 0x00}, + {0x35, 0x80}, + {0x36, 0x00}, + {0x37, 0x00}, + {0x38, 0x00}, + {0x39, 0x00}, + {0x3a, 0x00}, + {0x3b, 0x00}, + {0x48, 0x00}, + {0x49, 0x80}, + {0x4a, 0x00}, + {0x4b, 0x00}, + {0x4c, 0x00}, + {0x4d, 0x00}, + {0x4e, 0x00}, + {0x4f, 0x00}, + {0x5c, 0x00}, + {0x5d, 0x00}, + {0x5e, 0xae}, + {0x5f, 0xc3}, + {0x60, 0x00}, + {0x61, 0x45}, + {0x62, 0xa1}, + {0x63, 0xcb}, + {0x64, 0x04}, + {0x65, 0x0c}, + {0x66, 0x37}, + {0x67, 0x14}, + {0x68, 0xc0}, + {0x69, 0x00}, + {0x6a, 0x00}, + {0x6b, 0x00}, + {0x6c, 0x04}, + {0x6d, 0xc1}, + {0x6e, 0xff}, + {0x6f, 0x93}, + {0x74, 0x00}, + {0x75, 0x80}, + {0x76, 0x00}, + {0x77, 0x00}, + {0x00, 0x2d}, + {0x18, 0x7b}, + {0x19, 0x3e}, + {0x1a, 0x00}, + {0x1b, 0x6d}, + {0x1c, 0x00}, + {0x1d, 0x00}, + {0x1e, 0xae}, + {0x1f, 0xc3}, + {0x20, 0x00}, + {0x21, 0x00}, + {0x22, 0x00}, + {0x23, 0x00}, + {0x24, 0x00}, + {0x25, 0x00}, + {0x26, 0x00}, + {0x27, 0x00}, + {0x28, 0x00}, + {0x29, 0x00}, + {0x2a, 0x00}, + {0x2b, 0x00}, + {0x2c, 0x00}, + {0x2d, 0x80}, + {0x2e, 0x00}, + {0x2f, 0x00}, + {0x00, 0x2e}, + {0x24, 0x20}, + {0x25, 0x29}, + {0x26, 0x00}, + {0x27, 0x94}, + {0x00, 0x31}, + {0x48, 0x40}, + {0x49, 0x00}, + {0x4a, 0x00}, + {0x4b, 0x00}, + {0x4c, 0x00}, + {0x4d, 0x00}, + {0x4e, 0x00}, + {0x4f, 0x00}, + {0x50, 0x00}, + {0x51, 0x00}, + {0x52, 0x00}, + {0x53, 0x00}, + {0x54, 0x00}, + {0x55, 0x00}, + {0x56, 0x00}, + {0x57, 0x00}, + {0x58, 0x00}, + {0x59, 0x00}, + {0x5a, 0x00}, + {0x5b, 0x00}, + {0x5c, 0x00}, + {0x5d, 0x00}, + {0x5e, 0x00}, + {0x5f, 0x00}, + {0x60, 0x00}, + {0x61, 0x00}, + {0x62, 0x00}, + {0x63, 0x00}, + {0x64, 0x00}, + {0x65, 0x00}, + {0x66, 0x00}, + {0x67, 0x00}, + {0x68, 0x00}, + {0x69, 0x00}, + {0x6a, 0x00}, + {0x6b, 0x00}, + {0x6c, 0x00}, + {0x6d, 0x00}, + {0x6e, 0x00}, + {0x6f, 0x00}, + {0x70, 0x00}, + {0x71, 0x00}, + {0x72, 0x00}, + {0x73, 0x00}, + {0x74, 0x00}, + {0x75, 0x00}, + {0x76, 0x00}, + {0x77, 0x00}, + {0x78, 0x00}, + {0x79, 0x00}, + {0x7a, 0x00}, + {0x7b, 0x00}, + {0x7c, 0x00}, + {0x7d, 0x00}, + {0x7e, 0x00}, + {0x7f, 0x00}, + {0x00, 0x32}, + {0x08, 0x00}, + {0x09, 0x00}, + {0x0a, 0x00}, + {0x0b, 0x00}, + {0x0c, 0x00}, + {0x0d, 0x00}, + {0x0e, 0x00}, + {0x0f, 0x00}, + {0x10, 0x00}, + {0x11, 0x00}, + {0x12, 0x00}, + {0x13, 0x00}, + {0x14, 0x00}, + {0x15, 0x00}, + {0x16, 0x00}, + {0x17, 0x00}, + {0x18, 0x00}, + {0x19, 0x00}, + {0x1a, 0x00}, + {0x1b, 0x00}, + {0x1c, 0x00}, + {0x1d, 0x00}, + {0x1e, 0x00}, + {0x1f, 0x00}, + {0x20, 0x00}, + {0x21, 0x00}, + {0x22, 0x00}, + {0x23, 0x00}, + {0x24, 0x00}, + {0x25, 0x00}, + {0x26, 0x00}, + {0x27, 0x00}, + {0x28, 0x00}, + {0x29, 0x00}, + {0x2a, 0x00}, + {0x2b, 0x00}, + {0x2c, 0x00}, + {0x2d, 0x00}, + {0x2e, 0x00}, + {0x2f, 0x00}, + {0x30, 0x00}, + {0x31, 0x00}, + {0x32, 0x00}, + {0x33, 0x00}, + {0x34, 0x00}, + {0x35, 0x00}, + {0x36, 0x00}, + {0x37, 0x00}, + {0x38, 0x00}, + {0x39, 0x00}, + {0x3a, 0x00}, + {0x3b, 0x00}, + {0x3c, 0x00}, + {0x3d, 0x00}, + {0x3e, 0x00}, + {0x3f, 0x00}, + {0x40, 0x00}, + {0x41, 0x00}, + {0x42, 0x00}, + {0x43, 0x00}, + {0x44, 0x00}, + {0x45, 0x00}, + {0x46, 0x00}, + {0x47, 0x00}, + {0x48, 0x00}, + {0x49, 0x00}, + {0x4a, 0x00}, + {0x4b, 0x00}, + {0x4c, 0x00}, + {0x4d, 0x00}, + {0x4e, 0x00}, + {0x4f, 0x00}, + {0x50, 0x00}, + {0x51, 0x00}, + {0x52, 0x00}, + {0x53, 0x00}, + {0x54, 0x00}, + {0x55, 0x00}, + {0x56, 0x00}, + {0x57, 0x00}, + {0x58, 0x00}, + {0x59, 0x00}, + {0x5a, 0x00}, + {0x5b, 0x00}, + {0x5c, 0x00}, + {0x5d, 0x00}, + {0x5e, 0x00}, + {0x5f, 0x00}, + {0x60, 0x00}, + {0x61, 0x00}, + {0x62, 0x00}, + {0x63, 0x00}, + {0x64, 0x00}, + {0x65, 0x00}, + {0x66, 0x00}, + {0x67, 0x00}, + {0x68, 0x00}, + {0x69, 0x00}, + {0x6a, 0x00}, + {0x6b, 0x00}, + {0x6c, 0x00}, + {0x6d, 0x00}, + {0x6e, 0x00}, + {0x6f, 0x00}, + {0x70, 0x00}, + {0x71, 0x00}, + {0x72, 0x00}, + {0x73, 0x00}, + {0x74, 0x00}, + {0x75, 0x00}, + {0x76, 0x00}, + {0x77, 0x00}, + {0x78, 0x00}, + {0x79, 0x00}, + {0x7a, 0x00}, + {0x7b, 0x00}, + {0x7c, 0x00}, + {0x7d, 0x00}, + {0x7e, 0x00}, + {0x7f, 0x00}, + {0x00, 0x33}, + {0x08, 0x00}, + {0x09, 0x00}, + {0x0a, 0x00}, + {0x0b, 0x00}, + {0x0c, 0x00}, + {0x0d, 0x00}, + {0x0e, 0x00}, + {0x0f, 0x00}, + {0x10, 0x00}, + {0x11, 0x00}, + {0x12, 0x00}, + {0x13, 0x00}, + {0x14, 0x00}, + {0x15, 0x00}, + {0x16, 0x00}, + {0x17, 0x00}, + {0x18, 0x00}, + {0x19, 0x00}, + {0x1a, 0x00}, + {0x1b, 0x00}, + {0x1c, 0x00}, + {0x1d, 0x00}, + {0x1e, 0x00}, + {0x1f, 0x00}, + {0x20, 0x00}, + {0x21, 0x00}, + {0x22, 0x00}, + {0x23, 0x00}, + {0x24, 0x00}, + {0x25, 0x00}, + {0x26, 0x00}, + {0x27, 0x00}, + {0x28, 0x00}, + {0x29, 0x00}, + {0x2a, 0x00}, + {0x2b, 0x00}, + {0x2c, 0x00}, + {0x2d, 0x00}, + {0x2e, 0x00}, + {0x2f, 0x00}, + {0x30, 0x00}, + {0x31, 0x00}, + {0x32, 0x00}, + {0x33, 0x00}, + {0x34, 0x00}, + {0x35, 0x00}, + {0x36, 0x00}, + {0x37, 0x00}, + {0x38, 0x00}, + {0x39, 0x00}, + {0x3a, 0x00}, + {0x3b, 0x00}, + {0x3c, 0x00}, + {0x3d, 0x00}, + {0x3e, 0x00}, + {0x3f, 0x00}, + {0x40, 0x00}, + {0x41, 0x00}, + {0x42, 0x00}, + {0x43, 0x00}, + {0x44, 0x00}, + {0x45, 0x00}, + {0x46, 0x00}, + {0x47, 0x00}, + {0x48, 0x00}, + {0x49, 0x00}, + {0x4a, 0x00}, + {0x4b, 0x00}, + {0x4c, 0x00}, + {0x4d, 0x00}, + {0x4e, 0x00}, + {0x4f, 0x00}, + {0x50, 0x00}, + {0x51, 0x00}, + {0x52, 0x00}, + {0x53, 0x00}, + {0x54, 0x00}, + {0x55, 0x00}, + {0x56, 0x00}, + {0x57, 0x00}, + {0x58, 0x00}, + {0x59, 0x00}, + {0x5a, 0x00}, + {0x5b, 0x00}, + {0x5c, 0x00}, + {0x5d, 0x00}, + {0x5e, 0x00}, + {0x5f, 0x00}, + {0x60, 0x00}, + {0x61, 0x00}, + {0x62, 0x00}, + {0x63, 0x00}, + {0x64, 0x00}, + {0x65, 0x00}, + {0x66, 0x00}, + {0x67, 0x00}, + {0x68, 0x00}, + {0x69, 0x00}, + {0x6a, 0x00}, + {0x6b, 0x00}, + {0x6c, 0x00}, + {0x6d, 0x00}, + {0x6e, 0x00}, + {0x6f, 0x00}, + {0x70, 0x00}, + {0x71, 0x00}, + {0x72, 0x00}, + {0x73, 0x00}, + {0x74, 0x00}, + {0x75, 0x00}, + {0x76, 0x00}, + {0x77, 0x00}, + {0x78, 0x00}, + {0x79, 0x00}, + {0x7a, 0x00}, + {0x7b, 0x00}, + {0x7c, 0x00}, + {0x7d, 0x00}, + {0x7e, 0x00}, + {0x7f, 0x00}, + {0x00, 0x34}, + {0x08, 0x00}, + {0x09, 0x00}, + {0x0a, 0x00}, + {0x0b, 0x00}, + {0x0c, 0x00}, + {0x0d, 0x00}, + {0x0e, 0x00}, + {0x0f, 0x00}, + {0x10, 0x00}, + {0x11, 0x00}, + {0x12, 0x00}, + {0x13, 0x00}, + {0x14, 0x00}, + {0x15, 0x00}, + {0x16, 0x00}, + {0x17, 0x00}, + {0x18, 0x00}, + {0x19, 0x00}, + {0x1a, 0x00}, + {0x1b, 0x00}, + {0x1c, 0x00}, + {0x1d, 0x00}, + {0x1e, 0x00}, + {0x1f, 0x00}, + {0x20, 0x00}, + {0x21, 0x00}, + {0x22, 0x00}, + {0x23, 0x00}, + {0x24, 0x00}, + {0x25, 0x00}, + {0x26, 0x00}, + {0x27, 0x00}, + {0x28, 0x00}, + {0x29, 0x00}, + {0x2a, 0x00}, + {0x2b, 0x00}, + {0x2c, 0x00}, + {0x2d, 0x00}, + {0x2e, 0x00}, + {0x2f, 0x00}, + {0x30, 0x00}, + {0x31, 0x00}, + {0x32, 0x00}, + {0x33, 0x00}, + {0x34, 0x00}, + {0x35, 0x00}, + {0x36, 0x00}, + {0x37, 0x00}, + {0x38, 0x00}, + {0x39, 0x00}, + {0x3a, 0x00}, + {0x3b, 0x00}, + {0x3c, 0x00}, + {0x3d, 0x00}, + {0x3e, 0x00}, + {0x3f, 0x00}, + {0x40, 0x00}, + {0x41, 0x00}, + {0x42, 0x00}, + {0x43, 0x00}, + {0x44, 0x00}, + {0x45, 0x00}, + {0x46, 0x00}, + {0x47, 0x00}, + {0x48, 0x00}, + {0x49, 0x00}, + {0x4a, 0x00}, + {0x4b, 0x00}, + {0x4c, 0x00}, + {0x4d, 0x00}, + {0x4e, 0x00}, + {0x4f, 0x00}, + {0x50, 0x00}, + {0x51, 0x00}, + {0x52, 0x00}, + {0x53, 0x00}, + {0x54, 0x00}, + {0x55, 0x00}, + {0x56, 0x00}, + {0x57, 0x00}, + {0x58, 0x00}, + {0x59, 0x00}, + {0x5a, 0x00}, + {0x5b, 0x00}, + {0x5c, 0x00}, + {0x5d, 0x00}, + {0x5e, 0x00}, + {0x5f, 0x00}, + {0x60, 0x00}, + {0x61, 0x00}, + {0x62, 0x00}, + {0x63, 0x00}, + {0x64, 0x00}, + {0x65, 0x00}, + {0x66, 0x00}, + {0x67, 0x00}, + {0x68, 0x00}, + {0x69, 0x00}, + {0x6a, 0x00}, + {0x6b, 0x00}, + {0x6c, 0x00}, + {0x6d, 0x00}, + {0x6e, 0x00}, + {0x6f, 0x00}, + {0x70, 0x00}, + {0x71, 0x00}, + {0x72, 0x00}, + {0x73, 0x00}, + {0x74, 0x00}, + {0x75, 0x00}, + {0x76, 0x00}, + {0x77, 0x00}, + {0x78, 0x00}, + {0x79, 0x00}, + {0x7a, 0x00}, + {0x7b, 0x00}, + {0x7c, 0x00}, + {0x7d, 0x00}, + {0x7e, 0x00}, + {0x7f, 0x00}, + {0x00, 0x35}, + {0x08, 0x00}, + {0x09, 0x00}, + {0x0a, 0x00}, + {0x0b, 0x00}, + {0x0c, 0x00}, + {0x0d, 0x00}, + {0x0e, 0x00}, + {0x0f, 0x00}, + {0x10, 0x00}, + {0x11, 0x00}, + {0x12, 0x00}, + {0x13, 0x00}, + {0x14, 0x00}, + {0x15, 0x00}, + {0x16, 0x00}, + {0x17, 0x00}, + {0x18, 0x00}, + {0x19, 0x00}, + {0x1a, 0x00}, + {0x1b, 0x00}, + {0x1c, 0x00}, + {0x1d, 0x00}, + {0x1e, 0x00}, + {0x1f, 0x00}, + {0x20, 0x00}, + {0x21, 0x00}, + {0x22, 0x00}, + {0x23, 0x00}, + {0x24, 0x00}, + {0x25, 0x00}, + {0x26, 0x00}, + {0x27, 0x00}, + {0x28, 0x00}, + {0x29, 0x00}, + {0x2a, 0x00}, + {0x2b, 0x00}, + {0x2c, 0x00}, + {0x2d, 0x00}, + {0x2e, 0x00}, + {0x2f, 0x00}, + {0x30, 0x00}, + {0x31, 0x00}, + {0x32, 0x00}, + {0x33, 0x00}, + {0x34, 0x00}, + {0x35, 0x00}, + {0x36, 0x00}, + {0x37, 0x00}, + {0x38, 0x00}, + {0x39, 0x00}, + {0x3a, 0x00}, + {0x3b, 0x00}, + {0x3c, 0x00}, + {0x3d, 0x00}, + {0x3e, 0x00}, + {0x3f, 0x00}, + {0x40, 0x00}, + {0x41, 0x00}, + {0x42, 0x00}, + {0x43, 0x00}, + {0x44, 0x00}, + {0x45, 0x00}, + {0x46, 0x00}, + {0x47, 0x00}, + {0x48, 0x00}, + {0x49, 0x00}, + {0x4a, 0x00}, + {0x4b, 0x00}, + {0x4c, 0x00}, + {0x4d, 0x00}, + {0x4e, 0x00}, + {0x4f, 0x00}, + {0x50, 0x00}, + {0x51, 0x00}, + {0x52, 0x00}, + {0x53, 0x00}, + {0x54, 0x00}, + {0x55, 0x00}, + {0x56, 0x00}, + {0x57, 0x00}, + {0x58, 0x00}, + {0x59, 0x00}, + {0x5a, 0x00}, + {0x5b, 0x00}, + {0x5c, 0x00}, + {0x5d, 0x00}, + {0x5e, 0x00}, + {0x5f, 0x00}, + {0x60, 0x00}, + {0x61, 0x00}, + {0x62, 0x00}, + {0x63, 0x00}, + {0x64, 0x00}, + {0x65, 0x00}, + {0x66, 0x00}, + {0x67, 0x00}, + {0x00, 0x00}, + {0x7f, 0xaa}, + {0x00, 0x24}, + {0x18, 0x07}, + {0x19, 0xf0}, + {0x1a, 0xe4}, + {0x1b, 0x16}, + {0x1c, 0xf0}, + {0x1d, 0x1e}, + {0x1e, 0x37}, + {0x1f, 0xd3}, + {0x20, 0x07}, + {0x21, 0xf0}, + {0x22, 0xe4}, + {0x23, 0x16}, + {0x24, 0x0f}, + {0x25, 0xe1}, + {0x26, 0xab}, + {0x27, 0xa4}, + {0x28, 0xf8}, + {0x29, 0x1e}, + {0x2a, 0x1b}, + {0x2b, 0x4a}, + {0x2c, 0x07}, + {0x2d, 0xf2}, + {0x2e, 0xc6}, + {0x2f, 0x03}, + {0x30, 0xf0}, + {0x31, 0x1a}, + {0x32, 0x73}, + {0x33, 0xfa}, + {0x34, 0x07}, + {0x35, 0xf2}, + {0x36, 0xc6}, + {0x37, 0x03}, + {0x38, 0x0f}, + {0x39, 0xe5}, + {0x3a, 0x76}, + {0x3b, 0x28}, + {0x3c, 0xf8}, + {0x3d, 0x1a}, + {0x3e, 0x5e}, + {0x3f, 0x1c}, + {0x40, 0x08}, + {0x41, 0x28}, + {0x42, 0x01}, + {0x43, 0xe1}, + {0x44, 0xf0}, + {0x45, 0x35}, + {0x46, 0x45}, + {0x47, 0x27}, + {0x48, 0x07}, + {0x49, 0xa3}, + {0x4a, 0x11}, + {0x4b, 0xa4}, + {0x4c, 0x0f}, + {0x4d, 0xca}, + {0x4e, 0xba}, + {0x4f, 0xd9}, + {0x50, 0xf8}, + {0x51, 0x34}, + {0x52, 0xec}, + {0x53, 0x7b}, + {0x54, 0x07}, + {0x55, 0xfd}, + {0x56, 0x56}, + {0x57, 0xbd}, + {0x58, 0xf0}, + {0x59, 0x0d}, + {0x5a, 0x69}, + {0x5b, 0xed}, + {0x5c, 0x07}, + {0x5d, 0xf7}, + {0x5e, 0xfd}, + {0x5f, 0xbb}, + {0x60, 0x0f}, + {0x61, 0xf2}, + {0x62, 0x96}, + {0x63, 0x13}, + {0x64, 0xf8}, + {0x65, 0x0a}, + {0x66, 0xab}, + {0x67, 0x87}, + {0x68, 0x07}, + {0x69, 0xe1}, + {0x6a, 0xc2}, + {0x6b, 0x69}, + {0x6c, 0xf0}, + {0x6d, 0xac}, + {0x6e, 0x0d}, + {0x6f, 0x58}, + {0x70, 0x07}, + {0x71, 0x94}, + {0x72, 0x0c}, + {0x73, 0x4d}, + {0x74, 0x0f}, + {0x75, 0x53}, + {0x76, 0xf2}, + {0x77, 0xa8}, + {0x78, 0xf8}, + {0x79, 0x8a}, + {0x7a, 0x31}, + {0x7b, 0x49}, + {0x7c, 0x08}, + {0x7d, 0x00}, + {0x7e, 0x00}, + {0x7f, 0x00}, + {0x00, 0x25}, + {0x08, 0x00}, + {0x09, 0x00}, + {0x0a, 0x00}, + {0x0b, 0x00}, + {0x0c, 0x00}, + {0x0d, 0x00}, + {0x0e, 0x00}, + {0x0f, 0x00}, + {0x10, 0x00}, + {0x11, 0x00}, + {0x12, 0x00}, + {0x13, 0x00}, + {0x14, 0x00}, + {0x15, 0x00}, + {0x16, 0x00}, + {0x17, 0x00}, + {0x18, 0x08}, + {0x19, 0x00}, + {0x1a, 0x00}, + {0x1b, 0x00}, + {0x1c, 0xf1}, + {0x1d, 0x79}, + {0x1e, 0xcb}, + {0x1f, 0xec}, + {0x20, 0x06}, + {0x21, 0xa6}, + {0x22, 0x49}, + {0x23, 0xa5}, + {0x24, 0x0e}, + {0x25, 0x86}, + {0x26, 0x34}, + {0x27, 0x14}, + {0x28, 0xf9}, + {0x29, 0x59}, + {0x2a, 0xb6}, + {0x2b, 0x5b}, + {0x2c, 0x09}, + {0x2d, 0x63}, + {0x2e, 0x61}, + {0x2f, 0x75}, + {0x30, 0xf8}, + {0x31, 0x28}, + {0x32, 0x33}, + {0x33, 0x32}, + {0x34, 0x02}, + {0x35, 0xcb}, + {0x36, 0xa2}, + {0x37, 0x07}, + {0x38, 0x05}, + {0x39, 0xc8}, + {0x3a, 0x94}, + {0x3b, 0x61}, + {0x3c, 0xfd}, + {0x3d, 0xe0}, + {0x3e, 0x34}, + {0x3f, 0xf0}, + {0x40, 0x08}, + {0x41, 0x00}, + {0x42, 0x00}, + {0x43, 0x00}, + {0x44, 0xf1}, + {0x45, 0x79}, + {0x46, 0xcb}, + {0x47, 0xec}, + {0x48, 0x06}, + {0x49, 0xa6}, + {0x4a, 0x49}, + {0x4b, 0xa5}, + {0x4c, 0x0e}, + {0x4d, 0x86}, + {0x4e, 0x34}, + {0x4f, 0x14}, + {0x50, 0xf9}, + {0x51, 0x59}, + {0x52, 0xb6}, + {0x53, 0x5b}, + {0x54, 0x07}, + {0x55, 0xd8}, + {0x56, 0xc2}, + {0x57, 0x5c}, + {0x58, 0xf1}, + {0x59, 0x09}, + {0x5a, 0x84}, + {0x5b, 0x20}, + {0x5c, 0x07}, + {0x5d, 0xa4}, + {0x5e, 0xd9}, + {0x5f, 0x7a}, + {0x60, 0x0e}, + {0x61, 0xf6}, + {0x62, 0x7b}, + {0x63, 0xe0}, + {0x64, 0xf8}, + {0x65, 0x82}, + {0x66, 0x64}, + {0x67, 0x2a}, + {0x68, 0x07}, + {0x69, 0xc6}, + {0x6a, 0x16}, + {0x6b, 0x0b}, + {0x6c, 0xf3}, + {0x6d, 0x04}, + {0x6e, 0x30}, + {0x6f, 0xd8}, + {0x70, 0x07}, + {0x71, 0x00}, + {0x72, 0x0d}, + {0x73, 0xc1}, + {0x74, 0x0c}, + {0x75, 0xfb}, + {0x76, 0xcf}, + {0x77, 0x28}, + {0x78, 0xf9}, + {0x79, 0x39}, + {0x7a, 0xdc}, + {0x7b, 0x34}, + {0x7c, 0x07}, + {0x7d, 0xfc}, + {0x7e, 0x8e}, + {0x7f, 0xc5}, + {0x00, 0x26}, + {0x08, 0xf0}, + {0x09, 0x91}, + {0x0a, 0xb8}, + {0x0b, 0xc2}, + {0x0c, 0x07}, + {0x0d, 0xe1}, + {0x0e, 0xf7}, + {0x0f, 0xf1}, + {0x10, 0x0f}, + {0x11, 0x6e}, + {0x12, 0x47}, + {0x13, 0x3e}, + {0x14, 0xf8}, + {0x15, 0x21}, + {0x16, 0x79}, + {0x17, 0x4a}, + {0x18, 0x08}, + {0x19, 0x00}, + {0x1a, 0x00}, + {0x1b, 0x00}, + {0x1c, 0x00}, + {0x1d, 0x00}, + {0x1e, 0x00}, + {0x1f, 0x00}, + {0x20, 0x00}, + {0x21, 0x00}, + {0x22, 0x00}, + {0x23, 0x00}, + {0x24, 0x00}, + {0x25, 0x00}, + {0x26, 0x00}, + {0x27, 0x00}, + {0x28, 0x00}, + {0x29, 0x00}, + {0x2a, 0x00}, + {0x2b, 0x00}, + {0x2c, 0x08}, + {0x2d, 0x00}, + {0x2e, 0x00}, + {0x2f, 0x00}, + {0x30, 0x00}, + {0x31, 0x00}, + {0x32, 0x00}, + {0x33, 0x00}, + {0x34, 0x00}, + {0x35, 0x00}, + {0x36, 0x00}, + {0x37, 0x00}, + {0x38, 0x00}, + {0x39, 0x00}, + {0x3a, 0x00}, + {0x3b, 0x00}, + {0x3c, 0x00}, + {0x3d, 0x00}, + {0x3e, 0x00}, + {0x3f, 0x00}, + {0x40, 0x08}, + {0x41, 0x00}, + {0x42, 0x00}, + {0x43, 0x00}, + {0x44, 0x00}, + {0x45, 0x00}, + {0x46, 0x00}, + {0x47, 0x00}, + {0x48, 0x00}, + {0x49, 0x00}, + {0x4a, 0x00}, + {0x4b, 0x00}, + {0x4c, 0x00}, + {0x4d, 0x00}, + {0x4e, 0x00}, + {0x4f, 0x00}, + {0x50, 0x00}, + {0x51, 0x00}, + {0x52, 0x00}, + {0x53, 0x00}, + {0x54, 0x08}, + {0x55, 0x00}, + {0x56, 0x00}, + {0x57, 0x00}, + {0x58, 0x00}, + {0x59, 0x00}, + {0x5a, 0x00}, + {0x5b, 0x00}, + {0x5c, 0x00}, + {0x5d, 0x00}, + {0x5e, 0x00}, + {0x5f, 0x00}, + {0x60, 0x00}, + {0x61, 0x00}, + {0x62, 0x00}, + {0x63, 0x00}, + {0x64, 0x00}, + {0x65, 0x00}, + {0x66, 0x00}, + {0x67, 0x00}, + {0x68, 0x08}, + {0x69, 0x00}, + {0x6a, 0x00}, + {0x6b, 0x00}, + {0x6c, 0x00}, + {0x6d, 0x00}, + {0x6e, 0x00}, + {0x6f, 0x00}, + {0x70, 0x00}, + {0x71, 0x00}, + {0x72, 0x00}, + {0x73, 0x00}, + {0x74, 0x00}, + {0x75, 0x00}, + {0x76, 0x00}, + {0x77, 0x00}, + {0x78, 0x00}, + {0x79, 0x00}, + {0x7a, 0x00}, + {0x7b, 0x00}, + {0x7c, 0x08}, + {0x7d, 0x00}, + {0x7e, 0x00}, + {0x7f, 0x00}, + {0x00, 0x27}, + {0x08, 0x00}, + {0x09, 0x00}, + {0x0a, 0x00}, + {0x0b, 0x00}, + {0x0c, 0x00}, + {0x0d, 0x00}, + {0x0e, 0x00}, + {0x0f, 0x00}, + {0x10, 0x00}, + {0x11, 0x00}, + {0x12, 0x00}, + {0x13, 0x00}, + {0x14, 0x00}, + {0x15, 0x00}, + {0x16, 0x00}, + {0x17, 0x00}, + {0x18, 0x08}, + {0x19, 0x00}, + {0x1a, 0x00}, + {0x1b, 0x00}, + {0x1c, 0x00}, + {0x1d, 0x00}, + {0x1e, 0x00}, + {0x1f, 0x00}, + {0x20, 0x00}, + {0x21, 0x00}, + {0x22, 0x00}, + {0x23, 0x00}, + {0x24, 0x00}, + {0x25, 0x00}, + {0x26, 0x00}, + {0x27, 0x00}, + {0x28, 0x00}, + {0x29, 0x00}, + {0x2a, 0x00}, + {0x2b, 0x00}, + {0x2c, 0x08}, + {0x2d, 0x00}, + {0x2e, 0x00}, + {0x2f, 0x00}, + {0x30, 0x00}, + {0x31, 0x00}, + {0x32, 0x00}, + {0x33, 0x00}, + {0x34, 0x00}, + {0x35, 0x00}, + {0x36, 0x00}, + {0x37, 0x00}, + {0x38, 0x00}, + {0x39, 0x00}, + {0x3a, 0x00}, + {0x3b, 0x00}, + {0x3c, 0x00}, + {0x3d, 0x00}, + {0x3e, 0x00}, + {0x3f, 0x00}, + {0x40, 0x08}, + {0x41, 0x00}, + {0x42, 0x00}, + {0x43, 0x00}, + {0x44, 0x00}, + {0x45, 0x00}, + {0x46, 0x00}, + {0x47, 0x00}, + {0x48, 0x00}, + {0x49, 0x00}, + {0x4a, 0x00}, + {0x4b, 0x00}, + {0x4c, 0x00}, + {0x4d, 0x00}, + {0x4e, 0x00}, + {0x4f, 0x00}, + {0x50, 0x00}, + {0x51, 0x00}, + {0x52, 0x00}, + {0x53, 0x00}, + {0x54, 0x08}, + {0x55, 0x00}, + {0x56, 0x00}, + {0x57, 0x00}, + {0x58, 0x00}, + {0x59, 0x00}, + {0x5a, 0x00}, + {0x5b, 0x00}, + {0x5c, 0x00}, + {0x5d, 0x00}, + {0x5e, 0x00}, + {0x5f, 0x00}, + {0x60, 0x00}, + {0x61, 0x00}, + {0x62, 0x00}, + {0x63, 0x00}, + {0x64, 0x00}, + {0x65, 0x00}, + {0x66, 0x00}, + {0x67, 0x00}, + {0x68, 0x08}, + {0x69, 0x00}, + {0x6a, 0x00}, + {0x6b, 0x00}, + {0x6c, 0x00}, + {0x6d, 0x00}, + {0x6e, 0x00}, + {0x6f, 0x00}, + {0x70, 0x00}, + {0x71, 0x00}, + {0x72, 0x00}, + {0x73, 0x00}, + {0x74, 0x00}, + {0x75, 0x00}, + {0x76, 0x00}, + {0x77, 0x00}, + {0x78, 0x00}, + {0x79, 0x00}, + {0x7a, 0x00}, + {0x7b, 0x00}, + {0x7c, 0x08}, + {0x7d, 0x00}, + {0x7e, 0x00}, + {0x7f, 0x00}, + {0x00, 0x28}, + {0x08, 0x00}, + {0x09, 0x00}, + {0x0a, 0x00}, + {0x0b, 0x00}, + {0x0c, 0x00}, + {0x0d, 0x00}, + {0x0e, 0x00}, + {0x0f, 0x00}, + {0x10, 0x00}, + {0x11, 0x00}, + {0x12, 0x00}, + {0x13, 0x00}, + {0x14, 0x00}, + {0x15, 0x00}, + {0x16, 0x00}, + {0x17, 0x00}, + {0x18, 0x08}, + {0x19, 0x00}, + {0x1a, 0x00}, + {0x1b, 0x00}, + {0x1c, 0x00}, + {0x1d, 0x00}, + {0x1e, 0x00}, + {0x1f, 0x00}, + {0x20, 0x00}, + {0x21, 0x00}, + {0x22, 0x00}, + {0x23, 0x00}, + {0x24, 0x00}, + {0x25, 0x00}, + {0x26, 0x00}, + {0x27, 0x00}, + {0x28, 0x00}, + {0x29, 0x00}, + {0x2a, 0x00}, + {0x2b, 0x00}, + {0x2c, 0x08}, + {0x2d, 0x00}, + {0x2e, 0x00}, + {0x2f, 0x00}, + {0x30, 0x00}, + {0x31, 0x00}, + {0x32, 0x00}, + {0x33, 0x00}, + {0x34, 0x00}, + {0x35, 0x00}, + {0x36, 0x00}, + {0x37, 0x00}, + {0x38, 0x00}, + {0x39, 0x00}, + {0x3a, 0x00}, + {0x3b, 0x00}, + {0x3c, 0x00}, + {0x3d, 0x00}, + {0x3e, 0x00}, + {0x3f, 0x00}, + {0x40, 0x08}, + {0x41, 0x00}, + {0x42, 0x00}, + {0x43, 0x00}, + {0x44, 0x00}, + {0x45, 0x00}, + {0x46, 0x00}, + {0x47, 0x00}, + {0x48, 0x00}, + {0x49, 0x00}, + {0x4a, 0x00}, + {0x4b, 0x00}, + {0x4c, 0x00}, + {0x4d, 0x00}, + {0x4e, 0x00}, + {0x4f, 0x00}, + {0x50, 0x00}, + {0x51, 0x00}, + {0x52, 0x00}, + {0x53, 0x00}, + {0x54, 0x08}, + {0x55, 0x00}, + {0x56, 0x00}, + {0x57, 0x00}, + {0x58, 0x00}, + {0x59, 0x00}, + {0x5a, 0x00}, + {0x5b, 0x00}, + {0x5c, 0x00}, + {0x5d, 0x00}, + {0x5e, 0x00}, + {0x5f, 0x00}, + {0x60, 0x00}, + {0x61, 0x00}, + {0x62, 0x00}, + {0x63, 0x00}, + {0x64, 0x00}, + {0x65, 0x00}, + {0x66, 0x00}, + {0x67, 0x00}, + {0x68, 0x08}, + {0x69, 0x00}, + {0x6a, 0x00}, + {0x6b, 0x00}, + {0x6c, 0x00}, + {0x6d, 0x00}, + {0x6e, 0x00}, + {0x6f, 0x00}, + {0x70, 0x00}, + {0x71, 0x00}, + {0x72, 0x00}, + {0x73, 0x00}, + {0x74, 0x00}, + {0x75, 0x00}, + {0x76, 0x00}, + {0x77, 0x00}, + {0x78, 0x00}, + {0x79, 0x00}, + {0x7a, 0x00}, + {0x7b, 0x00}, + {0x7c, 0x08}, + {0x7d, 0x00}, + {0x7e, 0x00}, + {0x7f, 0x00}, + {0x00, 0x29}, + {0x08, 0x00}, + {0x09, 0x00}, + {0x0a, 0x00}, + {0x0b, 0x00}, + {0x0c, 0x00}, + {0x0d, 0x00}, + {0x0e, 0x00}, + {0x0f, 0x00}, + {0x10, 0x00}, + {0x11, 0x00}, + {0x12, 0x00}, + {0x13, 0x00}, + {0x14, 0x00}, + {0x15, 0x00}, + {0x16, 0x00}, + {0x17, 0x00}, + {0x00, 0x2e}, + {0x7c, 0x08}, + {0x7d, 0x00}, + {0x7e, 0x00}, + {0x7f, 0x00}, + {0x00, 0x2f}, + {0x08, 0x00}, + {0x09, 0x00}, + {0x0a, 0x00}, + {0x0b, 0x00}, + {0x0c, 0x00}, + {0x0d, 0x00}, + {0x0e, 0x00}, + {0x0f, 0x00}, + {0x10, 0x00}, + {0x11, 0x00}, + {0x12, 0x00}, + {0x13, 0x00}, + {0x14, 0x00}, + {0x15, 0x00}, + {0x16, 0x00}, + {0x17, 0x00}, + {0x1c, 0x08}, + {0x1d, 0x00}, + {0x1e, 0x00}, + {0x1f, 0x00}, + {0x20, 0x00}, + {0x21, 0x00}, + {0x22, 0x00}, + {0x23, 0x00}, + {0x24, 0x00}, + {0x25, 0x00}, + {0x26, 0x00}, + {0x27, 0x00}, + {0x28, 0x00}, + {0x29, 0x00}, + {0x2a, 0x00}, + {0x2b, 0x00}, + {0x2c, 0x00}, + {0x2d, 0x00}, + {0x2e, 0x00}, + {0x2f, 0x00}, + {0x00, 0x2a}, + {0x48, 0x00}, + {0x49, 0x15}, + {0x4a, 0xa7}, + {0x4b, 0x04}, + {0x4c, 0x00}, + {0x4d, 0x15}, + {0x4e, 0xa7}, + {0x4f, 0x04}, + {0x50, 0x00}, + {0x51, 0x15}, + {0x52, 0xa7}, + {0x53, 0x04}, + {0x54, 0x7b}, + {0x55, 0x43}, + {0x56, 0x52}, + {0x57, 0x44}, + {0x58, 0x89}, + {0x59, 0x22}, + {0x5a, 0xbf}, + {0x5b, 0x66}, + {0x00, 0x00}, + {0x7f, 0x8c}, + {0x00, 0x2b}, + {0x34, 0x00}, + {0x35, 0x22}, + {0x36, 0x1d}, + {0x37, 0x95}, + {0x38, 0x02}, + {0x39, 0xa3}, + {0x3a, 0x9a}, + {0x3b, 0xcc}, + {0x3c, 0x00}, + {0x3d, 0x06}, + {0x3e, 0xd3}, + {0x3f, 0x72}, + {0x40, 0x00}, + {0x41, 0x00}, + {0x42, 0x00}, + {0x43, 0x00}, + {0x44, 0x00}, + {0x45, 0x00}, + {0x46, 0x4e}, + {0x47, 0xa5}, + {0x48, 0xff}, + {0x49, 0x81}, + {0x4a, 0x47}, + {0x4b, 0xae}, + {0x4c, 0xf9}, + {0x4d, 0x06}, + {0x4e, 0x21}, + {0x4f, 0xa9}, + {0x50, 0xfc}, + {0x51, 0xc2}, + {0x52, 0xd8}, + {0x53, 0xc5}, + {0x54, 0x00}, + {0x55, 0x00}, + {0x56, 0x00}, + {0x57, 0x00}, + {0x58, 0x00}, + {0x59, 0x02}, + {0x5a, 0x4b}, + {0x5b, 0xce}, + {0x00, 0x2d}, + {0x58, 0x02}, + {0x59, 0xa3}, + {0x5a, 0x9a}, + {0x5b, 0xcc}, + {0x5c, 0x02}, + {0x5d, 0xa3}, + {0x5e, 0x9a}, + {0x5f, 0xcc}, + {0x60, 0x00}, + {0x61, 0x44}, + {0x62, 0x32}, + {0x63, 0x13}, + {0x64, 0x00}, + {0x65, 0x00}, + {0x66, 0x00}, + {0x67, 0x00}, + {0x68, 0x00}, + {0x69, 0x00}, + {0x6a, 0x00}, + {0x6b, 0x00}, + {0x6c, 0xff}, + {0x6d, 0x81}, + {0x6e, 0x47}, + {0x6f, 0xae}, + {0x70, 0xf9}, + {0x71, 0x06}, + {0x72, 0x21}, + {0x73, 0xa9}, + {0x74, 0xfc}, + {0x75, 0xad}, + {0x76, 0x96}, + {0x77, 0x20}, + {0x78, 0x00}, + {0x79, 0x00}, + {0x7a, 0x00}, + {0x7b, 0x00}, + {0x7c, 0x00}, + {0x7d, 0x00}, + {0x7e, 0x00}, + {0x7f, 0x00}, + {0x00, 0x00}, + {0x7f, 0xaa}, + {0x00, 0x2e}, + {0x40, 0x58}, + {0x41, 0x3b}, + {0x42, 0x2f}, + {0x43, 0x3d}, + {0x44, 0x58}, + {0x45, 0x3b}, + {0x46, 0x2f}, + {0x47, 0x3d}, + {0x48, 0x58}, + {0x49, 0x3b}, + {0x4a, 0x2f}, + {0x4b, 0x3d}, + {0x4c, 0xae}, + {0x4d, 0x1a}, + {0x4e, 0x80}, + {0x4f, 0x9b}, + {0x50, 0xc2}, + {0x51, 0xde}, + {0x52, 0x41}, + {0x53, 0xd5}, + {0x00, 0x2b}, + {0x20, 0x06}, + {0x21, 0x55}, + {0x22, 0xaf}, + {0x23, 0xd8}, + {0x24, 0xf9}, + {0x25, 0xaa}, + {0x26, 0x50}, + {0x27, 0x28}, + {0x28, 0x06}, + {0x29, 0x55}, + {0x2a, 0xaf}, + {0x2b, 0xd8}, + {0x2c, 0xae}, + {0x2d, 0x1a}, + {0x2e, 0x80}, + {0x2f, 0x9b}, + {0x30, 0xc2}, + {0x31, 0xde}, + {0x32, 0x41}, + {0x33, 0xd5}, + {0x0c, 0x06}, + {0x0d, 0x55}, + {0x0e, 0xaf}, + {0x0f, 0xd8}, + {0x10, 0xf9}, + {0x11, 0xaa}, + {0x12, 0x50}, + {0x13, 0x28}, + {0x14, 0x06}, + {0x15, 0x55}, + {0x16, 0xaf}, + {0x17, 0xd8}, + {0x18, 0xae}, + {0x19, 0x1a}, + {0x1a, 0x80}, + {0x1b, 0x9b}, + {0x1c, 0xc2}, + {0x1d, 0xde}, + {0x1e, 0x41}, + {0x1f, 0xd5}, + {0x00, 0x2a}, + {0x34, 0x00}, + {0x35, 0x15}, + {0x36, 0xa7}, + {0x37, 0x04}, + {0x38, 0x00}, + {0x39, 0x15}, + {0x3a, 0xa7}, + {0x3b, 0x04}, + {0x3c, 0x00}, + {0x3d, 0x15}, + {0x3e, 0xa7}, + {0x3f, 0x04}, + {0x40, 0x7b}, + {0x41, 0x43}, + {0x42, 0x52}, + {0x43, 0x44}, + {0x44, 0x89}, + {0x45, 0x22}, + {0x46, 0xbf}, + {0x47, 0x66}, + {0x00, 0x00}, + {0x7f, 0x8c}, + {0x00, 0x2d}, + {0x30, 0x02}, + {0x31, 0xa3}, + {0x32, 0x9a}, + {0x33, 0xcc}, + {0x34, 0x02}, + {0x35, 0xa3}, + {0x36, 0x9a}, + {0x37, 0xcc}, + {0x38, 0x00}, + {0x39, 0x06}, + {0x3a, 0xd3}, + {0x3b, 0x72}, + {0x3c, 0x00}, + {0x3d, 0x00}, + {0x3e, 0x00}, + {0x3f, 0x00}, + {0x40, 0x00}, + {0x41, 0x00}, + {0x42, 0x00}, + {0x43, 0x00}, + {0x44, 0xff}, + {0x45, 0x81}, + {0x46, 0x47}, + {0x47, 0xae}, + {0x48, 0xf9}, + {0x49, 0x06}, + {0x4a, 0x21}, + {0x4b, 0xa9}, + {0x4c, 0xfc}, + {0x4d, 0xc2}, + {0x4e, 0xd8}, + {0x4f, 0xc5}, + {0x50, 0x00}, + {0x51, 0x00}, + {0x52, 0x00}, + {0x53, 0x00}, + {0x54, 0x00}, + {0x55, 0x00}, + {0x56, 0x00}, + {0x57, 0x00}, + {0x00, 0x00}, + {0x7f, 0xaa}, + {0x00, 0x2a}, + {0x5c, 0x7b}, + {0x5d, 0x58}, + {0x5e, 0xf9}, + {0x5f, 0x48}, + {0x60, 0x84}, + {0x61, 0xa7}, + {0x62, 0x06}, + {0x63, 0xb8}, + {0x64, 0x7b}, + {0x65, 0x58}, + {0x66, 0xf9}, + {0x67, 0x48}, + {0x68, 0x7b}, + {0x69, 0x43}, + {0x6a, 0x52}, + {0x6b, 0x44}, + {0x6c, 0x89}, + {0x6d, 0x22}, + {0x6e, 0xbf}, + {0x6f, 0x66}, + {0x70, 0x7b}, + {0x71, 0x58}, + {0x72, 0xf9}, + {0x73, 0x48}, + {0x74, 0x84}, + {0x75, 0xa7}, + {0x76, 0x06}, + {0x77, 0xb8}, + {0x78, 0x7b}, + {0x79, 0x58}, + {0x7a, 0xf9}, + {0x7b, 0x48}, + {0x7c, 0x7b}, + {0x7d, 0x43}, + {0x7e, 0x52}, + {0x7f, 0x44}, + {0x00, 0x2b}, + {0x08, 0x89}, + {0x09, 0x22}, + {0x0a, 0xbf}, + {0x0b, 0x66}, + {0x00, 0x2e}, + {0x54, 0x58}, + {0x55, 0x3b}, + {0x56, 0x2f}, + {0x57, 0x3d}, + {0x58, 0x58}, + {0x59, 0x3b}, + {0x5a, 0x2f}, + {0x5b, 0x3d}, + {0x5c, 0x58}, + {0x5d, 0x3b}, + {0x5e, 0x2f}, + {0x5f, 0x3d}, + {0x60, 0xae}, + {0x61, 0x1a}, + {0x62, 0x80}, + {0x63, 0x9b}, + {0x64, 0xc2}, + {0x65, 0xde}, + {0x66, 0x41}, + {0x67, 0xd5}, + {0x00, 0x00}, + {0x7f, 0x8c}, + {0x00, 0x2e}, + {0x10, 0x00}, + {0x11, 0x80}, + {0x12, 0x00}, + {0x13, 0x00}, + {0x0c, 0x00}, + {0x0d, 0x80}, + {0x0e, 0x00}, + {0x0f, 0x00}, + {0x08, 0x00}, + {0x09, 0x80}, + {0x0a, 0x00}, + {0x0b, 0x00}, + {0x18, 0x00}, + {0x19, 0x80}, + {0x1a, 0x00}, + {0x1b, 0x00}, + {0x1c, 0x40}, + {0x1d, 0x00}, + {0x1e, 0x00}, + {0x1f, 0x00}, + {0x20, 0x40}, + {0x21, 0x00}, + {0x22, 0x00}, + {0x23, 0x00}, // Register Tuning - { 0x00, 0x00 }, - { 0x7f, 0x00 }, - { 0x30, 0x00 }, - { 0x4c, 0x30 }, - { 0x03, 0x03 }, + {0x00, 0x00}, + {0x7f, 0x00}, + {0x30, 0x00}, + {0x4c, 0x30}, + {0x03, 0x03}, - { 0x00, 0x00 }, - { 0x7f, 0x00 }, - { 0x78, 0x80 }, + {0x00, 0x00}, + {0x7f, 0x00}, + {0x78, 0x80}, - }; +}; #ifdef __cplusplus } diff --git a/components/audio_hal/driver/zl38063/LICENSE.txt b/components/audio_hal/driver/zl38063/LICENSE.txt new file mode 100644 index 00000000..f92379e7 --- /dev/null +++ b/components/audio_hal/driver/zl38063/LICENSE.txt @@ -0,0 +1,9 @@ +MIT License + +Copyright 2018 Microsemi Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/components/audio_hal/driver/zl38063/Readme_twolf.txt b/components/audio_hal/driver/zl38063/Readme_twolf.txt new file mode 100644 index 00000000..9dbabd46 --- /dev/null +++ b/components/audio_hal/driver/zl38063/Readme_twolf.txt @@ -0,0 +1,36 @@ +The Source code for the Timberwolf device driver is partitioned into 4 folders. + +\api_lib\ +There are 5 files in this folder +The VprocTwolf_access.c/h - +is the user's space OS independent API to read/write specific register of the device to +reset the device into one of the 5 supported reset modes and to boot load a firmware/configuration record into the device. +The API must be used in conjunction with a low level device driver such as microsemi_spis_tw.c/h, VprocGal_HAL.c/h + +vproc_common.c/h - +includes functions and variable declarations that are common to all Microsemi Voice processing devices. +These functions include the Vproc_msDelay(), VprocWait(). The Variables declarations include +the device status codes, and device reset modes enums. As well as multiple macros to enable debug mode. + +the specific user_space hardware abstraction layer code for the ZL38040/05x/06x/08x Timberwolf devices. + +\firmware\ +This folder contains the firmware image , configuration record files and header file. + +NOTE: The firmware of the development board and its corresponding configuration have been encapsulated into a static library. + +\example_apps\ +This folder contains example host applications for the zl38040/050/060/080 Microsemi devices. + +zl38063.c/h - +a series of operations for zl38063, such as initialize, adjust the volume, and so on. + + +NOTE: You can get the latest firmware and related technical support by registering SDS account. + http://sds.microsemi.com/software.php. + + ZLS38063 GUI software(MiTuner Lite GUI Software), ZLS38063 and ZLS38508LITE + http://sds.microsemi.com/software.php?view_type=listrev&id=103386. + + firmware of ZL38063 + http://sds.microsemi.com/software.php?view_type=listrev&id=104598. diff --git a/components/audio_hal/driver/zl38063/api_lib/vprocTwolf_access.c b/components/audio_hal/driver/zl38063/api_lib/vprocTwolf_access.c new file mode 100644 index 00000000..ad1676d6 --- /dev/null +++ b/components/audio_hal/driver/zl38063/api_lib/vprocTwolf_access.c @@ -0,0 +1,1061 @@ +/**************************************************************************** + * vprocTwolf_access.c - Voice Processor devices high level access module + *function definitions + * + * NOTE: The registers of the device are 16-bit wide. A 32-bit access + * is not required. However, the 32-bit access functions are provided + * only if the host wants to access two consecutives 16-bit registers + * in one single access. + * + **************************************************************************** + * Copyright Microsemi Inc, 2018. All rights reserved. + * Licensed under the MIT License. See LICENSE.txt in the project + * root for license information. + * + ***************************************************************************/ + +#include "vprocTwolf_access.h" + +/*------------------------------------------------------*/ +/*TWOLF MACROS-------------------------------*/ +#define HBI_PAGED_READ(offset, length) \ + ((uint16)(((uint16)(offset) << 8) | (length))) +#define HBI_DIRECT_READ(offset, length) \ + ((uint16)(0x8000 | ((uint16)(offset) << 8) | (length))) +#define HBI_PAGED_WRITE(offset, length) \ + ((uint16)(HBI_PAGED_READ(offset, length) | 0x0080)) +#define HBI_DIRECT_WRITE(offset, length) \ + ((uint16)(HBI_DIRECT_READ(offset, length) | 0x0080)) +#define HBI_GLOBAL_DIRECT_WRITE(offset, length) \ + ((uint16)(0xFC00 | ((offset) << 4) | (length))) +#define HBI_CONFIGURE(pinConfig) ((uint16)(0xFD00 | (pinConfig))) +#define HBI_SELECT_PAGE(page) ((uint16)(0xFE00 | (page))) +#define HBI_SELECT_CL_PAGE() \ + ((uint16)(0xFE80) +#define HBI_CL_BROADCAST ((uint16)0xFEFF) +#define HBI_NO_OP ((uint16)0xFFFF) + +#ifndef USING_MICROSEMI_LINUX_KERNEL_DRIVER +/*TWOLF REGisters*/ +#define HOST_CMD_REG 0x0032 /*Host Command register*/ +#define HOST_CMD_IDLE 0x0000 /*idle/ operation complete*/ +#define HOST_CMD_NO_OP 0x0001 /*no-op*/ +#define HOST_CMD_IMG_CFG_LOAD 0x0002 /*load firmware and CR from flash*/ +#define HOST_CMD_IMG_LOAD 0x0003 /*load firmware only from flash*/ +#define HOST_CMD_IMG_CFG_SAVE 0x0004 /*save a firmware and CR to flash*/ +#define HOST_CMD_IMG_CFG_ERASE 0x0005 /*erase a firmware and CR in flash*/ +#define HOST_CMD_CFG_LOAD 0x0006 /*Load CR from flash*/ +#define HOST_CMD_CFG_SAVE 0x0007 /*save CR to flash*/ +#define HOST_CMD_FWR_GO 0x0008 /*start/restart firmware (GO)*/ +#define HOST_CMD_HOST_LOAD_CMP 0x000D /*Host Application Load Complete*/ +#define HOST_CMD_HOST_FLASH_INIT 0x000B /*Host Application flash discovery*/ +#define HOST_CMD_FWR_STOP 0x8000 /*stop firmware */ +#define HOST_CMD_CMD_IN_PROGRESS 0xFFFF /*wait command is in progress */ + +#define PAGE_255_CHKSUM_LO_REG 0x000A +#define PAGE_255_CHKSUM_HI_REG 0x0008 +#define CLK_STATUS_REG 0x014 /*Clock status register*/ +#define PAGE_255_BASE_LO_REG 0x000E +#define PAGE_255_BASE_HI_REG 0x000C +#define HOST_SW_FLAGS_REG 0x0006 +#define HOST_SW_FLAGS_CMD 0x0001 +#define HOST_SW_FLAGS_CMD_NORST 0x0004 + +#define TWOLF_CLK_STATUS_HBI_BOOT 0x0001 + +#define HBI_CONFIG_REG 0xFD00 +#define HBI_CONFIG_ENDIANNESS 0x0000 +#define HBI_CONFIG_DIVEMODE 0x0000 +#define HBI_CONFIG_WAKE 0x0080 +#define HBI_CONFIG_VAL \ + (HBI_CONFIG_ENDIANNESS | HBI_CONFIG_DIVEMODE | HBI_CONFIG_WAKE) + +#define HOST_CMD_PARAM_RESULT_REG 0x034 /*Host Command Param/Result register*/ +#endif /*USING_MICROSEMI_LINUX_KERNEL_DRIVER*/ + +#define TOTAL_FWR_DATA_WORD_PER_LINE 24 +#define TOTAL_FWR_DATA_BYTE_PER_LINE 128 +#define TWOLF_STATUS_NEED_MORE_DATA 22 +#define TWOLF_STATUS_BOOT_COMPLETE 23 + +#define TWOLF_MBCMDREG_SPINWAIT 10000 +#define TWOLF_MAILBOX_SPINWAIT 1000 + +/*--------------------------------------------------------------------*/ +/* VprocTwolfMailboxAcquire(): use this function to + * check for the availability of the mailbox + * + * Input Argument: None + * Return: (VprocStatusType) type error code (0 = success, else= fail) + */ +static VprocStatusType VprocTwolfMailboxAcquire(uint16 flag, uint16 timeout) { + VprocStatusType status = VPROC_STATUS_SUCCESS; + /*Check whether the host owns the command register*/ + uint16 i = 0, temp = 0x0BAD; + for (i = 0; i < timeout; i++) { + status = VprocTwolfHbiRead(HOST_SW_FLAGS_REG, 1, &temp); + if ((status != VPROC_STATUS_SUCCESS)) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", status); + return status; + } + if (!(temp & flag)) { + break; + } + Vproc_msDelay(10); /*wait for reset to complete*/ + } + DEBUG_LOGD(TAG_SPI, "timeout count = %d: \n", i); + if ((i >= timeout) && (temp & flag)) { + return VPROC_STATUS_MAILBOX_BUSY; + } + /*read the Host Command register*/ + return VPROC_STATUS_SUCCESS; +} + +/* VprocTwolfcmdRegAcquire(): use this function to + * check whether the last command completed sucsesfully + * + * Input Argument: None + * Return: (VprocStatusType) type error code (0 = success, else= fail) + */ +static VprocStatusType VprocTwolfcmdRegAcquire(uint16 flag, uint16 timeout) { + VprocStatusType status = VPROC_STATUS_SUCCESS; + /*Check whether the host owns the command register*/ + uint16 i = 0, temp = 0x0BAD; + for (i = 0; i < timeout; i++) { + status = VprocTwolfHbiRead(HOST_CMD_REG, 1, &temp); + if ((status != VPROC_STATUS_SUCCESS)) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", status); + return status; + } + if (temp == flag) { + break; + } + Vproc_msDelay(10); /*wait*/ + } + DEBUG_LOGD(TAG_SPI, "timeout count = %d, cmdReg = 0x%04x: \n", i, temp); + if ((i >= timeout) && (temp != flag)) { + return VPROC_STATUS_CMDREG_BUSY; + } + /*read the Host Command register*/ + return VPROC_STATUS_SUCCESS; +} + +/* VprocTwolfcmdRegWr(): use this function to + * access the host command register + * + * Input Argument: cmd - the command to send + * Return: (VprocStatusType) type error code (0 = success, else= fail) + */ +static VprocStatusType VprocTwolfcmdRegWr(unsigned short cmd) { + VprocStatusType status = VPROC_STATUS_SUCCESS; + unsigned short flag = 0x0BAD; + /*Check whether the host owns the command register*/ + + status = VprocTwolfMailboxAcquire(HOST_SW_FLAGS_CMD, TWOLF_MAILBOX_SPINWAIT); + if ((status != VPROC_STATUS_SUCCESS)) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", status); + return status; + } + /*write the command into the Host Command register*/ + status = VprocTwolfHbiWrite(HOST_CMD_REG, 1, &cmd); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", status); + return status; + } + /*Release the command reg*/ + /*read the Host Command register*/ + flag = HOST_SW_FLAGS_CMD; + status = VprocTwolfHbiWrite(HOST_SW_FLAGS_REG, 1, &flag); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", status); + return status; + } + /*Wait for the command to complete*/ + status = VprocTwolfcmdRegAcquire(HOST_CMD_IDLE, TWOLF_MAILBOX_SPINWAIT); + if ((status != VPROC_STATUS_SUCCESS)) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: CMD_REG - Operation is not complete\n", + status); + return status; + } + return VPROC_STATUS_SUCCESS; +} + +static VprocStatusType VprocTwolfCheckCmdResult(void) { + VprocStatusType status = VPROC_STATUS_SUCCESS; + unsigned short buf; + status = VprocTwolfHbiRead(HOST_CMD_PARAM_RESULT_REG, 1, &buf); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", status); + return status; + } + + if (buf != 0) { + DEBUG_LOGE(TAG_SPI, "Command failed...Resultcode = 0x%04x\n", buf); + return VPROC_STATUS_ERR_VERIFY; + } + return VPROC_STATUS_SUCCESS; +} + +/* spis_tw_hbi_rd16()- Decode the 16-bit T-WOLF Regs Host address into + * page, offset and build the 16-bit command acordingly to the access type. + * then read the 16-bit word data and store it in pdata + * \param[in] + * .addr the 16-bit HBI address + * + * return ::status + */ +static int spis_tw_hbi_rd16(uint16* pdata) { + /*perform the HBI access*/ + if (VprocHALRead(pdata) != 0) { + return VPROC_STATUS_ERR_HBI; + } + return 0; +} + +/* spis_tw_hbi_wr16_cmd()- this function is used for single word access + * It decodes the 16-bit T-WOLF Regs Host address into + * page, offset and build the 16-bit command acordingly to the access type. + * then write the command to the device + * \param[in] + * .addr the 16-bit HBI address + * + * return ::status + */ +static int spis_tw_hbi_wr16_cmd(uint16 addr, uint8 numwords) { + uint16 cmd; + int status = 0; + uint8 page; + uint8 offset; + + page = addr >> 8; + offset = (addr & 0xFF) / 2; + + if (page == 0) { /*Direct page access*/ + cmd = HBI_DIRECT_WRITE(offset, numwords - 1); /*build the cmd*/ + } else { + /*indirect page access*/ + if (page != 0xFF) { + page -= 1; + } + cmd = HBI_SELECT_PAGE(page); + /*select the page*/ + if (VprocHALWrite(cmd) != 0) { + return status; + } + cmd = HBI_PAGED_WRITE(offset, numwords - 1); /*build the cmd*/ + } + /*perform the HBI access*/ + if (VprocHALWrite(cmd) != 0) { /*write the register address*/ + return status; + } + return 0; +} + +/* spis_tw_hbi_rd16()- Decode the 16-bit T-WOLF Regs Host address into + * page, offset and build the 16-bit command acordingly to the access type. + * then read the 16-bit word data and store it in pdata + * \param[in] + * .addr the 16-bit HBI address + * + * return ::status + */ +static int spis_tw_hbi_rd16_cmd(uint16 addr, uint8 numwords) { + uint16 cmd; + int status = 0; + uint8 page; + uint8 offset; + + page = addr >> 8; + offset = (addr & 0xFF) / 2; + + if (page == 0) { + /*Direct page access*/ + cmd = HBI_DIRECT_READ(offset, numwords - 1); /*build the cmd*/ + } else { + /*Indirect page access*/ + if (page != 0xFF) { + page -= 1; + } + cmd = HBI_SELECT_PAGE(page); + /*select the page*/ + if (VprocHALWrite(cmd) != 0) { + return status; + } + cmd = HBI_PAGED_READ(offset, numwords - 1); /*build the cmd*/ + } + + /*perform the HBI access*/ + if (VprocHALWrite(cmd) != 0) { /*write the register address*/ + return status; + } + return 0; +} + +/* spis_tw_hbi_wr16()- this function is used for single word access by the + * ioctl read. It decodes the 16-bit T-WOLF Regs Host address into + * page, offset and build the 16-bit command acordingly to the access type. + * then write the command and data to the device + * \param[in] + * .addr the 16-bit HBI address + * + * return ::status + */ +static int spis_tw_hbi_wr16_data(uint16 data) { + if (VprocHALWrite(data) != 0) { + return VPROC_STATUS_ERR_HBI; + } + return 0; +} + +/****************************************************************************** + * TwolfPagedWrite() + * This function selects the specified page, writes the number of specified + * words, starting at the specified offset from a source buffer. + * + * \param[in] page Page to select + * \param[in] offset Offset of the requested Page to read from + * \param[in] numWords Number of words to read starting from the offset + * \param[in] pSrc Pointer to the date to write + * + * \retval ::VP_STATUS_SUCCESS + * \retval ::VP_STATUS_ERR_HBI + ******************************************************************************/ +static VprocStatusType TwolfHbiPage255Write(unsigned char page, + unsigned char offset, + unsigned char numWords, + unsigned short* pDdata) { + uint16 cmdWrd = (uint16)(page << 8) | (uint16)offset; + if (VprocTwolfHbiWrite(cmdWrd, numWords, pDdata) != VPROC_STATUS_SUCCESS) { + return VPROC_STATUS_ERR_HBI; + } + return VPROC_STATUS_SUCCESS; +} /* TwolfHbiPagedWrite() */ + +/*------------------------------------------------------ + * Higher level functions - Can be called by a host application + *------------------------------------------------------*/ +/*VprocTwolfHbiInit - use this function to initialize the device HBI + * This function can be called at startup during the system init + * Configure the HBI_CONFIG_VAL as per the host system. But default + * config is good for most cases. See HBI section in device datasheet for + * details + * + * \retval ::VPROC_STATUS_SUCCESS + * \retval ::VPROC_STATUS_ERR_HBI + */ + +VprocStatusType VprocTwolfHbiInit(void) { + unsigned short buf = HBI_CONFIG_REG | HBI_CONFIG_VAL; + if (VprocHALInit() != 0) { + return VPROC_STATUS_INIT_FAILED; + } + return VprocHALWrite(buf); +} + +/*VprocTwolfHbiCleanup - To close any open communication path to + * to the device + * + * \retval ::VPROC_STATUS_SUCCESS + * \retval ::VPROC_STATUS_ERR_HBI + */ +VprocStatusType VprocTwolfHbiCleanup(void) { + VprocHALcleanup(); + return VPROC_STATUS_SUCCESS; +} +/*VprocTwolfHbiRead - use this function to read up to 254 words from the device + * \param[in] cmd of the requested device register to read from + * \param[in] numWords Number of words to read starting from the offset + * \param[in] pData Pointer to the data read + * + * \retval ::VPROC_STATUS_SUCCESS + * \retval ::VPROC_STATUS_ERR_HBI + */ +VprocStatusType VprocTwolfHbiRead(unsigned short cmd, /*register to read from*/ + unsigned char numwords, + unsigned short* pData) { + VprocStatusType status = VPROC_STATUS_SUCCESS; + unsigned short tempBuf = 0x0BAD; + unsigned char i = 0; + + // DEBUG_LOGE(TAG_SPI, "cmd = 0x%04x\n", cmd); + status = spis_tw_hbi_rd16_cmd(cmd, numwords); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR: VPROC_STATUS_RD_FAILED,CMD:0x%04x\n", cmd); + return VPROC_STATUS_WR_FAILED; + } + + for (i = 0; i < numwords; i++) { + status = spis_tw_hbi_rd16(&tempBuf); + pData[i] = tempBuf; + // DEBUG_LOGE(TAG_SPI, "pData[%d] = 0x%04x\n", i, pData[i]); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR: VPROC_STATUS_RD_FAILED,CMD:0x%04x\n", cmd); + return VPROC_STATUS_RD_FAILED; + } + } + return status; +} + +/*VprocTwolfHbiWrite - use this function to write up to 252 words to the device + * \param[in] cmd of the requested device register to write to + * \param[in] numWords Number of words to write starting from the offset + * \param[in] pData Pointer to the data to write + * + * \retval ::VPROC_STATUS_SUCCESS + * \retval ::VPROC_STATUS_ERR_HBI + */ +VprocStatusType VprocTwolfHbiWrite(unsigned short cmd, /*register to read from*/ + unsigned char numwords, + unsigned short* pData) { + VprocStatusType status = VPROC_STATUS_SUCCESS; + unsigned char i = 0; + + if ((numwords == 0) || (numwords > 126)) { + DEBUG_LOGE(TAG_SPI, "number of words is out of range. Maximum is 126\n"); + return VPROC_STATUS_INVALID_ARG; + } + /*16-bit SPI access mode - Send only 1 word within the same CS*/ + status = spis_tw_hbi_wr16_cmd(cmd, numwords); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR: VPROC_STATUS_WR_FAILED\n"); + return VPROC_STATUS_WR_FAILED; + } + for (i = 0; i < numwords; i++) { + status = spis_tw_hbi_wr16_data(pData[i]); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR: VPROC_STATUS_WR_FAILED\n"); + return VPROC_STATUS_WR_FAILED; + } + } + return VPROC_STATUS_SUCCESS; +} + +/*VprocTwolfLoadConfig() - use this function to load a custom or new config + * record into the device RAM to override the default config + * \retval ::VPROC_STATUS_SUCCESS + * \retval ::VPROC_STATUS_ERR_HBI + */ +VprocStatusType VprocTwolfLoadConfig(dataArr* pCr2Buf, + unsigned short numElements) { + VprocStatusType status = VPROC_STATUS_SUCCESS; + unsigned short i, buf; + /*stop the current firmware but do not reset the device and do not go to boot + * mode*/ + + /*send the config to the device RAM*/ + for (i = 0; i < numElements; i++) { + buf = pCr2Buf[i].value; + status = VprocTwolfHbiWrite(pCr2Buf[i].reg, 1, &buf); + if (status != VPROC_STATUS_SUCCESS) { + return VPROC_STATUS_ERR_HBI; + } + } + + return status; +} + +/* HbiSrecBoot_alt() Use this alternate method to load the st_twFirmware.c + *(converted *.s3 to c code) to the device + */ +static VprocStatusType HbiSrecBoot_alt(twFirmware* st_firmware) { + uint16 index = 0; + uint16 gTargetAddr[2] = {0, 0}; + VprocStatusType status = VPROC_STATUS_SUCCESS; + while (index < st_firmware->twFirmwareStreamLen) { + /* put the address into our global target addr */ + gTargetAddr[0] = + (uint16)((st_firmware->st_Fwr[index].targetAddr & 0xFFFF0000) >> 16); + gTargetAddr[1] = + (uint16)(st_firmware->st_Fwr[index].targetAddr & 0x0000FFFF); + + // DEBUG_LOGE(TAG_SPI, "gTargetAddr[0] = 0x%04x, gTargetAddr[1] = 0x%04x: + // \n", + // gTargetAddr[0], gTargetAddr[1]); + + // DEBUG_LOGE(TAG_SPI, "numWords = %d: \n", + // st_firmware->st_Fwr[index].numWords); + + /* write the data to the device */ + if (st_firmware->st_Fwr[index].numWords != 0) { + if (st_firmware->st_Fwr[index].useTargetAddr) { + status = VprocTwolfHbiWrite(PAGE_255_BASE_HI_REG, 2, gTargetAddr); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, + "Unable to set gTargetAddr[0] = 0x%04x," + " gTargetAddr[1] = 0x%04x: \n", + gTargetAddr[0], gTargetAddr[1]); + return VPROC_STATUS_ERR_HBI; + } + } + status = TwolfHbiPage255Write(0xFF, (uint8)((gTargetAddr[1] & 0x00FF)), + st_firmware->st_Fwr[index].numWords, + st_firmware->st_Fwr[index].buf); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "status = %d, numWords = %d: \n", status, + st_firmware->st_Fwr[index].numWords); + return status; + } + } + // DEBUG_LOGE(TAG_SPI, "index %d\n", index); + if (index == 9) { + // break; + } + index++; + } + + /* + * convert the number of bytes to two 16 bit + * values and write them to the requested page register + */ + /* even number of bytes required */ + + /* program the program's execution start register */ + gTargetAddr[0] = (uint16)((st_firmware->execAddr & 0xFFFF0000) >> 16); + gTargetAddr[1] = (uint16)(st_firmware->execAddr & 0x0000FFFF); + status = VprocTwolfHbiWrite(0x12C, 2, gTargetAddr); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, " unable to program page 1 execution address\n"); + return status; + } + + /* print out the srecord program info */ + DEBUG_LOGI(TAG_SPI, "prgmBase 0x%08x\n", (int)st_firmware->prgmBase); + DEBUG_LOGI(TAG_SPI, "execAddr 0x%08x\n", (int)st_firmware->execAddr); + DEBUG_LOGI(TAG_SPI, "DONE\n"); + return VPROC_STATUS_SUCCESS; +} + +/*VprocTwolfHbiBoot_alt - use this function to bootload the firmware + * into the device + * \param[in] pointer to image data structure + * + * \retval ::VPROC_STATUS_SUCCESS + * \retval ::VPROC_STATUS_ERR_HBI + * \retval ::VPROC_STATUS_MAILBOX_BUSY + */ +VprocStatusType VprocTwolfHbiBoot_alt(twFirmware* st_firmware) { + VprocStatusType status = VPROC_STATUS_SUCCESS; + unsigned short buf[2] = {0, 0}; + + /* write a value of 1 to address 0x14 (direct page offset 0x0A). + * to stop current firmware, reset the device into the Boot Rom mode. + */ + buf[0] = 1; // TWOLF_CLK_STATUS_HBI_BOOT; + status = VprocTwolfHbiWrite(CLK_STATUS_REG, 1, buf); + if (status != VPROC_STATUS_SUCCESS) { + return VPROC_STATUS_ERR_HBI; + } + Vproc_msDelay(300); /*wait for reset to complete*/ + + buf[0] = buf[1] = 0; + status = VprocTwolfHbiRead(HOST_CMD_PARAM_RESULT_REG, 1, buf); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", status); + return status; + } + /*Check if the device is accessible for command*/ + if ((buf[0] != 0xD3D3)) { + DEBUG_LOGE(TAG_SPI, "ERROR: HBI is not accessible\n"); + return VPROC_STATUS_ERR_HBI; + } + /*Transfer the image*/ + status = HbiSrecBoot_alt(st_firmware); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", status); + return status; + } + + /*tell Twolf that the firmware loading is complete*/ + buf[0] = HOST_CMD_HOST_LOAD_CMP; + status = VprocTwolfcmdRegWr(buf[0]); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", status); + return status; + } + + /*Verify whether the boot loading is successful*/ + if (VprocTwolfCheckCmdResult() != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR: Failed to load the Firmware...\n"); + return VPROC_STATUS_FW_LOAD_FAILED; + } + + return VPROC_STATUS_SUCCESS; +} + +/*The following 3 functions provide a mean to loading the *.s3 firmare into + * the device + * - Call sequence: + * 1- Call VprocTwolfHbiBootPrepare() + * 2- Call VprocTwolfHbiBootMoreData() in a loop by passing one line at a time + * from the *.S3 image file until the whole file is transferred + * to the device. or until a TWOLF_STATUS_BOOT_COMPLETE status + * is reported + * 3- Call VprocTwolfHbiBootConclude() once the whole data is transferred suc- + * cessfully + */ +VprocStatusType VprocTwolfHbiBootPrepare(void) { + unsigned short buf[2] = {0, 0}; + VprocStatusType status = VPROC_STATUS_SUCCESS; + /* write a value of 1 to address 0x14 (direct page offset 0x0A). + * to stop current firmware, reset the device into the Boot Rom mode. + */ + buf[0] = 1; // TWOLF_CLK_STATUS_HBI_BOOT; + status = VprocTwolfHbiWrite(CLK_STATUS_REG, 1, buf); + if (status != VPROC_STATUS_SUCCESS) { + return VPROC_STATUS_ERR_HBI; + } + Vproc_msDelay(300); /*wait for reset to complete*/ + + buf[0] = buf[1] = 0; + status = VprocTwolfHbiRead(HOST_CMD_PARAM_RESULT_REG, 1, buf); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", status); + return status; + } + /*Check if the device is accessible for command*/ + if ((buf[0] != 0xD3D3)) { + DEBUG_LOGE(TAG_SPI, "ERROR: HBI is not accessible\n"); + return VPROC_STATUS_ERR_HBI; + } + + return status; +} +/*AsciiHexToHex() - to convert ascii char hex to integer hex + * pram[in] - str - pointer to the char to convert. + * pram[in] - len - the number of character to convert (2:u8, 4:u16, 8:u32). + + */ +static unsigned int AsciiHexToHex(const char* str, unsigned char len) { + unsigned int val = 0; + char c; + unsigned char i = 0; + for (i = 0; i < len; i++) { + c = *str++; + val <<= 4; + + if (c >= '0' && c <= '9') { + val += c & 0x0F; + continue; + } + + c &= 0xDF; + if (c >= 'A' && c <= 'F') { + val += (c & 0x07) + 9; + continue; + } + return 0; + } + return val; +} +static int spisTwBootWrite(char* blockOfFwrData) /*0: HBI; 1:FLASH*/ +{ + /*Use this method to load the actual *.s3 file line by line*/ + int status = 0; + int rec_type, i = 0, j = 0; + uint8 numbytesPerLine = 0; + uint8 numdataWordPerLine = 0; + uint16 dataBuf[64]; + unsigned long address = 0; + uint8 page255Offset = 0x00; + uint16 cmd = 0; + uint16 gTargetAddr[2] = {0, 0}; + DEBUG_LOGI(TAG_SPI, "blockOfFwrData = %s\n", blockOfFwrData); + + if (blockOfFwrData == NULL) { + DEBUG_LOGE(TAG_SPI, "blockOfFwrData[0] = %c\n", blockOfFwrData[0]); + return VPROC_STATUS_INVALID_ARG; + } + /* if this line is not an srecord skip it */ + if (blockOfFwrData[0] != 'S') { + DEBUG_LOGE(TAG_SPI, "blockOfFwrData[0] = %c\n", blockOfFwrData[0]); + return VPROC_STATUS_INVALID_ARG; + } + numbytesPerLine = AsciiHexToHex(&blockOfFwrData[2], 2); + numdataWordPerLine = (numbytesPerLine - 5) / 2; + DEBUG_LOGI(TAG_SPI, "numbytesPerLine = %d\n", numbytesPerLine); + if (numbytesPerLine == 0) { + DEBUG_LOGE(TAG_SPI, "blockOfFwrData[3] = %c\n", blockOfFwrData[3]); + return VPROC_STATUS_INVALID_ARG; + } + /* get the srecord type */ + rec_type = blockOfFwrData[1] - '0'; + + /* skip non-existent srecord types and block header */ + if ((rec_type == 4) || (rec_type == 5) || (rec_type == 6) || + (rec_type == 0)) { + return TWOLF_STATUS_NEED_MORE_DATA; + } + + /* get the info based on srecord type (skip checksum) */ + address = AsciiHexToHex(&blockOfFwrData[4], 8); + + page255Offset = (uint8)(address & 0xFF); + + gTargetAddr[0] = (uint16)((address & 0xFFFF0000) >> 16); + gTargetAddr[1] = (uint16)(address & 0x0000FFFF); + + /* store the execution address */ + if ((rec_type == 7) || (rec_type == 8) || (rec_type == 9)) { + /* the address is the execution address for the program */ + DEBUG_LOGI(TAG_SPI, "execAddr = 0x%08lx\n", address); + /* program the program's execution start register */ + // status = spis_tw_hbi_multi_wr8(0x012C, 4, buf); + status = VprocTwolfHbiWrite(0x12C, 2, gTargetAddr); + + if (status != 0) { + DEBUG_LOGE(TAG_SPI, " unable to program page 1 execution address\n"); + return status; + } + DEBUG_LOGI(TAG_SPI, "Loading firmware data complete...\n"); + return TWOLF_STATUS_BOOT_COMPLETE; /*BOOT_COMPLETE Sucessfully*/ + } + + /* put the address into our global target addr */ + + // DEBUG_LOGE(TAG_SPI, "gTargetAddr = 0x%08lx: \n", address); + status = VprocTwolfHbiWrite(PAGE_255_BASE_HI_REG, 2, gTargetAddr); + // status = spis_tw_hbi_multi_wr8(PAGE_255_BASE_HI_REG, 4, buf); + if (status != 0) { + DEBUG_LOGE(TAG_SPI, "gTargetAddr = 0x%08lx: \n", address); + return VPROC_STATUS_FW_LOAD_FAILED; + } + + /* get the data bytes */ + j = 12; + DEBUG_LOGI(TAG_SPI, "dataBuf[]=\n"); + for (i = 0; i < numdataWordPerLine; i++) { + dataBuf[i] = AsciiHexToHex(&blockOfFwrData[j], 4); + j += 4; + DEBUG_LOGI(TAG_SPI, "0x%04x, ", dataBuf[i]); + } + /* write the data to the device */ + cmd = (uint16)(0xFF << 8) | (uint16)page255Offset; + status = VprocTwolfHbiWrite(cmd, numdataWordPerLine, dataBuf); + if (status != 0) { + return status; + } + + DEBUG_LOGI(TAG_SPI, "Provide next block of data...\n"); + return TWOLF_STATUS_NEED_MORE_DATA; /*REQUEST STATUS_MORE_DATA*/ +} + +VprocStatusType VprocTwolfHbiBootMoreData(char* dataBlock) { + // return ioctl(twolf_fd, TWOLF_BOOT_SEND_MORE_DATA, dataBlock); + return spisTwBootWrite(dataBlock); +} + +VprocStatusType VprocTwolfHbiBootConclude(void) { + VprocStatusType status = VPROC_STATUS_SUCCESS; + unsigned short buf; + + /*tell Twolf that the firmware loading is complete*/ + buf = HOST_CMD_HOST_LOAD_CMP; + status = VprocTwolfcmdRegWr(buf); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", status); + return status; + } + + /*Verify whether the boot loading is successful*/ + if (VprocTwolfCheckCmdResult() != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR: Failed to load the Firmware...\n"); + return VPROC_STATUS_FW_LOAD_FAILED; + } + return status; + // return status; +} + +/*USe this function to erase a slave flash device controlled by the Twolf*/ +VprocStatusType VprocTwolfEraseFlash(void) { + VprocStatusType status = VPROC_STATUS_SUCCESS; + unsigned short buf; + /*Save firmware to flash*/ + + status = VprocTwolfReset(VPROC_RST_HARDWARE_RAM); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", status); + return status; + } + + buf = HOST_CMD_HOST_FLASH_INIT; + /*if there is a flash on board initialize it*/ + status = VprocTwolfcmdRegWr(buf); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", status); + return status; + } + + buf = 0xAA55; + status = VprocTwolfHbiWrite(HOST_CMD_PARAM_RESULT_REG, 1, &buf); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "Unable to set command reg = 0x%04x: \n", buf); + return VPROC_STATUS_ERR_HBI; + } + + buf = 0x0009; + /*delete all applications on flash*/ + status = VprocTwolfcmdRegWr(buf); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", status); + return status; + } + return VPROC_STATUS_SUCCESS; +} + +/* VprocTwolfReset(): use this function to reset the device. + * + * + * Input Argument: mode - the reset mode (VPROC_RST_HARDWARE_ROM, + * VPROC_RST_HARDWARE_ROM, VPROC_RST_SOFT, VPROC_RST_AEC) + * Return: (VprocStatusType) type error code (0 = success, else= fail) + */ +VprocStatusType VprocTwolfReset(VprocResetMode mode) { + VprocStatusType status = VPROC_STATUS_SUCCESS; + unsigned short buf; + /*PLATFORM SPECIFIC code*/ + if (mode == VPROC_RST_HARDWARE_RAM) { /*hard reset*/ + /*hard reset*/ + buf = 0x05; + status = VprocTwolfHbiWrite(0x014, 1, &buf); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", status); + return status; + } + } else if (mode == VPROC_RST_HARDWARE_ROM) { /*power on reset*/ + /*hard reset*/ + buf = 0x09; + status = VprocTwolfHbiWrite(0x014, 1, &buf); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", status); + return status; + } + } else if (mode == VPROC_RST_AEC) { /*AEC method*/ + buf = 0x01; + status = VprocTwolfHbiWrite(0x0300, 1, &buf); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", status); + return status; + } + } else if (mode == VPROC_RST_SOFTWARE) { /*soft reset*/ + buf = 0x02; + status = VprocTwolfHbiWrite(0x006, 1, &buf); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", status); + return status; + } + } else { + DEBUG_LOGE(TAG_SPI, "Invalid reset type\n"); + return VPROC_STATUS_INVALID_ARG; + } + Vproc_msDelay(200); + return VPROC_STATUS_SUCCESS; +} + +VprocStatusType VprocTwolfSetVolume(uint8 vol) { + VprocStatusType status = VPROC_STATUS_SUCCESS; + unsigned short buf = vol; // Gain A + buf += (unsigned short)vol << 8; // Gain B + VprocHALInit(); + status = VprocTwolfHbiWrite(0x238, 1, &buf); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", status); + return status; + } + status = VprocTwolfHbiWrite(0x23A, 1, &buf); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", status); + return status; + } + return status; +} + +VprocStatusType VprocTwolfGetVolume(int8_t* vol) { + VprocStatusType status = VPROC_STATUS_SUCCESS; + unsigned short buf = 0; + VprocHALInit(); + status = VprocTwolfHbiRead(0x238, 1, &buf); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", status); + return status; + } + *vol = (int8_t)buf; + return status; +} + +VprocStatusType VprocTwolfGetAppStatus(uint16* status) { + VprocStatusType ret = VPROC_STATUS_SUCCESS; + unsigned short buf = 0; + VprocHALInit(); + ret = VprocTwolfHbiRead(0x030, 1, &buf); + if (ret != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", ret); + return ret; + } + *status = buf & 0x0F; + return ret; +} +/* VprocTwolfSaveImgToFlash(): use this function to + * save both the config record and the firmware to flash. It Sets the bit + * which initiates a firmware save to flash when the device + * moves from a STOPPED state to a RUNNING state (by using the GO bit) + * + * Input Argument: None + * Return: (VprocStatusType) type error code (0 = success, else= fail) + */ + +/* VprocTwolfSaveImgToFlash(): use this function to + * save both the config record and the firmware to flash. It Sets the bit + * which initiates a firmware save to flash when the device + * moves from a STOPPED state to a RUNNING state (by using the GO bit) + * + * Input Argument: None + * Return: (VprocStatusType) type error code (0 = success, else= fail) + */ +VprocStatusType VprocTwolfSaveImgToFlash(void) { + unsigned short buf; + VprocStatusType status = VPROC_STATUS_SUCCESS; + /*Save firmware to flash*/ + + buf = HOST_CMD_HOST_FLASH_INIT; + /*if there is a flash on board initialize it*/ + status = VprocTwolfcmdRegWr(buf); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", status); + return status; + } + + buf = 0xAA55; + status = VprocTwolfHbiWrite(HOST_CMD_PARAM_RESULT_REG, 1, &buf); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "Unable to set command reg = 0x%04x: \n", buf); + return VPROC_STATUS_ERR_HBI; + } + + buf = 0x0009; + /*delete all applications on flash*/ + status = VprocTwolfcmdRegWr(buf); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", status); + return status; + } + + buf = HOST_CMD_IMG_CFG_SAVE; + /*save the image to flash*/ + status = VprocTwolfcmdRegWr(buf); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "Save firmware to flash failed... reg = 0x%04x: \n", + buf); + return VPROC_STATUS_ERR_HBI; + } + /*check whethe the actions above were performed successfully*/ + return VprocTwolfCheckCmdResult(); +} + +/* VprocTwolfSaveCfgToFlash(): use this function to + * save the config record to flash. It Sets the bit + * which initiates a config save to flash when the device + * moves from a STOPPED state to a RUNNING state (by using the GO bit) + * + * Input Argument: None + * Return: (VprocStatusType) type error code (0 = success, else= fail) + * The firmware must be stopped first with VprocTwolfFirmwareStop() + */ + +VprocStatusType VprocTwolfSaveCfgToFlash(void) { + unsigned short buf; + VprocStatusType status = VPROC_STATUS_SUCCESS; + /*Save firmware to flash*/ + /*if there is a flash on board initialize it*/ + + /* Clear the checksum register so that the fimrware can calculate a new chk + * value If this register is not cleared first, then an invalid checksum will + * be calculated which will cause this procedure to fail + */ + + buf = HOST_CMD_HOST_FLASH_INIT; + + /*if there is a flash on the board initialize it*/ + status = VprocTwolfcmdRegWr(buf); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", status); + return status; + } + + /*Check if there is a flash device and an image already saved to it - load it + * to RAM*/ + status = VprocTwolfHbiRead(0x026, 1, &buf); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", status); + return status; + } + if ((buf > 0)) { + /*load the corresponding image/cr from flash*/ + buf = 0x0001; + status = VprocTwolfHbiWrite(HOST_CMD_PARAM_RESULT_REG, 1, &buf); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "Unable to set command reg = 0x%04x: \n", buf); + return VPROC_STATUS_ERR_HBI; + } + buf = 0x8002; + status = VprocTwolfHbiWrite(HOST_CMD_REG, 1, &buf); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "Unable to set command reg = 0x%04x: \n", buf); + return VPROC_STATUS_ERR_HBI; + } + + /*Release the command reg*/ + /*read the Host Command register*/ + buf = 0x0004; + status = VprocTwolfHbiWrite(HOST_SW_FLAGS_REG, 1, &buf); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: \n", status); + return status; + } + + status = VprocTwolfcmdRegAcquire(HOST_CMD_IDLE, TWOLF_MAILBOX_SPINWAIT); + if ((status != VPROC_STATUS_SUCCESS)) { + DEBUG_LOGE(TAG_SPI, "ERROR %d: CMD_REG - Operation is not complete\n", + status); + return status; + } + + /*Verify wheter the operation completed sucessfully*/ + status = VprocTwolfCheckCmdResult(); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "Error %d: Unable to verify result-param: \n", + status); + return status; + } + } + + return VPROC_STATUS_SUCCESS; +} + +/*VprocTwolfFirmwareStart - use this function to start/restart the firmware + * previously stopped with VprocTwolfFirmwareStop() + * \param[in] none + * + * \retval ::VPROC_STATUS_SUCCESS + * \retval ::VPROC_STATUS_ERR_HBI + */ +VprocStatusType VprocTwolfFirmwareStart(void) { + unsigned short buf; + + /*Start firmware*/ + buf = HOST_CMD_FWR_GO; + return VprocTwolfcmdRegWr(buf); +} + +/*VprocTwolfFirmwareStop - use this function to stop the firmware currently + * running And set the device in boot mode \param[in] none + * + * \retval ::VPROC_STATUS_SUCCESS + * \retval ::VPROC_STATUS_ERR_HBI + */ +VprocStatusType VprocTwolfFirmwareStop(void) { + unsigned short buf; + + /*Stop firmware*/ + buf = HOST_CMD_FWR_STOP; + return VprocTwolfcmdRegWr(buf); +} diff --git a/components/audio_hal/driver/zl38063/api_lib/vprocTwolf_access.h b/components/audio_hal/driver/zl38063/api_lib/vprocTwolf_access.h new file mode 100644 index 00000000..fc086917 --- /dev/null +++ b/components/audio_hal/driver/zl38063/api_lib/vprocTwolf_access.h @@ -0,0 +1,85 @@ +/**************************************************************************** + * + * vprocTwolf_access.h - Voice Processor devices high level access module + *function prototypes, variables + * + **************************************************************************** + * Copyright Microsemi Inc, 2018. All rights reserved. + * Licensed under the MIT License. See LICENSE.txt in the project + * root for license information. + * + ***************************************************************************/ + +#ifndef VPROC_TWOLFACCESS_H +#define VPROC_TWOLFACCESS_H + +#include "vproc_common.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define TWOLF_MAILBOX_SPINWAIT 1000 /*at least a 1000 to avoid mailbox busy */ + +/*device HBI command structure*/ +typedef struct hbiCmdInfo { + unsigned char page; + unsigned char offset; + unsigned char numwords; +} hbiCmdInfo; + +/* external function prototypes */ + +VprocStatusType VprocTwolfHbiInit( + void); /*Use this function to initialize the HBI bus*/ + +VprocStatusType VprocTwolfHbiRead( + unsigned short cmd, /*the 16-bit register to read from*/ + unsigned char numwords, /* The number of 16-bit words to read*/ + unsigned short *pData); /* Pointer to the read data buffer*/ + +VprocStatusType VprocTwolfHbiWrite( + unsigned short cmd, /*the 16-bit register to write to*/ + unsigned char numwords, /* The number of 16-bit words to write*/ + unsigned short *pData); /*the words (0-255) to write*/ + +VprocStatusType +TwolfHbiNoOp( /*send no-op command to the device*/ + unsigned char numWords); /* The number of no-op (0-255) to write*/ + +/*An alternative method to loading the firmware into the device + * USe this method if you have used the provided tool to convert the *.s3 into + * c code that can be compiled with the application + */ +VprocStatusType +VprocTwolfHbiBoot_alt(/*use this function to boot load the firmware (*.c) from + the host to the device RAM*/ + twFirmware *st_firmware); /*Pointer to the firmware image + in host RAM*/ + +VprocStatusType VprocTwolfLoadConfig(dataArr *pCr2Buf, + unsigned short numElements); + +VprocStatusType VprocTwolfHbiCleanup(void); +VprocStatusType VprocTwolfHbiBootPrepare(void); +VprocStatusType VprocTwolfHbiBootMoreData(char *dataBlock); +VprocStatusType VprocTwolfHbiBootConclude(void); +VprocStatusType VprocTwolfFirmwareStop( + void); /*Use this function to halt the currently running firmware*/ +VprocStatusType VprocTwolfFirmwareStart( + void); /*Use this function to start/restart the firmware currently in RAM*/ +VprocStatusType VprocTwolfSaveImgToFlash( + void); /*Save current loaded firmware from device RAM to FLASH*/ +VprocStatusType VprocTwolfSaveCfgToFlash( + void); /*Save current device config from device RAM to FLASH*/ +VprocStatusType VprocTwolfReset(VprocResetMode mode); +VprocStatusType VprocTwolfEraseFlash(void); +VprocStatusType VprocTwolfLoadFwrCfgFromFlash(uint16 image_number); +VprocStatusType VprocTwolfSetVolume(uint8 vol); +VprocStatusType VprocTwolfGetVolume(int8_t *vol); +VprocStatusType VprocTwolfGetAppStatus(uint16 *status); + +#ifdef __cplusplus +} +#endif +#endif /* VPROCTWOLFACCESS_H */ diff --git a/components/audio_hal/driver/zl38063/api_lib/vproc_common.c b/components/audio_hal/driver/zl38063/api_lib/vproc_common.c new file mode 100644 index 00000000..13191059 --- /dev/null +++ b/components/audio_hal/driver/zl38063/api_lib/vproc_common.c @@ -0,0 +1,165 @@ +/**************************************************************************** + * vproc_common.c - Hal functions for the VPROC API + * + * + **************************************************************************** + * Copyright Microsemi Inc, 2018. All rights reserved. + * Licensed under the MIT License. See LICENSE.txt in the project + * root for license information. + * + ***************************************************************************/ + +#include "vproc_common.h" + +#include +#include + +#include "audio_idf_version.h" +#include "board.h" +#include "driver/gpio.h" +#include "driver/spi_master.h" +#include "lwip/def.h" +#include "soc/gpio_struct.h" + +#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 4)) +#define SPI_HOST_NUM SPI2_HOST +#elif (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)) +#define SPI_HOST_NUM SPI3_HOST +#else +#define SPI_HOST_NUM HSPI_HOST +#endif + +#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)) +#include "esp_rom_sys.h" +#endif + +static spi_device_handle_t g_spi = NULL; + +int VprocHALInit(void) { + /*if the customer platform requires any init + * then implement such init here. + * Otherwise the implementation of this function is complete + */ + esp_err_t ret = ESP_OK; + + spi_bus_config_t buscfg = {0}; + spi_device_interface_config_t devcfg = { + .clock_speed_hz = 1000000, // Clock out at 10 MHz + .mode = 0, // SPI mode 0 + .queue_size = 6, // queue 7 transactions at a time + }; + + get_spi_pins(&buscfg, &devcfg); + // Initialize the SPI bus + if (g_spi) { + return ret; + } + ret = spi_bus_initialize(SPI_HOST_NUM, &buscfg, 0); + assert(ret == ESP_OK); + ret = spi_bus_add_device(SPI_HOST_NUM, &devcfg, &g_spi); + assert(ret == ESP_OK); + gpio_set_pull_mode(0, GPIO_FLOATING); + return ret; +} + +/*HAL clean up function - To close any open file connection + * microsemi_spis_tw kernel char driver + * + * return: a positive integer value for success, a negative integer value for + * failure + */ + +void VprocHALcleanup(void) { + /*if the customer platform requires any cleanup function + * then implement such function here. + * Otherwise the implementation of this function is complete + */ + int ret = 0; + ret = spi_bus_remove_device(g_spi); + assert(ret == ESP_OK); + ret = spi_bus_free(SPI_HOST_NUM); + + assert(ret == ESP_OK); +} +/*Note - These functions are PLATFORM SPECIFIC- They must be modified + * accordingly + **********************************************************************/ + +/* Vproc_msDelay(): use this function to + * force a delay of specified time in resolution of milli-second + * + * Input Argument: time in unsigned 16-bit + * Return: none + */ + +void Vproc_msDelay(unsigned short time) { +#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)) + esp_rom_delay_us(time * 1000); +#else + ets_delay_us(time * 1000); +#endif +} + +/* VprocWait(): use this function to + * force a delay of specified time in resolution of 125 micro-Seconds + * + * Input Argument: time in unsigned 32-bit + * Return: none + */ +void VprocWait(unsigned long int time) { +#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)) + esp_rom_delay_us(time * 1000); +#else + ets_delay_us(time * 1000); +#endif +} + +#define BIGENDIAN 1 + +/* This is the platform dependent low level spi + * function to write 16-bit data to the ZL380xx device + */ +int VprocHALWrite(unsigned short val) { + /*Note: Implement this as per your platform*/ + esp_err_t ret; + spi_transaction_t t; + unsigned short data = 0; + memset(&t, 0, sizeof(t)); // Zero out the transaction + t.length = sizeof(unsigned short) * + 8; // Len is in bytes, transaction length is in bits. +#if BIGENDIAN + data = htons(val); + t.tx_buffer = &data; // Data +#else + t.tx_buffer = &val; +#endif + ret = spi_device_transmit(g_spi, &t); // Transmit + assert(ret == ESP_OK); + + return 0; +} + +/* This is the platform dependent low level spi + * function to read 16-bit data from the ZL380xx device + */ +int VprocHALRead(unsigned short *pVal) { + /*Note: Implement this as per your platform*/ + esp_err_t ret; + spi_transaction_t t; + unsigned short data = 0; + + memset(&t, 0, sizeof(t)); // Zero out the transaction + t.length = sizeof(unsigned short) * 8; + t.rxlength = sizeof(unsigned short) * + 8; // The unit of len is byte, and the unit of length is bit. + t.rx_buffer = &data; + ret = spi_device_transmit(g_spi, &t); // Transmit! +#if BIGENDIAN + *pVal = ntohs(data); +#else + *pVal = data; +#endif + assert(ret == ESP_OK); + + return 0; +} diff --git a/components/audio_hal/driver/zl38063/api_lib/vproc_common.h b/components/audio_hal/driver/zl38063/api_lib/vproc_common.h new file mode 100644 index 00000000..4ed7d9bc --- /dev/null +++ b/components/audio_hal/driver/zl38063/api_lib/vproc_common.h @@ -0,0 +1,129 @@ +/**************************************************************************** + * vproc_common.h - Hal functions prototypes, macros and variables for the VPROC + *API + * + * + **************************************************************************** + * Copyright Microsemi Inc, 2018. All rights reserved. + * Licensed under the MIT License. See LICENSE.txt in the project + * root for license information. + * + ***************************************************************************/ + +#ifndef VPROC_COMMON_H +#define VPROC_COMMON_H + +#include +#include +#include + +#include "esp_log.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define DEBUG_LOGD ESP_LOGD +#define DEBUG_LOGE ESP_LOGE +#define DEBUG_LOGI ESP_LOGI +/*This header includes some platform dependent data types*/ +#include "vproc_data_types.h" + +// #define RETRY_COUNT 100 +#define VPROC_TIMEOUT 500 + +#define TAG_SPI "SPI" + +/* external defines */ +#undef VPROC_DEBUG + +/*create a 16-bit word out of two bytes*/ +#define MAKE16(a, b) \ + (unsigned short)(((unsigned short)(b) << 8) | (unsigned short)(a)) +/*create a 32-bit word out of 4 bytes*/ + +#define MAKE32(a, b, c, d) \ + (unsigned long)(((unsigned long)d << 24) | ((unsigned long)c << 16) | \ + ((unsigned long)b << 8) | ((unsigned long)a)) +/* + * debug - print the function name and line number for the source of the error + * the line number count start at 1 and not 0 + */ + +/* + *Define this macro to report mode debug info + */ +#undef VPROC_API_DBG_INFO +#ifdef VPROC_API_DBG_INFO +#define VPROG_DBG_INFO(s, args...) printf(""s, ##args); +#else +#define VPROG_DBG_INFO(s, args...) +#endif + +#define VPROC_API_DBG_ERROR +#ifdef VPROC_API_DBG_ERROR +#define VPROG_DBG_ERROR(s, args...) \ + printf("---%s %d: "s, __func__, __LINE__, ##args); +#else +#define VPROG_DBG_ERROR(s, args...) +#endif + +/*unsigned char deviceType;*/ +/*device/access Status codes*/ +typedef enum VprocStatusType { + VPROC_STATUS_SUCCESS = 0, + VPROC_STATUS_FAILURE, + VPROC_STATUS_INIT_FAILED, + VPROC_STATUS_WR_FAILED, + VPROC_STATUS_RD_FAILED, + VPROC_STATUS_FW_LOAD_FAILED, + VPROC_STATUS_CFG_LOAD_FAILED, + VPROC_STATUS_CLOSE_FAILED, + VPROC_STATUS_FW_SAVE_FAILED, + VPROC_STATUS_GFG_SAVE_FAILED, + VPROC_STATUS_MAU_NOT_READY, + VPROC_STATUS_CHK_FAILED, + VPROC_STATUS_FUNC_NOT_SUPPORTED, + VPROC_STATUS_INVALID_ARG, + VPROC_STATUS_ERR_VTD_CODE, + VPROC_STATUS_ERR_VERIFY, + VPROC_STATUS_DEVICE_BUSY, + VPROC_STATUS_ERR_HBI, + VPROC_STATUS_ERR_IMAGE, + VPROC_STATUS_MAILBOX_BUSY, + VPROC_STATUS_CMDREG_BUSY, + VPROC_STATUS_IN_CRTCL_SECTN, + VPROC_STATUS_BOOT_LOADING_MORE_DATA, + VPROC_STATUS_BOOT_LOADING_CMP, + VPROC_STATUS_DEV_NOT_INITIALIZED, + +} VprocStatusType; + +/* Device Reset modes*/ +typedef enum VprocResetMode { + VPROC_RST_HARDWARE_ROM = + 0, /*hardware reset -reset the device and reload the firmware from flash*/ + VPROC_RST_HARDWARE_RAM = + 1, /*hardware reset -reset the device and reload the firmware from RAM*/ + VPROC_RST_SOFTWARE = 2, + VPROC_RST_AEC = 3, /*software reset -reset and runs the firmware from RAM*/ + VPROC_RST_BOOT = 4 +} VprocResetMode; + +typedef enum vProcDeviceType { + VPROC_DEV_GALILEO = 1, /*Galileo devices: ZL38004, ZL38012, ZL38005*/ + VPROC_DEV_TIMBERWOLF = 2 /*Timberwolf: ZL38040*/ +} VprocDeviceType; + +extern void VprocHALcleanup(void); +extern int VprocHALInit(void); +extern void Vproc_msDelay(unsigned short time); +extern void VprocWait(unsigned long int time); +extern int VprocHALWrite(unsigned short val); +extern int VprocHALRead(unsigned short* pVal); + +#ifdef __cplusplus +} +#endif + +#endif /* VPROC_COMMON_H */ diff --git a/components/audio_hal/driver/zl38063/api_lib/vproc_data_types.h b/components/audio_hal/driver/zl38063/api_lib/vproc_data_types.h new file mode 100644 index 00000000..409259eb --- /dev/null +++ b/components/audio_hal/driver/zl38063/api_lib/vproc_data_types.h @@ -0,0 +1,124 @@ +/** \file vproc_data_types.h + * vproc_data_types.h + * + * This file is the header for all standard types used in the API code. + * + **************************************************************************** + * Copyright Microsemi Inc, 2018. All rights reserved. + * Licensed under the MIT License. See LICENSE.txt in the project + * root for license information. + * + ***************************************************************************/ + +#ifndef VP_API_TYPES_H +#define VP_API_TYPES_H +/* For maximum that can be stored in an int - if file exists in library */ +#include "esp_types.h" +#include "limits.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef NULL +#define NULL (0) +#endif + +#ifdef EXTERN +#undef EXTERN +#error EXTERN was redefined! +#endif /* undef EXTERN */ + +#ifdef __cplusplus +#define EXTERN extern "C" +#else +#define EXTERN extern +#endif /* __cplusplus */ + +/********************* DECLARATIONS ***************************/ +/* Constants */ +#define FALSE (0) /* Boolean constant */ +#define TRUE (1) /* Boolean constant */ +#ifndef __cplusplus +/* C++ language provides a boolean data type; So no need to define + * one more data type; Make use of it + * NOTE: The 'C' potions of the VP-API assume C++ "bool" to be of the + * same size as that of "char". Please make sure this assumption is correct. + */ + +// typedef unsigned char bool; +#endif /* __cplusplus */ +/****************** typedefs ***********************************/ +/* These are the basic number types used */ +/* for uint8, uint16, uint32, int8, int16, int32, bool */ +// PLATFORM SPECIFIC DEFINITIONS +typedef unsigned char uchar; +typedef signed char int8; +typedef unsigned char UCharT; // 8 bits unsigned - PLATFORM SPECIFIC +typedef unsigned char UInt8T; // 8 bits unsigned - PLATFORM SPECIFIC +typedef unsigned short UInt16T; // 16 bits unsigned - PLATFORM SPECIFIC +typedef unsigned long UInt32T; // 32 bits unsigned - PLATFORM SPECIFIC +typedef signed long Int32T; // 32 bits signed - PLATFORM SPECIFIC +typedef unsigned char uint8; // 8 bits unsigned - PLATFORM SPECIFIC +typedef unsigned short uint16; // 16 bits unsigned - PLATFORM SPECIFIC +typedef uint8* uint8p; // pointer to 8 bits unsigned - PLATFORM SPECIFIC +typedef uint16* uint16p; // pointer to 16 bits unsigned - PLATFORM SPECIFIC +typedef uint32_t uint32; // 32 bits unsigned - PLATFORM SPECIFIC +typedef signed short int16; // 32 bits unsigned - PLATFORM SPECIFIC +typedef uint32* uint32p; +typedef int8* int8p; +typedef int16* int16p; +typedef Int32T* int32p; + +/* external types */ +/* Some compilers optimize the size of enumeration data types based on + * the maximum data value assigned to the members of that data type. + * 'Standard C' requires enumeration data types to be of the same size + * as that of native 'int' implementation. + * The VP-API from a portability persepective adds a 'dummy' member to + * all enumeration data types that force the compilers to allocate the size + * of enumeration data types to be equal to that of native 'int' + * implementation */ +#define FORCE_STANDARD_C_ENUM_SIZE (INT_MAX) + +/* Eliminate error messages that occur when comparing an enumeration constant + < 0 */ +#define FORCE_SIGNED_ENUM (INT_MIN) + +/* Define any API specific basic data type ranges (that are necessary) */ +#define VP_INT16_MAX (SHRT_MAX) +#define VP_INT16_MIN (SHRT_MIN) +#define VP_INT32_MAX (LONG_MAX) +#define VP_INT32_MIN (LONG_MIN) + +/*firmware data structures*/ +typedef struct { + uint16 buf[16]; /*the firmware data block to send to the device*/ + uint16 + numWords; /*the number of words within the block of data stored in buf[]*/ + uint32 targetAddr; /*the target base address to write to register 0x00c of the + device*/ + uint8 useTargetAddr; /*this value is either 0 or 1. When 1 the tarGetAddr must + be written to the device*/ +} twFwr; + +typedef struct { + twFwr* st_Fwr; + uint32 byteCount; /*The total number of bytes within the firmware - NOT USED*/ + uint8 havePrgmBase; + uint32 prgmBase; + uint32 execAddr; /*The execution start address of the firmware in RAM*/ + uint16 twFirmwareStreamLen; /*The number of blocks within the firmware*/ +} twFirmware; + +/*config record structures*/ +typedef struct { + uint16 reg; /*the register */ + uint16 value; /*the value to write into reg */ +} dataArr; + +#ifdef __cplusplus +} +#endif + +#endif /* VP_API_TYPES_H */ diff --git a/components/audio_hal/driver/zl38063/example_apps/tw_hal_verify.c b/components/audio_hal/driver/zl38063/example_apps/tw_hal_verify.c new file mode 100644 index 00000000..af2255b8 --- /dev/null +++ b/components/audio_hal/driver/zl38063/example_apps/tw_hal_verify.c @@ -0,0 +1,307 @@ +/**************************************************************************** + * tw_hal_verify.c - Read/write registers of the device and verify whether the + * device is accessed properly + * + * + **************************************************************************** + * Copyright Microsemi Inc, 2018. All rights reserved. + * Licensed under the MIT License. See LICENSE.txt in the project + * root for license information. + * + ***************************************************************************/ + +#include +#include /* malloc, free, rand */ + +#include "esp_log.h" +#include "vprocTwolf_access.h" +#include "vproc_common.h" +#include "zl38063_config.h" +#include "zl38063_firmware.h" + +/*NOTE: notice that the *.c code are included in the apps- + * This is because the compiler I'm using requires that + * But if your makefile is such that compiler knows where to find these files + * then remove the #include *.c below + */ + +#undef SAVE_IMAGE_TO_FLASH /*define this macro to save the firmware from RAM \ + to flash*/ +#undef SAVE_CFG_TO_FLASH /*define this macro to save the cfg from RAM to \ + flash*/ +/*quick test*/ + +#define TW_HAL_VERIFY_DEBUG + +#define MAX_WORDS_FOR_MULTIWORD_ACCESS_TEST 125 + +static const char* TAG = "TW_HAL_VERIFY"; + +/*LoadFwrConfig_Alt - to load a converted *s3, *cr2 to c code into the device. + * Basically instead of loading the *.s3, *cr2 directly, + * use the tw_convert tool to convert the ascii hex fwr mage into code and + * compile with the application + * + * input arg: mode: 0 - load both firmware and confing + * 1 - load firmware only + * 2 - load config only + */ +VprocStatusType LoadFwrConfig_Alt(uint8 mode) { + VprocStatusType status = VPROC_STATUS_SUCCESS; + if ((mode == 0) || (mode == 1)) { + twFirmware st_Firmware; + st_Firmware.st_Fwr = (twFwr*)st_twFirmware; + st_Firmware.twFirmwareStreamLen = (uint16)firmwareStreamLen; + st_Firmware.execAddr = (uint32)executionAddress; + st_Firmware.havePrgmBase = (uint8)haveProgramBaseAddress; + st_Firmware.prgmBase = (uint32)programBaseAddress; + ESP_LOGD(TAG, "Firmware boot loading started ...."); + status = VprocTwolfHbiBoot_alt(&st_Firmware); + if (status != VPROC_STATUS_SUCCESS) { + ESP_LOGD(TAG, "Error %d:VprocTwolfHbiBoot()", status); + return -1; + } + ESP_LOGD(TAG, "Loading the image to RAM....done"); +#ifdef SAVE_IMAGE_TO_FLASH + ESP_LOGD(TAG, "Saving firmware to flash...."); + status = VprocTwolfSaveImgToFlash(); + if (status != VPROC_STATUS_SUCCESS) { + ESP_LOGD(TAG, "Error %d:VprocTwolfSaveImgToFlash()", status); + + return status; + } + ESP_LOGD(TAG, "Saving firmware to flash....done"); + +#endif + + status = VprocTwolfFirmwareStart(); + if (status != VPROC_STATUS_SUCCESS) { + ESP_LOGD(TAG, "Error %d:VprocTwolfFirmwareStart()", status); + + return status; + } + } + if ((mode == 0) || (mode == 2)) { + ESP_LOGD(TAG, "Loading the config file into the device RAM...."); + + status = + VprocTwolfLoadConfig((dataArr*)st_twConfig, (uint16)configStreamLen); + if (status != VPROC_STATUS_SUCCESS) { + ESP_LOGD(TAG, "Error %d:VprocTwolfLoadConfig()", status); + + return status; + } +#ifdef SAVE_CFG_TO_FLASH + ESP_LOGD(TAG, "Saving config to flash...."); + status = VprocTwolfSaveCfgToFlash(); + if (status != VPROC_STATUS_SUCCESS) { + ESP_LOGD(TAG, "Error %d:VprocTwolfSaveCfgToFlash()", status); + + return status; + } + ESP_LOGD(TAG, "Saving config to flash....done"); + +#endif + } + { /*Verify that the boot loading PASS or Fail*/ + uint16 val = 0; + + status = VprocTwolfHbiRead(0x0022, 1, &val); + if (status != VPROC_STATUS_SUCCESS) { + ESP_LOGD(TAG, "Error %d:VprocTwolfHbiRead()", status); + VprocTwolfHbiCleanup(); + return -1; + } + if ((val == 38040) || (val == 38050) || (val == 38060) || (val == 38080) || + (val == 38051) || (val == 38041)) { + ESP_LOGD(TAG, "Device boot loading completed successfully..."); + } else { + ESP_LOGD(TAG, "Device boot loading failed!!!..."); + return VPROC_STATUS_FAILURE; + } + } + + /*Firmware reset - in order for the configuration to take effect + * NOTE: The ZL38040 needs a soft reset for the uploaded configuration + * to take effect. This soft-reset is sent below + * if the ZL38040 is an I2S slave, if the I2S master is not stable + * at the time of this reset, then that reset will not take effect. + * In that case the host has to to simply resend the reset + * command once the I2S master + * is up and running and is at a stable state. + */ + status = VprocTwolfReset(VPROC_RST_SOFTWARE); + if (status != VPROC_STATUS_SUCCESS) { + ESP_LOGD(TAG, "Error %d:VprocTwolfReset()", status); + + return status; + } + + ESP_LOGD(TAG, "Device boot loading completed successfully..."); + return status; +} + +int test_zl38063(void* arg) { + int status = 0; + uint16 cmdword = 0; + uint16 val[MAX_WORDS_FOR_MULTIWORD_ACCESS_TEST]; + uint8 numwords = 0; + uint16 tempbuf[MAX_WORDS_FOR_MULTIWORD_ACCESS_TEST]; + uint16 i = 0; +#ifdef TW_HAL_VERIFY_DEBUG + uint16 j = 0; +#endif + status = VprocTwolfHbiInit(); + if (status < 0) { + perror("tw_spi_access open"); + return -1; + } + if ((MAX_WORDS_FOR_MULTIWORD_ACCESS_TEST > 125) || + (MAX_WORDS_FOR_MULTIWORD_ACCESS_TEST < 2)) { + ESP_LOGD(TAG, "MAX_WORDS_FOR_MULTIWORD_ACCESS_TEST must between 2 and 126"); + } + memset(val, 0, sizeof(val)); + memset(tempbuf, 0, sizeof(tempbuf)); + + ESP_LOGD(TAG, + "Test 1 - Verifying that the device is present and working ...."); + cmdword = 0x00C; + numwords = 2; + val[0] = 0x1234; + val[1] = 0x5678; + status = VprocTwolfHbiWrite(cmdword, numwords, val); + if (status != VPROC_STATUS_SUCCESS) { + ESP_LOGD(TAG, "Error %d:VprocTwolfHbiWrite()\n", status); + VprocHALcleanup(); + return -1; + } +#ifdef TW_HAL_VERIFY_DEBUG + j = 0; + for (i = 0; i < numwords; i++) { + ESP_LOGD(TAG, "wr: addr 0x%04x = 0x%04x", (cmdword + j), val[i]); + j = j + 2; + } +#endif + status = VprocTwolfHbiRead(cmdword, numwords, tempbuf); + if (status != VPROC_STATUS_SUCCESS) { + ESP_LOGD(TAG, "Error %d:VprocTwolfHbiRead()", status); + VprocTwolfHbiCleanup(); + return -1; + } +#ifdef TW_HAL_VERIFY_DEBUG + j = 0; + for (i = 0; i < numwords; i++) { + ESP_LOGD(TAG, "RD: addr 0x%04x = 0x%04x", (cmdword + j), tempbuf[i]); + j = j + 2; + } +#endif + if ((tempbuf[0] != 0x1234) && (tempbuf[1] != 0x5600)) { + ESP_LOGD(TAG, "Test 1 - completed - FAIL!!!"); + return -1; + } + + ESP_LOGD(TAG, "Test 1 - completed - PASS\n\n"); + + status = VprocTwolfReset(0); + if (status != VPROC_STATUS_SUCCESS) { + ESP_LOGD(TAG, "Error %d:VprocTwolfHbiRead()", status); + VprocTwolfHbiCleanup(); + return -1; + } + ESP_LOGD(TAG, "Device reset completed successfully..."); + + ESP_LOGD(TAG, "Test 2 - Verifying single word write/read access ...."); + cmdword = 0x0300; + val[0] = 0x4008; + numwords = 1; + status = VprocTwolfHbiWrite(cmdword, numwords, val); + if (status != VPROC_STATUS_SUCCESS) { + ESP_LOGD(TAG, "Error %d:VprocTwolfHbiWrite()", status); + VprocTwolfHbiCleanup(); + return -1; + } +#ifdef TW_HAL_VERIFY_DEBUG + j = 0; + for (i = 0; i < numwords; i++) { + ESP_LOGD(TAG, "wr: addr 0x%04x = 0x%04x", (cmdword + j), val[i]); + j = j + 2; + } +#endif + status = VprocTwolfHbiRead(cmdword, numwords, val); + if (status != VPROC_STATUS_SUCCESS) { + ESP_LOGD(TAG, "Error %d:VprocTwolfHbiRead()", status); + VprocTwolfHbiCleanup(); + return -1; + } +#ifdef TW_HAL_VERIFY_DEBUG + j = 0; + for (i = 0; i < numwords; i++) { + ESP_LOGD(TAG, "RD: addr 0x%04x = 0x%04x\n", (cmdword + j), val[i]); + j = j + 2; + } +#endif + if ((val[0] != 0x4008)) { + ESP_LOGD(TAG, "Test 2 - completed - FAIL!!!"); + return -1; + } + ESP_LOGD(TAG, "Test 2 - completed - PASS"); + + ESP_LOGD(TAG, "Test 3 - Verifying multiple words write/read access ...."); + + /* Fill the data buffer with unique data values. */ + for (i = 0; i < MAX_WORDS_FOR_MULTIWORD_ACCESS_TEST; i++) { + val[i] = i | ((0xFF - i) << 8); + } + + cmdword = 0x0300; + numwords = MAX_WORDS_FOR_MULTIWORD_ACCESS_TEST; + status = VprocTwolfHbiWrite(cmdword, numwords, val); + if (status != VPROC_STATUS_SUCCESS) { + ESP_LOGD(TAG, "Error %d:VprocTwolfHbiWrite()", status); + VprocTwolfHbiCleanup(); + return -1; + } +#ifdef TW_HAL_VERIFY_DEBUG + j = 0; + for (i = 0; i < numwords; i++) { + ESP_LOGD(TAG, "twr: addr 0x%04x = 0x%04x", (cmdword + j), val[i]); + j = j + 2; + } +#endif + status = VprocTwolfHbiRead(cmdword, numwords, tempbuf); + if (status != VPROC_STATUS_SUCCESS) { + ESP_LOGD(TAG, "Error %d:VprocTwolfHbiRead()", status); + VprocTwolfHbiCleanup(); + return -1; + } +#ifdef TW_HAL_VERIFY_DEBUG + j = 0; + for (i = 0; i < numwords; i++) { + ESP_LOGD(TAG, "RD: addr 0x%04x = 0x%04x =? 0x%04x", (cmdword + j), + tempbuf[i], val[i]); + j = j + 2; + } +#endif + j = 0; + for (i = 0; i < MAX_WORDS_FOR_MULTIWORD_ACCESS_TEST; i++) { + if (tempbuf[i] != val[i]) { + ESP_LOGD(TAG, "RD: addr 0x%04x = 0x%04x =? 0x%04x", (cmdword + j), + tempbuf[i], val[i]); + ESP_LOGD(TAG, "Test 3 - completed - FAIL!!!"); + return -1; + } + j = j + 2; + } + ESP_LOGD(TAG, "Test 3 - completed - PASS"); + + ESP_LOGD(TAG, "Test 4 - Verifying the firmware/config boot loading ...."); + if (LoadFwrConfig_Alt(0) != VPROC_STATUS_SUCCESS) { + ESP_LOGD(TAG, "Device boot loading failed....."); + ESP_LOGD(TAG, "Test 4 - completed - FAIL!!!"); + + } else { + ESP_LOGD(TAG, "Test 4 - completed - PASS"); + } + VprocTwolfHbiCleanup(); + return 0; +} diff --git a/components/audio_hal/driver/zl38063/example_apps/tw_ldcfg.c b/components/audio_hal/driver/zl38063/example_apps/tw_ldcfg.c new file mode 100644 index 00000000..f41f152d --- /dev/null +++ b/components/audio_hal/driver/zl38063/example_apps/tw_ldcfg.c @@ -0,0 +1,161 @@ +/**************************************************************************** + * tw_ldfwcfg.c - To load a *.s3 firmware and/or a *.cr2 into the device + * and optionally save the loaded image to flash + * + * + **************************************************************************** + * Copyright Microsemi Inc, 2018. All rights reserved. + * Licensed under the MIT License. See LICENSE.txt in the project + * root for license information. + * + ***************************************************************************/ + +#include +#include /* malloc, free, rand */ + +#include "esp_log.h" +#include "vprocTwolf_access.h" +#include "vproc_common.h" + +/*NOTE: notice that the *.c code are included in the apps- + * This is because the compiler I'm using requires that + * But if your makefile is such that compiler knows where to find these files + * then remove the #include *.c below + */ + +#undef SAVE_CFG_TO_FLASH /*define this macro to save the cfg from RAM to \ + flash*/ +static const char* TAG = "TW_LDCFG"; +uint16 numElements; +dataArr* pCr2Buf; + +/* fseekNunlines() -- The firmware file is an ascii text file. + * the information from fseek will not be useful. + * this is our own fseek equivalent + */ +static unsigned long fseekNunlines(FILE* BOOT_FD) { + uint32 line_count = 0; + int c; + + while ((c = fgetc(BOOT_FD)) != EOF) { + if (c == '\n') line_count++; + } + return line_count; +} + +/* readCfgFile() use this function to + * Read the Voice processing cr2 config file into RAM + * filepath -- pointer to the location where to find the file + * pCr2Buf -- the actual firmware data array will be pointed to this buffer + */ +static int readCfgFile(char* filepath) { + unsigned int reg[2], val[2], len; + uint8 done = 0; + uint16 index = 0; + FILE* BOOT_FD; + char* s; + char line[512] = ""; + + BOOT_FD = fopen(filepath, "rb"); + if (BOOT_FD != NULL) { + len = fseekNunlines(BOOT_FD); + if (len <= 0) { + ESP_LOGD(TAG, "Error: file is not of the correct format..."); + return -1; + } + ESP_LOGD(TAG, "fileLength = %u", len); + /*start at the beginning of the file*/ + // fseek(BOOT_FD, 0, SEEK_SET); + + /* allocate memory to contain the reg and val:*/ + pCr2Buf = (dataArr*)malloc(len * sizeof(dataArr)); + if (pCr2Buf == NULL) { + ESP_LOGD(TAG, "not enough memory to allocate %u bytes.. ", + len * sizeof(dataArr)); + return -1; + } + + rewind(BOOT_FD); + /*read and format the data accordingly*/ + numElements = 0; + do { + s = fgets(line, 512, BOOT_FD); + if (line[0] == ';') { + continue; + } else if (s != NULL) { + numElements++; + sscanf(line, "%x %c %x", reg, s, val); + pCr2Buf[index].reg = reg[0]; + pCr2Buf[index].value = val[0]; + // ESP_LOGD(TAG,"pCr2Buf[%d].reg pCr2Buf[%d].value = 0x%04x\t0x%04x\n", + // index, index, pCr2Buf[index].reg, pCr2Buf[index].value); + index++; + } else { + done = 1; + } + + } while (done == 0); + + fclose(BOOT_FD); + ESP_LOGD(TAG, "size of pCr2Buf = %u bytes.. ", sizeof(pCr2Buf)); + } else { + ESP_LOGD(TAG, "Error: can't open file"); + } + return 0; +} + +/*This example host app load the *.s3 firmware to the device RAM. Optionally + * save it to flash Then start the firmware from the execution address in RAM It + * then stops the firmware - Load the cr2 file into RAM. Optionally save it to + * flash Then restarts the firmware + */ + +int main(int argc, char** argv) { + VprocStatusType status = VPROC_STATUS_SUCCESS; + + if (argc != 2) { + ESP_LOGD(TAG, "Error: argc = %d - missing %d arg(s)... ", argc, + 3 - (argc - 1)); + ESP_LOGD(TAG, "command Usage:%s ConfigPath", argv[0]); + exit(1); + } + ESP_LOGD(TAG, ":%s %s %s", argv[0], argv[1], argv[2]); + + /*global file handle*/ + status = VprocTwolfHbiInit(); + + if (status < 0) { + perror("tw_spi_access open"); + return -1; + } + + if (readCfgFile(argv[1]) < 0) { + ESP_LOGD(TAG, "Error:read %s file", argv[1]); + } + ESP_LOGD(TAG, "a- Reading config file to host RAM - done...."); + + ESP_LOGD(TAG, "c- Loading the config file into the device RAM"); + status = VprocTwolfLoadConfig(pCr2Buf, numElements); + if (status != VPROC_STATUS_SUCCESS) { + ESP_LOGD(TAG, "Error %d:VprocTwolfLoadConfig()", status); + VprocTwolfHbiCleanup(); + return -1; + } + +#ifdef SAVE_CONFIG_TO_FLASH + status = VprocTwolfSaveCfgToFlash(); + if (status != VPROC_STATUS_SUCCESS) { + ESP_LOGD(TAG, "Error %d:VprocTwolfSaveCfgToFlash()", status); + VprocTwolfHbiCleanup(); + return -1; + } + ESP_LOGD(TAG, "d- Saving config to flash- done...."); +#endif + + ESP_LOGD(TAG, "e- Loading config record - done...."); + free(pCr2Buf); + pCr2Buf = NULL; + VprocTwolfHbiCleanup(); + + return 0; +} diff --git a/components/audio_hal/driver/zl38063/example_apps/tw_ldfw.c b/components/audio_hal/driver/zl38063/example_apps/tw_ldfw.c new file mode 100644 index 00000000..5e07cc74 --- /dev/null +++ b/components/audio_hal/driver/zl38063/example_apps/tw_ldfw.c @@ -0,0 +1,118 @@ + +/**************************************************************************** + * tw_ldfw.c - To load a *.s3 firmware into the device + * and optionally save the loaded image to flash + * + * + **************************************************************************** + * Copyright Microsemi Inc, 2018. All rights reserved. + * Licensed under the MIT License. See LICENSE.txt in the project + * root for license information. + * + ***************************************************************************/ + +#include "esp_log.h" +#include "vprocTwolf_access.h" +#include "vproc_common.h" + +/*NOTE: notice that the *.c code are included in the apps- + * This is because the compiler I'm using requires that + * But if your makefile is such that compiler knows where to find these files + * then remove the #include *.c below + */ + +// #undef SAVE_IMAGE_TO_FLASH /*define this macro to save the firmware from RAM +// to flash*/ +static const char* TAG = "TW_LDFW"; +/*quick test*/ + +/*This example host app load the *.s3 firmware to the device RAM. Optionally + * save it to flash Then start the firmware from the execution address in RAM + */ +int main(int argc, char** argv) { + VprocStatusType status = VPROC_STATUS_SUCCESS; + FILE* BOOT_FD; + char line[256] = ""; + + if (argc != 2) { + ESP_LOGD(TAG, "Error: argc = %d - missing %d arg(s)... ", argc, + 3 - (argc - 1)); + ESP_LOGD(TAG, "command Usage:%s firmwarePath", argv[0]); + exit(1); + } + ESP_LOGD(TAG, ":%s %s %s", argv[0], argv[1], argv[2]); + + BOOT_FD = fopen(argv[1], "rb"); + if (BOOT_FD == NULL) { + ESP_LOGD(TAG, "Error: can't open file %s", argv[1]); + return -1; + } + + /*global file handle*/ + status = VprocTwolfHbiInit(); + if (status < 0) { + perror("tw_spi_access open"); + fclose(BOOT_FD); + return -1; + } + + ESP_LOGD(TAG, "1- Opening firmware file - done...."); + + status = VprocTwolfHbiBootPrepare(); + if (status != VPROC_STATUS_SUCCESS) { + ESP_LOGD(TAG, "Error %d:VprocTwolfHbiBootPrepare()", status); + fclose(BOOT_FD); + VprocHALcleanup(); + return -1; + } + ESP_LOGD(TAG, "-- Boot prepare - done...."); + + while (fgets(line, 256, BOOT_FD) != NULL) { + status = VprocTwolfHbiBootMoreData(line); + if (status == VPROC_STATUS_BOOT_LOADING_MORE_DATA) { + continue; + } else if (status == VPROC_STATUS_BOOT_LOADING_CMP) { + break; + } else if (status != VPROC_STATUS_SUCCESS) { + ESP_LOGD(TAG, "Error %d:VprocTwolfHbiBootMoreData()", status); + fclose(BOOT_FD); + VprocHALcleanup(); + return -1; + } + } + ESP_LOGD(TAG, "-- Firmware data transfer - done...."); + fclose(BOOT_FD); + /*clean up and verify that the boodloading completed correctly*/ + status = VprocTwolfHbiBootConclude(); + if (status != VPROC_STATUS_SUCCESS) { + ESP_LOGD(TAG, "Error %d:VprocTwolfHbiBootConclude()", status); + VprocHALcleanup(); + return -1; + } + + ESP_LOGD(TAG, "2- Loading firmware - done...."); +#ifdef SAVE_IMAGE_TO_FLASH + ESP_LOGD(TAG, "-- Saving firmware to flash...."); + status = VprocTwolfSaveImgToFlash(); + if (status != VPROC_STATUS_SUCCESS) { + ESP_LOGD(TAG, "Error %d:VprocTwolfSaveImgToFlash()", status); + VprocHALcleanup(); + return -1; + } + ESP_LOGD(TAG, "-- Saving firmware to flash....done"); + +#endif + + status = VprocTwolfFirmwareStart(); + if (status != VPROC_STATUS_SUCCESS) { + ESP_LOGD(TAG, "Error %d:VprocTwolfFirmwareStart()", status); + VprocHALcleanup(); + return -1; + } + + ESP_LOGD(TAG, "Device boot loading completed successfully..."); + + VprocHALcleanup(); + + return 0; +} diff --git a/components/audio_hal/driver/zl38063/example_apps/tw_ldfwcfg.c b/components/audio_hal/driver/zl38063/example_apps/tw_ldfwcfg.c new file mode 100644 index 00000000..36cd015a --- /dev/null +++ b/components/audio_hal/driver/zl38063/example_apps/tw_ldfwcfg.c @@ -0,0 +1,222 @@ +/**************************************************************************** + * tw_ldfwcfg.c - To load a *.s3 firmware and/or a *.cr2 into the device + * and optionally save the loaded image to flash + * + * + **************************************************************************** + * Copyright Microsemi Inc, 2018. All rights reserved. + * Licensed under the MIT License. See LICENSE.txt in the project + * root for license information. + * + ***************************************************************************/ + +#include +#include /* malloc, free, rand */ + +#include "vprocTwolf_access.h" +#include "vproc_common.h" + +/*NOTE: notice that the *.c code are included in the apps- + * This is because the compiler I'm using requires that + * But if your makefile is such that compiler knows where to find these files + * then remove the #include *.c below + */ + +#undef SAVE_IMAGE_TO_FLASH /*define this macro to save the firmware from RAM \ + to flash*/ +#undef SAVE_CFG_TO_FLASH /*define this macro to save the cfg from RAM to \ + flash*/ +/*quick test*/ + +uint16 numElements; + +dataArr* pCr2Buf; +/* fseekNunlines() -- The firmware file is an ascii text file. + * the information from fseek will not be useful. + * this is our own fseek equivalent. + */ +static unsigned long fseekNunlines(FILE* BOOT_FD) { + uint32 line_count = 0; + int c; + + while ((c = fgetc(BOOT_FD)) != EOF) { + if (c == '\n') line_count++; + } + return line_count; +} + +/* readCfgFile() use this function to + * Read the Voice processing cr2 config file into RAM + * filepath -- pointer to the location where to find the file + * pCr2Buf -- the actual firmware data array will be pointed to this buffer + */ +static int readCfgFile(char* filepath) { + unsigned int reg[2], val[2], len; + uint8 done = 0; + uint16 index = 0; + FILE* BOOT_FD; + char* s; + char line[512] = ""; + + BOOT_FD = fopen(filepath, "rb"); + if (BOOT_FD != NULL) { + len = fseekNunlines(BOOT_FD); + if (len <= 0) { + printf("Error: file is not of the correct format...\n"); + return -1; + } + // printf("fileLength = %u\n", len); + /*start at the beginning of the file*/ + // fseek(BOOT_FD, 0, SEEK_SET); + + /* allocate memory to contain the reg and val:*/ + pCr2Buf = (dataArr*)malloc(len * sizeof(dataArr)); + if (pCr2Buf == NULL) { + printf("not enough memory to allocate %u bytes.. ", + len * sizeof(dataArr)); + return -1; + } + + rewind(BOOT_FD); + /*read and format the data accordingly*/ + numElements = 0; + do { + s = fgets(line, 512, BOOT_FD); + if (line[0] == ';') { + continue; + } else if (s != NULL) { + numElements++; + sscanf(line, "%x %c %x", reg, s, val); + pCr2Buf[index].reg = reg[0]; + pCr2Buf[index].value = val[0]; + // printf("pCr2Buf[%d].reg pCr2Buf[%d].value = 0x%04x\t0x%04x\n", + // index, index, pCr2Buf[index].reg, pCr2Buf[index].value); + index++; + } else { + done = 1; + } + + } while (done == 0); + + fclose(BOOT_FD); + // printf ("size of pCr2Buf = %u bytes.. \n", len*sizeof(pCr2Buf)); + } else { + printf("Error: can't open file\n"); + } + return 0; +} + +/*This example host app load the *.s3 firmware to the device RAM. Optionally + * save it to flash Then start the firmware from the execution address in RAM It + * then stops the firmware - Load the cr2 file into RAM. Optionally save it to + * flash Then resstarts the firmware + */ +int main(int argc, char** argv) { + VprocStatusType status = VPROC_STATUS_SUCCESS; + FILE* BOOT_FD; + char line[256] = ""; + + if (argc < 3) { + printf("Error: argc = %d - missing %d arg(s)... \n", argc, 3 - (argc - 1)); + printf("command Usage:%s firmwarePath ConfigPath\n", argv[0]); + exit(1); + } + printf(":%s %s %s\n", argv[0], argv[1], argv[2]); + + BOOT_FD = fopen(argv[1], "rb"); + if (BOOT_FD == NULL) { + printf("Error: can't open file %s\n", argv[1]); + return -1; + } + /*global file handle*/ + status = VprocTwolfHbiInit(); + // gTwolf_fd = open(file_name, O_RDWR); + if (status < 0) { + perror("tw_spi_access open"); + fclose(BOOT_FD); + return -1; + } + + printf("1- Opening firmware file - done....\n"); + + status = VprocTwolfHbiBootPrepare(); + if (status != VPROC_STATUS_SUCCESS) { + printf("Error %d:VprocTwolfHbiBootPrepare()\n", status); + fclose(BOOT_FD); + VprocTwolfHbiCleanup(); + return -1; + } + printf("-- Boot prepare - done....\n"); + + while (fgets(line, 256, BOOT_FD) != NULL) { + status = VprocTwolfHbiBootMoreData(line); + if (status == VPROC_STATUS_BOOT_LOADING_MORE_DATA) { + continue; + } else if (status == VPROC_STATUS_BOOT_LOADING_CMP) { + break; + } else if (status != VPROC_STATUS_SUCCESS) { + printf("Error %d:VprocTwolfHbiBootMoreData()\n", status); + fclose(BOOT_FD); + VprocTwolfHbiCleanup(); + return -1; + } + } + printf("-- Firmware data transfer - done....\n"); + fclose(BOOT_FD); + + status = VprocTwolfHbiBootConclude(); + if (status != VPROC_STATUS_SUCCESS) { + printf("Error %d:VprocTwolfHbiBootConclude()\n", status); + VprocTwolfHbiCleanup(); + return -1; + } + +#ifdef SAVE_IMAGE_TO_FLASH + printf("-- Saving firmware to flash....\n"); + status = VprocTwolfSaveImgToFlash(); + if (status != VPROC_STATUS_SUCCESS) { + printf("Error %d:VprocTwolfSaveImgToFlash()\n", status); + VprocTwolfHbiCleanup(); + return -1; + } + printf("-- Saving firmware to flash....done\n"); + +#endif + + status = VprocTwolfFirmwareStart(); + if (status != VPROC_STATUS_SUCCESS) { + printf("Error %d:VprocTwolfFirmwareStart()\n", status); + VprocTwolfHbiCleanup(); + return -1; + } + + printf("3- Loading the config file into the device RAM\n"); + if (readCfgFile(argv[2]) < 0) { + printf("Error:read %s file\n", argv[2]); + } + printf("a- Reading config file to host RAM - done....\n"); + + status = VprocTwolfLoadConfig(pCr2Buf, numElements); + if (status != VPROC_STATUS_SUCCESS) { + printf("Error %d:VprocTwolfLoadConfig()\n", status); + VprocTwolfHbiCleanup(); + return -1; + } + +#ifdef SAVE_CFG_TO_FLASH + printf("-- Saving config to flash....\n"); + status = VprocTwolfSaveCfgToFlash(); + if (status != VPROC_STATUS_SUCCESS) { + printf("Error %d:VprocTwolfSaveCfgToFlash()\n", status); + VprocTwolfHbiCleanup(); + return -1; + } + printf("-- Saving config to flash....done\n"); + +#endif + printf("Device boot loading completed successfully...\n"); + + VprocTwolfHbiCleanup(); + + return 0; +} diff --git a/components/audio_hal/driver/zl38063/example_apps/tw_spi_access.c b/components/audio_hal/driver/zl38063/example_apps/tw_spi_access.c new file mode 100644 index 00000000..da801711 --- /dev/null +++ b/components/audio_hal/driver/zl38063/example_apps/tw_spi_access.c @@ -0,0 +1,458 @@ +/**************************************************************************** + * tw_spi_access.c - Demo apps demonstrating how to access registers of the + * device over spi or I2C. Loading a firmware and or config into the device + * + * + **************************************************************************** + * Copyright Microsemi Inc, 2018. All rights reserved. + * Licensed under the MIT License. See LICENSE.txt in the project + * root for license information. + * + ***************************************************************************/ + +#include "vprocTwolf_access.h" +#include "vproc_common.h" + +/*NOTE: notice that the *.c code are included in the apps- + * This is because the compiler I'm using requires that + * But if your makefile is such that compiler knows where to find these files + * then remove the #include *.c below + */ +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "zl38063_config.h" +#include "zl38063_firmware.h" + +#undef SAVE_IMAGE_TO_FLASH /*define this macro to save the firmware from RAM \ + to flash*/ +#undef SAVE_CFG_TO_FLASH /*define this macro to save the cfg from RAM to \ + flash*/ + +#define SAVE_IMAGE_TO_FLASH +#define SAVE_CFG_TO_FLASH +/*quick test*/ + +/*LoadFwrConfig_Alt - to load a converted *s3, *cr2 to c code into the device. + * Basically instead of loading the *.s3, *cr2 directly, + * use the tw_convert tool to convert the ascii hex fwr mage into code and + * compile with the application + * + * input arg: mode: 0 - load both firmware and confing + * 1 - load firmware only + * 2 - load config only + * -1 - Force loading + */ +int tw_upload_dsp_firmware(int mode) { + union { + short a; + char b; + } test_bigendian; + if (mode >= 0) { + uint16 vol = 0; + vTaskDelay(1000 / portTICK_PERIOD_MS); + int ret = VprocTwolfGetAppStatus(&vol); + if (vol) { + ESP_LOGW(TAG_SPI, "MCS ret:%d,Status:%d", ret, vol); + return 0; + } + ESP_LOGI(TAG_SPI, "** Loading DSP firmware ret:%d,Status:%d **", ret, vol); + } else { + mode = 0; + } + test_bigendian.a = 1; + ESP_LOGI(TAG_SPI, "b=%d", test_bigendian.b); + + int status = VprocTwolfHbiInit(); + if (status < 0) { + DEBUG_LOGE(TAG_SPI, "tw_spi_access open"); + return -1; + } + + if ((mode == 0) || (mode == 1)) { + twFirmware st_Firmware; + st_Firmware.st_Fwr = (twFwr *)st_twFirmware; + st_Firmware.twFirmwareStreamLen = (uint16)firmwareStreamLen; + st_Firmware.execAddr = (uint32)executionAddress; + st_Firmware.havePrgmBase = (uint8)haveProgramBaseAddress; + st_Firmware.prgmBase = (uint32)programBaseAddress; + + ESP_LOGI(TAG_SPI, "1- Firmware boot loading started ...."); + + status = VprocTwolfHbiBoot_alt(&st_Firmware); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "Error %d:VprocTwolfHbiBoot()", status); + // VprocTwolfHbiCleanup(); + return -1; + } + + ESP_LOGI(TAG_SPI, "2- Loading the image to RAM....done"); +#ifdef SAVE_IMAGE_TO_FLASH + ESP_LOGI(TAG_SPI, "-- Saving firmware to flash...."); + status = VprocTwolfSaveImgToFlash(); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "Error %d:VprocTwolfSaveImgToFlash()", status); + // VprocTwolfHbiCleanup(); + return status; + } + ESP_LOGI(TAG_SPI, "-- Saving firmware to flash....done"); + +#endif + status = VprocTwolfFirmwareStart(); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "Error %d:VprocTwolfFirmwareStart()", status); + // VprocTwolfHbiCleanup(); + return status; + } + } + +#if 1 + if ((mode == 0) || (mode == 2)) { + ESP_LOGI(TAG_SPI, "3- Loading the config file into the device RAM...."); + + status = + VprocTwolfLoadConfig((dataArr *)st_twConfig, (uint16)configStreamLen); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "Error %d:VprocTwolfLoadConfig()", status); + // VprocTwolfHbiCleanup(); + return status; + } +#ifdef SAVE_CFG_TO_FLASH + ESP_LOGI(TAG_SPI, "-- Saving config to flash...."); + status = VprocTwolfSaveCfgToFlash(); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "Error %d:VprocTwolfSaveCfgToFlash()", status); + // VprocTwolfHbiCleanup(); + return status; + } + ESP_LOGI(TAG_SPI, "-- Saving config to flash....done"); + +#endif + } + /*Firmware reset - in order for the configuration to take effect*/ + status = VprocTwolfReset(VPROC_RST_SOFTWARE); + if (status != VPROC_STATUS_SUCCESS) { + DEBUG_LOGE(TAG_SPI, "Error %d:VprocTwolfReset()", status); + ESP_LOGI(TAG_SPI, "Error"); + // VprocTwolfHbiCleanup(); + return status; + } +#endif + + ESP_LOGI(TAG_SPI, "Device boot loading completed successfully..."); + return status; +} + +int zl38063_comm(int argc, char **argv) { + VprocStatusType status = VPROC_STATUS_SUCCESS; + + if (argc == 1) { + printf("Usage: for help type:%s -h", argv[0]); + exit(1); + } + + if (strcmp(argv[1], "-h") == 0) { + printf( + "\nUsage:\n\t%s [-cmd mode] [options...] see supported" + " command modes below\n\n", + argv[0]); + printf( + "\t-wr : to write one or more 16-bit words to the device\n" + "\t-rd : to read one or more 16-bit words from the device\n" + "\t-rst : to reset the device in one of these" + " supported reset modes:\n" + "\t\t - [0: RAM | 1: ROM | 2: SOFT | 3: AEC | 4: BOOT]\n"); + printf( + "\t-lfcff : to load a specific firmware and related" + " config from flash - arg: 1 to 14\n"); + printf( + "\t-lfcfh-a : to load a pre-compiled firmware and related config" + " from host via SPI\n"); + printf("\t-lffh-a: to load a pre-compiled firmware from host via SPI\n"); + printf("\t-lcfh-a: to load a pre-compiled config from host via SPI\n"); + printf("\t-fclr : to erase the content of the ZL380xx slave flash\n"); + printf("\t-sto : to reset the device into boot mode\n"); + printf( + "\t-sta : to start execution of firmware found at " + "exec address in RAM\n"); + printf( + "\t-apla : to configure the ZL380xx x-point for " + "audio playback mode\n"); + printf( + "\t-arec : to configure the ZL380xx x-point for audio " + "recording mode\n"); + printf("Example:\n"); + printf( + "\tEx to write 0x8004 into register 0x0300:" + "\n\t%s -wr 0x0300 0x8004\n\n", + argv[0]); + printf( + "\tEx to read 12 words starting from register 0x020:" + "\n\t%s -rd 0x0020 12\n\n", + argv[0]); + printf( + "\tEx to reset the device in boot mode:" + "\n\t%s -rst n 'where n:[1-4]\n\n", + argv[0]); + printf( + "\tEx to load to RAM a firmware and config previously" + " saved to flash at index 1:\n\t%s -lfcff 1\n\n", + argv[0]); + printf( + "\tEx to load to RAM a firmware previously" + " saved to flash at index 1:\n\t%s -lfff 1\n\n", + argv[0]); + printf( + "\tEx to load to RAM the pre-compiled (in)firmware " + "from teh host " + "HBI (SPI):\n\t%s -lffh-a\n\n", + argv[0]); + printf( + "\tEx to load to RAM the pre-compiled (in)config " + "from teh host " + "HBI (SPI):\n\t%s -lcfh-a\n\n", + argv[0]); + printf( + "\tEx to load to RAM the pre-compiled (in)firmware and config " + "from teh host " + "HBI (SPI):\n\t%s -lfcfh-a\n\n", + argv[0]); + printf( + "\tEx to stop the firmware currently running and clear " + "the RAM:\n\t%s -sto\n\n", + argv[0]); + printf( + "\tEx to start a firmware previously loaded into " + "RAM:\n\t%s -sta\n\n", + argv[0]); + printf("\tEx to mute SOUT :\n\t%s -mute_s [1 | 0]\n\n", argv[0]); + printf("\tEx to mute ROUT :\n\t%s -mute_r [1 | 0]\n\n", argv[0]); + printf( + "\tEx to erase the slave flash device controlled by " + "the ZL380xx :\n\t%s -fclr\n\n", + argv[0]); + printf( + "\tEx to configure the device for recording mode at a " + "desired clock and sample rates" + " with AEC off[0] or on [1]:\n\t%s -arec clkrate " + "fsrate n 'where n:[0 | 1]'\n\n", + argv[0]); + printf( + "\tEx to configure the device for playback mode at a " + "desired clock and sample rates" + " with AEC off[0] or on [1]:\n\t%s -apla clkrate " + "fsrate n 'where n:[0 | 1]'\n\n", + argv[0]); + return -1; + } + + if ((argc < 3) && (strcmp(argv[1], "-wr") == 0)) { + printf("Usage:%s -wr register value0 value1....value124 \n", argv[0]); + return -1; + } + if ((argc < 3) && (strcmp(argv[1], "-rd") == 0)) { + printf("Usage:%s -rd register n 'where n:[1-127]'\n", argv[0]); + return -1; + } + if ((argc < 3) && (strcmp(argv[1], "-rst") == 0)) { + printf("Usage:%s -rst n 'where n:[0-4]'\n", argv[0]); + return -1; + } + if ((argc < 3) && (strcmp(argv[1], "-apla") == 0)) { + printf( + "Usage:%s -apla n" + " 'where n:[0 | 1]'\n", + argv[0]); + return -1; + } + if ((argc < 3) && (strcmp(argv[1], "-arec") == 0)) { + printf( + "Usage:%s -arec n" + " 'where n:[0 | 1]'\n", + argv[0]); + return -1; + } + if ((argc < 3) && (strcmp(argv[1], "-lfcff") == 0)) { + printf("Usage:%s -lfcfh 1\n", argv[0]); + return -1; + } + /*global file handle*/ + status = VprocTwolfHbiInit(); + if (status < 0) { + perror("tw_spi_access open"); + return -1; + } + if ((strcmp(argv[1], "-wr") == 0) || (strcmp(argv[1], "-rd") == 0)) { + int i = 0, j = 0; + unsigned short val[128]; + unsigned short cmdword = (unsigned short)strtoul(argv[2], NULL, 0); + unsigned char numwords = 0; + + memset(val, 0, sizeof(val)); + + if (strcmp(argv[1], "-wr") == + 0) { /*for WRITING 1 or more ZL380xx registers*/ + + unsigned short val[128]; + numwords = argc - 3; /*calculate the number of words to write*/ + ; + for (i = 0; i < numwords; i++) { + val[i] = (unsigned short)strtoul(argv[3 + i], NULL, 0); + } + status = VprocTwolfHbiWrite(cmdword, numwords, val); + if (status != VPROC_STATUS_SUCCESS) { + printf("Error %d:VprocTwolfHbiWrite()\n", status); + VprocTwolfHbiCleanup(); + return -1; + } + for (i = 0; i < numwords; i++) { + printf("wr: addr 0x%04x = 0x%04x\n", (cmdword + j), val[i]); + j = j + 2; + } + + } else { /*for READING 1 or more ZL380xx registers**/ + numwords = (unsigned char)strtoul(argv[3], NULL, 0); + if ((numwords == 0) || (numwords > 128)) { + printf("number of words is out of range. Maximum is 128\n"); + VprocTwolfHbiCleanup(); + return -1; + } + status = VprocTwolfHbiRead(cmdword, numwords, val); + if (status != VPROC_STATUS_SUCCESS) { + printf("Error %d:VprocTwolfHbiRead()\n", status); + VprocTwolfHbiCleanup(); + return -1; + } + for (i = 0; i < numwords; i++) { + printf("RD: addr 0x%04x = 0x%04x\n", (cmdword + j), val[i]); + j = j + 2; + } + } + } else if (strcmp(argv[1], "-rst") == 0) { /*for RESETTING ZL380xx*/ + unsigned char rstMode = (unsigned char)strtoul(argv[2], NULL, 0); + status = VprocTwolfReset((uint16)rstMode); + if (status != VPROC_STATUS_SUCCESS) { + printf("Error %d:VprocTwolfHbiRead()\n", status); + VprocTwolfHbiCleanup(); + return -1; + } + printf("Device reset completed successfully...\n"); + + } else if (strcmp(argv[1], "-lfcff") == 0) { + /*Load ZL380x0 firmware + related config record from flash*/ + unsigned short image_num = (unsigned short)strtoul(argv[2], NULL, 0); + status = VprocTwolfFirmwareStop(); + if (status != VPROC_STATUS_SUCCESS) { + printf("Error %d:VprocTwolfFirmwareStop()\n", status); + VprocTwolfHbiCleanup(); + return -1; + } + status = VprocTwolfLoadFwrCfgFromFlash(image_num); + if (status != VPROC_STATUS_SUCCESS) { + printf("Error %d:VprocTwolfLoadFwrCfgFromFlash()\n", status); + VprocTwolfHbiCleanup(); + return -1; + } + status = VprocTwolfReset(VPROC_RST_HARDWARE_RAM); + if (status != VPROC_STATUS_SUCCESS) { + printf("Error %d:VprocTwolfReset()\n", status); + VprocTwolfHbiCleanup(); + return -1; + } + printf("Device boot loading from flash completed successfully...\n"); + } else if (strcmp(argv[1], "-lfff") == 0) { + if (status != VPROC_STATUS_SUCCESS) { + printf("Error %d:VprocTwolfLoadFwrFromFlash()\n", status); + VprocTwolfHbiCleanup(); + return -1; + } + + printf("Device boot loading from flash completed successfully...\n"); + + } else if (strcmp(argv[1], "-lfcfh-a") == 0) { /*for LOADING FWR/CFG via SPI*/ + if (tw_upload_dsp_firmware(0) != VPROC_STATUS_SUCCESS) + printf("Device boot loading failed.....\n"); + + } else if (strcmp(argv[1], "-lcfh-a") == 0) { /*for LOADING CFG via SPI*/ + if (tw_upload_dsp_firmware(2) != VPROC_STATUS_SUCCESS) + printf("Device boot loading failed.....\n"); + + } else if (strcmp(argv[1], "-lffh-a") == 0) { /*for LOADING FWR via SPI*/ + if (tw_upload_dsp_firmware(1) != VPROC_STATUS_SUCCESS) + printf("Device boot loading failed.....\n"); + + } else if (strcmp(argv[1], "-sto") == 0) { /*for resetting into boot mode*/ + if (VprocTwolfFirmwareStop() != 0) + VprocTwolfHbiCleanup(); + else + printf( + "Firmware stopped to boot mode completed" + " successfully...\n"); + } else if (strcmp(argv[1], "-sta") == 0) { /*start executing FWR/CFG */ + if (VprocTwolfFirmwareStart() != 0) + VprocTwolfHbiCleanup(); + else + printf("Firmware is now running successfully...\n"); + } else if (strcmp(argv[1], "-mute_r") == 0) { /*start executing FWR/CFG */ + uint8 mute = (uint8)strtoul(argv[2], NULL, 0); + // to do need fix + // if(VprocTwolfMute(VPROC_ROUT, mute) != 0) + if (1) { + VprocTwolfHbiCleanup(); + } else { + if (mute) + printf("ROUT Port muted sucessfully...\n"); + else + printf("ROUT Port unmuted sucessfully...\n"); + } + } else if (strcmp(argv[1], "-mute_s") == 0) { /*start executing FWR/CFG */ + uint8 mute = (uint8)strtoul(argv[2], NULL, 0); + // to do need fix + // if(VprocTwolfMute(VPROC_SOUT, mute) != 0) + if (1) + VprocTwolfHbiCleanup(); + else { + if (mute) + printf("SOUT Port muted sucessfully...\n"); + else + printf("SOUT Port unmuted sucessfully...\n"); + } + } else if ((strcmp(argv[1], "-arec") == 0) || (strcmp(argv[1], "-apla") == 0)) + /* configure the ZL380x0 for either audio recording or playback + * Over an I2S link + */ + { + unsigned short pclkrate = (unsigned short)strtoul(argv[2], NULL, 0); + unsigned short fsrate = (unsigned short)strtoul(argv[3], NULL, 0); + unsigned short aecState = (unsigned char)strtoul(argv[4], NULL, 0); + printf("pclkrate = %u KHz, fsrate = %u Hz, AEC state = %d\n", pclkrate, + fsrate, aecState); + // to do need fix +#if 0 + if (strcmp(argv[1], "-arec") == 0) { + if (VprocTwolfUpstreamConfigure(pclkrate, fsrate, aecState) != 0) + VprocTwolfHbiCleanup(); + else + printf("Device configured for audio recording...\n"); + } else if (strcmp(argv[1], "-apla") == 0) { + if (VprocTwolfDownstreamConfigure(pclkrate, fsrate, aecState) != 0) + VprocTwolfHbiCleanup(); + else + printf("Device configured for audio playback...\n"); + } +#endif + } else if (strcmp(argv[1], "-fclr") == 0) { + /*Erase the full content of the ZL380x0 controlled slave flash*/ + status = VprocTwolfEraseFlash(); + if (status != VPROC_STATUS_SUCCESS) { + printf("Error %d:VprocTwolfEraseFlash()\n", status); + VprocTwolfHbiCleanup(); + return -1; + } + printf("flash erasing completed successfully...\n"); + } else { + printf("Usage: for help type:\n%s -h\n", argv[0]); + } + printf("\n"); + + return 0; +} diff --git a/components/audio_hal/driver/zl38063/example_apps/tw_spi_access.h b/components/audio_hal/driver/zl38063/example_apps/tw_spi_access.h new file mode 100644 index 00000000..f2d3eb65 --- /dev/null +++ b/components/audio_hal/driver/zl38063/example_apps/tw_spi_access.h @@ -0,0 +1,10 @@ +#ifndef TW_SPI_ACCESS_H +#define TW_SPI_ACCESS_H + +#include +#include +#include + +int tw_upload_dsp_firmware(int mode); + +#endif diff --git a/components/audio_hal/driver/zl38063/firmware/libfirmware.a b/components/audio_hal/driver/zl38063/firmware/libfirmware.a new file mode 100644 index 0000000000000000000000000000000000000000..b7f87819b8d341ea6795b823339a0eaca0f103cb GIT binary patch literal 114686 zcmb513tUvkz4+%Wh`We-z(*Ehl4D#25zPWCE{J*-i6Q2-Xksw6$&#QEFGfs=H7O>u zup&u&lLI2+lcTlP>&@*oeO;5=|IJxcT+}p}XrnD@*VNWsG>YaW#$^A$-^?ta&Ap$G zwwXO=&Ub$Eo8OuD%o)b!mp=c@(wXu1C^!DI54h#m16@VQoSG#FPdp)HFd@>+fBH}Q z_w5A!d!g#7svpfMe}4IoN}pd$DxY8R?DM6|3rb&D>?$jJe(?)0kj1MPKl5T$`HJVF z9!pDCEq4Diw?xR8U-kUr(&Y~>evUBFvsXN~r2JX(4EyPSM((*eQ3KNSeV5tJsIMpf z<%(>lJtzCAXp~b{+|%dBBSN2h2AT;154;^{uN;SiiO#g=+H;xVJn^sI``{c&lE8TU zpG2M{{da^E?t!})LLBUI8c85S;A;37nGiY34F#WJ@W1Fkct(iH+$TpOgNP~m@TOm6 zl>zKck8ij|Ruyb4z2Y?t@BrmwrMRdnj8|1q4z4_Xa!n+b#Ia}p?8uCzQI--KI{+FE ziBEw0C%rw9prl7ot}fUMF<(UnpaU)=v+xF4L$F^Dj|i6k-s~b96s*|^K}SYjjYL#p zHB0(x6h-8%!=O;JBujrSSo5J@sMg{6~V$KBxMl% z^#2-=KJz?3IXuay?PGvBV^; zrlxTupGavt%#GV$%i-}LOQS5IkQd6x7gBci|Gb)=z5kWSe@f)9ueOow7l8tm#OO}*D*aM@9WFn?lO|LGS4EdI7_@*!+q+Ik`eO~Jfn6F-Fe%v;bT)~B*otb-b@D)+n;~YPXjsl+y5`} zsssi?xr$(K0{T&Lg{*p$+<$@wu%4UP7_wvuQ4`3w5n?(pI{Srajz+okCief5s|(fy z@9Y2ihjNX7l6&X(20=DBfQ=&=5|O@*#F0;9iF7SuCQXS1a;SxbVvr?+gndodBIpO1 zf<3$W7g?o`g?tV7n12lR>t?@kq!}K>v3H>gHV$P%ym7=lm`E{D`u7i^OrQD@c#m>D zf{n%xUf=rTAN0clf*=U+Uc#k@eIBs7$ zQ`BZ(V;Q=Ejf=8M9}7O1scvS!BZELVldB3AV!w#dMBpF(M(@dY{GQqOCKif5W#~-~ zvu_`J)5Du?nSF18HEw|o-U3So-&jA~q-NhO>Z{xWtKI_ZxdoQq0;}HwYuo}Gyakq+ zZ^6E|z^b>vdTxQGx4`PRz#6x}25*5SmRqpzEwJh>u%26B=`FDOEwIKdutC8VW*$?_ zG-hgoa+c09ug5;KONYh(G)%t{uJE5 zc@7&*?qlxv!TkfWx?tTO6lM}g!%M9zTjxl}CRwPO7XY{0rp`DBzsMSbz0YSfySBtk zGE;j-VK8_#U3+4f+oToE(Y4DSY6Rj@VMnbqO4Kd)7tWeTLEqU8xgi%*y6 zG#Vuw7-r0xRuMLeR4l|b0yeoCFo#iD_g09=+D5NJh|wcmO-5; zR~IaSoCUe2#?@0}%Fnh?uPG{N;?gSd2l-@V1e0q~?PC5$gJ!I*A?Sk^*jDkV_Pl#aJ(yiW-pXS?FE`7g0b9-&_U(sMQJ4q1<2D_gx1#%s&A z&$7^Rn|sxBp zSnz99y>_%#15tD5IL)-qTmsq}nkKJi??M%=TIxN^QaMg*}x_2U5uGJNt4f z^{gD?`&;E*^qb1teTJ6k584i1smwg^`4`^cVrE~#dR7kh^{zbcEq`{fFT7-fw>*_h z!}4bx{{_5rXFjs3U?cB=&D~0E1Zt|YSr0>QjyOEea(nE^+{enMN3evxWY>x<*^zaY z(+)^WU57VQf!5%q$_a3{wu9MMu$4JhItF}w9qt^NCc#y0hdswk&2UxI;bp8YSk?J1 zkTC+{^8|mSF52MHnvDD_**&dguQs1*>C#-9o7q>ekb*st^uKM> zRM&JQld}hdMN}tR#?`^wZe6fop<-?ye~v`e_f0u*G$t>O2JHTIrJvpZKFT!&tG*v{ z+Q0&#Tm{_H&$OYTJS-`1Ls}c85vPz13bs*JPrAXsk*L$r&QTkx`A6U`ndjd*+`de^ z4p-oM`1Vj|;+Sx8PFMc%g|qWwX+cgbU4I(oDuSJT@_KmlU#SJ{zUi-+x|hHX!|Ic} zdv?@hI0L*x%RiQXl@FQg4PdB1;A9 z%7jv{HApW(Ed}NLrczHW$m)V6I+l9+zm|Gr4Z*fGYX4`cM>Z(f%FO?})FVsoL1phGRLvo@D}Tgk_2gQT$Lf-x zU@f#Te{)yCWlE-iBq+(y3&fH<%-ic|mSb7jBt_i5Et!M{?c5rl`LslyFL+69h8&7I zD1zms_D(FtZkP<(qp2v(nmHI!J9&%9zk)@5UDIz$eYHq0lv`9h@Df`ZMwSY;s3VleO7JCZcxXD7;C-y5Hk?{7yH096{|c7q>xr7rOEBu=ai}wR z3Ff61GTnK9q|kvaP2)Z??S`sX)g9E$ypL~O4LrV^YQ?Ir*xHW>TF4(2# zR<>F*$vW9VycSC^94ogK zoeM&(ea0cthEv7~WP^eo>3jTrR{&B4{nXL*Ysn9w$A$NmaKDy3&f0D=H)`MHP#_n3 zId#7}YIo5Fx$&zjj!0|6mzr#%>wbfB6~PYvUEFVrsQV9}W_{>rn^kgb25p-zStUK@ zYwe!LKZv9ws|xnp?H^7veH|WO@`rK0l3K6-@u}&Z$v#)^Qy*M$$dgNsA?p#W=}OGk zk@SzZqpU9=?pd@f`-G$9*fjdo`)#u%E3!1o>hffyf4kju1*PBRORBB$yYlYt9OaWI zf8jt@7i`I~n6FLHW7q(aO?t^6BI#dl_xjyACmksF38sS~*tY5O9FMxSDEGJ9Ye4QF9Zwva2eOeR4{-Z(iPM+{DA6_j zZjksDNaRwGRRkMJznyVB*DgKh%dCd}b!5_u8;j0`FADn#_6N7nDmaU&KfKBb0KX;RIcGQTqgqd z+3VySN(cLhLTS%b91&s(Jj2ETLBaZ1&#G;P+A;fBVm7OLFEqtO+BS|fQ%Yi4-A5jb z=3h$UAzxEsMpueM*EEc|3E(pO3YNy2z^C@WuP1IyjE5d2B{t;91azf4nOwDBuH|m@ zH>EK*9o-lO+>MC|R6T-nJyE$*9{8{Izn%77Hzg{PqySwhA6+)DOa)uWeCD7VKNH-I ziNk9&s(tLyIQ&6q46e4Q~7E?Qtarty*?&Jbg12CQ1^J^$0drzYXHY^kJzq^+-LD z^hY+sRG$cgEEO!ybYOTh3xihe50kpN#z0mVY&3i{jLgEI-aHJlhF~$y$fnx9IHO?{ z7G?o^Z$ZIE!(*6_H^B^(ztoPkv{!OM9RxK8$R%!WUpKTCe0&##KKh@4^5?H*tqkv_Zi(kHB`U3f>bX ztC{;Ux~5g=O4aOLkYa9M^mzsRYukP`k;Xg^SIx=sR6TkfTAC)fLmd>sQqqhP;v3PG zHZ!*cUCSHbu5CkB6>Jtr)4;bmIe~t6o|1jYkzb)J{RUiQJyE&R@6g}$7P^+b=nnZM zxXsDfc6Bm+=>UB{glFsgnG@^$lpKR=Y_I-+p~w+lKlHPfcJwy|z}4h2EZ;(_#aji| z#u|c!7N@%r@&ILIAtNK{Kim{;6;R(`R9{jLRHJ<7jq>_hEo8|&Zr`npoFn9o?~_N# zF7^ajMX<{MB5yw?>H2-ah?KFmkTY>9;M&Qo;7i z>tfWHn`(Dtb;0sB+Q+y;R=ax#=<_;z7lvTDy}qy2(ph+v8x-suChMUAvUW2@5xO8t z=124Iz*gt?j4NW{lUaCV6~Xe}M;l}AzA0Up7Gzby){s+-o6BVVeIvA59lXR-%U|FL zvL3-|RueTRsCqKg!dQav-FW?2yWQVh>@f8pO9jhitRq-rcsQz$U?H&H_Of!U3pSEI zwzcOOCdqb$rv-NebkUbjE$6L64qvU`q;Gu-+Q^uYhcWB1`uG8 z8juNjf}jpmu*l)++u6*eZ1pD}#)pwfxBaU*RiUAC-L=T-g57QGapGK1yG4dkf;Ofu z{!s`Wnw|iH}f?wSp;{5jWOvmrTKACI{12_B3J^c9hp*iVWeC) z1mE2E?WC6EG7 z)!0sp&zBvS4Xv{?7Gi%S5T6!H&1_zS3O0#`E`~16xwzwE7Or*{+(_l7c#-Ph_SCBOXThJqY9!WpCeK5>{ z9PWiV54|jFS+1EjSZOYXKsG4Y`vP?qOuuYJ&d{!hl0%1k4Xt5eB)xXq(RYv~k8}Hu ztp_@u(}OM-^u%3}KEEEqSR&~!ZckzFSP^XL^uX0+sfT+Pg^I4WUp;hfQE1N9`vQgG zMcs=+i!Ls@gmP8E-h1tlK#BLh-jFi^%8b{q$^4xM?4+jLR?6BIk6^Lvr1~@%_`6oa zoCV1dJ;_LV={77eD3=Nrdw7p;lPfIs&_{;f$fU2g?O`*P?Pkn#$m)V^OsTVAZZtG! z_e1ZBJf|J{4V6o1bp?$@)(~t74W$NKd94sScVn#+gm;Z>P_V|V0K8cvufOiuEb5+C zYxBY~mNrtt?Td9$;k8g0>z{+yBIzr(M(d!{tPVoCieN3Y5@!4&lh(d&PECW-2z}XY zI}MRKD1*qVeQcxL9cm*ZAfiyQ&@bwrj~g)*g)>fpW=0Zr>A7 zZXWfmPyBeEf5zai;yxb)v#?T6(Y5=(nR`8w{=!yd6~Xed)!r+8ePh`PT&uHSijh?X zn`Aw5UHTeJPJ3_1H&}8eZ#nwT#QG#_-OwoO5o~|F&{m3=@7Q`rC~&Rgn6@eWZXqtk;NU)cGUn>+3b+r$!`wZN19Z=LH)Avd&*o^s{f*IB`#S^W z>Vkcv_Lm0KPtd|i_G1|(Z&tQy>ebAM2GVPjh?lX3U||miYkeY<{4)d_wXpz)47Xl$wn)({ruKzo(fC0OzUZr{$PWYwysklR&H zYQTwW$Qd7DUC7rd_&k9k*cd$-p1_*|N*+q~4554>Jg=?OM%izC?Hn*vrPze{|;Ww{Id#1q)dh};nEfnG9bP?)N`!F)7L#r3|Ce11o;xD!#G97DB4UV0OuP8k9D zy>#`mGMMoxM!C9R6Ni#rpL?UbgZg(%@tTdV7aD?H(>h8HLSJiCBD&SBgA!xmcTl1k zTW$jp3ktUSkpD4O17)+}lPcD?R|We&up=rk4fe%V zoXu)uze{R;Mw|s#l)g306PbMln?O60>injzVf%`JIh*xlhMB@jWX73H4R%bqE+b0? zdp7F{@T>8kv9o7AHGb~nHChZAbYb=t?1gb=m2)8qWRTFX|}9Xx5iu>^@jWxk14u(!#6-kf%7ESf3jnc(1bk1mr1h-?Yx_Awnvg z@vy(B-iU`~qUYcm+BplBME)&|BG^iJQrQ|0>&;`J&3cy9z@AHpH}_7syDz>f19eaZ zYoUqp#CbP7q3QqGB*&9n8(i;kmOu`L6{`khJ%UXH8Ab3E%HuiQVG)4c6^W`Z>o511 zX)Nf5EEQ}#tbHyUZ>GMi2dCgTBp362F^N#{9MgH&N32Y0c`E}~RY z7n?US`gFh@pS+KwWd!oDt|U%;>y6L{DpOEyP_U3{LYy9WmL!q9r{PzYc8jBN+A7eKy-kz0D}HbPoJer)!bsrY8FY#^%(7Tc0wLgc;Mea*7! zoH!YB0rYx?LeBUT)L3!#$QpwEY5PywxdaRay|`A{F^evS9ui7`9T&g`1>5XKIgdeq zkN&jgV7*y=5o3|FH#g%`dj>1$W1mx4=cY zieR^F`6c*l*rI{^=9aC7ToGT-Z6~k5wHRbo!J_S5_PvnLiKK{p0Ts4n6W7Rk1dIL? z1~6#@uG8TfSvo*2@)-k|y9Zn&s|(gKz<pXFdtT8}``~l3&0oN*ABOAO)hk^l2 z;ecyo$ur!(a|ZYq4Y;05Z;K<&ELJWQ!9tC$$*#2$=EktiMC{YebiU7*wQ3?*(fJ^2 z=hZ%z*B@uIo1m3hOMVDp%F7ZV@5I4wQn>xqDND6);5`%=^Mh0`w7kgbf+bKY4~}!!#z0#HZMF)nH~3)w z#9A@J*M|hVVjJx2hn|9=J@c<;vt=kv=G>7Juf7+QJGVCwGv9wESO@bzvAvO)b01~b zrx;VkuDjUW6)EHPt!!;n)g$i)VBazH9Gud`*> z{QXCf^%^9vK-49wU@<)3%lu&?aTdZ;ztd|Zxf+T!7mk&feFcl}i}w??41GGCV1W^l zN_8hqg$gN`q%!*o7JOjuw}ryE$Yphcpwb3uV5=-SC*c;?;Z@(Gi6|y za@!6&Wpa%^xjQlm#J3|G0Dts$gL* zs8uI#!IQ|O+gs5Fl~6x%8&sxqeLaHJb9>-x6R-i${dOxa!(B8Fd3m0sg2i2_kOQIj zYlbT+LDHvDEveR@GBxt%HG6>NGkpL%-lt3?l+&f*%i&S9ah?f64W-&V)YlL!3txHO z3wZ+MLQZ!;Kh@vhg4W4thHGYD!D4ubbwq93?b9M}{x}m_Lm>KMav)2Vi2C`(V1& zGv0gPx$*izP80-!V@YdiXg-tc5iIR`I1ou6yxsM2Apd^KW&bUI2a#ZW6v%&o$)$qb zLB7M7PaVlGg28VroiG$W7wXtyih%Et{JD(P1*==Gfo~GsVfq$+uZFLOxlbU!9`44$ zEDp$2US%Y0sOQB5Fm^|QiXFUa1$OZ+=eV>FitSIqA>dmHoA&@1{ za{G4M<=UE{u8^gIeKP6` z@rmaSOaTi6@gS=UmivOnuDySR*>V5Nrsn*hm6S1!~F0k$VkHS7WRv z_l-2@p+V|UZcwm4q>Y8(2l2x1yl#lKv7jcV8YIIyhGJ(rkfq$dXR~nJsJVPF4#F>O z_8Mx8eop_!ku?MhCB+#FHAACp$GPZSOb@i+ zwArndz#dmN#}tg}5KiloX7#r71213 zvbmLDpALci|F`_KWA=%K5>ICbq`#$)M!94ew=Ylm6Rw{Vtie2vT@tog_m`Mz9`};p z19K&&b6~DSHYnI=dBj|aEhpy6-vb}bmB^9`ZeI)KxpE&o@6VOkXM{QAt-L>}2o_WJ zbJl)iuEZWC=1T1I@mz^=Rl#EJj--zV321?6uC(>7av|#xET3CndM;LSz-SkHB}M1% zq_I7T4iC(QCbGT;6|4gDqH5LXdij)EC7=3^Tx}gYcJJ%g;Wx7k?@+ETSl?x@eH!%6 z5>L-|5PJJ5a<_|G)0UolsJbI(c5P`HvW8$QTU{sIQ$4ms_N_|LzGS?s1HLL;J`ZMQ zhR}ilvO&SZdTDrWhnbO|R$6?)Ed1KB)V9R3A7;Edc>ioUw{LT!KYwYND{uzBjhaPa z2cNve@_V3ay5v)(w&W1XRRr6Sbzhx3so|8>bD*)TtO(|lt*7`Nb{pH}fvhT6=tsg> zDRi*`=EQKclnU*~!0{Ba9>L<+ijS!V`(hOMu9=Oanqkch=kRtCWT{|x!AyfD%WVF= zeWNp+RpnO6~RW*N3}-d(@B${FeL0Ng8kOWs)E%f@5rP; z;D};J7RI9I;);&$Y=M{b}K$5&EUca2;4wZ%j`|Fcbn0cl6}wwluHGx(90o< zZzsWLyP2B|t7-9>b|9mDBVDjh+xK+AR{#}luw!#)r%ZQ{|AL(iJ35E@66*DUxgO;j zf+cAlss+kzx_KWkS3}oBW_o|1x5{5FXK0gUw%;fySZ~`-w%b3H^Ax;&Go&h%^JMhO z!TYIX1-Gwwo+a1vs~y>Bg^=?R82Kf@6|=8kwaJ39%kTv5V(?cD{1T@9cQ{)3{vE+u z=x2_nsCKXR*k=ytA+z5f;xF_Up;ughay?PG#o-+2A-i}xv@>=jNd0ABFY!s%_oRY_ zc?r>z{3Y}fVZ{(iNiUSWOYlvxJXF?Et}fW&;tkNQgnG@z-v-V?M8h!q3ihwC@0CB1 zhbnr1$Rr4f{>TOe8+k7(3uZE%V?cw;ztT+m3|CM8xAvrx+gEp5F~=}U&%}2DE0|$y zU(>pDGKQ5mMX;F5Qh>(!JECR4^E9~A$prL+bx+hm6|5b4rRL1x)O<=O4n}2x+u$~5 z_D~0eMAjo%l|7#cuEicv9)ne0uD_gM*GJJ>16e9q3H#Mj3$Q!LZy~2uxBh})jys!G z1oOACY&@?E7H82br*%$)(RpqKFk?SjLrq`9{sXH5yK~IbP_7|ZGnA|{kSb>Y(SwAZ zn*m{v!)M3_1zW_p2_KF1xiSyJs_{;#0(^E#Zg6$-3bPqm$?c0iPcwepN14DE!n*T7 z9_1>6#jyCr7Z2ezbh3&`d;(n9t;X!23U-I|8_;eC`5m}R#dmVL^eea%V+WAy5iHCn z$h=O39ZFj~RlChtV;EZOzJ8Y8!16lj-v_XR2C(`7me+ET^q(*mYo8nC8aJ?9?!O>w zLAJ7W=)Rv5ObN5EV9U!U!6+WnvWxr@+{6l<@H=#uvb;{7=k}E=rqe927<(=uy^CEJ zi!jW-g5^(^mW`qw1?HbKcqnc|+{uWnDp)*kfseJ^=QLTLSpo04jbuPy6-z!JcY6dY zQGM21kecX73#sTx>p|$(qFgFizV5Hd4%kBhrxy10Ozsvv6J&M4;#lyV?E`l)+_-ZA zSwpb@yo;fK=K{WOWP^f*R>j0t(URk?tbN<}YyUpnStfmsyUNaHf?_=6` zoAG`9b2wxb!48yx;m{_r*_)w_kImiP{@tQK^r@ zb?8zcHfpJ9lyxSOW8Vu zB<`ZslYhbHf=Cs&FVDE@*q^huy4=R?`~qDzeiz9B)|#q$cf}U4{NNER)S?-?q&wm1u0iSG zRxiJ61TQOFPnJT@mDyLYrErdr2fn<=9o%9;YH3Tas$ojoZOVq=fngUufT`KNmx*!|u)0gXYvo3IM!d8@zEP0XJ7vuWa z`?vaN`cL~X^^nF2ok;g0K0H|{ zg^HMOwzV5sD%de6lGV<}JKcA{?+@$yOUWb{sbUPs>Vn0%&{{5-*%$^h8&Qj4c$9;z zA=rs9GlJox`X%>;;nqMlDA>-%yI6QWE~-5D3+XKg8MbK^^P$E04Qn^aDsEq#Tjw<> zuFUW?8lCaH6rfy1uwy&N`T}e}7g5TnR@|E%X?>}3DE+yFt=JAWpQ;M>lDB`o2kK^a z{*7i?dl|;fhU*=|+If#)Wh(m!8BJZSS_SM!X-sw_^K!6wmh$8Vz(j*s&#Av%ni3ic7jplS6r z{v~7=-&;To!QwLywbsL&u0co=T|)MV5Gu^`a(#n>9SQ9oAy#@rdIqEc^(8;z_Wi!} z3`_&FuV8OZ&m2e(rePeU!R1@R(xwU)(^F%pV+kc>BrW(Arfg0{gJ8a*!pfxqXF9SaXV`KLDf( zqiimPS+hv`&wvboo|3%{7id><=z)83B9nf*?Kmr&x?s~fi_US2dJm8Z2K61(4;j-H44aR8-%+j+)nNuf z|CzXFTF%&(Z2Ek=wE(`b8L?gZQqI_FMK&ndEekOnuwQMP^i}E0%a(lN-Sg4Fc#tJ8 zar^Q(?JQ0ljTtj==ddv|z~b4OjI1KqXq*SOVVv8n(Rl6>@gS=T_7m}i$kKBJ&Wu}o zIdsXs(P+ARt9?Vum_c$Zdlw$TDsYBb%Ob@IZb?jYO%VJvlc5kX5H%ktW3=#dJMO(UJFXWi+K}a)r?}j_rdE3O19iT4!#oY&CL-zVX3} zp&Qb;1?7^Lxqa{6YBWKbdFmEn%3114muuh9Z&d^9F)3dNKv5QDWCQY$}t z6j@cUYJRN#Sy_oYW*VjvrCkge&4rs{CMMB^ZZ6jom8<8sgg#?w-flE~cK$*)*jAS- z?s)u(q#r|?Q7#oMrvJzDVKrXA!vpL6Ib>f^m0VV$q8<-E&e#2Q!E!r*b+(M#I?x&i zzFBt#Q;l*B!QR~hJ{#}eif?(#6KIDmDd#^knzt;9NlT+f6S6_U7PO3*Z)`SYP#CMc zYz?+z8VRMK!G%zG@vBTO`7yVzzsc%vDfTy|7@J*BBrcNW<)@kxOBcDHC{`h+M1DS( zU_%$ei%ScPrp%4w;H_kC7}tXP1u9!N%!SnLSo<}zZBRq6TW^S*#2jWZGX2d9{=~nB!}!TUUhsG$%)l#S>7=OI|x@x_iQ=M zo;cwSh@UxQ@fUo@{E69DuzieEdUyV+k5(1GNb=|Gxi=>U>|F;Z${?S7X7xq|?17Y)G ze%Jcv0X};9vxe5zT$Z^V zb_A+^e)**WiGV1R@J+>TeaC8ONmkQRr=c%f{KWj9NZ5|7GKD#*^TqsFf zu_R#~fO7Sy4i2*C@v3OOU$Uqr<hwaWM7|z-CsgsaVrmT~%JTkm3qrJoVdA zt}0mEQ`v6b52T^(Z{Si5O?sRAwX?pQN3a-oX|5}Df8Zs18w=BBLcg}Am~o?NC$E16 zYdAyrL`be?=X|bgZI_TwbeL;U2VJnEd}XzrFV1)LKfUZNKeVQ`ok=feXRsN9thTV%Q(G;6(2D;t`wF()c5jb0 zb&0nl&)ht>w%jr2a$)WAD&JSjQvW#ZV6TtI7eU|{~_#pvx+-ET#trpW?#V~^)~pA6wD5|P7>D*aE+`XSln@j zychiA#Pv$JHo^5_>3^8bf`YZse+&JX9*2EjM3BpUjfsZy_h7pajJZ%Qq1?VoXO6E; z!Y6058e#uHVQ;&caV*7``TCGx5BBm@%RZj&Mt2)Qww<{hJpT$-_T5pRQr}$s)tejL zN%b3xFTT0n9bdn`_#baJxtof6SsmpO?17%Ej>6s}@Ftcymc6(icAlngFFv+>>T<`z zW4%@T*{_+J3p*aj_~XzlPgaurI%uRI$1$ zzCN?!jQy2agkE(V>Pf7)x+(xMMbiJw`)7h(S_NNfZ(Cj^XGBjOYa^YIw$4@XHPJSr zpv{7UZG?XPZ?`>Gb;kZ2NL^jE<2f#I$2OF*g~=seZeNgCQQ696oz46Q>|{NgiThb2 zlLl>sZUVoy7?jj>`jE64?gIInKRHCUz}2QtT0TKGDA*dKE#?%aT~XHg38rWe z!9CIN^}Br?jDL_NHQc_ilE1FtN?fh0$2#`Ax`DdZbfA97DuV6THCQKS2yG?QHjsbF zv}p#is$k&+n@_GedTM&;0;YeUP80Uk`D6Zrv7SDbD1W0X9n}O+U;MAF?H1Ht z%ZO@?a;aeb5_?0onmWIP);}zvRF{1ajE4#?^Zm-YU{`F%RF!>Cs?g?p*q#PMu=ob% z)D3(CMKjtZ)T7*SXb?|ZuutC)vdndtrfvSqnrX(zaHfZE*;Hdt5ZDJY4iEYVuYYT! z_3zOvYt8wohhopc^Z6B6O3Q4^UR>=cJedWhi`iGOa=sTzgC|?EW4)8%JJ3YZ{to9( zN?8QH4M}G2O%?1l`(srjsO!Ybl`xkI+*xX_cZNvXr}RaKtApFYBiKV*s?AVqRq(tZ za_!irwTH-Fu%L2+*;laE)XlZ+Cd}pIJH2ezB)7BGw$E#r&a$-Wg0;{Io!0U7UR&oG zcw2XOu7la)fjJ)K8iM7y|Hd4jv$o&f$Oil5V($O`9KQ+jJhH^c?Th)p<&*v#f6eD- zsT#z-0tmCRsR-7Uxe0Q=b^ND39GRcl>bh(l`$u1Yo=3T=U}4t_%l|y5Y}VjA4e3*O zgOGoHs5P>lK9-l+q8Wz>YMs*MYxA4Xwg$o6i7XYYRjG&e0?UJz(I0a(Hl8PS!A5I_ zr&)}U*Da_4|6b%!Yzr$xMxPEvGuus=UnMv(&P;!tc|FXv;jy6(LBWpcn&Y#EVJ{!# zs+Tf(37Sf=q~1dl$zg8awcNfKqigkQhe7b_s$I@l>xc7_YyA?Y&#ItYMX=qqyrlo* zjXL8nPdUg;!2Aj2o3{aKR4&xu8@C*K4eIFu^&_`A)H8|9zJi7NvB5fFSFOk`F|5X! zaoEIkn{kNEWm3VS{g;j3(q%|k9=WZ?_;`&{fIH1VUtO^AP%C50(Al`UYG)&q#+;X? zwG*^q$g$uUoB<20Ay_Q$hX!F8K4Q1lbWinv{0I1o>A9(gLwut)OE&8H_X zd-13D+tB!HeoiluPPF{W~Gn3*~(L-yuIpQ}KT@5tR%Qr z>PHlgsUKNrtshl5vVL?SvO&QXe9$)hAXwcDeCMNyg??v2xYxn0^HO#JYqQ8YZr}M{ z?K$X~Y!suO!!`Q9W&uwJMe>b!}L2KapierxGaADnczktja;{%f37 z1-q8Qd7BjyYgb|B6PP;sTVU3KKXd_D8S)4g+ulfeHZb*c+iT^Et*Kq!@-l1cAH92_ z{`?cSuVDY9^8@mnc~Tdwh5n_!jTm5waM?*H zzpv5{U_JETpahiL+M)Nw?Ayl<^|@AWZ{R(tLu3!5;>_3&`Z@K#!|W^AXn$x^Jxalo z5;*@FoX?FRkR|opzGm3r<$tHv|MVu+nGbC+4^g^$DQJdakyQj6jn(U40AH)2o;-f9 z-_QDB$f|;UX45PY`}T%oZ@N~$ZeVXs%ZSQA)+1OhWfxl#^v-|x?Wy;+%ah?-(+pRS;l!G!jn%RS^k$GX z1dIMytMeTqk_q2A?=7Z4Pm$MWLBaO4dW}Sf7qr73Op*`VRsM|yZ=q2xd5zoGYw%n< zr(Ui&#Q3qDxjruWFyZa7B3S5iL0l{Ci4_)KWfg%vCY8`1pLJpsw22rK%2fp$EeqJ2 zT2K{Tsfwh(-Q+$8Uly@>E{|X($W?Cv2m22*cfv26V{6Y8{jK#I`FDVHfWF9*u>^Ky z{p&_v1CNE>tRXmoMA%obuB%2auD_nm8Vz$toRl+Q?a8**UyR?JpnU}!O8uhM)l)5f z0jKfrgq-0@?vL5l%58=dQ^ij#eP$D;0d0x;Qo-U0DrYl;FaqLx z3QOP=6)(g+339Q|{|~ljPZzA${-3b=97$ge&u4)?{3}MEztg=MzF=?X`}+jDw3>gx zt2#{}DUyC~^YI0q)F%I1wF_WOHjT}J1f%*ob3odh*fKcRW)4}3u2g}psS;clo3kN5 z;r7*GZRXx9g_mdd6nqg$mzrIl^SrkD+>R4P@K-1>ZHi!R&@aPtqFudbvo^z9@%nq< zH00q>PXD|?bw0!Qmk8EEXVst0YKHHEuglk3C&1at(b0nHEQS=IT#sPK!rOd%!|nBB zJ8v66y$BSXJU(e7o3EyV#g!oZZj9$19DDMs5ZkZG$D6uf8{n(Wb8PMDUpBOn0KDUN z3EcpU2ws}X|5k<}*l!@V*;laNdG7|-WquCM1MA)Aj`oZ_F~t|Ui24Qv+wl(1l@~)x zA;-8f{{mqj^Qi&X! zx|1TF^d(`)nTt$=d$0%?859T*hu#?4DXgz#M4EY9gF!V>@UEu7D!P>%L zpT1}99{76yr7Her{rg$I%eRA7mcWoCz@wfzmi={emh_8J;86 z1Sj!)-H5CrSk>u*nEAIpS_YIz=qD~X)*wIrei}QG16ftD&)L=;Q9Fvxm4;vIPVg1< z7Ina19N1OR!_Pfv>p|8d*oG7njfb!AWca=aX5KBb4*dt%C+T;_!-=Rvc>WdahxxKa z(UZGK9)8=dTFCwni(LssA5ZnMk=Ej=C|8fl9ih|OE=kg1HyiHMh7-yXcT(vS$+VNo z_we&<48h{_rRN$TL`TlU^mKkh(oXoA;1POi&Fx*uU3^b^P_PfvBaTPt6Epr?odVBV z)IRC*PB=F>hTHc|Zr>C64Y%p^sJ#xxEj~JD#=$iKdkvLOC3hX0>7yMipDBW^fq9&Q zSKgmlNAH>yLyx_B7f4U(y1i>m*BxCN;pe)mg6)r!?=_dnAS%bj_NA2BSFjB--w7_0 z!N9}`=1F*Sd{-s1RIoC^y??@5@O){tOyJa|J|AXZ!A5t84;k=04?^H7M?CCtM%EB4 z<`s`kC-~iDrz3iX3oo7WOnx?ZP_TTznaa+9NQOPQf&9{NQAcuDWvizQ&&)=-M2prB z$(i4#!gpUuWi;t@qYQgkKB15wq)+1UR7JLqqX^byG3hNPIN2F^e)hJZHOfy@I2($c zJdScz!Qzvp)U>akTSj9B+#%}`EFASV;K_3o_L?$zC?lW7vG#%rw*SdYI(PsFdrXK- z>*7(aE?E8+8sXd`+?CQFawOc36s&O*I~tyi9>7}R-YVGOO>7E0OQGD_u*Wv38Y~$7 zJ6EKE+xJFmq6Ie<^lQS;;!p$&r#tnf8;$`Ukh&T=1n!u91shG9k0uP@>gZ5$$LuRu zv|}M1Hh`N$hYz?zmI}6r!q{&>`sc#^K-(d!3w8`VLpw%wxfAXO+74MmunIgwJ4V^N zq286idZAoA->a9k$3ej!%U}3j1KGpQE0XMrq5!L@d`B(r$wj%Ok=qwf(ny0Z7K_eF zBn@_^^F6w2TI&d&s0#DwfGUFBX-tCi1@J4$=pOx@20ul_%YKnn1&gNz$Q3nAiZ6A4 zJwHcaH~XTK{go$RJ%YtAst3Urw7Us@*@;i_duiswcB-RXD%dbSh1m@FK3l>a-fuyF zORm^Sa7X)22#>5TSoFa!NUK|U9`hQt`^`fY9p=c`xgW?Hf`ys@PDk(>|9q~GoU!yA zUpEa3mY>1WZpK;CJ?!s69U^%4ipSBA=)$!JkW1Ec`xc#RW86&ICRu@5Ugm(&7}7jO zWEH{U?o>R9#nrPGzJb7VhQJ5Lz4#Z%3^-!}SyixSGRr0qTA2M)I3wa<_THILNA{g; zHUU;rk@X06Je;a#!*>aPF9Y{mjq=69S24tiJF4(>P-LlKt*WK|V738gfMQR0&vg8o zS9~A$`h{BY`gzFef-QirhW@Sl%eAl*{J@BlZ6_*QgJp8Y*iIYt{_t-}A!`U0{$`D2 zgH*Q>mAOuEt6ys)3jBJF_E=$`8(80|4AH8>tl zU1$)pDf}%V3cCfou%kde z9Fu`o18XyxxwPbo1^i%k`2f+b4IKv|>Z4%nI(b~qO z_1h5Tk`3IxP!ouJ1!V{NNcTW)D}c56^0M*JTYG_>#i0oH_^Q>gi|${xuRV>aYbU7V zffKG1ZS1O=&8?_{^&JrS zy$aaJa8J-#0=;D{6)X1z8m;#g&Z_kfW8YjEf_;TP?%@2cEEUcNbA7NY>l)Z0>WlgY z1uJLxrw@y}|ARBm(Q3D?@ZxB-(>rWRBPF?4;a%{t6KUr5#lO!4XJKX9VaE#BJU-P; zyU%r9`|~&RM#0|+0J(}_=ifH_OP;RqCGF0C#M_`xU&sC~imUrmxI=I@VDK-(J>~vU<`Gtb9*xTe)ox>?vrgwM-d9hfXY@_w|}5=h0BOEKKY)=cFeF@V08z1=AGO>w1)O)OV=;S6i1ru3Auub&A-Xpz3CZT^5o!i^d8=uav@9#a@ zJNzDGgMBPA=Cmf7kkJH|n&N$+w@y}QY}R+MTC$S$CrJypZ)|ov`#xnfbMfz*#b)Cv z?6KK%n2T~1!Q#nfvDwR*y9(UHy>Zr;YvLy^qH)QqYvL@(s)DV9`|27pv4nPimit-v zr2}7fpYOf^AFM(?UnshIe{b{PE3|n~omZAGh9oxD zqk^4#?SXF|ybd`S%G*QVmfPO{b{IW&U5D?PHWW);8&uRm7p$R;l!I{cmxccB*U8gj z;4gc;(dO#7ecBlM=?rUl#$;p-!6p`GF7;*Ep`-vYk5;rBFAd}~El z%e?pZ9_%4Q#rQ(7)CQ-9$<;O06?f7Tj=0$B8nBlvQ}e`<8ef*o+GAC)P=j5KBh@vr z*>Av`&@w<;0@dTJ)irVO*LxIhU%{$VT2@qiL@s*p2CSO zkTxn<4~&9$vD2bltK$-@YckW~pijFZKj_4n%s5u>=z^_-KLv~uVzYD`JWFh@k?%Qt zt+s7Q`ja#`%dIf`3KmDte{_sUt~@`&atQMAE}F>R?R{5@uIve|A0Cgb33#I z_AX`zMX;bx?nQXoIfkDtNAh~$jwIyK%lqo#?;xVSYE&+q?*iu@PQL=g@#N^)zr<1i zEYyDW$a)0(N8pbv6)gY$jacT;geeL&XUw6Nv|;c~MiQO9 zKHP2M>zjg|OHJwHX<2ukEEnghak5?`=R~|?MVrC*h8lv6ktcY|%6jZgiC)-!KJSucXA{;9zfoZ~D%gp_Xm{nlVf4z|JY)h(8`;9`o7@$Z@ccf^ zv5J0@emu3kr`%R2x73t!`wF(%@^VepSmNAji>FnSPgWIF6;&@TE2=K3iXnR;pD_Ch z7HbS*!Q4|fx}|1;W5Lt~tE!YQJzr<6s!$#NDrR577UjbkCpM4-zo#7~Rhv#7%&Ldl z{X6nq>%#hGR_{>3R?$8UmfswIT~Z6*-zV64j%JJ5TXi@54%zChn)0IO#f*bhsv}Tc zl>hg##k_qJEc%_UDsc>q8?6v)ehbn7Gcssj!D1aZ_%+_|ic1_reXQp-gvME`;8eh( z0J3B&x3650IWZ2-s*E$$*F<}2$m6_KoYm|_RuODm{rv&0;_bAgQ!A&I+Ts!my-BC% zRWy@mNMu#P!kMlhC6-Cq>W!uV9dV$adup5vHBjPK zSW}w6DbBRLX806-#k2SlRk~Rg{F^W^D!TI)}aI+m%*>t)ZxbeK;_DqMbs`1-o50x{c=G zvvUHME?}6q0>jc8dH+GMqvus-IxiSaP40iE2~c;GFEN__^{e5&@@LzdHbH-x*;lYe zlYZpVd63hRcb-dM?{-hS^qJ98_8HzIs|(glH@J4<9fNhB_YiOwKuHc%Oi_dR`S2~O}2~tyP~aWZrE#p@0_;AP1@tIkALj;v8{Xu z^GfzE6u}mTv|^*B75)}4vubnrS!Mgf0i*dBzG2W4hgJvlRRxQ7ZFU=*JAYJok=p_8 zT82)^pfMG5APlk|!Maxsn+#vS&AixMI-#oDcrIpoEdAS>QL~dqpN)AC@)NRDuwP}m zrjMR)^BJ4p&oMU}+FjEkG%4wobx;Dti8_KkFy_ZZ+%*NjoCNA23iuM&oRQDw3crmnnGc?QEQBX zRUy>AoW;4_5JQ-IB>GJG*Y=kBe%W4`U7T0E7Fpt8_Dx(D`HEb1dPAkD$T6x#w!fDM z>m?+b3*%8^Wc8etqHv!76aT8}`$H#eDb?nVOpnM3HzF%?R<3*&-n_z%k7!^u6Lyvg zLl=0oL7om|&757;5xxjg02)M?C|^wsa&jo_)55MsRtm_ivKKy?XR_PLxc5rs>Stjm zbBr*HtTVt?8t=^QmG|4%3v2C#nN9WgagC9E?Qg#zlmB3m_aiHFRx>foBHIVXhDmw@ zak>_xPvW;x8AIaYq~-`@-JJd4v|KgRL?({3$W>W4l=}2i5y^QZnv}wsdB_qcv+v+Z zuhX+nFClur^pv{m#)x5QH((ve;iodXzGHLq^_(S#J8yP&N^lN7yO0^WDCMRIpR;Zn z;5f<^1FUmR*KiY_J9J{N=!W|**;Hw&GP&VMrD^7O$eKATL8^yklVqZIACnJmD_mTx znE?@cEvDW@Guje!XZo3rGwYl$ltRuJjkmf?R_M#q-Q`^n@g%g8HalG0M4M!DoLv#;0Vgta(^PVY^* zYF(F7KN6n6h$YIgw_%OXEYHlF$m%%@xjIuBwa_A0dT)3=GF<2FGTbnO#Zo+JT@o9g z=PaD_D5GGhU{yq>a!hfl1oVhZTdfmpIn(2&bIQz|jfXVIRoJcI7>+(8B_k&wm5yloM>1_w0{glcRaF+ z+LyCqVMls-e|SqriAqH^teV?Q#^5+8#tyMfKvv{zUcOvSV5x6b$)c`;Xlrd&n!&rQ zI0tr>!%}BNHnL{ULeJ#n5rVaLsPx`6JZt}Y=!N1<%9O!yw^xf*N@OL@;(aa0<%4Sq z7H_hh*f|LM!%tR~6wceayH-B9d>gV(&Ngpy&rE`6XQ_u=v2MuZXldJ8GU0XbHsc%r zRoF>=N9HVbn$Jw>Rv0lb$gQ^$LtRg)I3svoAy$uZu`$y)?2tWYPrbJf-Y~aHdwEWvZUDkEvMceD3N3 zkhLDD6T>rEorrQp&IanoN98YF-^O}}^bY&e$eIIk`RLhRZI?$kO@TeZg*g!am-dHE zEjx*<#97w6wd7G>7xr-leqEhu{5i5t&UUQ40(M|y5)W(T%7=BZ7fUR$oL{`7RcqW! zZ6y%XI?Fy+f3_|s)W@~)E_ht={akej&C-5?#R{s zK`oB$o0@!oircunF>T}eZy^fe*Yur1s3)U}5Vr_>N`EsRr?xc_X>hEH04Kru; z;In(X**W0OHUh_v$rx!VfW>EWb z7Rs~2gZ0lqYvuS?m?ja*CNjQKdVZ6$N#3tsgRIQiwqW$ekIu;Zy(>+pEl?K_>15^i zn?`(na{vFX3;&YZm$Md_JxZk7gPS&m#4VKU>+x^!Y;st(dplr7=SF17e=++8LoO84 z$l<5IYTWM4PwCJufmLXS^R|AwV)oA}7I|6u%UNiPuWQ`?k0F>Fyd7k=%6V^jN#W&9 zLLs()39W}j&ceC%WQr)=T|O|z0Hy2Q^*7pQbr1tNvV8gMn{&^h4(5Q|%JfU~`sJ#U zbwj3_X-Qp?ImKF`uFM=UJiBW)edm=pyElT}Uo+)iUP;`&wVRf2TL0|&^h+h{_GSj^ zEGK8lBonlrp{A(%&8=55NE~T+|IKv{mVI$D%A{JcYE!y zrQh8osTyZV;pR1SZhrO!wQqoh=X7^@<*UcD?sT>J1rI_N8A+yMe5kvtC+P zld;>Rl65OQmFlWY)bt+%QGVrOJ*_t-&WcCwEFX9)qn8-q+xlTS>32Z3bLsl5zWF}6 zD*Y15b#it@_JZ%taJFO}^tt)>sO^~qYNS26dotzfw%`SNWM$66JewXkszfi=+>@)H zI}J5OG|WJ*4DNaMlt|k~Zq5>CW8Z1N9%{b#&dh_g=9#A;1t9s<_j^Uu2IZ3fVfLNn zA>+156(hViD#Pv1%hdz#v<<*?!M#*?FJ$$c&A*`)G9C=mYVN>YZ_m9YSElzE?=d}| z>18^IoJAcVCs&^7J$awDH*VU=mK#vxI`=HCSiC13<(fI$rp7zTRj)t`VllllY7l&P zgrLolD>M3$l{h;P?y9*x7i{tD7Xb^T-!a~k54tuAg_+dPoSbF3T;9KJQ)8b6T6{3q zFKJKE$$m&1t-nyN%-J)&-f?eDsR}Rl!Yatw8mE2H(7)T)Hg0d+ZeJ8Uo2{jFa~9^Q zEQN9XwN>Z8T`>>N!F$Cbc=Ii|wYhQoyxHUk$|XmbeL-53BwgMVG>4WGH3ynMTDz*C z$#?2|*ygV0>K0`6oGo6C$AZ@tuRmE?Qs|fOF2B3}$~t_DE?JvqEvIFl7?8VvbwT)- z;!LawPE_Tu6bdJTFAV?ckStf7OA^@oF=yXh*Ek#ez}|Or)XmQhE;#*aaYpm?0#89I z)-Na7dw|4QZ^6*>tbPHh1@`qQwc@KoC*`VvYtKz*a-E#bnl%shr0w&J_Iz^Sxi9W* zuDc{x-;8N=j4fRD-7s>qo!U2`?+@Nu+3u6kH0sKOGML|V3RyR2*#r|r{t6LZfmVVp!Vf# zx`nl_6iU%j+m}+K(3vc=K2ZpwCAB84=3XtbB4-uhnU>Pl*+)M;niHqcF0$kq%3F*+ zT-~V9F0o`bB5UUCLwYpZqPwDPQD}25xQ7eIo~dqC2n#Jj3$hYtVUJSnvp*oREMn?H z&|PRT!8v4|oL%q)R~{}}bRB=OXLM)w%6zE- zkNy78Cw6yCEv$ZIYxv!qJ<${X_5RikN1uWS{uu9iFsbvEho9^vm-Xj|TG@Ck`7N_A zo(F%=C6`whJg^vHuHZ2ywR^+S6FskffI8?oyZO)c-8&U}sR8~*OUL2w1Zi)JB1GkU z?Whn3tvO&t&h8|zLj{S4|F8=MG0@!?M<@nMBghasdl6YPXR&`NCwa-~Q80I_Zr0K> zbDNlN^uuiD>(Q0<$V!~;hTT4N-ty5`6VO}2r9G?q$!*7qd|iv+Qrljp`OV2$=oy+~ zpK5IUWvw=DXLnK3e;zOUu%r;5=39l^)lml z{z>QG83}1ipT)FJKUG;*F@dEKfubY4b03 z=Iat?KWPev`A(q_K0wxUfAm|(5o%jXvACa92Fg-a&vaLVu)n*v7X0Ou!FDQ z!nH1ngr_8Xp(h_^0DxTbKC`c*cCVZe*9OykU@W+BsR~lsnW$;v>H!5>L78JjwV39(JI2ED&030g(en0 z-S8PFHGMLIwh^5HxfVq*#8p*Hk;E|sW(W{P5kx|I6{0c~OOirjUC#`JU9?R}q@)+|qZuBrRaZju!RHl7+L-Kt@2d-8i` zUmuKE&+W}lE=t;|m81>v^O|5ssNU?fs)2SXZ`{6p)V`d3Mz8&wBI>CfxAShVeJ$m4 zhi_Y`ZD)`K`5*p62zz8j&hFH{CEbcwEA7&R`23kyj*Wp8Ups@|lFD0($L#sKcnY#+ z&dP}gqV*DtE)1zDdR7QyWI{(`kaUWSZAXgtmCCA$IRI-L z@}qP3s|xano0!1HYDInwvg8lUzM&HA-UBloeMK2kun;Zf8T8Gmknf^-ZbDYiS#o8v z%~v$hsul`iO(KpA6oM7rfYl#u^!Xtxa#omKV?`-pFunsV!a`)r1=u%fj{jq*Ey9pB zb5`ku8DUqZ*f#vx9+x?YKy+A~1>yggTp0mgy5Y~rN}L@rGE8#MoB$~?_WkX*UEbyU zg_f$2Vktpi)Sg`!O>O4nERG!LTAKc%jimDac>ZWFMw)g=t);C#_=a+2&cbdYtyxXR zG$Y(!kYIhrA!Lso8*VFYwbWHtAnWFAn-aY>e75u!QDR)MoTDzN0W~Su0yH*;Bp^%v z$n1;9Y~F#^1&!~v-Y@#z;?0kea*~awjI(gnNhIy3)pOR?5iF&8(woiE@3wlQ*X4h^ zV}rvr-5Xt-yu&x_LO!i8M9yw2)K9Lwcy&dX^h{yfH0=Kw04tQD}ec|V2uB219x&LxDUpkjoQdn5FC@H=Bxe{~!>ihv# zi|k6O^X)IY8m-V_+MJvn;*=onkl54<<@2+RD`MJ}D0SPq65*0#b^cVE-(=2uV=g6W z=*Z?+X%*~~KE(MjiSa?x6%d<;+LyD?@@Sdcd^Y~M%5CeQG=S1{ds3SMWwSDw+P8+; zcMI(C4*QEAZ2DXqncd#~@rV#oL%qylx#Ht<;PjmJAHyeXxv~qM@pgE^I9o-C+Y5PP zh~%$*{V2*6Icu$Tl*ijNzB1WizxRQ$=k^EbJ>M!9fDX5g_SEq8-JDf8N|g5;;D;>< z(R;~g7}xYU+G@+*jiNOk@)D*BM}(z8$jY20&RLQj?xmHi;I01J^rKJ)DTYgRM?KMP zimWJP-JHdl{@U5%&h(?kqqRq`8V)xvl#EBqYOBjzcKd7XG;fll+<&2NErm1w+9X^0 z(SWqa5>T$5vjJ%^mUGks*Wi6&b`|Cm#Yky>4YDF+czm#`#Ui znmJpWCb4HWjU3t!&nz%9yFwy@%Hk_RR^sd~s|{jWpx@?M|9{WT8Ib!9KDVkCp(SBl zuy(lQp-)dIJyiM}Z5n1XnX}mHg?-C4!=+$N1eBB!P*O%U$3jUNA?=Vy&@pT`XUP$V zeY9;vi0HJ(S?e4X{yHpwjvbS(Xu5-8{s!txK4A9s%b(j`uVLjKOXUmD;zF+(Dp}>; zL}c{=7GyZ=rB@6#O?R10pchG$9QOTJ0_j9n-Y1!a45mHdAcDB9@ z<&qDXeOX!k$tv{qhJVuAbQI!f0;=b%1m(hy`5bRW_zFp>RarJ{NU;*?8*QP;ikwBy z9t3ZXBot=chek+58zEs%8VoHYm{VShteLab^gvX7Fmh2 z{<<*9^nn#}Pp&QfgW3fhYmaDgW#T3;J?GA`!%bgsSg7ya~5{~V{ITPS6{E$TGLm9 z<%1w?ttpf7PAJ#SS^vilyX8@?4WtNDv67_%Sn?-k-^aNY-&T4Ys6XEO^_mSI@8b1^ zp0kf~57rQm>I=*n5_k$*M}2%#OH!+ zD3U8%Tt$uz{5Q%ae`fY|0b8=R$g%hd_61;z_}V#S^_st(GQRy^oGu!+z@NBzw%76)Q$w%wO?yh}H1nL}Vq-K9^>NXQ`I17sy|UGYHHD^lhB- z1dXhdvmZ`;lFms=KbHwtFm2br!PYIxoE75cpItutSGU%sE;v_Gm_Pnt^M+zY$`I+( zxG}3duyZxab#pedd1Uiw+tbZ;%^uhT@b2!&=9BO(R60@FmLJ)yZAO-S%X)olx&itb>?X_vhnmOy5v2V$@(MyuA&K!Q> z#QrhXr!O^@z>eIn%hg|lM~$NEO(o7Mq|sj$jC(Ks6Oj4S^~0&m(U%HV%GLY+p7n-n z6UudR)>40OLcz+cIj*E?KlS&Mm7o92_&TyOXJOWd)3j-6anwbJ zwPXCgC35A(&10={<%kQBmt^#MVBMS@ISXb96dt_vZOnV|qYWDA$4}^yHK$`dvg8wH z-+fC9VwP?^u|F1U7JgyhrK~q_ROIE&PtQ?EXb)udoMkC{5hN0bJov@>5zJzjzFpZk zr#9uOzacAf_S=}GHH~jv+5Gh1Xa8);+UoQ+B~4pFeT8vr`o`BbAZzCAS_{f^ZHB1O z23U`|IcKwdUf_A-C$bV}@%b+)zEpgDz!9i}7BopPOQB=M;!T~N1&xHyX>fA(>g!!z zUCd4Bu@8!UN~+y%+Ar^~yJ)R<&(4Nx*_;MBAoob!SLvsTL3Jc|^UKR@4J1|JbZxFJ zAwRR8kocH{o3piVke_A3NRsm1?$=`0re88azcNWyN{e!KOY%XHjlX@$?CV`w_w&8k zK`>G!SLSVf>7A2R#d(=uq#vlO%s4ami<4EY|*N4xFeg&(8Rwwz@cvkH2v?^IUOWEl8RR z(oL5#8;jSLr@JcmW?+Vr+HrHtXw7T4~i8e_bjwMJkzN^)tOF1tc$fU z>QrLfigMkYod>oW^Obn+MCC~7m93+@(&;=SSA`>Y!TR?S#8hO-UzmMygel$OSiCsd zvG}VQ7dACky}16;Cdbmn$(J@QSpVXBWc8dai22DBjo)T{m`FA=hpd&n&Kk^g~=DSfdFeV3Bklh?BFr4tf9J zi2~d$bg~LYH=z!W#d{B#5C)@Bi@YdT=4=>@^TUiB7zLH>*JAq}%1J8e?V(kyoSX&JCRkI>IrE3m@g=tgYMhdB*RC zQu}iDW3c1oLV5G2^YpXHuVHWPb>}ymyn`q7m&xEK`<_RZe8%h>64zfQg0&9Ky@4~z zj%07H%9PQ1i#j^x%6%qe^_(qolxIA)rff$a#j(_mh0ci)jWqx6TSkmARi;yLMW%f07iXcyS1InuDnoGo(b z;ao>oc5+Tqf6!gW#xVz4Hcnx)EneSPP3uCDv(V2AWoMBitMD<6<2@Uvu;bLeoXsi} z;@l~kF%YR|4@SBrhA@~j{z8tcqB=MHYn>TciL?I*NdpdL%-dE_P~=c5^MQRYAs*Tj z?^~l0gb*NQ?;a?^JJk+pSGi zI(@lp{{=*8z5NS!iZ2RvaB~*R=SCPc&Z}l`Izy&J?1J65ENXI{&QV8}e9rw>>hcmn zE~Vo~&0kt;p^q*MR=~cOXoi)oW}1)noV7tpJcbFdf^w%2@yne=x67_QO#Adcg^`#o zv=2|@EaUQuV4ZLdp3N)j+hI1?X`EmZA4c=0IiSM?jg{Tc$ln`x4%h8Mt#I}KuU*u> zoSk6ZIU-`04tC+nPcs`(qbS!fE15{3{gcuaP5VonoRuNgK$mxf4bL(*rAw7ql!iwk z1-nqL%-Nmcy0V>G-7ZK~8J^38m^m4~ood~#r))ce8SCb38^N}aW=cev0__BQ-oma9 zV72R-k6`|NUOct$F=k)X&@QqwA#erm{9xD3>$@I;EbB+qbM}ox`<5};V$#X}xoPYw zh=Z`qAN$ioqiIxwRTK- z2dtLs^yp$P>@XVY48|sP__fmNbZXy#+)&iZJjU+`jWt+cXOZ;l^a#{pv0?BVStn=1 z)79Z)%8NFfvFM_zcevw)!WmX}mk&-&ww~;z_T}ugNuN8e#olmqdQ&|{gOF2hgc{j` zf0s$08jl*0b#oSF_=?&s!c_azDxIs;LU)SXnw-^GrEM;)rgZ?3nSH}2tA#P;Yoh1( z=*F+GWObkHCzCRz4^ENE?@2ekH$5m<&)L+QGd)A5=t@JUd}0|mWtp^~f0lQTaD5P_ zc;4wMEwUnKU8PMurtcKpqrZDwtL*u4@4~)k?mzng;;+2(Tz~fTvk#Cpb5<=}D=mpT z*S|;A*v+J!xv%W55K!AelV75~E^!tm`eUDd=k1*A>1Xb%g|l$wss0Mp*#{9n`l9#1 zXq4;Z?CCz){`;FBN-$pXBbZZG`}>>!BL%cI!Mr4Ejn>ze)UmP-d{gZATu*X#iLh0)K zxv+u-S&6gY3;8px=xrfW%oZ}C2G(GuOV=iLIIc}-cGS}H%*okLvyU#?R`?s!;q3AV zop)Pdxe4#Hq3F5=^OG=@+LyD;%l^`2v7YpI-bm>RnWC`}!)?7rDvubEvxtpf1lXZ1 zr9&Yf8ZYLJzZ#wmYo{%8al&(7%mq)#>T^+jNgcEAPT0p9%WEaclJ*Ey;jN{Lp7#>7 zpjNo5&4y^asDqxfn>+3_X#yO_7_^yX#=a$p6AsL!7Q; ziO#{=M&B7oJ+trT;xVgMcAwIUK6!1 zXS>pvZQaBGZH`9JL2NX2=sGHdEFZRSkd--Gyw;J<>XSA~YbHQx?h!=PWK+?9S&(&e zHjuYcV5ArGQ-U=FO3Q1LAP>bhJFZPcmNYQ?9)mmuyJA9F{t4uz8k0RcWP-->8!C50 z(YI8tp0lhq0_|SG2JH=)n^_#?T4{aU`aroNXN}gAeGNS)x{v#eeb^enTEEk?Q;9Wn z#IBtRWX+t_l|?7sg*YVUluuwr1=ilQ7Kgf9|ETVkID4|s*w^X#cRbcMtSoVI7Sq1X z%6xHNl0q7L!M z4rmW--~GtSuA%ll&g^@#&ma4CwS8Hjy|BA_-!k+B_S}BK?8{j!5iwS zXjh3t7xNON0I%O&tDOu_746H}eyH=ptPrs{ZuBqV|F7(mU!C4Fy-kq`v@t1<_N_QM zn{#?iw49=XlxwDp-o4%W)J^PFkW;BGZm@ntnX^4fe_1jN`m}4HR9sR#`cfqHK@PU% zU>rLs$MuFF5XQ#{=I>5?DnPVLKC!IrZ=kdB_>?9FgR(qEPaQoFR6+LyDBQ}LwcS!uN?FPtuj zDTqea`B>jMStT#eSXR6&^N?kk2v1P!DOEs>tiGg&G8?OtIjbg~Qi#A(h|k{>BRit` zx>kSe<+pLgHOh5!HdG2$?u7RSB}DB=mLAH%3JHGI8i*ku@~5&DS<=Yt3xTZR9HE3u z@W8I0{$s{1f>@r75%kJw8Kvj!1_zr>1`$^vVvjvXF-Y$mCIu@#gSCK%U3`3qv%hu) zOI|wn19z56_I5+iSWSyL?l7nGMlv;St5=>4*{Dc37&$ICP zTljRrC$chU--lxt;MgDFvl%`=fX|Di>hMo2`LhlkXZuFEIjeFm-bCQN)qN~j`L|N_ z(6g3vvotW8USzRPz80h!gK|j|voFk;im0-XZhqcHAD}fLHoYq<76tl0?8m#=LG*|%= z;^dSLh*}v8IixM|B`AkKkjrXO2R&!o5?`T5)mrGUm^MTj3vd3qY0wi;66G3bjiz=G zIhzg7E5xRnCPV95&Fj}8P`=HE-&h}^Tr+2Jtvqj$K)i}57jl2W_Jjf36VdV1z5%(A z6IQk72s^tw@<-5pQ6U1Z;;zG0k)4|}E|-=iPR=e%hq+;5AomE9gF{OouZBWRf1+|> zlYK3y0VB>n^3ua&MxIK4j=hR-Ton1R~-kG{N8K*POj=UK$eBS9% z-whiPN!LT_IXisu%t^;4>2BJNhpfq-Zo-vbQ{T=UEmh7lZVidOK*zpB&eqO0ovwYo zZgyp62F(1|-K@+srqsd+7^dRYS6REn%vn~}1>($N-~jEvGYjFYp>r`5vXGCbo>H9-^;I0jE%*AcEL_fh+D z7TUUmy(^)7qk+lpg|?Efv<*riWZj&F7(4OyLWm4+!Cp8LGQg=;fKE_?3r1`SAxlm( z`{LVM=#+;LNhJ$fP7P3!u7;K|$F$i6qmQ@D zl*~H3ea6{;-#){ccu%y?I7{1SD$o}CEir8nkNceHu$6P#wrwW?wbw zD1~@mzx-aV3I{^lU#gi%N|mja7W8*D^Iy*Pm+lO?UAhzMfhqypp$XQVy4&y_%5DMQ zUr=9>vnCI|NenJCc|iKFU(F|vI zN(di|k(ROD)sT1yRsdwRH?aDRvzy=;kIHL!30mLf!gxuS;Fr?Vu7{k4NKe$hoMmzP zDzeK(wpN%C6>vpkyrz_`jgmME`!_o0*96{7?ZUHEs;$gid|eZe>wLsQ+}lS{FQ28- z)*wkWkZD^(<}B(Mi0yhk#045wz-)7>F^wZg?aNu{!FWQ~0Lyem{iuCi%)U?Rx{%5X zqq^c%vRze!te&%vbzMkx^~ZJ{!gMiq0ASbyw)JaJy;PkI7>(#Xo3y&lpCDgM_djYlgW!Ys0G&OWx}lh(_oQvI=G zX?;P?Gy9@_PzKuavHh~S{emc~f6P)Xn4XWHb~Du>mg*pK_VJVd;nRMSHFNgg>zm8< z{q;N4zK?a#po|~to6Gerqpb5W8-gsvO@bL({@Bg$41zg$8{Tmn;tlwl+LyB{;plCM zz882>ctyxWQyE0hgZkh(D%Z_f#k-^2$J8jGgg9pFbRV+% z06Res`%`8^4>gjqMH)ksabHa-8E2QW|0{L#mitOo&irIH5VP6W{r;U8c z?3)*zw?ZuZOq`Yzu08CUWA(!5fG~Zzq?JTHfykfKzMO^k(VY`);i52ol4Xdbr{{gU z;XU>(Vfrl#e?NZ2uGp!zX+`b4@XQa6g=@3U8B1{I7qvB949~bq=fjve+fjh=9G6)z z${m{xm)(BqR+F!>`(%&l)?E6GCCi&?`KVq5OzWq;@x<6z^&IU@OuPOVlB@pUhe#A1lpFY9*E6j_9kbe&g&3f;C(e^nRiZ2xV~G7k}Y7YG2O6 zPAxWL%@1pDUKc{`?V|G$$yb5$;a|&il!>(`YKL<5oJA6A?*=j)>Xs;128>8!ovl)$ zU)Up&6*;T!v3^)vv*YN1?sT8xR%txn3LUa$&gz|V3Lf>xPKNU; zkUiPh4Q`y zcx3gQZ6LWIDavI84bdY5b`4yQtjO6XQ=dUKd{V0vT3?tsD;q?v;lGnQfQ}_eoDDoJ ze{3+=R0lR~AmQ+Am{!fycbuI4R}G)k>PuR#%a3%R&;60zP9BsY3OutL<`QaO&i-?{ zpOpIcLDt7aE;0L7L#|Lw>wy|hHEj&k7^-Qx@R#LzcS;M@SI=2^bK)(nX|UT2?3)C# zu%0#EB`KIvYG2O!V}Al?v3@n)b*JE6{IT=l2-c-*VhDYgHgk5_m{4h`HPgYOOk>TW z%Z?Nka2-BjR?kbE{p)^gvEj2~_w>j94vt`34f$%CkDZV7^~dgmv+qOfdst(=ANO7+ zvvd&QJi5TPJD_~Tk``v)t22*(-w|`-{>cZ8{pnrlH`6=QZ=`oLSkk{^Hb%L6 z&O)Cr#G}TMx7GQR&`LAWGEra|mOH6^IqOcP8m3@sT$LkpbvcpBQO4ELig>&R=97S2 zGiTH98hv7uD)9vNc+fbrig>&(a2#2Qvp&jToJ!TSQt*T|G42$M{f*Cu7?{nRoP`)% z{8=@SztIvcl06rYou3#^`|xDW!WaM%)ThM_=j>+Fm6AS%k|My={y8p>WOjFK0J}L z?0wVIZk=YI1GCp1O3f;)yXjj;Lt-KAdo@4OfyHFKT4s%Z7v2#GjowELc*O>XictG< z7W?4Ylb_%UgOy9N<)I8~*IQx7WOz4)Jx0I|PR_~}Mm~h8o#OYB^vKGbMg3j|`yf|JIn)C0 zWu?E6b#wMKmuIJE%y1QQ74#RT5n1wgW?z(7Nzc5GXBMb5BJf2HZ5GT%1Ybf{&so+} z?TL0x&zT{ft*>lbk-zd}Y1-!!C8M-NB3FCN*4I5tDJYWQyq=%9S{~ zA0#1dpCTF}pj=qK#g+84EwE;0?b~q;mqxSrMx0%e91J65wUt+YE)+(7brR<1TV&&` zc}dx)Hzj4CNvCrqWX=jL&_|s6+3K!sK}kW<^>G$DZ*fb~zOQ^621*~&zIZohXRQgd ztyuBl+F7u!CV$1%O{LaJ>NK z4FY+$Hom`lu7kAgcGxb-#vZ)G4$FkGZzMO^rsx4Qy z)K_GmUUnLz_Yakdi?e5!!kiEjM5bmjp3R(Hzg?cb>`X>;_8Cu1Em(N6wCv2>sT+$| z#pqW>NGtNGeK~8qv}$FDl)p03HoSR??WyLw2~RcGSFA4?V~cEFcILy$$T~Uu%-M}e zo&r70pLx1DviXHGp|DmfvUybV`VzLP2U(f3ATz-R(SEH7*o(zH33^C7tBAMjQg##V z195ZqIVt(*H)UHOg2{%OPiy`L{WbQ&q?*@`?iEz9|JifQzL%MO)v(^~bIKOi{BO-) zfMq48nnXxqqd?nzdd|i}TXKp-G)XwyAW1Kck_@gPFd{kDYAYjpJ#FuZoQ<+cWqQ5* z%ShW6_;l^l+KS3Vz5YK#Y^#9H`W2?l%vn|{6GJiN@Q{h0NH3QuNi^Iea2#2QvkOx~ zr3Gan6J=;uq&SE^Us94dVEwU^;FpKy3nypQ3OsW@PEDn4h-dLjLf{IN&SLM%oMjgE zb`BRjU8|xW%3;!9k76&eV4HPR(K@RJb#QamAN!9(!?U;69EIMDE6~H0R`Ws4s(dZ1 zT88zMf&Slbn0-gmb-ysi3~O8!t+)ml_8>jIm$M~s#CYpa znVR4oAT~DrR4caN@#dfqWXTm~UmF}t@0r`Jq|7F`MuH=-uXIa&cY?l-&X?13HvDUh z>Qj5`M|!maDYepy62DR^@z-FQFGSA1Ecz$iIHV+aPw&b>(Ehv(zmT7QuGYZX1ZK`+ zYB$6i&uz9qnx~T4`CyB+)}SGa;8Oz{QTuWh?Sv`9PqiW&{$h&E_z7uPNZZv;&O*x0 z!9MPX)MOc+pDDD|LYfww!&HQSJy1{W%UQJo8MX2yBq2rk>t({8#HONsw5{RhEX&~# z*^|dYZuexttV3AmQ?=uEzi^wjqllZ?cg+f2j7|!g5Gt9fWjoHvFU~6%_d?FHbmZT> zjXLN#+b`U8tQp@Q-U%~o;-oRva@C0kuj{S>XQ~dGz~-cjoXyKw{(SM6J7e;4T$PL0 zEq}gX#WK^_>J1K?+&0ZMlg$M*b5@l=q6n-~n*g)G{l{z&iBqc6{%xPKIXP?lzVvfGJl&l_rVpae*vVOl2ifkufmU#*Vp}8(QhKv}WPM~E{xAPAwJ&Fh zAqfZ=e-lZ(Qcs|_2(=s_sGMel47>Iq>*lO+EP;0qjnh^9W#Ni^OEmr(aHKI&-gPzq zw1Mr7K&~?T+I875id9!Z3iYrK1HY@MFLaW^J?qHyx18P;)V`b@x~{GwZwr~Oa;{#H zy-^LHd0RGZBeR44`*ggtBYPvVB4_bPZX+>-IOlJlzkSm-kbYSF4>&Sib!5bH@h8Zd zIZLLK8c%*$UhwoVXZ}i9a|*xn3(giVNUFV)JD=}A#My%5Y}ACcY_r;Ja>#_NQlqae z(F(Ivc=^Ct1LO;g+j4ti@39s`!?bHh%Of?ZmGBGp)$$b3cO03s8bdQ2Z%om^Xpdb> z3@)%XQ7ixnC9m^N~a+gHmpB?=py ztpHi54N*J`zlehEO|IuGjNj1rgClat#1`psnic{JvkQW#eL0KAf(hPn)C|2;efbK^ zBEn;^;=d)Rm5pJWIZJzTgODZk3Zg{P4)2Pj1vVO|?^zOO;kecf=dR)Yj<6D>9Cos_ z6HjUct_p!3Le#;@*$}A@;y93FWuKCeERa|s*oS^2k;^)W*$(Zo%gD-{?MonY{GTZ< zS121(a6~OwgBB>)W;J@jmRee-x;Z-p_Wvx0Rz2MuWgd^&o{1#SWi(FroJ4ER_&4 z#AydT&=<;uRqee{?twRo0XvvEi=z>)Ww?76>^e8?Ef`(Ie)S=Tm|W(QQb1oSE2}*) zJ2aU31-_q+N+y=8biB~X+2=QIl(d(Xu-n60h)RObOcSPe=D_T+|Ag;BVbs2yC5M%; zZz`c@^e}@7t*e3~rba~wIZWuB1~+H%T%wJ6% z8%ayLk7zK5d1kAiT=gf_`lQy5d|k|2rQ7MeK{IDr+GD=djq9V2CgW(seOH>8J#Smx6s10LmkYVHT^)-BIIJ?nWms!2`e8S z>97D~z6y*#Dd3YTr*2%B1)gu5MAPQvY)3T9xw@G95(y8rj81+7q9aL;ywuXxlETPu zPzRZ_*K9-;3ePnlQ{y}@Wt{_m;4+YPbGF_}p#NcX0+VJ;g&eQnA~o*bR>-cP_Px&R z%j8Y7YQhBPWY~?6X#~-m4nZkzQP4c3=PWrq5bQYE2Dh@%T%#bC631GbKk2bt@dt8$ z3UWo~QkcJoJEdFXg*Nj_sByw1C$%qU=R&D~@iwcp7Fio2!7OCly}8P0j;Ye(%mQSg z%b6(P^9_jnR3!!zth-i&-=xAP>_ieR6oy#arggCP8D|yn49pNY5UmtUmH|1!>Ys73 zIJk9nbg3Lg>mix5{z>l~9BFf}g!4(k-bTuHEM&OIzndjWtj*f-SPC zzV1i*1`n`OEf&Gw3(58fx3r^0@lD=%%jK)%N@>0z9%kR=iL4%uk`8`D1|Vo~&q9Tz(~9@%1o1 zKgY+~507+!nL3wspdEX5mKLT{Da=L1+6(0pFSD=m>(W;6Nh(+IHMyKOjtZpqg2A(12YGftO+J!cdEH=Ttp{)o~h3jx{%+Ks7 zvQEyD5Ik-dJV3m}iKpQ@{EkPFl{p)k@NhSQJ~NG!QwZ;}l<0u#ur5T&$htX;_r~LP z;U*ARBL+0W?{)!M(!uQ83B)U$zysI&VatLH4c_ZCX{;5w``1CsGOvLa{g zLJtsFV+IKPZWnID(N&x^a~27_Hy%eKaBp@$R>w-5MdB{Vz&bS`8Nb_wUN~AvpRw~1 z8z8WbwF~!wSjVr!`=P!vXYn`^KfE{A$#$V1u0z(%S*(ErlJR@60_$5?l>)1*!S)1M za)a3y&%g|RI+Lt1MF;*SHkN0TupsArYgQwPLRQb&qP=_%+x&-huoZaT|(0#M}rV)c*vgejwKG1p)^1S&tz6Y~DF(+qNmbqr+ z%ox*bhlsd-neFGiwAdWuUb%W@2^>SYGH3nr;V+XVZ;U-oLA`jsb<4DjH}ZaNrq`BG zpLBD!-4W#qwPM`T;Sf#IV?e8=+w7TFab2rKu2B2lWcDo)7=4k`ZM!{&(ZFXml9VNZ z{&mjI2Yc;^10*^2r; zS`V2yi%0u**yDaF%Zep1#>k>~D-@OR><@xnsC_w$^XlCxpF{r{o9B2?w$!qD^#^6x zZ@~6ve~oM3e+cZ+8oL0qW0x%xD|Jd)Wb|p*yEeL z1XAsB1L&^g%!bICIg2~JLDrP!Cu?J7kA1_it}LY>3M;bsWNA`yr%Q6lFl#D zUs`Tm0xPnA3QyoJv>CBa+04hg-JFexf}NLRe2(*4V{cU=2Ap6V02?>`b1$6? z9R}dPoP|C29__pr8WRsYDu>2E5Y)!(Vx7+-=QIE1EJk=eG7G&e2S!kLqy@ zdeD@hLyfwbM%2EXMeRaU;-!q9H)wtr-&L%8pqLA7OR%Q1DsJC42KUNBFa#My>> z#~;Y{J@fE>^d4xp=S{czlKpee9c#FU`Z_tg>l@P@;L#TInr2Y`9({fwy^qH{lmq(K zH1w3V&h4(hL$%KECWoQz?%-2=8+dBpM>@O(FiJxxjfA(^@{J^c}#j={IR@pu)o z#K-IlPqG)P0~WV`)&H;*o%Y??Nn&Ra2aRwMlq@^}a2#y9!rF8;|%43sNz zHc*D(=TLho-kb!sp1^Zekvli!AA8_MO|) z&|QDe!JZsiAOl(v=ox+eBd<9$_mS0ewqNUWXuqD@!*Wmho%-%NxDwXrGq0G3tjO8M znN-Sy{?V}OUq4>iQex_6-Y~bjf%=1)v-Q5}R`3Gmx$``;spmZGf2z%)d5Bk{T#2(+ zPzvUYrE~8!+^z49ykfcwPZE7v>>uHxtdp~czidms3HJF-BK3wI>Pfk#p1$c&&wt#& z$_LH{p&X{4aVOpL9ZI1a84oZQYjZU;zqvVUyBi4>h8*6rx}a@FY9h=~NTB6PcmGo! z(3#q|hnElNz1eep_yj;(^xfOk3Z@drZ>H(fsC_vLR=-8lmObBB(>Msq)9+$jj_=xK zzV`{WFK5{vmHtVS4!CA$4A`gqbv*WP+X?H*M%K((_7)UO7C>ps`g1jgkKl@6+E2>f z(Iw7eZ(o3^M25am+e0jMxzq8T1m!w8i|g5la0nt^+D|NkJr6H{FK=5ne718pYXc!G zbM|7AdnJi#FEciiDBRJGwvqDflf_04?UO~;&DlIpxuEKGk0B0nxnJmYjBNFK?Bs}H z5#-aTpuyviCAXM;p$-!)4L6gNw;SU#Ep3VEphJnu4|9Uzp~fY8Wc8fI`(j>nErB*< zj3-4C=RXFe7&yeilWwp?=vHN~JyJDPGKZZ!iN}Ofa=WSh6Fw9#1d=Oj(5tN=EHN(IALD3Bh z+dIX{S-fW>%+iBCYLT`P;oFn5}4{Le+ zlH1I_Y}^U^G2fIoK=hc&*0w}CJ~nU546q^VU*|05+to2kle#fJ?Xe+NXx+EACGLdh z0PXu2)^8+ombEUHKqUK#`~JWF%h~^v|8n;Ksv;C=}G8Zb67 z6Me2+0N;b>kF1`v(&h4?fdB0gEB?jjkQF)mr2qXppF`Fh(BTRH`*%Kvti;(T{g3ASzg*;Va0!UU~{C)(F?RrODUVhg3} z$N>V%b#iu&v--vAmoO%t?s*)Qy|(RUC;pnd|HVZwE`D(dvNC61T#9FMvtJNiqO5cI z3po(y&KbS@SIb|@Wn)xs&W1S^%imo7LM~qM(qfYOqj!(IGI)9I@)w?`M;4)6a*vk} zsdL_qdu7Kf;_^$&Ns{TvKbGs$2E7~dO6e;<``HWGllLO453q3l<@NfsAHC~bu70Kd zl^1d*R}r`#bx42Z$}7lvdw0lf{4Bqtfq0QsC|BZaoc&J7Lr2=aK%I*9s9aeDvoe++pO*&Xa=%49 zU(SX|56WP5%w$`wAcnw-ozMxRC5RydD{V%@N*gv0g!D4|8k8M3OnWg$97xaH>%D=W zFxv@dw^^NW5Z|Pwy;v0s7J%^m1Ulea3Q;Wbw0IkKyLJY z3tH%lyThl8(jToD5p{5EoHQhMv=kOQo!ZRFS=7{aGCVs%h;l8rRtXbbb70q(^apeM zP4{8OGHn~l0T$K{c+z0L>5w-3JJ5}PLt5dlDlrXa*P{;ZfW9FuaJ;s!?m>P37+b^r zH8Eb#C~MFpwUl`v8)E7rOZu37i`QmB97k70*0vWnE=#}q^Ny9MRal$>_O&-igXy{? zJ!cJ))iQ9BK~lsYgjSN0;N9D7N`iO8+14mmm)pgYnF+kfK$a&E;GRdmw9Ei+bU5Bj5*%Or)V86zbm8%N;GRt#s z@jSOG<|5`+V9lJx99jG*N3#3o<@+bCd`A;AL7GR)D2cP4c9QZLSQO`TyDIi&SBv&I z5`9DKhH)mTQW+|RIiM!<;Y$?R=3*ed$57yCZ zP%e4E?34t zu33LD{Vd8AIlJKOn{nC6ON%jn--7j?m=+$`?~|_&2`Z3t&4{cgwQV+ z4l&`-JDC?1(fUHqS^uQJ9)Nw9lZB~S?bRo(bmxQB<5*d}QF^5abr3nbL3*`FYrT*( z{{K;SE^tkq=i`3^0fA}_cq!VdM~g)*Dk3UUq$dzAUTVX|OV`U13tLIt?B}a%w3XfoM1v$!&q}pT2#~P+jRFzx`UgSDGUotO|M>? zdk*xEfIa!8y~G8^!l^q8KB-L(SN1pcD0g=>vgYf*m52pd!RNwBD9W`m7UL_f zZ23j4Z<%*liZPkZy~Puko`fA3krf$hzvUYYJ75Ha!l>-EtF8qbYM<}xSXS2LTCld( zTd_#W9~kReaH2-NA_ev?2!!~M71U7#>((lzw+jrC)*X-sl6{-Y)esu_wNe^$EjUnf z5oVfqtRO4y&L0CEY$N*8(to_rslT$-`KAw?)Zl#cG01U#zhA3UJEVP+ z$gpJJ5TT>j+Y`(0q+Tt=V=csE|G#P=Ci55K`&;R|ag2p`uU+5YvEu7~DP6*Pz*-LM zkiTEOVk2mWI`E7|O)o<3aPvS%c#^SW#XBc_7KI6lz%zZYFR}e?JF*(a2F_JLo@ic3 zR+=G91Mw}tlJ+l_QXH}ZV?WAnS+@3e!ufT#*W7k3n6W>hk6NYV!aKnss~yrlW!4cL zXpXyPktFfxGF?W(`8BuK_OF9Gd#V#?pN%-e;!{f+sFaK0@HX_`D?xBa@4CUYv@giU z*aXNCj#o=krKcCOr%Nu>m$)SRu7lA06=T)Q&`S86HND5X5_;Ey9Ar7h{(Ou~evHiE zg@KZN8H+Yr2lsEOhLaTCa*v0s?OW5E0MDfMW$aoecg>l^KKVOXy0p}63h(T_7~Tn% zSV-F~0%KF4{OLe>^!;Ckr{a@b3no>s>r*egNaLB6v3U2m>Xh)ceI0I#RkJ(5&U8MP z$k^EPkc(9%^sPN3S)lIil@MN#I~?qU@6$9L+ZYQeymuq$A?XmY@P3bL!5^y5hCko8 zFNUf6j%B^=YndsUaD@e9T#gP!Pj2JH4` z)yE<0digeVpY2c%{Cptw}`F!G0mkm4h;8FeILHXL(LzfnxiHiy%=s*#Z)wj(d z-?bJms&3x72v(Ur1GPEYw@qMz6WTWjPL1tw#GF{?VEHrb#hTz)+qVfq24t8xjgLmBWO#^8GQ=xsz7L&ZvRD3OI+!CE9hd zu-DhGx>iXVpTK=6rqezUk+E;}Cc@tOkHY-uaM;Z=97c%!)wru0%&6f#IjPNSV{C`T zcRsce@RSotKCFeXm>2s`Eff8q#!l_)DcQICs=XV}r+8#RAha_lLpxIe?acAQgatl= z>RJhHGjNQJb*P-vQl=?>*QsuoV*9kz<)&##ozO>Lz2P6xD3@of-F6gv?&EBB@Oh&m z4!}>pur7~_GZ#|!6`rY~Ggsi7FwNfw8jN-S)V< zu;RBb@!o1!^LwCf&4a=f7sHSD<%PEnd4GpGSQ(oY)OPR0{bP5h3nw3R+wnYZ8LZTGdncWeuag?);pmez!YQVS4S8)F|`6d_>CFsel5 zR4gnJF=P~i543xI7lgtd&d3tEWZ&h2BfPMv6wWIRNSY$}Px>9KxRT2-=Jam&GAUw^ zB{1Vtp+=cVI=uWCk!o#Fbu+j4 z>@xeUwy@(g?pPV?Fxqw4SMg)5NUV*a4kBYcIa2z;Zmmui6c|2{BOm1EjT01xo%)TV z+OamqR`S!~%)-o7Bvi(c-LmB#a2^xv-U2NLZ4g;9p5`UQOR_JiUIHmdfZgS`@6HNR zuh&(=?BP`S`;;J6jf~8qGmqNb|Y5zaauA*f(&)Dkb|9=aa+Ly6X z``O(>F3_fDr3VK6OBkuMBP%dA6ZSxq>ek6n`}?*|s$XZ$#XM4gwM58T8GCEV!9-k1cx@ibo-7`w7t@KnJ3W;MhC!IJ}jACuV=R%(G8_xeP+R>mqn6+9=K1QKWx zWKWpd%4=d33vHo^vthRNY##1LR%Glvli(QyY=}wl2n9aM1hLM8ho0$Q)_&t}zlE%g zv30WJ4%kEJ%uJO6?rLuK`Rmi>dr%z54 zm&!DPH{n57Z;y5G&Fa65U0oZdPhME+uMtW;RKTf_lPAJA2_Z{a|0H7xl&y1X_v=d) zF9~5GrT!|RpwZhq71#kdBOLbl0TnciwL=R3&yXDn%}hGCSzs*f8yejov^?R2cbPV$ z8Qd&Z1A>`*i)z zQV&j$1t^3h_!R`d0_ZQP%(5|77BE>rG6ejm(qC{2dq5y1!|`sAOME2zK0*DV&oN*o z{S^hjrc;s^9#fPOWI4uG3#zK5VxL8caAx>sD6gxPitzay`R$!XDYrtFXDsYYyA0#- zz$d+V$+kfZ~M0JSz5gmxHWZ!vIhajqhoFipB zvr8w3P#xyEb>J8)^-)MVgi;+s{zC_zu_#AH<%CL1=uD1$iT5g&VVF?+GPcxzGu1)` zdYTP8vn%~ey*5MIsW>p$s9q+WTOy3G3J!e!=Rm244%Tr3sR#jg5x6s{o7&gShJxQ# z@XKXv1h_YW+vsLRHyZ_h3E;N_Vz<;X8~D9_F7}wnAiYxiGS(zCSzOH{y{f6b@;vxG^>bXX6jUDAE^TF+#mbEyAFSfc>thP+YQ z$B;b2@?ZTjSpA))n`rtBzI}x`9f85G!9JX&k2jhO$GjA%1IJjo)thLjz0MAH2Pbrm zUnH6iDm>`5JpoeMxzX^`L;Exl!&JEpi0u}MNhOR4Orsq~RXlP2Oz*fBGuF!l}ADG2ZD`%;T@seKunDl}U>R>*|QD-T{e zSJ?7K+^HLIwkmKNoOvsR8Q&mlW9*TTz)Lruan)Z53)4>*zWIH^-NYdkl*+!s>f5WM zj^9O=jF;@&2B+4XxUJA{gPNjvKA=o>`&?nck`viAZ?(YqgEViDV{8VU!`vNw)DiFa ziRs$)7XwNaS4`W2GSVlSYA%)1u;3ZnVRGayHO(kXxLc}dhaTW*)usMjKsiE7NxLaP zD&H7;{4VTVCzQ%MOg?3$vUXF6SW2##EfHClr?tQDH{QWwEqYSxN06GWMIdVXrBmT?^_D zCJvqL?G9=i3JgA4qJ;DL3Jv{NyLfU%h?jv)112VWp3i2@9wWOHOI`#6>shKeEuyhK_ai;+b0Tgn^MJQLGZW2K9!S9pDZp_s05v^DA&8J;~cdwW6e3} zgY_L~Qykz8e8{oh7NEn0<6Vy2r)e4z8T;uGe^{62VVwlTe1HG<3ZBt zILsd^HirLn63SOEd!e26|1#FMA}PGo-vWDUBo4t|d^PHJU``ismm}JS3PQT64gzD7 zPV>gZ;&feN@n&Ol$xryL$6jbJm6gGGr!>Mx?K>h@uwRv0*!Omu7axcD*S@AUho&q; z*XGCy8g4;W9AQoW(j}KA85Nznx&G&L!JglH{(a{nJavHxm0gZ`$l4e?wJVgvU6b?j znk{L?KNO3((=N%wY)gD$B&X!~UuZldFkx2)_k>=2)TFp{dB?OafZgUz-M31P+k;O!j$1Nx|JquVJI-`+@LyYD4AqD_@QlrX_%zPcS@f^1 za0-0qmAU4om5Wb0iWg<*>Mjn3&!p{G4P&L;F4uSx>Lj|L7>Ab-;}{G-F}TT?p_|#I z3PZU9W3d#;HQIx9u<`*`NI3a6rL);lN1E7(A+lD+RuUX(lhv!QwmUL{x^Kar`R_e0 zoN~a9KJd$*#z~Q}ryT2|+I!oh__lSuYn|4N<8J zAnGZB2$|-WlQ~*y;>5{e&oF2?>Vu@$Z}P~ zw>e5Fe_$*Zp=x+O`-P;0CK91+_%7#%;#j!*p%y6D##og4|I-3lGD)(p7!43QNX`_PgN2+ zR>kjBM8wf}1>xe>L=!3X*$9l4wE8{<&f0|#jo_Mu!b~y}pC-s|uMevZL&eXn)^&sJJ<^53H z=hVY92!Ds`VP{L(QrzX!gSPzz#;U+~^VMHAdpr^fzdU?+{PtDjx2GPyseMP}`sLzv zxdp#THGIQ(ay>MSS2pd~mVT!MS&^|Y+hj4c3s+`B?N1hZ7}#CMuiYZDe)vUX4*G63 z#-cPUmDxbQ57O^LNIpCAZUmNgV*SA!64O@dw+>d<5H1zYjZr#c`&4)1pq}(i-8K6$ z+GgMw+tPPdarCZY`5XazxcRmSdsgsNAGve3>8{;reT2>x<{3K~bin7D93GFLE83lvWa-$p(ur!i;tu877(2^uzg!CY&G-tjXP}MPb5YS_8*LS2$zzgz zuLb#og@R3zh0_#n$M7VWg4jCi4){*yl>#b3rk82eCbd7-tYs?$TC zJFybxDs8EaJJJ0EtN$`Kr`BH`4`W0Mc|u!-{D*FfJnqCKm8Qz9>c(?8RH%c%*vs}n z6TD>oJ9E2hFc&{P;PONFtqQ~|@q za|I^^O7WMm&$BV9%&T&Ut*`@dsJAc1k69-FY2H3oDgH7Rd#n_z@hbj`fmDsZg3}q3>J@St8#6)^ug);ZNgv!R)%$qHO4>;+ zQArayjh7jr5{)`&7z^iMIlO&QlMx;@kYXj)V5xl>`|3e#6O#x7#7Pp3so4+qZo^r? zF)*iej+8$z_WI51H|*DD&n_$VczS^#2A|xWc=eVo?VA2Z=FPgJHaaFDGB#Qv#nh~z zTeg_5n}wM@v(yt6=D*@TLlskI&~Z~6W3@p&mu-1of+bc?Zh)rSg0A0s#>CT>^vo&c zYHHtUl6?!G_TS)|I$)>}W&p+vk`VKS(~(nmB}T=4Et+TD`l>>ySI}_N zFxF4#PwO|t+-Y_sMqTca+Gc^5)KST`3f{8eYdTL?V64J4D}EUIu4cto#63~=81L_S z{gx%RB34tSh%Jw8qy3&%#?FkL1^*w5ov=`f#Un8o$7nHbqrM_zQ-y~)4bFMT|MD;u z>}>oNtQ(is<=Yr559@~0(@N=e>G%JP`dubc`%aha`%uo?qZn9AMCEs{p!Q{~FRYRr zx$Z0MVZTv_U(nywzKoTg`|c?Iy-~l-R0qv}=ukC^sb;@bv|cT^b$H)>-BC^^T>jEkbWn^TIoqMR$j;2 zWY5(}DFjXgoV8*iO&2!CCJe4Ut%)Mm4=x652wd`cX#ZalqDiA@wuP--{D>f(D@Pue z>^tQWiJEgb9mbdUeanS=3GXkdS_Gqucr6syvrzjomJ9U)AJuPzmwO3{zh=O=v{;Fw z?;sl%N7kSnR>4%Tzp&kIcDE5;lO9U9nza8&DR>N4)vbt~0owb9a zLIe=~h+;?<Py7RP0vqUjGQ_9L?0KTGKrPi zSC7KnNwH>II?Cl3tIg2rPTn~+C{{-GxI&(;7pvngJgJYmm2kTo<`Z?(xxzeSN3TD@ zIL2c=)=)Z;u779kLJecNDh^`9Ba1~ie{KA{$z@{YqzzEomx$P5W^ibIn`M<4 zEs8bWbWB2IY$)hRg5$vo9-$p@qHn=nu{s7;y88)*P7+1lr}ky+jo>eVestcvGO=bN zoN0r<0|gOce0NWglauxbpCQ?oSa;lgb$|oEy5!gHi5VIchM|BE3Ph8z-J`I^h-3d z8phJ6^%f5cVC9>^-@zR>gWF-<(AT}!gS$r74>2~Ws9ZdG2W3^H4BhA8?>$#VvS`_P z`;9vqaG_i)W7`MzrHYkrI-KK3J(7d>oKCT3Bqx#5rpQ+2 z-M=N(7zRB6@-L`;8C$41Ur3p#h!6X73iX9)gK5JK5*cwwJkOtx)l>U2_8UDH_30Pl z`9i~>;g5y~gCxrP%U|k`cb(5ZenEMg^*=Dyt3i3brR($TvqdCIex&6>vQZuu3b_Ne zg=6k$XkKk)EU|7XxaaDCd}rvs>ki~$?_YkcN_{Q(XgwDR{ihdE2a&Pe8GAQ4omL2i z`h+(@4zXHNoKx@DX(AOLI43)48nQ9=w0`iOSh+{(TKIjPSmS(*K#cGRN`!fJ#CrMl z`@<-g%#!R2>Gu8Ztx-MWL!cLW;k{b1#+)ss;w}5c>I{M`$5`u9XdeuSHCk93Dw_Q; zJy#pG0UP)rQYs$2MbjJ4*wA`o_B2S{cOab|+E%B=wKyjh4LA!z)4Wg)wJ&4Ex|DMr zXPaIfiCGt_>r&Ia4*}I$U67aNg{&}22eGp2Y|6Q&SG_@ZiL-aNR)5fel99DC)=$VF zD5dG(k}l9uSklD>ef$o@1gqt*9^uYtWJNdIY~fG-^7Qd)J_<_<{#27C@m}Q3)@m{r zb01`Fj7@~Y2-|v{Uj21ih~=*1&Be{dCC8zs?Id~T2%G?bEcBxiY`;NnhB+SOAad9{ zhP*%h#>9E!O^~|Zf1-N=>SFuTGFDx1 zzTmvkIUc${qki#e!IpwFb%DAl`9&dWqV-(CS=v{uVQf*3(NLi#(Z!$s17=nhX#W*1 z7httU^sa_;#(#y%slEbZ&lL=fy8$w{9WKc3ESUQ34^S48sPw}>gnA3M^vg8wvoaQa z<{yc@81U`cf*-=6)Q;ZL_yf$(S6=)9=I3`(9Yn^GXxMFct8;?AF5sIXk1LSQ<%bHj zLteJJnDb7r@1*!U!bX}J3$y#m=eybr*_;9=ic4dMMyZo%Z!1I`$bE0JD+gWZQBYd zt}@}IbA}!AOV~M;J}>bm%C#|;hukBv$2sM@IU#YGeFEM0u?eR?^Ziwla3t@&7q0THa}X4|c>ZZ>>5e zR;P`#z+FiWvHGp!X>zog$k;}>p62lxe#;KyxA!6Z_Ns<&vF19}!N%AtkUL_@O`>V- z^I2N^G}lZ$kR%>#hFDGG?~{^!Q*H;rmDEA;;8BRh0pD=&J^5R)Ms=RdE)jTI25^ks za8I-(_ih{#E7$j_2hhG>4|LuUYnq|n3@#ccdB#E;5cWiaI!^CMeO0QZVy$(go~mJN z$DPhTvBnB@@J;IvL9N>S*P|C8H@h=ZCq;b)#*Rp7qEgQGU&e}+-CI}PS_QFfVZCTc>c21qeM1n+ zF34Bk64U5hKpSIm&-ye^D}Ik_K>ODPUHl+hVTeDYiD+PD3kj0!+fu$hXSheS%(731 zT^t~GMd+cwG8RH;7WA!D)A}UGSmo<0E}ni%w3zkrFp`mE#CoOXSp~!(%`-mmjr#J8 z#ro(o;3w$iMptt;B9!uqWS!ixk$ZVxH(=2dE6#_}A2mWs`B z6V{4}2TAxi=ouTg9L~DG2C?^>o7bs*8GG}VSez9%glQ-uafm~{iP;F|rIVo|PbL)j&Gb)Q|NZb71N9+}-sK(enI#^$_NQD3@a_^htw% z(!J#SQvQhX@M!N*2M;Ck#v-Y{!!!2u-LD-aLS_AF&YAliLmDV&&)z312v@ToWpvWG zqhW09fM{tSIMy3753~BD>oWty)C`Sij3u>n6`Q8_1VLJ`PzXlYG1|{8hmhMuj1@|4#Ob3^Pco(V$JsL9Ya3LkR?ws`@((_ z9K1c=k@4Y~`>i#BK?K@S+S#spd`o1x5fagR7#&%jk8?^;T+@| zv0a(84Jj~IT8G#}XHHA}m93kM=lTK`N-osF%2=319iG}JR&JoNUGlF;;v&G3MVzc}kw|t4xx@&Bj;^H?o`@Nj5%Ys(=}}j&ez`WM9gFbvlga z`}in)#z|zlLW1(Jc&D3=myZSEl zK|P`&DjU{@w=`8}rsIllsT|TUHXc~fys1x-ZA*t4K5V5o%DmV|mdhJaUxBfi>1PXC zVW&!*g{a8JJsRwEZa0R{aZ9IEzA+Y8S2kH@bv@Q4X$h+c|xoqV*s zA-9OkY2P#L8_knT_n{6PV==u)ZEJDtP35D;H$1vcZH&2~nFD(vMZVRT^F}|_muIZn zxK~9Yr+#Q$ex$BHC)Efu-YweM@cYSW-$2+?n`s!^pYx@DQ~2I*2Q`Cw98XKiCNP#= z0Q-HwcaF4=i@;d9b$yO#Ips*a!9yKgyW?PdV)wS7wGP+9)dz0`TWOz|m9YpL)B5A}h+K?y_c%h+pBcS)Jl)`#`r`?BxqlZ(z3B^T_4TDd3W8=Zy7+8EneaL#x= z_&&V%tPj-2fwY3OK`n`#bLd=Qa*?{wNbNx8v-~0Q5o>2rVa}cGemL>M)L3MA&VcW= zJUgaupGve)`!cracJrMYuS_hhU<5d~zC0Fl{)hjOXVtC>q~T@@>@ z-N14YSq)Xjoz&kkM9kQh4Xm!ix|JEM`{+E>L1e6tsZRZF zfV(dRq&>RG2YPOLU>^jra?LQZHpY?#K4o=NPde+pD>ueeRe49+#hRXAC&;`-cTGT+ zERgiAOR85&8eor7BQU5X)WN4%K$9T_vK(X0&~75{-wF-{>RK>Q-|W`qn>`%7p}qU9 zCS-ZWq8+Z;ZUtNG1h}UsIFmlzQ3u!GkB1Wzk<~D^tq${oIH$7edT>9iAg@s$;5C?M z^`9BUzsL%VjpFE*5+pG_+u`VUKcBAT%UX(2IYR| z_;x^&OP*%&*Bawc4vfg{pmN*$B)O;VNOCzhTOZR(<P3t{c;r<@m4SGMaR>mGsALKz+|GC>BtN)?(tZ@J38<%K*pU7Cz(&{=k zbkOUCc8nR9cigynu@~yZI#sud#vhbxV{EMw#(zWJsuL~ouA7(P)S*`AG)PYnhcV_! z{V*g%vTtU+-+Uih@0!`v(NCbC{3i4-iH2D%t3xU#JN-~D$Jjk}szvg!a_FsU*K40~ zPTvEqNsKk+$xsS4B-65mXKZ^3`qc1Z62@ zY?#QNUPhlt?aSDQPcIvJ`X+pOi$QuKwJ&39AisI|?hcwW@X%}h==^z*>#+QHln&FI zzJneJ8)*#YVfG!#CoKkK%GP^W_W5z6Hmi+1>)hJrBG z4*G|7&@i?JTDET;8;Ju}u*0q3Hs}xVn~!aFmj8~@VP;bo_BMWSJ@~VFWzMXYH6i;T zCKT7H7PI>AC>_2I*-&(0xpR7P-R0L%|L%-(HO!B)cI33tI-^^jz3Eyc^}2B+MJ<-p^{I_2y5#weF#tNWpz_sEH@GWq4x0f>=4Y9a$@5aV$-=^jv*f$ne7cg+Z84 zsxVB^RC8JV5fm(YJ0=KaR^?K+kr`;7KMlf{yK;i;h+Uf82CgFb&;wi)j{x~sL-QYysL z@`7V5efB_x9O^we5p27YY@t{9kjcI=@n%bAKJ|_M& zjBRxBk=R=UBi)vSGs-rx@`>xT|Chd-jj_{j%z)PPjGonZpx4e0y}qlk*BA5c*})&b zBc(SID%rPua_S46%V77U6)7`P+e!2UYZuh+&O?pwrS>)V_RCQRj8OS$!mu& zHN72Ep9(DpYpOA|s9sGXpE^YC%h;kV*xzeRBT-oYOEsP|7UsOvP9ooKEZSl;6ljpu zFc$iHBYi$J<`n496~G8dMB7KZayI6iGm_B^D`Us@pJvb=&1<*B zO6BVlgB{T8h;l{7Dzba7N`0Q-KX5HLw>~ILfcJuT?6da-N#z@3HMs9%Wsm(@umVb| z((%}fx)#P!wRBwPCarstFv-4|^%>+Kq<68#H$>dkpEiD>Tv+ZFgYnS5fVKY1f$|x&2lqkEJ|4z6seKuHquwIl zrzB8|RwO_z8b*_E2AiN%z6QG8fF~krW$b=MZEA7ILA5a#YF~XzO?kPZx!F?Izc0oE z`oR?{YG1~dr%uNlwBP5>zNGEI?Sj}?zEKg^T)r<}fi%dqF}CS7=x4)ncXAo@lJ3-l zT_L}Ou~bW|<1tfz8nR@mWQTr3e;%w~hkS3JN|6ATFu>Up@Q%}Aq*}AeCmdOhv3^2X zFPXy&{|v22g*i>HiItO=^FoDcimAdQXo;SVeesO-6||Aug$h+mc?I8L0gY~=MuVY> zoc}d-2Wh18jj`CbdEAoJq0qNlzUb2KI9|h_fW0dUysM)Ids^-qBG4ohKCEsYOW#;(aJTrNO=gTL_X1<`V)FIXtp4mKEAYsz1$ zY*(64uE^LlZ;WL@p)d82hBDVCg>fG*do?S9Q$kG#W#j zE7K<6eT2Rn3770Ex09(-%LOxVzF3WvTKU^R?Q zZNhwf@?R@bZrV8*3qMzw21MM2X#30Ue6*hxS%I+|3Yy*s_*MgQ%o|Dc_`?^Bmot<* z`HMHN-Mk@0PiR2a%GfkbQ!&ihNWa+~d4ohh@yTT!e?bJvnK#v^x#-EiMpk6((Jt-Q zqad{+`KL`>v`0hC`CkIr^rl6f(ng{cA0TUEY|O<;-*jgGFVM+HxoFuT#ih9Om$#lR zeD+$(84@j{`jTameN|meZzzkk>3fr21UVkRKBL#_E@!k}Ogg3S79xFUKMcoMWmm$* z@|2fOVIK(J)p8-}M1~Ce@<}xLHGjdMmd89}HA39^&HIwR#(uWu3u!B`*B;7aOX{hY znxO9bOVn4xSWlSQ7&wtAy?L{Y-HmB0%K>{F}IdR4Saou>9>>?>clT3$F~R<>GR zI$>5l1^#B$=2P@<{3~rzUCzc>I9m@&2(uDvrtf#Ya8figt_kjj?ekGCSuWYPx!laR zTB>2}Voo^J4Pb;$ZvCS3g%*hU<>pw(IRNDtYlhs&90M|%sRmYa{B~&h$*q6r+@~f{ zX@`;J89NR_Uo?9|7-uX8xiNdyR6a_GZ?#xbk=2aIRkd240S(Ii&8nv2%eteBD<)T6 zf;_gNwM+SiIRROLv6q9i8Q8~`kONO{*qCFE=b^W~S#ORvD-~crWUY*CdR1jtU57f< z4ahGos++27FylauF=BH$lwvf!iH!AJ5DsZF=t3Ix|0&dtJ)VX+Ic7x;q$-c+B{;~l>^H|r)9vC64QRJ{ZqRMsb zKx$DQ>dP^#`Y(GvyOm5;_hSF0ux^=Sc3 zal8sNrgIuJjKynhmPm1>2=$97E3B%!1(wixe+1Wi>{8h+Fc#Vl!sK`?S^vEia$%Wb zp=>g>FJsGh!MfYsJ3}l@*gIUT4^+vfT6Ps10^?;0E#Ri;drHEJI z$XHBneM(UfosA3YLuo&kjj?m~ZVTG$gR8zZyWrfE`5r>F$w`jZ-hx?2_MUpm!pXS= z%XwL#pB4Me6@t@OtabW*S$i~$hx1ULZ&N-qlO(iJ`!d!!O{^vUbM_8|I;VeG+gYMm z_)l^PR{m<1IX#ZlmMlS*XDqyt@G4yYtd?*kFecqz4{hGsiO|>KB#pH;seQp%l;QL^ zT~ zWUY*C0EvfcC&MgRbI!Bp$D3L#%HZ}r+Tf-8oB^NJX3=pGk+HrerQKN`b3?l_Rh<-o zdWUJUbhvU^I~UIB3qrXz#;$LVfO0o^gDfz>D)qvnmd=2~wdIRY3uMVk$-ZsT@$LV7 zD%sx|*ihRRje35+9JMOW{xerK)k(vGV{BusHUi&hTaZ`CAg5f3mKqE}+ji=cmM1Mk zxjbV#m(?o^xuoR<+Co?vn`AU*`{>2osU@!{F^;hQNyeV6vxDtB$^+HYd7NQ+EBIs` znIj11oOixZgv?rmas|dFTvUYYT*RL#))$6N4Nd^~vXT;@>@RSwn&ct0P5vA3PsxuJZL9WQyrf1BTF0V{HW1Q1H7p-7i&e#EGb{n(z z$Jm3d>~ z75;X>E}cn5nqc*^PT08@POpM%$a0LmV7#*QE4U_KTDrhjP%pQIrqA;hdSRCjf5>4- zHL^To^FJHCQ%BOW%dr0uFuQO?sqs^`{(`Z8uIu{*cJ*Cpf-wvC{!~fT$}7Rr*eJ>s z7<+9i_Qb%5C><}u{e|DI%h1__F^_ZaAH~>z-#_YSuz%F<9M}`H4)^qJ?nSvGV_geg zsN-R$Ox#Bm_hnsMhdUyp3-^#(MfCW)T3XHAhnI))sXvzZTTA>@CNXv$~9(dTycR!sQH8Px@SOh2(!?k@ zbG{7s?zX{dvOZXijcL{|n4|H`##lv2_tlM6kIu80ZgsbnL!Rb8UFg=$H;tcX6v%?j zlqIVq`);iI;py&rj|GnjH?DV-|2gURN@WD{j?n2h{s|=*>cBDfRu5UQ!$h9kEJXIK zKC`iEU#1f3ez5OVj3T76$#*`oJYzQtu-jknnITIn_ADrby_1N4pwJzZc;;o(<%kw( z{sUwEqc;m?1)PA`9_M`ghQ&YrF6`-gFkwi&?3nZTkeTKs0%N6kyCkICKe6v<4{u3B>julrMdMaH(= zi)k0l@bp-Gdjh*b^@RrNvjj3{Gpy~C#tUtX-Fu1P+VxEz)_l)aE!%z1*GwktRT;Y z$DHY_TJMe*jt@;J^DDzq+rpazw17J4n^r(#VIax^u%-*NXM7 z5Y$1#*xPk8RcQUD2m&#)HykQ8!uH&80)gBY_gP0)V5}4$p>77PZTxSC*%Ta{rSLCZ zLzif7q5X(f#==_6u9ot2U2|pMd-ff;s{yXyoYn<@>AfgdWUO@ekKDnYgRG6Q&~H@E z?c*%^?4g3(Y)y8+U$q&=>~?*!(WaYik;a6{vyy#hm(SieW{rq6N6B(@xWxr>r2cir za?s-)KM*(Q=128{7eF5i>cBHLw8Bdvx8i$nJLZGkT=laBb=BTW89FsBk2Q?- zQphOTR-TlbYxMtqTYBJJZ`d(ocKMPDltAsvSogEpdyjt34&z-TvR1}wU?(IZyx$Qx z_bFj0H*oG`c)D7@_mcFSz}d)(j8(wdq%GyI<|_2f<;oo+Pk#6`WNnO9SE0s=OCypV zQV+w8@REH;>u1+JW>Qz}F#3PfR-T+2cqvmS?E%j*Hc9VW_G)f(`4atqK7YgxJY#*y zp|!qb$2wnfcrC<3(2fvaVk`G0=5>T9;6KD)#!7x<9~=Qn{UkRJ?nZDU4e{5_%0W(O zjW78O{5;Sb++pDUg1V8lx>@vF0e(lQ9H{MsI}+S~bjuapEc&ejzx&`PXL8lxCeNXp z+SkpZ+*I(BQ$IlpS1_+^e_2R`v725`fvCZLn(W>LQ(@XMoqlD_xBZFI}ExmmPB_2&?OM#()0?qYCD zVL@U>+t&(y0`-&R9s;+?Ethk%_}&fRS2l`0{0CpM$IbF?)&tnzg5SH~Hxkbp!EL5) zd^e4o#drG@{K}~u?UBp_dM#R_I0x;rvv;#MzP<4JJc;#aI>hN z<6B=64u11N2ej|>?;u@)JBZrM>SodJS@7Epeor!X3%Gv;?wOK($FRG=uNC}eFxCq0 zE8u>dvbHhom*7X9CuAyP&w=|fa8IEuQH|Iab+`t83&C$PV~4>V1MUFIa${Kk?|sPz z@bhQvli=P8ZYhlUF>E;a?Et@tj8%cVjJm0P$FQm3R}FrTGIk5Ne?{HM3S-zj@cRP% z#xeFaaDN4EZ>q0#3|j(z$Ecqa7G>aW2e%hx#WC!=;CB}MF#kon>;v~j>P8)GW7vb> z_Z|3Q+C;V<+<&KTWJ%m;`+fj^Ka67k7u^4Jv)mZA0sQRXCqpS9_t)UQ25u?#^JCbL zz^|M7NjiKC?(1$=Glo43em6$3zXA76H!F-`e+z!MMzQk0`4Uy?hz?dai|N7#{1U03 zl-?BJUgu`TG3;dUQ;%W;!JX=6ZDZIcz;E*?mIL=oZkEK4*cWvO0zVD-jg*@q;MTcW zZVVd%ewm}>^5E9HS$+(g3VylZH!_{?zd3k1Ia#>Rttftw`>Blbl$5&S}^AHu$54Y(J%S#Auw4*Wt#vGXoN z7=!x>sxLo=Re@jbC^iw?Mz>te7IJe!{F`* zcL-&zW7tdJ$Gs%wllX29a7Tc9vSi;etj`Y+x4|z2bU=GYfx8&o%)Vn-9{hw?sJfI@ zbwiy1+!9L?N82|Z{7R`G@?c+Zm$_MP47(2e-WkPyb{*;u;FiilehmBN1ISCjZ#-4Q zm$ZSq-_2^quhi3zelMb%JL(*;8wU<+ZZ-zI>ce{lfu}K%ma4>b<_NJ^+Wsm zkr42U8pVc!n|HI^7&aXIRNyD2c|T$VcOtl1{_AG(U3P%qI_f9ATQRuRZdNmf#T^Jz zN3o^g-t1-tH;XoV7yMpgEV|9$*0@=#n?)Tg;HP7(4BQpqPIt4Sn?=8B@XH(}_u%7@ z_kp{g#&w&UMcbR7fM;r?xQ^~G!Mz9EQaUDUM%(ui_%(nZ<~x&t?FaW!a7%Rp&ds8} zJ~N}GItZn-u$ zi*jEAzo1d92Hf-9atX9vWvD!T7i&J~n?;?}eF)qN>PCIJG3>e>pfC81*g*sCdEl1v zGv3Xj4o2{c8pWEyt#-@RxLJI+gW#7+{Un`CZ$kW~_u`X;QLKyolk^???F~*VVlFJ4@r&CfR!E(wi@ zTpU`Mzu1svOv}zo&nZHEI~bdx&tJH>C@Uj7Pg|6p_uAroeZ`VI~AKC9q4pu;2wF=^<1%6k9S~39w+Mg5Gw5$-EL?|c0{D?5@c9xxN8!^BpFhE;8QI2%Y#Uq? zA#I+6{0`dGd!YT>2!Gq*v*RqX9d7mtFfYM%GyIJJE)_mcz~?ZyH=je+;bwE;I)^eZ z!e!9gp~k->|BzLzA4zZaiv?=VsE*|}C_*-*x+;zJ{h z9G6q1{h5}e=M_b9I&Gegi!O@F%L#?Q$f_Az^kQDl65XPg7cIhHD|Iig+(feS(v1Zi zmz!f;!XcZ>*wD}-E-xovm&R>PH)QdgHcF?9&PyiRbWZnbiZLHqGh?&US93-~UV1^E zF*h0b{H$~%$$O{^vW+7;Fuf#QIM9VGN>A2lUxc@O*-%7v=wK{9KZDE3i^|4#BGLMc zyx1r%SGztpyC8=%=Av8&V{@{!hG=~<$xYA6%iEf*jpevxLskZ-)o13Xkep0p70*ld z<%)8*a0SK!eb#Frksv&O+r_JQ@wxmmJC}VTDjEq#0SHKxEx8%XgXKvwg3_0tF zHiy%3PZi{$T=j@tL#~#~B~R+|MnXaVq9L8UT#%BUyCE-~+AMd3&C7W%T}S*1^0bEB zTzo4oH~LA`6tsiiDA&x`!hFs^p4<|blbP{6$-uvc=kq}6TrJ7f=cm(rvXQZH1+0`0 za!8RbuZWPmO{w{W6wr(jZ2+GR#>z?2G&$)Bl#|0#eaL5fAbUH1C$)Co{$cJsjlJtTIZ;oLk;C`o>=)pU0{2dM4o_LNoBcibJq~`TLp-o`;2xYHhh5BNWF2L5 z-Ryqwdl}dU@Jj}^9NhTncvMDolr=Nfmta2y_JKV4y$|twS5Dpm?wyHH79`8aE0k?? zv)C_zpKIUwkRSHItBm|;6yIz;~5mjtIupDo}%@^flmH;er>_!$Pj-vW#MHTdxdxrZpL zcC*+&gCEDYKE&f)UxIxl*st+1u>HS4xw(uT^U~m$?ZMY|faKnoi4>M#dsD+b_m9t3anu<+8IP)8}%2 z`F;fR9L#4>ZUlIDx~0^6?x7QG&_7ueT?i(EDrSv6xrbfI&XF7nfDB6*OlFXOU9xqJiUm4%=K7rB(Oxs0V^ zb$)Y|BsVupuZ7n$kzXkA*TVPln&gFAk(hZPzf)oA` zYKKO~=BTtBXV7P*!#*RN9;#*ekZW(r$s&flxSYI5nxAzrb_4e_Lyo~vw1qtvHiPji z%1=*LZq3b2PmZN?v>c4p<#6fTsyJfIheAsYnWX+_Te!%TbNzIFL=Aa3+Ch;b*|$Jv z+_IYERNSg{KOrgcewat6b9s4rIa?qkIGUe@GIl)yQ5pGKE;BDTKi!b-XH*iMj>{{^ zHs+^s602rxdZyow7^2gz=Cs-ATi0{h1?g#idFzQWCzs35$&&J4#$r832T|*x@5q(a zM6Z+Nni-pA{MiRC&M%T9;d8ki;dA|VtRw5=@F(X72YG;82V)n~f5dO3 z6qq|_PQD+PM^bbo3sVTSFXRGPQ<_Vn^D(SAXl8Iei+udx+US4ChB9{ab^Psm)8!g{ z4Oul~v33g8QmDINzgXxe(0|kjb)(-we(_tZ-y)mK*wJ-es3YwgT^EM7unbuvW$c|{y+g21zdGl7Ti?}t+vJUY%@gt_ zsQlu*{^D{Bouq4+%#1xb&^`FOp_Ji1*)e&H_e$?`@?9Q(bG^m1fBpf=ZDi~mmy>LR z_YL*j>5(M6>uMby0889_P&2&SWgzqEyLB-3J+PQk_9>Y_cDVe(s-9roKe(O*OCJV{ zS4j3{>`UY^h#?mD>c z*iIrni#)fJtouIq<_;hBJmu{n|HJ+MfkvtR%h+iie&fF#{}p+p=as7q2XD;0zrHc2 zG3WmJ8#5OUzH;@E9@N*&*ssX9f! zGIl#@da&+6fNM2q$H{)?Djfb{csgi(kA#v8cng%mRPiVd@yN4#xh?Wp&LWHN@$9!gbCSDKnGp!yUtCWz#*T4x-Qm-)jqy0IL$X8nrw>o} zI4kQI-ac%GWrOG7NlvP-nz1!x7HpaKH`fXn)BT658#Enu2_$`(cm19$lS%!wxr_}W zv98aD&kxtTz9RLqBeF{*#btkBc<_^913BW+M{Q{FgGr*~*cuu8%H0?5$B?Hy`#g_$7zjvvV1JO}xSgdG$-ay| zKm7S{tSbn5keA7RPk2}QumBd75xM6$Z$IA&k5KzER`F%*+^uyyiHLnVFGeIGly&BkU5OW{jPoXCT6Dlxp)4#_n*7?d|7*~_1o+0v-Wy6Vq(J-jO-t`TaKNCuhYY@F=EH!Td)HA1hi| zym-;$OG-*(rOhvIdF9ntU#tGr*4MYaQL}yfj$iM5bJtsMzx|uts@@7y``bP5?A^C- z|GNj?JNW(w2R}UY(cvQ>9sRiWli$^TdhGb|lP8q6#?+qr_s>rK{`8qMXa8{i+#k>X z>B7Z}mp=dEi!U!D}%Qp?*Ucd3}U;p~I#+x^9eb?MO zvcGFr_12r(&5pO6Y6QNCpE4OQ8T=Wd+v$mUNhy@p^I)KTjp+?F#i544*{P|N%dS*j zgpIdFr^G0&&(x-+D#^iZE{UrlhMYHCQn%eD&K)ip_NLNinOgQ&Jv8CtGG0sM?@@Ie z-+lzk2>OP69Q;!2*9^Pxo7&G>b!+vs8eU|N??)Vi$Y{mgsI_st6{a>A4;eyEI|*YX zI|5G_g@wdmEnQhv(ZkTznA$}AKyPe2P41=*hT|j0;w7iz1@dK{*$%a)R?YkI{{UP3 zR41yRrp`^BU*On{_BFL5LPvx)wM`4z*t*)i+!Y<989~={-EMa}f`W|pog8T2R<7XI zp>0*W)qN1az1Jnn4!VRDt9)OheNAo4@2*B%?To&vey;Unv~LToMu`fsnuE6J$s&)% z@`ijZ{cWoZALTc-f41GHy{q-t_v)GUbM_KPH|GiGb3s|IPOYxC`q2F=!!|2S?V8|~ zZJr8Q(YDI7x!pUVXTu!rlOu9FY=}JHF}~CM=>4~;W2iB;9Xl6#Pjuz*!#&oZSPdtT2s3&H8E{>-^~7J((?yOM&+QmA#V;HHtfW`IU~N# zTr$!zN@?p&?X#mp@2eUUHtxCcuKP{)O`k3uY}CTbTN2sPSCrGqs-=z5dwz;>3lg7nU#b zF5bC#@RIkJ419dsqhpP=mKCOU)`G%Fp7X-&>{;I2(>beV3^3k#tueJN50p%F-T&P9 zuyIvmLhpNav}4qgkzZ%3W2iN?IU`QoJ8amSL*s^24w8)gfoIY)`|s|Xn6@sp?VV5d zY3!}E^`>@#?`l$Bue#g)iQguaclX4<6xX-wi7tiSj-B`4Ha|MPlhS&o1lsp}#|@FW z9g-s)?azk26S}!wm1jlUr$Sb?Srh!L)*rgBwo+Q3sqNG%%k^B)31>HFiQ}9-)4o^l zufMC^r~R4hvA^wW<66%$wQq2(j^>&T=Q_7S83v)80CP`QRK0#v`)c+dhi*-Kw0C9C zTM6m$uDG<=UwdbD9v<`K+vY`Ace)X!v=yfIfv7_rhjcs~`Cw#2hvz$_ceoOh)UUqJ%Z^e~ByWni{Lh zJyQei+olVDXRNfTsa@9@Pb+^=yt>CYuiD=XO6xPVR^AWCLB_L4RyY|>7n9-xAB}6IEGqF`@wDWvIvKwc|n@+VYCcV z@!?MNI|ABzOZ!nL8KcUMMDavT_&7>tsrYC|Q4^W!7(CO>_Wh)zaAG-;ky5GR-$lwM z6(8#$yNHz5XK6p}AV*c%@d)`s#U~=f&gqkr?In&_X|pWtzqglrRoSU@R7@kOJYc1^;Z4A#OmxB%OBwq#_9!jpXHoTP5 z)?3;?x5jIcQOD{EwT$#X+=j=JtE`9!HQRTF*}h-3GQ617yJWvwBKx&Vp2nNWwIIWz zsd{~u_AfzrI5HZX5~?nUZ=A9a(~#>9!^0_UmZkmHAq~l7;AxcClfT*x&nJz#;r*1> zZ)yLg%l<4fZfc^upnRvvYj{GrWs|Ui!0}dCTD+d>TQ>(~n^?PHqr9N4>aDS~*rLc# z!xr%!BG{h@Q{dR2$Ww;4*3x2&BGra1iZCsV{jmnurtFV>js9f4rNtISeudlVN*t{T z_9wDMQ})L?yukQQj@iE0A}{INl`V>latQXvzD{L-++SSkczu@kU6uE|TiK$>*fxUw zVQd~{fBYeSTeoKojVu*v4Ewb);oM3+< zzn`P*kM{YAI)(~Mi!Ea4uP9sOxIY!_&nB0cev2f2$LOclSXyk+CV4L_ThwGls9=AZ zeED-_f4ZC=uIjC|w8|ExGFI85Ltaf0?9VB?o>lhe5^sjm)>~R^(Jk5xWs7a3BuubB zkKA3P>@Qp%ep_ihGtKtJ7Nev~2W5+1S$0aWzaH}D1IqqV$9}j;vl)}X=RIJ zWXKbO{mqidv&#O;<=TFw&9b!E;wC9tuWa!XxoeZaw+(qzY5kTKTl|GB z>CTMV%`Y*n_{$?@1P1pCW(uJbATi*$9*SM}Cd zT5Pemn_Dclcs%&!D#8A`d){MNnN!AxZ+uf}Yb`Cd_(I1QUQo8!&--ABV1JbfE8bQ1 z7v5)^@jsjDEiJbATZ(){a`R;!dQ3+W*hZZG;1Fv?@9O>ybN!{C-5aW3_GrA)^@Y8_88{F zdZ>j~c=+M)oY9}GZPuP6uP?Xw^}v+0JPXkdk>5bRQ+>DkX6;=;bRcMm_B2Fq8e$%| z>=QJ`OuTV-kI}xf%=YEKqO$ypTk`MlzH2eMw=q^Gp`-^+=4S~?>uc67qaPX0Z8i&! zIx2&@hU1L0sC$xd29-9eSvv{OIjRijOh0nji*#V#6wV;^UgS#}ZRR(%HW|>_CL;#h zWZfK_?0KH_2R1o;OOx9MXwv#gRd0o<)ujA)x;)cEm$55#NnmdL$;TYx)*Z6umrltT zt+X|!Hc0Ld50b@P#cRJ*S3_%=k`^qVtqzfn-nKICGo`IHwe4i)p)fi3mk9CB=qULy z(bD#g&XWJjuF`jLcX`HGLsV~SdrH)6$ucu0P3rsKE#;BJWX?yUfU8 zJJ7y<+1lrEDY^KpT+di9Lmz)b8b19%-dc7}hMfDG{K%)YK2zJ#w)SMYZFIlswtls% zZ2nGrZSwjzwy*9;)~4NGq_zJ>X|qi2ds^pfQF_q0#rlAZ%Ult>C(yAaO6xbZf&6Qf z-vW13D~W(uNP>QW{%^B(7^|O`M zXKGa)D*TX6<*TkrRKGDuvR2pq ze;1T?_`jf?{V!;j{|nkJ|AO|=KWbg?vDoOJgYw3gEv=?nOts1Lt>oSzL;86WX0XO< zLE*f4dA&y6>z%p4-z(Xd+`AyThc_)LCCO*_axXQgR-9NkGk?LfsUz}p=gIi7_e>o$ zcxU~_ly}da_j(~d(hw!{6=gBdxFTimjma(+Qx;7+TKLIDzOJ%P_=e3 zm&Rk&2Vl_h8GU)U`S_VDvbk>}u)^oNDdW-QFm9Gb$$eJZO_cY^qi5zwG?btuo z+*UQI^qs^TD6`VTNL$}Xm8-kdX3Eu(skAK0>yze7?K3r()trw_E0~!yLlzWHEqrX4 znHGP+yjca)9vM7s!OTH9IV@LOATx_+&UmzN&b)jpWA?P7nOXm=v+5jMSTJ+iBO_<# z^PvPAcPSOrHDGP4#AlocD-M$#O0Z6p=2wuPJ|zL1|!_@4#UJ5^`ZY0A}|zh$t_co#C&HtyF5 z|CLVl`tbw*t*$2;RiAYQsrt5X-mIX`uL>$(<@!{Da0ZQfda!~jQw#t)0?k3&Y-23` z`(V{Pnk;KumG(nt)veN2Sti@+7&1VGJ+B0Gs<)*+N0k}pm)QCaY)T&WohMetsI*F_ z{G8gh+Kx>bNqzIwh8e8SRc|=9)YYMzXo-j|-5tq3Z_Cg!71$2^PEAQMWOw$yGc};k zc9-5Wa+u9#)uig2(p<0lsG+L6$Uy|oaRT3yE)`!=)7qxn>8Uw2$#QAD+d*D1gn&nL zI71;^3y}zjBrghhVv`u~LM+6wUp%@5O_M}Tm!9M$fe(^3r=$?4LK^cN{UDv~fsg@% zVJN6^0o7~Fgpn{xYi!IS9s}cG0!)NSFd3#mwr1yl1zp#3w0-+>NzZ0NW3Fbi zvwefO5pJ@5i&%758mG%+*Cm`GyE2#FRO;3Oazi#`_O^r8dtdS^+{Gkl49u&t-=lqCIbw@-gjOV;m}6x}PS=+kuD@P7Jg zNoR%BK;14GcQQnJ^MYK^BaGae7zV1bx;$6LqI+lAfSV)*GIfLVmU$ zCe!t=gL8Co=jxI%TaTByxluVU3=Ux|Y0kupTzR zM!ifn>6&b&t+wb5wragkpRM}d(rv^w`mU1gdeiGW7z5o&9lP}XvRm)7V2>`@d-dM3 zkNo|5Ztem0JxE=L^!FkTb3;BteMfbzv=)x(b9)^peNq?yDg8+BX>@1cte#PRUXP5t zp!dqUsC&Ja&|KE*ZCCVSsnfIMD(zcO`Wop5(%1Dxt{c?ds8`r-Qg%!4&_V2C*X&+q z9s7tAr{=PEZ|$~E3=6i82@bJmxA)jLwh6Uw>=14bX&Yhh5*2A55E^B7cZfzC173)Q zIEaS?dxb3#da|7aK1hZXU<8Lh&WUffHmJH&-c$c5Q37xEw<{7?XePz1%W2$nzzltDQxg=MfDLs((Y&0Wc*xyl|a z7549%D(z*qDto+lwY|@RHH@CGweug#(XNLLun{)FX4nGNuobpJjol^N`HnjnRo_W^ zm%X*@w#%SB)Vt2Uwv6RP=jwhW!I+6N%l1?J+Bb`h-g>)+EG}8S@r;{E? zI)n6J(nB4rfF~aA&?M85BO@LA)JUIXksjm7l5wObkeHNae~WP zcFXN7lVGPNAx_aePWd#HbhtBDBAk6}k!Ye=SP)Hl4CP+-k0mb-;vvB)4T(;%^`tzB za-UPqB$G~I|5Wx*bCxyr<5Ekfd?4i+>_3?8q2vu?|KU#gHWU3w@ zUrM|TmOG_v1*~Ly6;wc_^FmXVv%$8S8{`_NQ`R~U36p%X9yU0ef;KwCLpC{Gp_`p< z&lac0T}}R0*akJQ9d^J@*af>`5A20~upbVobb9Hch#j2Z0yhLh2r!8$p}-)NL_j1&K{UjG z7h)j};voSNp(iAP50W7TQXvicK{^bC3>XYUVHgaDOc)8HAPdI8IG6wvVG>M+DUc1* zAqR3{Hq3=Q$Ok_ZKp_-CF)V^5Py%I84ohJfEQb}a5>`P4R6-T3hBdGj*1>w%02^Tw zY=$jR4O?Lw)WCMw0XtzA?1nwC7xuw^H~73$#{G{AMZ0gZ4IZh?A$)xZu;aDf|wAp|@S3gHj|k-&hbL_-XCAr|5w z9ugoCdO{NTAQ@6171E#|q{BeSfWa^nhQV;))pi*Pqkz}RgjaHe*BXSS;llD-nFK8J z5|+wHHcSVmy@aU)Vfa<%LLTIU9}1ulil7)4!4fEeGAM_ound;N3RnrNpaLqP3Rc4! zSPSc5J#2uDun9K97N~};unlTpJM4g+unTs>9@q=}U_TsygK!8A!x1a)&=nUaxZE+~c0cx6uzR{K z#QoA#kNXY@b-%qMoU#aa_@|NRqud=N+AX#i^1KiWq4xj15zt7c!+bpd{Lo0}_oE+_ z{~wHVsv#B?)WoeCr&Ke{YFi`zyK&1I^YU}&%(6x;hZrddWd6gjWApf8%W=p5A750h zj9-CFH4tY8^+=<_KaMY|#g_4bBICEZP89z*zPJh9|73je3_3OTYX$4N%Opb`Lxx#! zoPj^3Q>LbFx2o)i#upo?uZA*A$ + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +/*Configuration file version: Microsemi_ZLS38063_1_P1_4_0_Config.cr2, modified: + * Tue Sep 18 20:48:31 2018*/ + +#ifndef _ZL38063_CONFIG_H_ +#define _ZL38063_CONFIG_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +extern const unsigned short configStreamLen; +extern const dataArr st_twConfig[]; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/components/audio_hal/driver/zl38063/firmware/zl38063_firmware.h b/components/audio_hal/driver/zl38063/firmware/zl38063_firmware.h new file mode 100644 index 00000000..c8121edb --- /dev/null +++ b/components/audio_hal/driver/zl38063/firmware/zl38063_firmware.h @@ -0,0 +1,48 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2018 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +/*Firmware Version : Microsemi_ZLS38063_1_P1_4_0_Firmware.s3, modified: Tue Sep + * 18 20:50:24 2018 */ + +#ifndef _ZL38063_FIRMWARE_H_ +#define _ZL38063_FIRMWARE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +extern const twFwr st_twFirmware[]; + +extern const unsigned short firmwareStreamLen; +extern const unsigned long programBaseAddress; +extern const unsigned long executionAddress; +extern const unsigned char haveProgramBaseAddress; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/components/audio_hal/driver/zl38063/zl38063.c b/components/audio_hal/driver/zl38063/zl38063.c new file mode 100644 index 00000000..cf5feaf1 --- /dev/null +++ b/components/audio_hal/driver/zl38063/zl38063.c @@ -0,0 +1,153 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2018 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include "zl38063.h" + +#include + +#include "audio_volume.h" +#include "board.h" +#include "driver/gpio.h" +#include "driver/i2c.h" +#include "esp_log.h" +#include "tw_spi_access.h" +#include "vprocTwolf_access.h" + +static const char *TAG = "zl38063"; + +static int codec_init_flag = 0; +static codec_dac_volume_config_t *dac_vol_handle; + +#define ZL38063_DAC_VOL_CFG_DEFAULT() \ + { \ + .max_dac_volume = 6, .min_dac_volume = -90, \ + .board_pa_gain = BOARD_PA_GAIN, .volume_accuracy = 1, .dac_vol_symbol = 1, \ + .zero_volume_reg = 0, .reg_value = 0, .user_volume = 0, \ + .offset_conv_volume = NULL, \ + } + +audio_hal_func_t AUDIO_CODEC_ZL38063_DEFAULT_HANDLE = { + .audio_codec_initialize = zl38063_codec_init, + .audio_codec_deinitialize = zl38063_codec_deinit, + .audio_codec_ctrl = zl38063_codec_ctrl_state, + .audio_codec_config_iface = zl38063_codec_config_i2s, + .audio_codec_set_mute = zl38063_codec_set_voice_mute, + .audio_codec_set_volume = zl38063_codec_set_voice_volume, + .audio_codec_get_volume = zl38063_codec_get_voice_volume, + .audio_codec_enable_pa = NULL, + .audio_hal_lock = NULL, + .handle = NULL, +}; + +static bool zl38063_codec_initialized() { return codec_init_flag; } + +esp_err_t zl38063_codec_init(audio_hal_codec_config_t *cfg) { + if (zl38063_codec_initialized()) { + ESP_LOGW(TAG, "The zl38063 codec has been already initialized"); + return ESP_OK; + } + tw_upload_dsp_firmware(0); + gpio_config_t borad_conf; + memset(&borad_conf, 0, sizeof(borad_conf)); + borad_conf.mode = GPIO_MODE_OUTPUT; + borad_conf.pin_bit_mask = 1UL << (get_reset_board_gpio()); + borad_conf.pull_down_en = 0; + borad_conf.pull_up_en = 0; + + gpio_config_t pa_conf; + memset(&pa_conf, 0, sizeof(pa_conf)); + pa_conf.mode = GPIO_MODE_OUTPUT; + pa_conf.pin_bit_mask = 1UL << (get_pa_enable_gpio()); + pa_conf.pull_down_en = 0; + pa_conf.pull_up_en = 0; + + gpio_config(&pa_conf); + gpio_config(&borad_conf); + gpio_set_level(get_pa_enable_gpio(), 1); // enable PA + gpio_set_level(get_reset_board_gpio(), 0); // enable DSP + codec_init_flag = 1; + + codec_dac_volume_config_t vol_cfg = ZL38063_DAC_VOL_CFG_DEFAULT(); + dac_vol_handle = audio_codec_volume_init(&vol_cfg); + return ESP_OK; +} + +esp_err_t zl38063_codec_deinit(void) { + gpio_set_level(get_pa_enable_gpio(), 0); + gpio_set_level(get_reset_board_gpio(), 1); + codec_init_flag = 0; + audio_codec_volume_deinit(dac_vol_handle); + return ESP_OK; +} + +esp_err_t zl38063_codec_ctrl_state(audio_hal_codec_mode_t mode, + audio_hal_ctrl_t ctrl_state) { + return ESP_OK; +} + +esp_err_t zl38063_codec_config_i2s(audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface) { + return ESP_OK; +} + +esp_err_t zl38063_codec_set_voice_mute(bool mute) { + /* For now we do not have implementation for this */ + return ESP_OK; +} + +/** + * @param volume: 0 ~ 100, 0 means mute + * + * @note Register values. 0xA6: -90 dB, 0xCE: -50 dB, 0x00: 0 dB, 0x06: 6 dB + * @note Accuracy of gain is 1 dB + * + * @return + * - (-1) Error + * - (0) Success + */ +esp_err_t zl38063_codec_set_voice_volume(int volume) { + int ret = 0; + uint8_t reg = 0; + reg = audio_codec_get_dac_reg_value(dac_vol_handle, volume); + ret = VprocTwolfSetVolume(reg); + ESP_LOGD(TAG, "Set volume:%.2d reg_value:0x%.2x dB:%.1f", + dac_vol_handle->user_volume, reg, (int8_t)reg * 1.0); + return ret; +} + +esp_err_t zl38063_codec_get_voice_volume(int *volume) { + int ret = 0; + int8_t reg = 0; + ret = VprocTwolfGetVolume(®); + if (reg == (int8_t)dac_vol_handle->reg_value) { + *volume = dac_vol_handle->user_volume; + } else { + *volume = 0; + ret = ESP_FAIL; + } + ESP_LOGD(TAG, "Get volume:%.2d reg_value:0x%x", *volume, (uint8_t)reg); + return ret; +} diff --git a/components/audio_hal/driver/zl38063/zl38063.h b/components/audio_hal/driver/zl38063/zl38063.h new file mode 100644 index 00000000..5ab8c3ef --- /dev/null +++ b/components/audio_hal/driver/zl38063/zl38063.h @@ -0,0 +1,123 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2018 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef __ZL38063_H__ +#define __ZL38063_H__ + +#include "audio_hal.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Initialize ZL38063 chip + * + * @param cfg configuration of ZL38063 + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t zl38063_codec_init(audio_hal_codec_config_t *cfg); +/** + * @brief Deinitialize ZL38063 chip + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t zl38063_codec_deinit(void); +/** + * The functions zl38063_ctrl_state and zl38063_config_i2s are not used by this + * driver. They are kept here to maintain the uniformity and convenience of the + * interface of the ADF project. These settings for zl38063 are burned in + * firmware and configuration files. Default i2s configuration: 48000Hz, 16bit, + * Left-Right channels. Use resampling to be compatible with different file + * types. + * + * @brief Control ZL38063 chip + * + * @param mode codec mode + * @param ctrl_state start or stop decode or encode progress + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t zl38063_codec_ctrl_state(audio_hal_codec_mode_t mode, + audio_hal_ctrl_t ctrl_state); +/** + * @brief Configure ZL38063 codec mode and I2S interface + * + * @param mode codec mode + * @param iface I2S config + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ +esp_err_t zl38063_codec_config_i2s(audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface); + +/** + * @brief mute or unmute the codec + * + * @param mute: true, false + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t zl38063_codec_set_voice_mute(bool mute); + +/** + * @brief Set voice volume + * + * @param volume: voice volume (0~100) + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t zl38063_codec_set_voice_volume(int volume); + +/** + * @brief Get voice volume + * + * @param[out] *volume: voice volume (0~100) + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t zl38063_codec_get_voice_volume(int *volume); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/components/audio_hal/include/audio_hal.h b/components/audio_hal/include/audio_hal.h index ac3718b7..9e4d457e 100644 --- a/components/audio_hal/include/audio_hal.h +++ b/components/audio_hal/include/audio_hal.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -32,241 +32,237 @@ #include "freertos/task.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif #define AUDIO_HAL_VOL_DEFAULT 70 - typedef struct audio_hal *audio_hal_handle_t; +typedef struct audio_hal *audio_hal_handle_t; - /** - * @brief Select media hal codec mode - */ - typedef enum - { - AUDIO_HAL_CODEC_MODE_ENCODE = 1, /*!< select adc */ - AUDIO_HAL_CODEC_MODE_DECODE, /*!< select dac */ - AUDIO_HAL_CODEC_MODE_BOTH, /*!< select both adc and dac */ - AUDIO_HAL_CODEC_MODE_LINE_IN, /*!< set adc channel */ - } audio_hal_codec_mode_t; +/** + * @brief Select media hal codec mode + */ +typedef enum { + AUDIO_HAL_CODEC_MODE_ENCODE = 1, /*!< select adc */ + AUDIO_HAL_CODEC_MODE_DECODE, /*!< select dac */ + AUDIO_HAL_CODEC_MODE_BOTH, /*!< select both adc and dac */ + AUDIO_HAL_CODEC_MODE_LINE_IN, /*!< set adc channel */ +} audio_hal_codec_mode_t; - /** - * @brief Select adc channel for input mic signal - */ - typedef enum - { - AUDIO_HAL_ADC_INPUT_LINE1 = 0x00, /*!< mic input to adc channel 1 */ - AUDIO_HAL_ADC_INPUT_LINE2, /*!< mic input to adc channel 2 */ - AUDIO_HAL_ADC_INPUT_ALL, /*!< mic input to both channels of adc */ - AUDIO_HAL_ADC_INPUT_DIFFERENCE, /*!< mic input to adc difference channel */ - } audio_hal_adc_input_t; +/** + * @brief Select adc channel for input mic signal + */ +typedef enum { + AUDIO_HAL_ADC_INPUT_LINE1 = 0x00, /*!< mic input to adc channel 1 */ + AUDIO_HAL_ADC_INPUT_LINE2, /*!< mic input to adc channel 2 */ + AUDIO_HAL_ADC_INPUT_ALL, /*!< mic input to both channels of adc */ + AUDIO_HAL_ADC_INPUT_DIFFERENCE, /*!< mic input to adc difference channel */ +} audio_hal_adc_input_t; - /** - * @brief Select channel for dac output - */ - typedef enum - { - AUDIO_HAL_DAC_OUTPUT_LINE1 = 0x00, /*!< dac output signal to channel 1 */ - AUDIO_HAL_DAC_OUTPUT_LINE2, /*!< dac output signal to channel 2 */ - AUDIO_HAL_DAC_OUTPUT_ALL, /*!< dac output signal to both channels */ - } audio_hal_dac_output_t; +/** + * @brief Select channel for dac output + */ +typedef enum { + AUDIO_HAL_DAC_OUTPUT_LINE1 = 0x00, /*!< dac output signal to channel 1 */ + AUDIO_HAL_DAC_OUTPUT_LINE2, /*!< dac output signal to channel 2 */ + AUDIO_HAL_DAC_OUTPUT_ALL, /*!< dac output signal to both channels */ +} audio_hal_dac_output_t; - /** - * @brief Select operating mode i.e. start or stop for audio codec chip - */ - typedef enum - { - AUDIO_HAL_CTRL_STOP = 0x00, /*!< set stop mode */ - AUDIO_HAL_CTRL_START = 0x01, /*!< set start mode */ - } audio_hal_ctrl_t; +/** + * @brief Select operating mode i.e. start or stop for audio codec chip + */ +typedef enum { + AUDIO_HAL_CTRL_STOP = 0x00, /*!< set stop mode */ + AUDIO_HAL_CTRL_START = 0x01, /*!< set start mode */ +} audio_hal_ctrl_t; - /** - * @brief Select I2S interface operating mode i.e. master or slave for audio - * codec chip - */ - typedef enum - { - AUDIO_HAL_MODE_SLAVE = 0x00, /*!< set slave mode */ - AUDIO_HAL_MODE_MASTER = 0x01, /*!< set master mode */ - } audio_hal_iface_mode_t; +/** + * @brief Select I2S interface operating mode i.e. master or slave for audio + * codec chip + */ +typedef enum { + AUDIO_HAL_MODE_SLAVE = 0x00, /*!< set slave mode */ + AUDIO_HAL_MODE_MASTER = 0x01, /*!< set master mode */ +} audio_hal_iface_mode_t; - /** - * @brief Select I2S interface samples per second - */ - typedef enum - { - AUDIO_HAL_08K_SAMPLES, /*!< set to 8k samples per second */ - AUDIO_HAL_11K_SAMPLES, /*!< set to 11.025k samples per second */ - AUDIO_HAL_16K_SAMPLES, /*!< set to 16k samples in per second */ - AUDIO_HAL_22K_SAMPLES, /*!< set to 22.050k samples per second */ - AUDIO_HAL_24K_SAMPLES, /*!< set to 24k samples in per second */ - AUDIO_HAL_32K_SAMPLES, /*!< set to 32k samples in per second */ - AUDIO_HAL_44K_SAMPLES, /*!< set to 44.1k samples per second */ - AUDIO_HAL_48K_SAMPLES, /*!< set to 48k samples per second */ - } audio_hal_iface_samples_t; +/** + * @brief Select I2S interface samples per second + */ +typedef enum { + AUDIO_HAL_08K_SAMPLES, /*!< set to 8k samples per second */ + AUDIO_HAL_11K_SAMPLES, /*!< set to 11.025k samples per second */ + AUDIO_HAL_16K_SAMPLES, /*!< set to 16k samples in per second */ + AUDIO_HAL_22K_SAMPLES, /*!< set to 22.050k samples per second */ + AUDIO_HAL_24K_SAMPLES, /*!< set to 24k samples in per second */ + AUDIO_HAL_32K_SAMPLES, /*!< set to 32k samples in per second */ + AUDIO_HAL_44K_SAMPLES, /*!< set to 44.1k samples per second */ + AUDIO_HAL_48K_SAMPLES, /*!< set to 48k samples per second */ +} audio_hal_iface_samples_t; - /** - * @brief Select I2S interface number of bits per sample - */ - typedef enum - { - AUDIO_HAL_BIT_LENGTH_16BITS = 1, /*!< set 16 bits per sample */ - AUDIO_HAL_BIT_LENGTH_24BITS, /*!< set 24 bits per sample */ - AUDIO_HAL_BIT_LENGTH_32BITS, /*!< set 32 bits per sample */ - } audio_hal_iface_bits_t; +/** + * @brief Select I2S interface number of bits per sample + */ +typedef enum { + AUDIO_HAL_BIT_LENGTH_16BITS = 1, /*!< set 16 bits per sample */ + AUDIO_HAL_BIT_LENGTH_24BITS, /*!< set 24 bits per sample */ + AUDIO_HAL_BIT_LENGTH_32BITS, /*!< set 32 bits per sample */ +} audio_hal_iface_bits_t; - /** - * @brief Select I2S interface format for audio codec chip - */ - typedef enum - { - AUDIO_HAL_I2S_NORMAL = 0, /*!< set normal I2S format */ - AUDIO_HAL_I2S_LEFT, /*!< set all left format */ - AUDIO_HAL_I2S_RIGHT, /*!< set all right format */ - AUDIO_HAL_I2S_DSP, /*!< set dsp/pcm format */ - } audio_hal_iface_format_t; +/** + * @brief Select I2S interface format for audio codec chip + */ +typedef enum { + AUDIO_HAL_I2S_NORMAL = 0, /*!< set normal I2S format */ + AUDIO_HAL_I2S_LEFT, /*!< set all left format */ + AUDIO_HAL_I2S_RIGHT, /*!< set all right format */ + AUDIO_HAL_I2S_DSP, /*!< set dsp/pcm format */ +} audio_hal_iface_format_t; - /** - * @brief I2s interface configuration for audio codec chip - */ - typedef struct - { - audio_hal_iface_mode_t mode; /*!< audio codec chip mode */ - audio_hal_iface_format_t fmt; /*!< I2S interface format */ - audio_hal_iface_samples_t samples; /*!< I2S interface samples per second */ - audio_hal_iface_bits_t - bits; /*!< i2s interface number of bits per sample */ - } audio_hal_codec_i2s_iface_t; +/** + * @brief I2s interface configuration for audio codec chip + */ +typedef struct { + audio_hal_iface_mode_t mode; /*!< audio codec chip mode */ + audio_hal_iface_format_t fmt; /*!< I2S interface format */ + audio_hal_iface_samples_t samples; /*!< I2S interface samples per second */ + audio_hal_iface_bits_t bits; /*!< i2s interface number of bits per sample */ +} audio_hal_codec_i2s_iface_t; - /** - * @brief Configure media hal for initialization of audio codec chip - */ - typedef struct - { - audio_hal_adc_input_t adc_input; /*!< set adc channel */ - audio_hal_dac_output_t dac_output; /*!< set dac channel */ - audio_hal_codec_mode_t - codec_mode; /*!< select codec mode: adc, dac or both */ - audio_hal_codec_i2s_iface_t - i2s_iface; /*!< set I2S interface configuration */ - } audio_hal_codec_config_t; +/** + * @brief Configure media hal for initialization of audio codec chip + */ +typedef struct { + audio_hal_adc_input_t adc_input; /*!< set adc channel */ + audio_hal_dac_output_t dac_output; /*!< set dac channel */ + audio_hal_codec_mode_t codec_mode; /*!< select codec mode: adc, dac or both */ + audio_hal_codec_i2s_iface_t i2s_iface; /*!< set I2S interface configuration */ +} audio_hal_codec_config_t; - /** - * @brief Configuration of functions and variables used to operate audio - * codec chip - */ - typedef struct audio_hal - { - esp_err_t (*audio_codec_initialize) ( - audio_hal_codec_config_t *codec_cfg); /*!< initialize codec */ - esp_err_t (*audio_codec_deinitialize) (void); /*!< deinitialize codec */ - esp_err_t (*audio_codec_ctrl) ( - audio_hal_codec_mode_t mode, - audio_hal_ctrl_t ctrl_state); /*!< control codec mode and state */ - esp_err_t (*audio_codec_config_iface) ( - audio_hal_codec_mode_t mode, - audio_hal_codec_i2s_iface_t *iface); /*!< configure i2s interface */ - esp_err_t (*audio_codec_set_mute) (bool mute); /*!< set codec mute */ - esp_err_t (*audio_codec_set_volume) (int volume); /*!< set codec volume */ - esp_err_t (*audio_codec_get_volume) (int *volume); /*!< get codec volume */ - xSemaphoreHandle audio_hal_lock; /*!< semaphore of codec */ - void *handle; /*!< handle of audio codec */ - } audio_hal_func_t; +/** + * @brief Configuration of functions and variables used to operate audio codec + * chip + */ +typedef struct audio_hal { + esp_err_t (*audio_codec_initialize)( + audio_hal_codec_config_t *codec_cfg); /*!< initialize codec */ + esp_err_t (*audio_codec_deinitialize)(void); /*!< deinitialize codec */ + esp_err_t (*audio_codec_ctrl)( + audio_hal_codec_mode_t mode, + audio_hal_ctrl_t ctrl_state); /*!< control codec mode and state */ + esp_err_t (*audio_codec_config_iface)( + audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface); /*!< configure i2s interface */ + esp_err_t (*audio_codec_set_mute)(bool mute); /*!< set codec mute */ + esp_err_t (*audio_codec_set_volume)(int volume); /*!< set codec volume */ + esp_err_t (*audio_codec_get_volume)(int *volume); /*!< get codec volume */ + esp_err_t (*audio_codec_enable_pa)(bool enable); /*!< enable pa */ + xSemaphoreHandle audio_hal_lock; /*!< semaphore of codec */ + void *handle; /*!< handle of audio codec */ +} audio_hal_func_t; - /** - * @brief Initialize media codec driver - * - * @note If selected codec has already been installed, it'll return the - * audio_hal handle. - * - * @param audio_hal_conf Configure structure audio_hal_config_t - * @param audio_hal_func Structure containing functions used to operate audio - * the codec chip - * - * @return int, 0--success, others--fail - */ - audio_hal_handle_t audio_hal_init (audio_hal_codec_config_t *audio_hal_conf, - audio_hal_func_t *audio_hal_func); +/** + * @brief Initialize media codec driver + * + * @note If selected codec has already been installed, it'll return the + * audio_hal handle. + * + * @param audio_hal_conf Configure structure audio_hal_config_t + * @param audio_hal_func Structure containing functions used to operate audio + * the codec chip + * + * @return int, 0--success, others--fail + */ +audio_hal_handle_t audio_hal_init(audio_hal_codec_config_t *audio_hal_conf, + audio_hal_func_t *audio_hal_func); - /** - * @brief Uninitialize media codec driver - * - * @param audio_hal reference function pointer for selected audio codec - * - * @return int, 0--success, others--fail - */ - esp_err_t audio_hal_deinit (audio_hal_handle_t audio_hal); +/** + * @brief Uninitialize media codec driver + * + * @param audio_hal reference function pointer for selected audio codec + * + * @return int, 0--success, others--fail + */ +esp_err_t audio_hal_deinit(audio_hal_handle_t audio_hal); - /** - * @brief Start/stop codec driver - * - * @param audio_hal reference function pointer for selected audio codec - * @param mode select media hal codec mode either encode/decode/or both to - * start from audio_hal_codec_mode_t - * @param audio_hal_ctrl select start stop state for specific mode - * - * @return int, 0--success, others--fail - */ - esp_err_t audio_hal_ctrl_codec (audio_hal_handle_t audio_hal, - audio_hal_codec_mode_t mode, - audio_hal_ctrl_t audio_hal_ctrl); +/** + * @brief Start/stop codec driver + * + * @param audio_hal reference function pointer for selected audio codec + * @param mode select media hal codec mode either encode/decode/or both to start + * from audio_hal_codec_mode_t + * @param audio_hal_ctrl select start stop state for specific mode + * + * @return int, 0--success, others--fail + */ +esp_err_t audio_hal_ctrl_codec(audio_hal_handle_t audio_hal, + audio_hal_codec_mode_t mode, + audio_hal_ctrl_t audio_hal_ctrl); - /** - * @brief Set codec I2S interface samples rate & bit width and format either - * I2S or PCM/DSP. - * - * @param audio_hal reference function pointer for selected audio codec - * @param mode select media hal codec mode either encode/decode/or both to - * start from audio_hal_codec_mode_t - * @param iface I2S sample rate (ex: 16000, 44100), I2S bit width (16, 24, - * 32),I2s format (I2S, PCM, DSP). - * - * @return - * - 0 Success - * - -1 Error - */ - esp_err_t audio_hal_codec_iface_config (audio_hal_handle_t audio_hal, - audio_hal_codec_mode_t mode, - audio_hal_codec_i2s_iface_t *iface); +/** + * @brief Set codec I2S interface samples rate & bit width and format either I2S + * or PCM/DSP. + * + * @param audio_hal reference function pointer for selected audio codec + * @param mode select media hal codec mode either encode/decode/or both to start + * from audio_hal_codec_mode_t + * @param iface I2S sample rate (ex: 16000, 44100), I2S bit width (16, 24, + * 32),I2s format (I2S, PCM, DSP). + * + * @return + * - 0 Success + * - -1 Error + */ +esp_err_t audio_hal_codec_iface_config(audio_hal_handle_t audio_hal, + audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface); + +/** + * @brief Set voice mute. Enables or disables DAC mute of a codec. + * @note `audio_hal_get_volume` will still give a non-zero number in mute + * state. It will be set to that number when speaker is unmuted. + * + * @param audio_hal reference function pointer for selected audio codec + * @param mute true/false. If true speaker will be muted and if false + * speaker will be unmuted. + * + * @return int, 0--success, others--fail + */ +esp_err_t audio_hal_set_mute(audio_hal_handle_t audio_hal, bool mute); - /** - * @brief Set voice mute. Enables or disables DAC mute of a codec. - * @note `audio_hal_get_volume` will still give a non-zero number in - * mute state. It will be set to that number when speaker is unmuted. - * - * @param audio_hal reference function pointer for selected audio codec - * @param mute true/false. If true speaker will be muted and if false - * speaker will be unmuted. - * - * @return int, 0--success, others--fail - */ - esp_err_t audio_hal_set_mute (audio_hal_handle_t audio_hal, bool mute); +/** + * @brief Set voice volume. + * @note if volume is 0, mute is enabled,range is 0-100. + * + * @param audio_hal reference function pointer for selected audio codec + * @param volume value of volume in percent(%) + * + * @return int, 0--success, others--fail + */ +esp_err_t audio_hal_set_volume(audio_hal_handle_t audio_hal, int volume); - /** - * @brief Set voice volume. - * @note if volume is 0, mute is enabled,range is 0-100. - * - * @param audio_hal reference function pointer for selected audio codec - * @param volume value of volume in percent(%) - * - * @return int, 0--success, others--fail - */ - esp_err_t audio_hal_set_volume (audio_hal_handle_t audio_hal, int volume); +/** + * @brief get voice volume. + * @note if volume is 0, mute is enabled, range is 0-100. + * + * @param audio_hal reference function pointer for selected audio codec + * @param volume value of volume in percent returned(%) + * + * @return int, 0--success, others--fail + */ +esp_err_t audio_hal_get_volume(audio_hal_handle_t audio_hal, int *volume); - /** - * @brief get voice volume. - * @note if volume is 0, mute is enabled, range is 0-100. - * - * @param audio_hal reference function pointer for selected audio codec - * @param volume value of volume in percent returned(%) - * - * @return int, 0--success, others--fail - */ - esp_err_t audio_hal_get_volume (audio_hal_handle_t audio_hal, int *volume); +/** + * @brief Enables or disables PA. + * + * @param audio_hal reference function pointer for selected audio codec + * @param enable true/false. + * + * @return int, 0--success, others--fail + */ +esp_err_t audio_hal_enable_pa(audio_hal_handle_t audio_hal, bool enable); #ifdef __cplusplus } #endif -#endif //__AUDIO_HAL_H__ +#endif //__AUDIO_HAL_H__ diff --git a/components/audio_hal/include/audio_volume.h b/components/audio_hal/include/audio_volume.h new file mode 100644 index 00000000..616ef3a1 --- /dev/null +++ b/components/audio_hal/include/audio_volume.h @@ -0,0 +1,99 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2022 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _AUDIO_VOLUME_H_ +#define _AUDIO_VOLUME_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Map of user volume to codec dac volume offset + */ +typedef float (*audio_codec_dac_vol_offset)(int volume); + +typedef void *volume_handle_t; + +/** + * @brief Codec dac volume configurations + */ +typedef struct { + float max_dac_volume; /*!< Codec support max volume */ + float min_dac_volume; /*!< Codec support min volume */ + float board_pa_gain; /*!< Board power amplifier gain */ + float volume_accuracy; /*!< Codec dac volume accuracy(0.5 or 1) */ + int8_t dac_vol_symbol; /*!< Whether the dac volume is positively correlated + with the register value */ + uint8_t zero_volume_reg; /*!< Codec register value for zero dac volume */ + uint8_t reg_value; /*!< Record current dac volume register value */ + int user_volume; /*!< Record the user set volume */ + audio_codec_dac_vol_offset + offset_conv_volume; /*!< Convert user volume to dac volume offset */ +} codec_dac_volume_config_t; + +/** + * @brief Init the audio dac volume by config + * + * @param config Codec dac volume config + * + * @return volume_handle_t + */ +volume_handle_t audio_codec_volume_init(codec_dac_volume_config_t *config); + +/** + * @brief Calculate codec register value by a linear formula + * + * @param vol_handle The dac volume handle + * @param volume User set volume (0-100) + * + * @return Codec dac register value + */ +uint8_t audio_codec_get_dac_reg_value(volume_handle_t vol_handle, int volume); + +/** + * @brief Calculate codec dac volume by a linear formula + * + * @param vol_handle The dac volume handle + * + * @return Codec dac volume + */ +float audio_codec_cal_dac_volume(volume_handle_t vol_handle); + +/** + * @brief Deinit the dac volume handle + * + * @param vol_handle The dac volume handle + */ +void audio_codec_volume_deinit(volume_handle_t vol_handle); + +#ifdef __cplusplus +} +#endif + +#endif //_AUDIO_VOLUME_H_ diff --git a/components/audio_hal/test/test_audio_hal.c b/components/audio_hal/test/test_audio_hal.c index c4f1fd31..0e8de045 100644 --- a/components/audio_hal/test/test_audio_hal.c +++ b/components/audio_hal/test/test_audio_hal.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -42,148 +42,139 @@ static const char *TAG = "TEST_AUDIO_HAL"; extern const uint8_t test_pcm_start[] asm("_binary_test_pcm_start"); extern const uint8_t test_pcm_end[] asm("_binary_test_pcm_end"); -static void -i2s_init () -{ +static void i2s_init() { i2s_config_t i2s_cfg = { - .mode = I2S_MODE_MASTER | I2S_MODE_TX | I2S_MODE_RX, - .sample_rate = 16000, - .bits_per_sample = 16, - .channel_format = I2S_CHANNEL_FMT_ONLY_RIGHT, - .communication_format = I2S_COMM_FORMAT_I2S, - .dma_buf_count = 3, - .dma_buf_len = 300, - .use_apll = 1, - .intr_alloc_flags = ESP_INTR_FLAG_LEVEL2, + .mode = I2S_MODE_MASTER | I2S_MODE_TX | I2S_MODE_RX, + .sample_rate = 16000, + .bits_per_sample = 16, + .channel_format = I2S_CHANNEL_FMT_ONLY_RIGHT, + .communication_format = I2S_COMM_FORMAT_I2S, + .dma_buf_count = 3, + .dma_buf_len = 300, + .use_apll = 1, + .intr_alloc_flags = ESP_INTR_FLAG_LEVEL2, }; - i2s_driver_install (TEST_I2S_NUM, &i2s_cfg, 0, NULL); - i2s_pin_config_t i2s_pin_cfg = { 0 }; - get_i2s_pins (TEST_I2S_NUM, &i2s_pin_cfg); - i2s_set_pin (TEST_I2S_NUM, &i2s_pin_cfg); - i2s_mclk_gpio_select (TEST_I2S_NUM, GPIO_NUM_0); + i2s_driver_install(TEST_I2S_NUM, &i2s_cfg, 0, NULL); + i2s_pin_config_t i2s_pin_cfg = {0}; + if (sizeof(board_i2s_pin_t) == sizeof(i2s_pin_config_t)) { + get_i2s_pins(TEST_I2S_NUM, (board_i2s_pin_t *)&i2s_pin_cfg); + i2s_set_pin(TEST_I2S_NUM, &i2s_pin_cfg); + } } -static void -i2s_deinit () -{ - i2s_driver_uninstall (TEST_I2S_NUM); -} +static void i2s_deinit() { i2s_driver_uninstall(TEST_I2S_NUM); } -TEST_CASE ("Usage test", "[audio_hal]") -{ - ESP_LOGI (TAG, "Initialize i2s"); - i2s_init (); +TEST_CASE("Usage test", "[audio_hal]") { + ESP_LOGI(TAG, "Initialize i2s"); + i2s_init(); - ESP_LOGI (TAG, "Start codec chip"); - audio_board_handle_t board_handle = audio_board_init (); - TEST_ASSERT_NOT_NULL (board_handle); - TEST_ASSERT_FALSE (audio_hal_ctrl_codec (board_handle->audio_hal, - AUDIO_HAL_CODEC_MODE_DECODE, - AUDIO_HAL_CTRL_START)); + ESP_LOGI(TAG, "Start codec chip"); + audio_board_handle_t board_handle = audio_board_init(); + TEST_ASSERT_NOT_NULL(board_handle); + TEST_ASSERT_FALSE(audio_hal_ctrl_codec(board_handle->audio_hal, + AUDIO_HAL_CODEC_MODE_DECODE, + AUDIO_HAL_CTRL_START)); - ESP_LOGI (TAG, "Set codec volume"); - TEST_ASSERT_FALSE (audio_hal_set_volume (board_handle->audio_hal, 65)); + ESP_LOGI(TAG, "Set codec volume"); + TEST_ASSERT_FALSE(audio_hal_set_volume(board_handle->audio_hal, 65)); int volume = 0; - TEST_ASSERT_FALSE (audio_hal_get_volume (board_handle->audio_hal, &volume)); - ESP_LOGI (TAG, "Get codec volume: %d", volume); + TEST_ASSERT_FALSE(audio_hal_get_volume(board_handle->audio_hal, &volume)); + ESP_LOGI(TAG, "Get codec volume: %d", volume); size_t bytes_written = 0; - ESP_LOGI (TAG, "Start to play music"); - TEST_ASSERT_FALSE (i2s_write (TEST_I2S_NUM, test_pcm_start, - test_pcm_end - test_pcm_start, &bytes_written, - portMAX_DELAY)); - - ESP_LOGW (TAG, "Reach the end of music, release all resource"); - TEST_ASSERT_FALSE (audio_board_deinit (board_handle)); - i2c_driver_delete (I2C_NUM_0); - i2s_deinit (); + ESP_LOGI(TAG, "Start to play music"); + TEST_ASSERT_FALSE(i2s_write(TEST_I2S_NUM, test_pcm_start, + test_pcm_end - test_pcm_start, &bytes_written, + portMAX_DELAY)); + + ESP_LOGW(TAG, "Reach the end of music, release all resource"); + TEST_ASSERT_FALSE(audio_board_deinit(board_handle)); + i2c_driver_delete(I2C_NUM_0); + i2s_deinit(); } /* * To run this case, please choose Lyrat_v4.3 in menuconfig and run on * lyrat_v4.3 board */ -TEST_CASE ("Test for es8388 driver", "[audio_hal]") -{ - ESP_LOGI (TAG, "Initialize i2s"); - i2s_init (); - - ESP_LOGI (TAG, "Start es8388 codec chip"); - audio_hal_codec_config_t es8388_cfg = AUDIO_CODEC_DEFAULT_CONFIG (); - TEST_ASSERT_FALSE (es8388_init (&es8388_cfg)); - TEST_ASSERT_FALSE ( - es8388_config_i2s (es8388_cfg.codec_mode, &es8388_cfg.i2s_iface)); - TEST_ASSERT_FALSE ( - es8388_ctrl_state (AUDIO_HAL_CODEC_MODE_BOTH, AUDIO_HAL_CTRL_START)); - TEST_ASSERT_FALSE (es8388_set_voice_volume (50)); +TEST_CASE("Test for es8388 driver", "[audio_hal]") { + ESP_LOGI(TAG, "Initialize i2s"); + i2s_init(); + + ESP_LOGI(TAG, "Start es8388 codec chip"); + audio_hal_codec_config_t es8388_cfg = AUDIO_CODEC_DEFAULT_CONFIG(); + TEST_ASSERT_FALSE(es8388_init(&es8388_cfg)); + TEST_ASSERT_FALSE( + es8388_config_i2s(es8388_cfg.codec_mode, &es8388_cfg.i2s_iface)); + TEST_ASSERT_FALSE( + es8388_ctrl_state(AUDIO_HAL_CODEC_MODE_BOTH, AUDIO_HAL_CTRL_START)); + TEST_ASSERT_FALSE(es8388_set_voice_volume(50)); size_t bytes_written = 0; - ESP_LOGI (TAG, "Start to play music"); - TEST_ASSERT_FALSE (i2s_write (TEST_I2S_NUM, test_pcm_start, - test_pcm_end - test_pcm_start, &bytes_written, - portMAX_DELAY)); - - ESP_LOGW (TAG, "Reach the end of music, release all resource"); - i2c_driver_delete (I2C_NUM_0); - i2s_deinit (); + ESP_LOGI(TAG, "Start to play music"); + TEST_ASSERT_FALSE(i2s_write(TEST_I2S_NUM, test_pcm_start, + test_pcm_end - test_pcm_start, &bytes_written, + portMAX_DELAY)); + + ESP_LOGW(TAG, "Reach the end of music, release all resource"); + i2c_driver_delete(I2C_NUM_0); + i2s_deinit(); } /* * To run this case, please choose Lyrat_mini in menuconfig and run on * lyrat_mini board */ -TEST_CASE ("Test for es8311 driver", "[audio_hal]") -{ - ESP_LOGI (TAG, "Initialize i2s"); - i2s_init (); - - ESP_LOGI (TAG, "Start es8311 codec chip"); - audio_hal_codec_config_t es8311_cfg = AUDIO_CODEC_DEFAULT_CONFIG (); - TEST_ASSERT_FALSE (es8311_codec_init (&es8311_cfg)); - TEST_ASSERT_FALSE ( - es8311_codec_config_i2s (es8311_cfg.codec_mode, &es8311_cfg.i2s_iface)); - TEST_ASSERT_FALSE (es8311_codec_ctrl_state (AUDIO_HAL_CODEC_MODE_BOTH, - AUDIO_HAL_CTRL_START)); - TEST_ASSERT_FALSE (es8311_codec_set_voice_volume (50)); +TEST_CASE("Test for es8311 driver", "[audio_hal]") { + ESP_LOGI(TAG, "Initialize i2s"); + i2s_init(); + + ESP_LOGI(TAG, "Start es8311 codec chip"); + audio_hal_codec_config_t es8311_cfg = AUDIO_CODEC_DEFAULT_CONFIG(); + TEST_ASSERT_FALSE(es8311_codec_init(&es8311_cfg)); + TEST_ASSERT_FALSE( + es8311_codec_config_i2s(es8311_cfg.codec_mode, &es8311_cfg.i2s_iface)); + TEST_ASSERT_FALSE( + es8311_codec_ctrl_state(AUDIO_HAL_CODEC_MODE_BOTH, AUDIO_HAL_CTRL_START)); + TEST_ASSERT_FALSE(es8311_codec_set_voice_volume(50)); size_t bytes_written = 0; - ESP_LOGI (TAG, "Start to play music"); - TEST_ASSERT_FALSE (i2s_write (TEST_I2S_NUM, test_pcm_start, - test_pcm_end - test_pcm_start, &bytes_written, - portMAX_DELAY)); - - ESP_LOGW (TAG, "Reach the end of music, release all resource"); - i2c_driver_delete (I2C_NUM_0); - i2s_deinit (); + ESP_LOGI(TAG, "Start to play music"); + TEST_ASSERT_FALSE(i2s_write(TEST_I2S_NUM, test_pcm_start, + test_pcm_end - test_pcm_start, &bytes_written, + portMAX_DELAY)); + + ESP_LOGW(TAG, "Reach the end of music, release all resource"); + i2c_driver_delete(I2C_NUM_0); + i2s_deinit(); } /* * To run this case, please choose LyratD_MSC in menuconfig and run on * lyratD_MSC board */ -TEST_CASE ("Test for zl38063 driver", "[audio_hal]") -{ - ESP_LOGI (TAG, "Initialize i2s"); - i2s_init (); - - ESP_LOGI (TAG, "Start zl38063 DSP"); - audio_hal_codec_config_t zl38063_cfg = AUDIO_CODEC_DEFAULT_CONFIG (); - TEST_ASSERT_FALSE (zl38063_codec_init (&zl38063_cfg)); - TEST_ASSERT_FALSE (zl38063_codec_config_i2s (zl38063_cfg.codec_mode, - &zl38063_cfg.i2s_iface)); - TEST_ASSERT_FALSE (zl38063_codec_ctrl_state (AUDIO_HAL_CODEC_MODE_BOTH, - AUDIO_HAL_CTRL_START)); - TEST_ASSERT_FALSE (zl38063_codec_set_voice_volume (50)); +TEST_CASE("Test for zl38063 driver", "[audio_hal]") { + ESP_LOGI(TAG, "Initialize i2s"); + i2s_init(); + + ESP_LOGI(TAG, "Start zl38063 DSP"); + audio_hal_codec_config_t zl38063_cfg = AUDIO_CODEC_DEFAULT_CONFIG(); + TEST_ASSERT_FALSE(zl38063_codec_init(&zl38063_cfg)); + TEST_ASSERT_FALSE( + zl38063_codec_config_i2s(zl38063_cfg.codec_mode, &zl38063_cfg.i2s_iface)); + TEST_ASSERT_FALSE(zl38063_codec_ctrl_state(AUDIO_HAL_CODEC_MODE_BOTH, + AUDIO_HAL_CTRL_START)); + TEST_ASSERT_FALSE(zl38063_codec_set_voice_volume(50)); size_t bytes_written = 0; - ESP_LOGI (TAG, "Start to play music"); - TEST_ASSERT_FALSE (i2s_write (TEST_I2S_NUM, test_pcm_start, - test_pcm_end - test_pcm_start, &bytes_written, - portMAX_DELAY)); - - ESP_LOGW (TAG, "Reach the end of music, release all resource"); - i2c_driver_delete (I2C_NUM_0); - i2s_deinit (); + ESP_LOGI(TAG, "Start to play music"); + TEST_ASSERT_FALSE(i2s_write(TEST_I2S_NUM, test_pcm_start, + test_pcm_end - test_pcm_start, &bytes_written, + portMAX_DELAY)); + + ESP_LOGW(TAG, "Reach the end of music, release all resource"); + i2c_driver_delete(I2C_NUM_0); + i2s_deinit(); } diff --git a/components/audio_sal/CMakeLists.txt b/components/audio_sal/CMakeLists.txt index 0b1dce36..aafc71a4 100644 --- a/components/audio_sal/CMakeLists.txt +++ b/components/audio_sal/CMakeLists.txt @@ -4,6 +4,11 @@ set(COMPONENT_ADD_INCLUDEDIRS "include") set(COMPONENT_SRCS "audio_mem.c" "audio_sys.c" "audio_thread.c" - "audio_url.c") + "audio_url.c" + "audio_mutex.c" + "audio_queue.c" + "media_os_ctype.c") + +list(APPEND COMPONENT_REQUIRES efuse) register_component() diff --git a/components/audio_sal/audio_mem.c b/components/audio_sal/audio_mem.c index 0e13e6cd..73fc66d5 100644 --- a/components/audio_sal/audio_mem.c +++ b/components/audio_sal/audio_mem.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,177 +18,180 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "audio_mem.h" -#include "esp_efuse.h" + +#include + #include "esp_heap_caps.h" #include "esp_log.h" #include "esp_system.h" #include "sdkconfig.h" #include "string.h" -#include -// #define ENABLE_AUDIO_MEM_TRACE +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 4) +#include "hal/efuse_hal.h" +#else +#include "esp_efuse.h" +#endif + +#ifdef CONFIG_MEDIA_LIB_MEM_AUTO_TRACE +#define ENABLE_AUDIO_MEM_TRACE +#define MALLOC_RAM_FLAG 1 +#endif +/** + * @brief Memory trace function is replaced by mem_trace module in + * `media_lib_sal` Users need follow below steps to let trace function work + * 1. After app start `#include "media_lib_adapter.h"` and call + * `media_lib_add_default_adapter();` + * 2. Automatically enable memory trace function from menuconfig + * `ADF Library Configuration --> Support trace memory + * automatically` Or call `media_lib_start_mem_trace` manually + * 3. Call `media_lib_stop_mem_trace` to stop trace and see trace results + * + * Use weak realization of trace function so that can work without + * `media_lib_sal` + */ +#ifdef ENABLE_AUDIO_MEM_TRACE +int __attribute__((weak)) +media_lib_add_trace_mem(const char *module, void *addr, int size, + uint8_t flag) { + return 0; +} + +void __attribute__((weak)) media_lib_remove_trace_mem(void *addr) {} +#endif -void * -audio_malloc (size_t size) -{ +void *audio_malloc(size_t size) { void *data = NULL; #if CONFIG_SPIRAM_BOOT_INIT - data = heap_caps_malloc (size, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT); + data = heap_caps_malloc(size, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT); #else - data = malloc (size); + data = malloc(size); #endif #ifdef ENABLE_AUDIO_MEM_TRACE - ESP_LOGI ("AUDIO_MEM", "malloc:%p, size:%d, called:0x%08x", data, size, - (intptr_t)__builtin_return_address (0) - 2); + media_lib_add_trace_mem(NULL, data, size, 0); #endif return data; } -void -audio_free (void *ptr) -{ - free (ptr); +void audio_free(void *ptr) { #ifdef ENABLE_AUDIO_MEM_TRACE - ESP_LOGI ("AUIDO_MEM", "free:%p, called:0x%08x", ptr, - (intptr_t)__builtin_return_address (0) - 2); + media_lib_remove_trace_mem(ptr); #endif + free(ptr); } -void * -audio_calloc (size_t nmemb, size_t size) -{ +void *audio_calloc(size_t nmemb, size_t size) { void *data = NULL; #if CONFIG_SPIRAM_BOOT_INIT - data = heap_caps_malloc (nmemb * size, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT); - if (data) - { - memset (data, 0, nmemb * size); - } + data = heap_caps_malloc(nmemb * size, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT); + if (data) { + memset(data, 0, nmemb * size); + } #else - data = calloc (nmemb, size); + data = calloc(nmemb, size); #endif #ifdef ENABLE_AUDIO_MEM_TRACE - ESP_LOGI ("AUIDO_MEM", "calloc:%p, size:%d, called:0x%08x", data, size, - (intptr_t)__builtin_return_address (0) - 2); + media_lib_add_trace_mem(NULL, data, nmemb * size, 0); #endif return data; } -void * -audio_realloc (void *ptr, size_t size) -{ +void *audio_realloc(void *ptr, size_t size) { void *p = NULL; +#ifdef ENABLE_AUDIO_MEM_TRACE + media_lib_remove_trace_mem(ptr); +#endif + #if CONFIG_SPIRAM_BOOT_INIT - p = heap_caps_realloc (ptr, size, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT); + p = heap_caps_realloc(ptr, size, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT); #else - p = heap_caps_realloc (ptr, size, MALLOC_CAP_8BIT); + p = heap_caps_realloc(ptr, size, MALLOC_CAP_8BIT); #endif #ifdef ENABLE_AUDIO_MEM_TRACE - ESP_LOGI ("AUDIO_MEM", "realloc,new:%p, ptr:%p size:%d, called:0x%08x", p, - ptr, size, (intptr_t)__builtin_return_address (0) - 2); + media_lib_add_trace_mem(NULL, p, size, 0); #endif return p; } -char * -audio_strdup (const char *str) -{ +char *audio_strdup(const char *str) { + int size = strlen(str) + 1; #if CONFIG_SPIRAM_BOOT_INIT - char *copy = heap_caps_malloc (strlen (str) + 1, - MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT); + char *copy = heap_caps_malloc(size, MALLOC_CAP_SPIRAM | MALLOC_CAP_8BIT); #else - char *copy = malloc (strlen (str) + 1); + char *copy = malloc(size); #endif - if (copy) - { - strcpy (copy, str); - } + if (copy) { + strcpy(copy, str); #ifdef ENABLE_AUDIO_MEM_TRACE - ESP_LOGI ("AUDIO_MEM", "strdup:%p, size:%d, called:0x%08x", copy, - strlen (copy), (intptr_t)__builtin_return_address (0) - 2); + media_lib_add_trace_mem(NULL, copy, size, 0); #endif + } return copy; } -void * -audio_calloc_inner (size_t n, size_t size) -{ +void *audio_calloc_inner(size_t n, size_t size) { void *data = NULL; #if CONFIG_SPIRAM_BOOT_INIT - data = heap_caps_calloc_prefer ( + data = heap_caps_calloc_prefer( n, size, 2, MALLOC_CAP_DEFAULT | MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT, MALLOC_CAP_DEFAULT | MALLOC_CAP_SPIRAM); #else - data = heap_caps_calloc (n, size, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); + data = heap_caps_calloc(n, size, MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); #endif - #ifdef ENABLE_AUDIO_MEM_TRACE - ESP_LOGI ("AUIDO_MEM", "calloc_inner:%p, size:%d, called:0x%08x", data, size, - (intptr_t)__builtin_return_address (0) - 2); + media_lib_add_trace_mem(NULL, data, n * size, MALLOC_RAM_FLAG); #endif return data; } -void -audio_mem_print (const char *tag, int line, const char *func) -{ +void audio_mem_print(const char *tag, int line, const char *func) { #ifdef CONFIG_SPIRAM_BOOT_INIT - ESP_LOGI (tag, - "Func:%s, Line:%d, MEM Total:%d Bytes, Inter:%d Bytes, Dram:%d " - "Bytes\r\n", - func, line, esp_get_free_heap_size (), - heap_caps_get_free_size (MALLOC_CAP_INTERNAL), - heap_caps_get_free_size (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT)); + ESP_LOGI( + tag, + "Func:%s, Line:%d, MEM Total:%d Bytes, Inter:%d Bytes, Dram:%d Bytes\r\n", + func, line, (int)esp_get_free_heap_size(), + (int)heap_caps_get_free_size(MALLOC_CAP_INTERNAL), + (int)heap_caps_get_free_size(MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT)); #else - ESP_LOGI (tag, "Func:%s, Line:%d, MEM Total:%d Bytes\r\n", func, line, - esp_get_free_heap_size ()); + ESP_LOGI(tag, "Func:%s, Line:%d, MEM Total:%d Bytes\r\n", func, line, + (int)esp_get_free_heap_size()); #endif } +bool audio_mem_spiram_is_enabled(void) { #if defined(CONFIG_SPIRAM_BOOT_INIT) -bool -audio_mem_spiram_is_enabled (void) -{ return true; -} #else -bool -audio_mem_spiram_is_enabled (void) -{ return false; -} #endif +} -#if defined(CONFIG_SPIRAM_BOOT_INIT) \ - && (CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY) -bool -audio_mem_spiram_stack_is_enabled (void) -{ +bool audio_mem_spiram_stack_is_enabled(void) { +#if defined(CONFIG_SPIRAM_BOOT_INIT) && \ + (CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY) bool ret = true; -#if CONFIG_IDF_TARGET_ESP32 - uint8_t chip_ver = esp_efuse_get_chip_ver (); - if (chip_ver < 3) - { - ESP_LOGW ( - "AUIDO_MEM", - "Can't support stack on external memory due to ESP32 chip is %d", - chip_ver); - ret = false; - } +#if defined(CONFIG_IDF_TARGET_ESP32) +#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 4) + uint32_t chip_ver = efuse_hal_chip_revision(); +#else + uint8_t chip_ver = esp_efuse_get_chip_ver(); #endif + if (chip_ver < 3) { + ESP_LOGW("AUIDO_MEM", + "Can't support stack on external memory due to ESP32 chip is %d", + (int)chip_ver); + ret = false; + } +#endif // defined(CONFIG_IDF_TARGET_ESP32) return ret; -} -#else -bool -audio_mem_spiram_stack_is_enabled (void) -{ +#else // defined(CONFIG_SPIRAM_BOOT_INIT) ... return false; -} #endif +} diff --git a/components/audio_sal/audio_mutex.c b/components/audio_sal/audio_mutex.c new file mode 100644 index 00000000..d2d54fb7 --- /dev/null +++ b/components/audio_sal/audio_mutex.c @@ -0,0 +1,72 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2021 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include "audio_mutex.h" + +#include "audio_idf_version.h" +#include "esp_log.h" +#include "freertos/FreeRTOS.h" +#include "freertos/semphr.h" +#include "freertos/task.h" + +#if (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4, 3, 0)) + +// The xQueueSemaphoreTake is not available on FreeRTOS v8.2.0, it's compatible +// implementation. +BaseType_t __attribute__((weak)) +xQueueSemaphoreTake(QueueHandle_t xQueue, TickType_t xTicksToWait) { + xSemaphoreTake(xQueue, xTicksToWait); + return pdPASS; +} +#endif + +void *mutex_create(void) { + void *handle = NULL; + handle = xSemaphoreCreateMutex(); + return (void *)handle; +} + +int mutex_destroy(void *mutex) { + vSemaphoreDelete((QueueHandle_t)mutex); + return 0; +} + +int mutex_lock(void *mutex) { +#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0)) + while (xSemaphoreTake((QueueHandle_t)mutex, portMAX_DELAY) != pdPASS) + ; +#else + while (xSemaphoreTake((QueueHandle_t)mutex, portMAX_DELAY) != pdPASS) + ; +#endif + return 0; +} + +int mutex_unlock(void *mutex) { + int ret = 0; + ret = xSemaphoreGive((QueueHandle_t)mutex); + return ret; +} diff --git a/components/audio_sal/audio_queue.c b/components/audio_sal/audio_queue.c new file mode 100644 index 00000000..8cee1875 --- /dev/null +++ b/components/audio_sal/audio_queue.c @@ -0,0 +1,79 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2021 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include "audio_queue.h" + +#include "freertos/FreeRTOS.h" +#include "freertos/semphr.h" +#include "freertos/task.h" + +audio_queue_handle_t audio_queue_create(uint32_t queue_len, + uint32_t item_size) { + audio_queue_handle_t handle = NULL; + handle = (QueueHandle_t)xQueueCreate(queue_len, item_size); + return handle; +} + +int audio_queue_delete(audio_queue_handle_t queue) { + vQueueDelete((QueueHandle_t)queue); + return 0; +} + +int audio_queue_send(audio_queue_handle_t queue, void *item, + uint32_t block_time_ms) { + int ret = 0; + ret = xQueueSend((QueueHandle_t)queue, item, + block_time_ms / portTICK_PERIOD_MS); + return ret; +} + +int audio_queue_send_to_front(audio_queue_handle_t queue, void *item, + uint32_t block_time_ms) { + int ret = 0; + ret = xQueueSendToFront((QueueHandle_t)queue, item, + block_time_ms / portTICK_PERIOD_MS); + return ret; +} + +int audio_queue_recv(audio_queue_handle_t queue, void *item, + uint32_t block_time_ms) { + int ret = 0; + ret = xQueueReceive((QueueHandle_t)queue, item, + block_time_ms / portTICK_PERIOD_MS); + return ret; +} + +int audio_queue_message_available(const audio_queue_handle_t queue) { + int ret = 0; + ret = uxQueueMessagesWaiting((QueueHandle_t)queue); + return ret; +} + +int audio_queue_spaces_available(const audio_queue_handle_t queue) { + int ret = 0; + ret = uxQueueSpacesAvailable((QueueHandle_t)queue); + return ret; +} diff --git a/components/audio_sal/audio_sys.c b/components/audio_sal/audio_sys.c index 3d243e75..56f54cb0 100644 --- a/components/audio_sal/audio_sys.c +++ b/components/audio_sal/audio_sys.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,57 +18,52 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "audio_sys.h" + +#include +#include + #include "audio_error.h" #include "audio_mem.h" #include "esp_log.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "soc/soc_memory_layout.h" -#include static const char *TAG = "AUDIO_SYS"; -#define ARRAY_SIZE_OFFSET \ - 8 // Increase this if audio_sys_get_real_time_stats returns - // ESP_ERR_INVALID_SIZE -#define AUDIO_SYS_TASKS_ELAPSED_TIME_MS 1000 // Period of stats measurement +#define ARRAY_SIZE_OFFSET \ + 8 // Increase this if audio_sys_get_real_time_stats returns + // ESP_ERR_INVALID_SIZE +#define AUDIO_SYS_TASKS_ELAPSED_TIME_MS 1000 // Period of stats measurement -const char *task_state[] - = { "Running", "Ready", "Blocked", "Suspended", "Deleted" }; +const char *task_state[] = {"Running", "Ready", "Blocked", "Suspended", + "Deleted"}; /** @brief * "Extr": Allocated task stack from psram, "Intr": Allocated task stack from * internel */ -const char *task_stack[] = { "Extr", "Intr" }; +const char *task_stack[] = {"Extr", "Intr"}; -int -audio_sys_get_tick_by_time_ms (int ms) -{ - return (ms / portTICK_PERIOD_MS); -} +int audio_sys_get_tick_by_time_ms(int ms) { return (ms / portTICK_PERIOD_MS); } -int64_t -audio_sys_get_time_ms (void) -{ +int64_t audio_sys_get_time_ms(void) { struct timeval te; - gettimeofday (&te, NULL); + gettimeofday(&te, NULL); int64_t milliseconds = te.tv_sec * 1000LL + te.tv_usec / 1000; return milliseconds; } -esp_err_t -audio_sys_get_real_time_stats (void) -{ -#if (CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID \ - && CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS) +esp_err_t audio_sys_get_real_time_stats(void) { +#if (CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID && \ + CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS) TaskStatus_t *start_array = NULL, *end_array = NULL; UBaseType_t start_array_size, end_array_size; uint32_t start_run_time, end_run_time; @@ -76,122 +71,111 @@ audio_sys_get_real_time_stats (void) esp_err_t ret; // Allocate array to store current task states - start_array_size = uxTaskGetNumberOfTasks () + ARRAY_SIZE_OFFSET; - start_array = audio_malloc (sizeof (TaskStatus_t) * start_array_size); - AUDIO_MEM_CHECK (TAG, start_array, { + start_array_size = uxTaskGetNumberOfTasks() + ARRAY_SIZE_OFFSET; + start_array = audio_malloc(sizeof(TaskStatus_t) * start_array_size); + AUDIO_MEM_CHECK(TAG, start_array, { ret = ESP_FAIL; goto exit; }); // Get current task states - start_array_size - = uxTaskGetSystemState (start_array, start_array_size, &start_run_time); - if (start_array_size == 0) - { - ESP_LOGE (TAG, "Insufficient array size for uxTaskGetSystemState. " - "Trying increasing ARRAY_SIZE_OFFSET"); - ret = ESP_FAIL; - goto exit; - } + start_array_size = + uxTaskGetSystemState(start_array, start_array_size, &start_run_time); + if (start_array_size == 0) { + ESP_LOGE(TAG, + "Insufficient array size for uxTaskGetSystemState. Trying " + "increasing ARRAY_SIZE_OFFSET"); + ret = ESP_FAIL; + goto exit; + } - vTaskDelay (pdMS_TO_TICKS (AUDIO_SYS_TASKS_ELAPSED_TIME_MS)); + vTaskDelay(pdMS_TO_TICKS(AUDIO_SYS_TASKS_ELAPSED_TIME_MS)); // Allocate array to store tasks states post delay - end_array_size = uxTaskGetNumberOfTasks () + ARRAY_SIZE_OFFSET; - end_array = audio_malloc (sizeof (TaskStatus_t) * end_array_size); - AUDIO_MEM_CHECK (TAG, start_array, { + end_array_size = uxTaskGetNumberOfTasks() + ARRAY_SIZE_OFFSET; + end_array = audio_malloc(sizeof(TaskStatus_t) * end_array_size); + AUDIO_MEM_CHECK(TAG, start_array, { ret = ESP_FAIL; goto exit; }); // Get post delay task states - end_array_size - = uxTaskGetSystemState (end_array, end_array_size, &end_run_time); - if (end_array_size == 0) - { - ESP_LOGE (TAG, "Insufficient array size for uxTaskGetSystemState. " - "Trying increasing ARRAY_SIZE_OFFSET"); - ret = ESP_FAIL; - goto exit; - } + end_array_size = + uxTaskGetSystemState(end_array, end_array_size, &end_run_time); + if (end_array_size == 0) { + ESP_LOGE(TAG, + "Insufficient array size for uxTaskGetSystemState. Trying " + "increasing ARRAY_SIZE_OFFSET"); + ret = ESP_FAIL; + goto exit; + } // Calculate total_elapsed_time in units of run time stats clock period. uint32_t total_elapsed_time = (end_run_time - start_run_time); - if (total_elapsed_time == 0) - { - ESP_LOGE (TAG, "Delay duration too short. Trying increasing " - "AUDIO_SYS_TASKS_ELAPSED_TIME_MS"); - ret = ESP_FAIL; - goto exit; - } + if (total_elapsed_time == 0) { + ESP_LOGE(TAG, + "Delay duration too short. Trying increasing " + "AUDIO_SYS_TASKS_ELAPSED_TIME_MS"); + ret = ESP_FAIL; + goto exit; + } - ESP_LOGI (TAG, "| Task | Run Time | Per | Prio | HWM " - "| State | CoreId | Stack "); + ESP_LOGI(TAG, + "| Task | Run Time | Per | Prio | HWM | State " + " | CoreId | Stack "); // Match each task in start_array to those in the end_array - for (int i = 0; i < start_array_size; i++) - { - for (int j = 0; j < end_array_size; j++) - { - if (start_array[i].xHandle == end_array[j].xHandle) - { - - task_elapsed_time = end_array[j].ulRunTimeCounter - - start_array[i].ulRunTimeCounter; - percentage_time = (task_elapsed_time * 100UL) - / (total_elapsed_time * portNUM_PROCESSORS); - ESP_LOGI ( - TAG, - "| %-17s | %-11d |%2d%% | %-4u | %-9u | %-7s | %-8x | %s", - start_array[i].pcTaskName, task_elapsed_time, - percentage_time, start_array[i].uxCurrentPriority, - start_array[i].usStackHighWaterMark, - task_state[(start_array[i].eCurrentState)], - start_array[i].xCoreID, - task_stack[esp_ptr_internal ( - pxTaskGetStackStart (start_array[i].xHandle))]); - - // Mark that task have been matched by overwriting their handles - start_array[i].xHandle = NULL; - end_array[j].xHandle = NULL; - break; - } - } + for (int i = 0; i < start_array_size; i++) { + for (int j = 0; j < end_array_size; j++) { + if (start_array[i].xHandle == end_array[j].xHandle) { + task_elapsed_time = + end_array[j].ulRunTimeCounter - start_array[i].ulRunTimeCounter; + percentage_time = (task_elapsed_time * 100UL) / + (total_elapsed_time * portNUM_PROCESSORS); + ESP_LOGI( + TAG, "| %-17s | %-11d |%2d%% | %-4u | %-9u | %-7s | %-8x | %s", + start_array[i].pcTaskName, (int)task_elapsed_time, + (int)percentage_time, start_array[i].uxCurrentPriority, + (int)start_array[i].usStackHighWaterMark, + task_state[(start_array[i].eCurrentState)], start_array[i].xCoreID, + task_stack[esp_ptr_internal( + pxTaskGetStackStart(start_array[i].xHandle))]); + + // Mark that task have been matched by overwriting their handles + start_array[i].xHandle = NULL; + end_array[j].xHandle = NULL; + break; + } } + } // Print unmatched tasks - for (int i = 0; i < start_array_size; i++) - { - if (start_array[i].xHandle != NULL) - { - ESP_LOGI (TAG, "| %s | Deleted", start_array[i].pcTaskName); - } + for (int i = 0; i < start_array_size; i++) { + if (start_array[i].xHandle != NULL) { + ESP_LOGI(TAG, "| %s | Deleted", start_array[i].pcTaskName); } - for (int i = 0; i < end_array_size; i++) - { - if (end_array[i].xHandle != NULL) - { - ESP_LOGI (TAG, "| %s | Created", end_array[i].pcTaskName); - } + } + for (int i = 0; i < end_array_size; i++) { + if (end_array[i].xHandle != NULL) { + ESP_LOGI(TAG, "| %s | Created", end_array[i].pcTaskName); } - printf ("\n"); + } + printf("\n"); ret = ESP_OK; -exit: // Common return path - if (start_array) - { - audio_free (start_array); - start_array = NULL; - } - if (end_array) - { - audio_free (end_array); - end_array = NULL; - } +exit: // Common return path + if (start_array) { + audio_free(start_array); + start_array = NULL; + } + if (end_array) { + audio_free(end_array); + end_array = NULL; + } return ret; #else - ESP_LOGW (TAG, - "Please enbale `CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID` and " - "`CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS` in menuconfig"); + ESP_LOGW(TAG, + "Please enbale `CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID` and " + "`CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS` in menuconfig"); return ESP_FAIL; #endif } diff --git a/components/audio_sal/audio_thread.c b/components/audio_sal/audio_thread.c index 39ea36ad..84aaa1cc 100644 --- a/components/audio_sal/audio_thread.c +++ b/components/audio_sal/audio_thread.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,105 +18,104 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ -#include "freertos/FreeRTOS.h" -#include "freertos/semphr.h" -#include "freertos/task.h" +#include "audio_thread.h" #include "audio_error.h" +#include "audio_idf_version.h" #include "audio_mem.h" -#include "audio_thread.h" #include "esp_log.h" +#include "freertos/FreeRTOS.h" +#include "freertos/semphr.h" +#include "freertos/task.h" static const char *TAG = "AUDIO_THREAD"; -BaseType_t __attribute__ ((weak)) xTaskCreateRestrictedPinnedToCore ( - const TaskParameters_t *const pxTaskDefinition, - TaskHandle_t *pxCreatedTask, const BaseType_t xCoreID) -{ - ESP_LOGE (TAG, - "Not found right %s.\r\nPlease enter IDF-PATH with \"cd " - "$IDF_PATH\" and apply the IDF patch with \"git apply " - "$ADF_PATH/idf_patches/idf_v3.3_freertos.patch\" first\r\n", - __func__); +#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)) +#define TASK_HANDLE_T TaskHandle_t +#else +#define TASK_HANDLE_T xTaskHandle +#endif + +BaseType_t __attribute__((weak)) xTaskCreateRestrictedPinnedToCore( + const TaskParameters_t *const pxTaskDefinition, TaskHandle_t *pxCreatedTask, + const BaseType_t xCoreID) { + ESP_LOGE(TAG, + "Not found right %s.\r\nPlease enter IDF-PATH with \"cd $IDF_PATH\" " + "and apply the IDF patch with \"git apply " + "$ADF_PATH/idf_patches/idf_%.4s_freertos.patch\" first\r\n", + __func__, IDF_VER); return pdFALSE; } -esp_err_t -audio_thread_create (audio_thread_t *p_handle, const char *name, - void (*main_func) (void *arg), void *arg, uint32_t stack, - int prio, bool stack_in_ext, int core_id) -{ +esp_err_t audio_thread_create(audio_thread_t *p_handle, const char *name, + void (*main_func)(void *arg), void *arg, + uint32_t stack, int prio, bool stack_in_ext, + int core_id) { StackType_t *task_stack = NULL; - if (stack_in_ext && audio_mem_spiram_stack_is_enabled ()) - { - /* - * Note: 1. ESP32-ECO3 chip support stack on external memory only. - * 2. Make sure selected the `CONFIG_SPIRAM_BOOT_INIT` and - * `CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY` by `make menuconfig` - * 3. Please apply the - * $ADF_PATH/idf_patches/idf_v3.3_freertos.patch - * - */ - ESP_LOGI (TAG, "The %s task allocate stack on external memory", name); - /* task_stack freed by freertos*/ - task_stack = (StackType_t *)audio_calloc (1, stack); - AUDIO_MEM_CHECK (TAG, task_stack, goto audio_thread_create_error); - TaskParameters_t xRegParameters - = { .pvTaskCode = main_func, - .pcName = name, - .usStackDepth = stack, - .pvParameters = arg, - .uxPriority = prio | portPRIVILEGE_BIT, - .puxStackBuffer = task_stack, - .xRegions = { { - .pvBaseAddress = 0x00, - .ulLengthInBytes = 0x00, - .ulParameters = 0x00, - } } }; - if (xTaskCreateRestrictedPinnedToCore (&xRegParameters, - (xTaskHandle)p_handle, core_id) - != pdPASS) - { - ESP_LOGE (TAG, "Error creating RestrictedPinnedToCore %s", name); - goto audio_thread_create_error; - } + if (stack_in_ext && audio_mem_spiram_stack_is_enabled()) { + /* + * Note: 1. ESP32-ECO3 chip support stack on external memory only. + * 2. Make sure selected the `CONFIG_SPIRAM_BOOT_INIT` and + * `CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY` by `make menuconfig` + * 3. Please apply the $ADF_PATH/idf_patches/idf_v3.3_freertos.patch + * + */ + ESP_LOGI(TAG, "The %s task allocate stack on external memory", name); + /* task_stack freed by freertos*/ + task_stack = (StackType_t *)audio_calloc(1, stack); + AUDIO_MEM_CHECK(TAG, task_stack, goto audio_thread_create_error); + TaskParameters_t xRegParameters = {.pvTaskCode = main_func, + .pcName = name, + .usStackDepth = stack, + .pvParameters = arg, + .uxPriority = prio | portPRIVILEGE_BIT, + .puxStackBuffer = task_stack, + .xRegions = {{ + .pvBaseAddress = 0x00, + .ulLengthInBytes = 0x00, + .ulParameters = 0x00, + }}}; + if (xTaskCreateRestrictedPinnedToCore( + &xRegParameters, (TASK_HANDLE_T *)p_handle, core_id) != pdPASS) { + ESP_LOGE(TAG, "Error creating RestrictedPinnedToCore %s", name); + goto audio_thread_create_error; } - else - { - if (xTaskCreatePinnedToCore (main_func, name, stack, arg, prio, - (xTaskHandle)p_handle, core_id) - != pdPASS) - { - ESP_LOGE (TAG, "Error creating task %s", name); - goto audio_thread_create_error; - } + } else { + if (stack_in_ext) { + ESP_LOGW( + TAG, + "Make sure selected the `CONFIG_SPIRAM_BOOT_INIT` and " + "`CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY` by `make menuconfig`"); } + if (xTaskCreatePinnedToCore(main_func, name, stack, arg, prio, + (TASK_HANDLE_T *)p_handle, core_id) != pdPASS) { + ESP_LOGE(TAG, "Error creating task %s", name); + goto audio_thread_create_error; + } else { + ESP_LOGI(TAG, "The %s task allocate stack on internal memory", name); + } + } return ESP_OK; audio_thread_create_error: - if (task_stack) - { - audio_free (task_stack); - } + if (task_stack) { + audio_free(task_stack); + } return ESP_FAIL; } -esp_err_t -audio_thread_cleanup (audio_thread_t *p_handle) -{ +esp_err_t audio_thread_cleanup(audio_thread_t *p_handle) { // TODO nothing return ESP_OK; } -esp_err_t -audio_thread_delete_task (audio_thread_t *p_handle) -{ - vTaskDelete (NULL); +esp_err_t audio_thread_delete_task(audio_thread_t *p_handle) { + vTaskDelete(NULL); return ESP_OK; /* Control never reach here if this is self delete */ } diff --git a/components/audio_sal/audio_url.c b/components/audio_sal/audio_url.c index aaff6379..ed0a679b 100644 --- a/components/audio_sal/audio_url.c +++ b/components/audio_sal/audio_url.c @@ -1,66 +1,53 @@ +#include +#include + #include "audio_error.h" #include "audio_mem.h" #include "esp_log.h" -#include -#include static char *TAG = "AUDIO_URL"; -static unsigned char -char_to_hex (unsigned char x) -{ +static unsigned char char_to_hex(unsigned char x) { return x > 9 ? x + 0x37 : x + 0x30; } -char * -audio_url_encode (const char *str) -{ - int out_len = (strlen (str) + 1) * 3; - char *final = audio_malloc (out_len); - AUDIO_MEM_CHECK (TAG, final, return NULL); +char *audio_url_encode(const char *str) { + int out_len = (strlen(str) + 1) * 3; + char *final = audio_malloc(out_len); + AUDIO_MEM_CHECK(TAG, final, return NULL); char *tmp = final; - for (size_t i = 0; i < strlen (str); i++) - { - if (isalnum ((unsigned char)str[i]) || (str[i] == '-') || (str[i] == '_') - || (str[i] == '.') || (str[i] == '!') || (str[i] == '@') - || (str[i] == '#') || (str[i] == '$') || (str[i] == '&') - || (str[i] == '*') || (str[i] == '(') || (str[i] == ')') - || (str[i] == '=') || (str[i] == ':') || (str[i] == '/') - || (str[i] == ',') || (str[i] == ';') || (str[i] == '?') - || (str[i] == '+') || (str[i] == '\'') || (str[i] == '~')) - { - *final++ = str[i]; - } - else - { - *final++ = '%'; - *final++ = char_to_hex ((unsigned char)str[i] >> 4); - *final++ = char_to_hex ((unsigned char)str[i] % 16); - } + for (size_t i = 0; i < strlen(str); i++) { + if (isalnum((unsigned char)str[i]) || (str[i] == '-') || (str[i] == '_') || + (str[i] == '.') || (str[i] == '!') || (str[i] == '@') || + (str[i] == '#') || (str[i] == '$') || (str[i] == '&') || + (str[i] == '*') || (str[i] == '(') || (str[i] == ')') || + (str[i] == '=') || (str[i] == ':') || (str[i] == '/') || + (str[i] == ',') || (str[i] == ';') || (str[i] == '?') || + (str[i] == '+') || (str[i] == '\'') || (str[i] == '~')) { + *final++ = str[i]; + } else { + *final++ = '%'; + *final++ = char_to_hex((unsigned char)str[i] >> 4); + *final++ = char_to_hex((unsigned char)str[i] % 16); } + } *final = 0; return tmp; } -char * -audio_url_decode (const char *str) -{ - char *final = audio_malloc (strlen (str) + 1); - AUDIO_MEM_CHECK (TAG, final, return NULL); +char *audio_url_decode(const char *str) { + char *final = audio_malloc(strlen(str) + 1); + AUDIO_MEM_CHECK(TAG, final, return NULL); char *tmp = final; - while (*str) - { - if (*str == '%') - { - char buffer[3] = { str[1], str[2], 0 }; - *final++ = strtol (buffer, NULL, 16); - str += 3; - } - else - { - *final++ = *str++; - } + while (*str) { + if (*str == '%') { + char buffer[3] = {str[1], str[2], 0}; + *final++ = strtol(buffer, NULL, 16); + str += 3; + } else { + *final++ = *str++; } + } *final = 0; return tmp; } diff --git a/components/audio_sal/include/audio_error.h b/components/audio_sal/include/audio_error.h index 130bc4f4..31e23350 100644 --- a/components/audio_sal/include/audio_error.h +++ b/components/audio_sal/include/audio_error.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -30,26 +30,25 @@ #include "esp_err.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif #ifndef __FILENAME__ #define __FILENAME__ __FILE__ #endif -#define ESP_ERR_ADF_BASE \ - 0x80000 /*!< Starting number of ESP-ADF error codes \ +#define ESP_ERR_ADF_BASE \ + 0x80000 /*!< Starting number of ESP-ADF error codes \ */ - /* - * ESP-ADF error code field start from 0x80000, end of the -1. - * The whole area is divided into series independent modules. - * The range of each module is 0x1000. - * ////////////////////////////////////////////////////////// - * ESP-Audio module starting on 0x81000; - * - */ +/* + * ESP-ADF error code field start from 0x80000, end of the -1. + * The whole area is divided into series independent modules. + * The range of each module is 0x1000. + * ////////////////////////////////////////////////////////// + * ESP-Audio module starting on 0x81000; + * + */ #define ESP_ERR_ADF_NO_ERROR ESP_OK #define ESP_ERR_ADF_NO_FAIL ESP_FAIL @@ -67,22 +66,28 @@ extern "C" #define ESP_ERR_ADF_INITIALIZED ESP_ERR_ADF_BASE + 10 #define ESP_ERR_ADF_UNINITIALIZED ESP_ERR_ADF_BASE + 11 -#define AUDIO_CHECK(TAG, a, action, msg) \ - if (!(a)) \ - { \ - ESP_LOGE (TAG, "%s:%d (%s): %s", __FILENAME__, __LINE__, __FUNCTION__, \ - msg); \ - action; \ - } +#define AUDIO_CHECK(TAG, a, action, msg) \ + if (!(a)) { \ + ESP_LOGE(TAG, "%s:%d (%s): %s", __FILENAME__, __LINE__, __FUNCTION__, \ + msg); \ + action; \ + } + +#define AUDIO_RET_ON_FALSE(TAG, a, action, msg) \ + if (unlikely(a == ESP_FAIL)) { \ + ESP_LOGE(TAG, "%s:%d (%s): %s", __FILENAME__, __LINE__, __FUNCTION__, \ + msg); \ + action; \ + } -#define AUDIO_MEM_CHECK(TAG, a, action) \ - AUDIO_CHECK (TAG, a, action, "Memory exhausted") +#define AUDIO_MEM_CHECK(TAG, a, action) \ + AUDIO_CHECK(TAG, a, action, "Memory exhausted") -#define AUDIO_NULL_CHECK(TAG, a, action) \ - AUDIO_CHECK (TAG, a, action, "Got NULL Pointer") +#define AUDIO_NULL_CHECK(TAG, a, action) \ + AUDIO_CHECK(TAG, a, action, "Got NULL Pointer") -#define AUDIO_ERROR(TAG, str) \ - ESP_LOGE (TAG, "%s:%d (%s): %s", __FILENAME__, __LINE__, __FUNCTION__, str) +#define AUDIO_ERROR(TAG, str) \ + ESP_LOGE(TAG, "%s:%d (%s): %s", __FILENAME__, __LINE__, __FUNCTION__, str) #define ESP_EXISTS (ESP_OK + 1) diff --git a/components/audio_sal/include/audio_idf_version.h b/components/audio_sal/include/audio_idf_version.h new file mode 100644 index 00000000..7827fa46 --- /dev/null +++ b/components/audio_sal/include/audio_idf_version.h @@ -0,0 +1,44 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2021 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef __AUDIO_IDF_VERSION_H__ +#define __AUDIO_IDF_VERSION_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#if __has_include("esp_idf_version.h") +#include "esp_idf_version.h" +#else +#define ESP_IDF_VERSION_VAL(major, minor, patch) 1 +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* #ifndef __AUDIO_IDF_VERSION_H__ */ diff --git a/components/audio_sal/include/audio_mem.h b/components/audio_sal/include/audio_mem.h index 44521534..e6fb3c29 100644 --- a/components/audio_sal/include/audio_mem.h +++ b/components/audio_sal/include/audio_mem.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -30,114 +30,113 @@ #include #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - /** - * @brief Malloc memory in ADF - * - * @param[in] size memory size - * - * @return - * - valid pointer on success - * - NULL when any errors - */ - void *audio_malloc (size_t size); +/** + * @brief Malloc memory in ADF + * + * @param[in] size memory size + * + * @return + * - valid pointer on success + * - NULL when any errors + */ +void *audio_malloc(size_t size); - /** - * @brief Free memory in ADF - * - * @param[in] ptr memory pointer - * - * @return - * - void - */ - void audio_free (void *ptr); +/** + * @brief Free memory in ADF + * + * @param[in] ptr memory pointer + * + * @return + * - void + */ +void audio_free(void *ptr); - /** - * @brief Malloc memory in ADF, if spi ram is enabled, it will malloc memory - * in the spi ram - * - * @param[in] nmemb number of block - * @param[in] size block memory size - * - * @return - * - valid pointer on success - * - NULL when any errors - */ - void *audio_calloc (size_t nmemb, size_t size); +/** + * @brief Malloc memory in ADF, if spi ram is enabled, it will malloc memory in + * the spi ram + * + * @param[in] nmemb number of block + * @param[in] size block memory size + * + * @return + * - valid pointer on success + * - NULL when any errors + */ +void *audio_calloc(size_t nmemb, size_t size); - /** - * @brief Malloc memory in ADF, it will malloc to internal memory - * - * @param[in] nmemb number of block - * @param[in] size block memory size - * - * @return - * - valid pointer on success - * - NULL when any errors - */ - void *audio_calloc_inner (size_t nmemb, size_t size); +/** + * @brief Malloc memory in ADF, it will malloc to internal memory + * + * @param[in] nmemb number of block + * @param[in] size block memory size + * + * @return + * - valid pointer on success + * - NULL when any errors + */ +void *audio_calloc_inner(size_t nmemb, size_t size); - /** - * @brief Print heap memory status - * - * @param[in] tag tag of log - * @param[in] line line of log - * @param[in] func function name of log - * - * @return - * - void - */ - void audio_mem_print (const char *tag, int line, const char *func); +/** + * @brief Print heap memory status + * + * @param[in] tag tag of log + * @param[in] line line of log + * @param[in] func function name of log + * + * @return + * - void + */ +void audio_mem_print(const char *tag, int line, const char *func); - /** - * @brief Reallocate memory in ADF, if spi ram is enabled, it will allocate - * memory in the spi ram - * - * @param[in] ptr memory pointer - * @param[in] size block memory size - * - * @return - * - valid pointer on success - * - NULL when any errors - */ - void *audio_realloc (void *ptr, size_t size); +/** + * @brief Reallocate memory in ADF, if spi ram is enabled, it will allocate + * memory in the spi ram + * + * @param[in] ptr memory pointer + * @param[in] size block memory size + * + * @return + * - valid pointer on success + * - NULL when any errors + */ +void *audio_realloc(void *ptr, size_t size); - /** - * @brief Duplicate given string. - * - * Allocate new memory, copy contents of given string into it and - * return the pointer - * - * @param[in] str String to be duplicated - * - * @return - * - Pointer to new malloc'ed string - * - NULL otherwise - */ - char *audio_strdup (const char *str); +/** + * @brief Duplicate given string. + * + * Allocate new memory, copy contents of given string into it and + * return the pointer + * + * @param[in] str String to be duplicated + * + * @return + * - Pointer to new malloc'ed string + * - NULL otherwise + */ +char *audio_strdup(const char *str); - /** - * @brief SPI ram is enabled or not - * - * @return - * - true, spi ram is enabled - * - false, spi ram is not enabled - */ - bool audio_mem_spiram_is_enabled (void); +/** + * @brief SPI ram is enabled or not + * + * @return + * - true, spi ram is enabled + * - false, spi ram is not enabled + */ +bool audio_mem_spiram_is_enabled(void); - /** - * @brief Stack on external SPI ram is enabled or not - * - * @return - * - true, stack on spi ram is enabled - * - false, stack on spi ram is not enabled - */ - bool audio_mem_spiram_stack_is_enabled (void); +/** + * @brief Stack on external SPI ram is enabled or not + * + * @return + * - true, stack on spi ram is enabled + * - false, stack on spi ram is not enabled + */ +bool audio_mem_spiram_stack_is_enabled(void); -#define AUDIO_MEM_SHOW(x) audio_mem_print (x, __LINE__, __func__) +#define AUDIO_MEM_SHOW(x) audio_mem_print(x, __LINE__, __func__) #ifdef __cplusplus } diff --git a/components/audio_sal/include/audio_mutex.h b/components/audio_sal/include/audio_mutex.h index 0a3c23f4..5b2e44ce 100644 --- a/components/audio_sal/include/audio_mutex.h +++ b/components/audio_sal/include/audio_mutex.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,33 +18,60 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ -#ifndef _AUDIO_MUTEX_H_ -#define _AUDIO_MUTEX_H_ +#ifndef __AUDIO_MUTEX_H__ +#define __AUDIO_MUTEX_H__ #include "freertos/FreeRTOS.h" #include "freertos/semphr.h" #include "freertos/task.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif -#define mutex_lock(x) \ - while (xSemaphoreTake (x, portMAX_DELAY) != pdPASS) \ - ; -#define mutex_unlock(x) xSemaphoreGive (x) -#define mutex_create() xSemaphoreCreateMutex () -#define mutex_destroy(x) vSemaphoreDelete (x) +/** + * @brief Create a mutex instance + * + * @return - Others: A mutex handle is returned + * - NULL: Failed to create mutex + */ +void *mutex_create(void); + +/** + * @brief Delete the mutex instance + * + * @param mutex The pointer to mutex handle + * + * @return - 0: Success to delete mutex + */ +int mutex_destroy(void *mutex); + +/** + * @brief Take the mutex + * + * @param mutex The pointer to mutex handle + * + * @return - 0: The lock was obtained + */ +int mutex_lock(void *mutex); + +/** + * @brief Release the mutex + * + * @param mutex The pointer to mutex handle + * + * @return - 0: The lock was released + */ +int mutex_unlock(void *mutex); #ifdef __cplusplus } #endif -#endif +#endif /* #ifndef __AUDIO_MUTEX_H__ */ diff --git a/components/audio_sal/include/audio_queue.h b/components/audio_sal/include/audio_queue.h new file mode 100644 index 00000000..5f6eb3a8 --- /dev/null +++ b/components/audio_sal/include/audio_queue.h @@ -0,0 +1,131 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2021 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef __AUDIO_QUEUE_H__ +#define __AUDIO_QUEUE_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void *audio_queue_handle_t; + +/** + * @brief Allocate queue instance with given item size and length + * + * @param queue_len The maximum number of items that the queue can + * contain + * @param item_size The number of bytes each item in the queue will + * require + * + * @return - Others: Queue handle is returned + * - NULL: Failed to create queue handle + */ +audio_queue_handle_t audio_queue_create(uint32_t queue_len, uint32_t item_size); + +/** + * @brief Delete the queue + * + * @param queue A pointer to queue handle + * + * @return - 0: The queue deleted successfully + */ +int audio_queue_delete(audio_queue_handle_t queue); + +/** + * @brief Post an item on given queue + * + * @param queue A pointer to queue handle + * @param item A pointer to the item that is to be placed on + * the queue + * @param block_time_ms The maximum amount of millisecond the task + * should block waiting for space to become available on the queue, should it + * already be full + * + * @return - 0: The item was successfully posted + * - Otherwise: Queue full error + */ +int audio_queue_send(audio_queue_handle_t queue, void *item, + uint32_t block_time_ms); + +/** + * @brief Post an item to the front of a queue + * + * @param queue A pointer to queue handle + * @param item A pointer to the item that is to be placed on + * the queue + * @param block_time_ms The maximum amount of millisecond the task + * should block waiting for space to become available on the queue, should it + * already be full + * + * @return - 0: The item was successfully posted + * - Otherwise: Queue full error + */ +int audio_queue_send_to_front(audio_queue_handle_t queue, void *item, + uint32_t block_time_ms); + +/** + * @brief Receive an item from a queue. + * + * @param queue A pointer to queue handle + * @param item A pointer to the item that is to be placed on + * the queue + * @param block_time_ms The maximum amount of millisecond the task + * should block waiting for space to become available on the queue, should it + * already be full + * + * @return - 0: An item was successfully received from the + * queue + * - Otherwise: Failed to received queue + */ +int audio_queue_recv(audio_queue_handle_t queue, void *item, + uint32_t block_time_ms); + +/** + * @brief Return the number of messages stored in a queue. + * + * @param queue A pointer to queue handle + * + * @return The number of messages available in the queue. + */ +int audio_queue_message_available(const audio_queue_handle_t queue); + +/** + * @brief Return the number of free spaces available in a queue. + * + * @param queue A pointer to queue handle + * + * @return The number of spaces available in the queue. + */ +int audio_queue_spaces_available(const audio_queue_handle_t queue); + +#ifdef __cplusplus +} +#endif + +#endif /* #ifndef __AUDIO_QUEUE_H__ */ diff --git a/components/audio_sal/include/audio_sys.h b/components/audio_sal/include/audio_sys.h index 048de4c6..fb2fa87b 100644 --- a/components/audio_sal/include/audio_sys.h +++ b/components/audio_sal/include/audio_sys.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -30,52 +30,57 @@ #include "esp_err.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif #define ___STR___(x) #x -#define STR_AUDIO(x) ___STR___ (x) +#define STR_AUDIO(x) ___STR___(x) - /** - * @brief Get system ticks by given millisecond - * - * @param[in] ms millisecond - * - * @return - * - tick - */ - int audio_sys_get_tick_by_time_ms (int ms); +#if defined(__GNUC__) && (__GNUC__ >= 7) +#define FALL_THROUGH __attribute__((fallthrough)) +#else +#define FALL_THROUGH ((void)0) +#endif /* __GNUC__ >= 7 */ - /** - * @brief Get system time with millisecond - * - * @return - * - time with millisecond - */ - int64_t audio_sys_get_time_ms (void); +/** + * @brief Get system ticks by given millisecond + * + * @param[in] ms millisecond + * + * @return + * - tick + */ +int audio_sys_get_tick_by_time_ms(int ms); + +/** + * @brief Get system time with millisecond + * + * @return + * - time with millisecond + */ +int64_t audio_sys_get_time_ms(void); - /** - * @brief Function to print the CPU usage of tasks over a given - * AUDIO_SYS_TASKS_ELAPSED_TIME_MS. - * - * This function will measure and print the CPU usage of tasks over a - * specified number of ticks (i.e. real time stats). This is implemented by - * simply calling uxTaskGetSystemState() twice separated by a delay, then - * calculating the differences of task run times before and after the delay. - * - * @note If any tasks are added or removed during the delay, the stats of - * those tasks will not be printed. - * @note This function should be called from a high priority task to - * minimize inaccuracies with delays. - * @note When running in dual core mode, each core will correspond to 50% - * of the run time. - * - * @return - * - ESP_OK - * - ESP_FIAL - */ - esp_err_t audio_sys_get_real_time_stats (void); +/** + * @brief Function to print the CPU usage of tasks over a given + * AUDIO_SYS_TASKS_ELAPSED_TIME_MS. + * + * This function will measure and print the CPU usage of tasks over a specified + * number of ticks (i.e. real time stats). This is implemented by simply calling + * uxTaskGetSystemState() twice separated by a delay, then calculating the + * differences of task run times before and after the delay. + * + * @note If any tasks are added or removed during the delay, the stats of + * those tasks will not be printed. + * @note This function should be called from a high priority task to minimize + * inaccuracies with delays. + * @note When running in dual core mode, each core will correspond to 50% of + * the run time. + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t audio_sys_get_real_time_stats(void); #ifdef __cplusplus } diff --git a/components/audio_sal/include/audio_thread.h b/components/audio_sal/include/audio_thread.h index adb96acc..960bc791 100644 --- a/components/audio_sal/include/audio_thread.h +++ b/components/audio_sal/include/audio_thread.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -31,64 +31,62 @@ #include "stdbool.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif -#define audio_thread_t xTaskHandle +typedef void *audio_thread_t; - /** - * @brief Allocate handle if not allocated and create a thread - * - * @param p_handle pointer to audio_thread_t handle - * @param name Task name - * @param main_func The function which task will execute - * @param stack Task stack - * @param prio Task priority - * @param stack_in_ext If task should reside in external memory - * @param core_id Core to which task will be pinned - * - * @return - ESP_OK : Task creation successful - * - ESP_FAIL: Failed to create task - * - * @note - Please apply the - * $ADF_PATH/idf_patches/idf_v3.3/4.x_freertos.patch first. - * - Please enable support for external RAM and `Allow external - * memory as an argument to xTaskCreateStatic` to be able to use external - * memory for task stack, namely `CONFIG_SPIRAM_BOOT_INIT=y` and - * `CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY=y`. - * - */ - esp_err_t audio_thread_create (audio_thread_t *p_handle, const char *name, - void (*main_func) (void *arg), void *arg, - uint32_t stack, int prio, bool stack_in_ext, - int core_id); +/** + * @brief Allocate handle if not allocated and create a thread + * + * @param p_handle pointer to audio_thread_t handle + * @param name Task name + * @param main_func The function which task will execute + * @param stack Task stack + * @param prio Task priority + * @param stack_in_ext If task should reside in external memory + * @param core_id Core to which task will be pinned + * + * @return - ESP_OK : Task creation successful + * - ESP_FAIL: Failed to create task + * + * @note - Please apply the + * $ADF_PATH/idf_patches/idf_v3.3/4.x_freertos.patch first. + * - Please enable support for external RAM and `Allow external + * memory as an argument to xTaskCreateStatic` to be able to use external memory + * for task stack, namely `CONFIG_SPIRAM_BOOT_INIT=y` and + * `CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY=y`. + * + */ +esp_err_t audio_thread_create(audio_thread_t *p_handle, const char *name, + void (*main_func)(void *arg), void *arg, + uint32_t stack, int prio, bool stack_in_ext, + int core_id); - /** - * @brief Cleanup all the task memory - * - * @param p_handle The pointer to audio_thread_t handle - * - * @return - ESP_OK : Task cleanup successful - * - ESP_FAIL: Task is already cleaned up - * - * @note must be called from different task after this task is - * deleted. - */ - esp_err_t audio_thread_cleanup (audio_thread_t *p_handle); +/** + * @brief Cleanup all the task memory + * + * @param p_handle The pointer to audio_thread_t handle + * + * @return - ESP_OK : Task cleanup successful + * - ESP_FAIL: Task is already cleaned up + * + * @note must be called from different task after this task is deleted. + */ +esp_err_t audio_thread_cleanup(audio_thread_t *p_handle); - /** - * @brief Delete the task - * - * @param p_handle The pointer to audio_thread_t handle - * - * @return - ESP_OK : Task deleted successfully - * - ESP_FAIL: Task is not running or cleaned up - * - * @note This only deletes the task and all the memory cleanup should - * be done with `audio_thread_cleanup` - */ - esp_err_t audio_thread_delete_task (audio_thread_t *p_handle); +/** + * @brief Delete the task + * + * @param p_handle The pointer to audio_thread_t handle + * + * @return - ESP_OK : Task deleted successfully + * - ESP_FAIL: Task is not running or cleaned up + * + * @note This only deletes the task and all the memory cleanup should be + * done with `audio_thread_cleanup` + */ +esp_err_t audio_thread_delete_task(audio_thread_t *p_handle); #ifdef __cplusplus } diff --git a/components/audio_sal/include/audio_url.h b/components/audio_sal/include/audio_url.h index e749cecf..a2aaa002 100644 --- a/components/audio_sal/include/audio_url.h +++ b/components/audio_sal/include/audio_url.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -28,39 +28,38 @@ #define __AUDIO_URL_H__ #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - /** - * @brief Allocate new memory, encoding given string to percent-encoding and - * return the pointer - * - * @note Returned pointer should be freed by user. - * ALPHA(0x41-0x5A and 0x61-0x7A), DIGIT (0x30-0x39) and - * "~!@#$&*()=:/,;?+'-_." are reserved. - * - * @param str String to be encode - * - * @return - * - valid pointer on success - * - NULL when any errors - */ - char *audio_url_encode (const char *str); +/** + * @brief Allocate new memory, encoding given string to percent-encoding and + * return the pointer + * + * @note Returned pointer should be freed by user. + * ALPHA(0x41-0x5A and 0x61-0x7A), DIGIT (0x30-0x39) and + * "~!@#$&*()=:/,;?+'-_." are reserved. + * + * @param str String to be encode + * + * @return + * - valid pointer on success + * - NULL when any errors + */ +char *audio_url_encode(const char *str); - /** - * @brief Allocate new memory, decoding given percent-encoding string and - * return the pointer - * - * @note Returned pointer should be freed by user - * - * @param str String to be decode - * - * @return - * - valid pointer on success - * - NULL when any errors - */ - char *audio_url_decode (const char *str); +/** + * @brief Allocate new memory, decoding given percent-encoding string and return + * the pointer + * + * @note Returned pointer should be freed by user + * + * @param str String to be decode + * + * @return + * - valid pointer on success + * - NULL when any errors + */ +char *audio_url_decode(const char *str); #ifdef __cplusplus } diff --git a/components/audio_sal/include/media_os_ctype.h b/components/audio_sal/include/media_os_ctype.h new file mode 100644 index 00000000..8f747c05 --- /dev/null +++ b/components/audio_sal/include/media_os_ctype.h @@ -0,0 +1,199 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2021 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef __MEDIA_OS_CTYPE_H__ +#define __MEDIA_OS_CTYPE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Checks whether c is either a decimal digit or an uppercase or + * lowercase letter. The result is true if either isalpha or isdigit would also + * return true. + * + * @param[in] Character to be checked, casted as an int, or EOF. + * + * @return A value different from zero (i.e., true) if indeed c is either a + * digit or a letter. Zero (i.e., false) otherwise. + * + */ +int media_os_isalnum(int c); + +/** + * @brief Checks whether c is an alphabetic letter. + * + * @param[in] Character to be checked, casted as an int, or EOF. + * + * @return A value different from zero (i.e., true) if indeed c is an + * alphabetic letter. Zero (i.e., false) otherwise. + * + */ +int media_os_isalpha(int c); + +/** + * @brief Checks whether c is a blank character. + * + * @param[in] Character to be checked, casted as an int, or EOF. + * + * @return A value different from zero (i.e., true) if indeed c is a blank + * character. Zero (i.e., false) otherwise. + * + */ +int media_os_isblank(int c); + +/** + * @brief Checks whether c is a control character. + * + * @param[in] Character to be checked, casted as an int, or EOF. + * + * @return A value different from zero (i.e., true) if indeed c is a + * control character. Zero (i.e., false) otherwise. + * + */ +int media_os_iscntrl(int c); + +/** + * @brief Checks whether c is a decimal digit character. + * + * @param[in] Character to be checked, casted as an int, or EOF. + * + * @return A value different from zero (i.e., true) if indeed c is a + * decimal digit. Zero (i.e., false) otherwise. + * + */ +int media_os_isdigit(int c); + +/** + * @brief Checks whether c is a character with graphical representation. + * + * @param[in] Character to be checked, casted as an int, or EOF. + * + * @return A value different from zero (i.e., true) if indeed c has a + * graphical representation as character. Zero (i.e., false) otherwise. + */ +int media_os_isgraph(int c); + +/** + * @brief Checks whether c is a lowercase letter. + * + * @param[in] Character to be checked, casted as an int, or EOF. + * + * @return A value different from zero (i.e., true) if indeed c is a + * lowercase alphabetic letter. Zero (i.e., false) otherwise. + * + */ +int media_os_islower(int c); + +/** + * @brief Checks whether c is a printable character. + * + * @param[in] Character to be checked, casted as an int, or EOF. + * + * @return A value different from zero (i.e., true) if indeed c is a + * printable character. Zero (i.e., false) otherwise. + * + */ +int media_os_isprint(int c); + +/** + * @brief Checks whether c is a punctuation character. + * + * @param[in] Character to be checked, casted as an int, or EOF. + * + * @return A value different from zero (i.e., true) if indeed c is a + * punctuation character. Zero (i.e., false) otherwise. + * + */ +int media_os_ispunct(int c); + +/** + * @brief Checks whether c is a white-space character. + * + * @param[in] Character to be checked, casted as an int, or EOF. + * + * @return A value different from zero (i.e., true) if indeed c is a + * white-space character. Zero (i.e., false) otherwise. + * + */ +int media_os_isspace(int c); + +/** + * @brief Checks if parameter c is an uppercase alphabetic letter. + * + * @param[in] Character to be checked, casted as an int, or EOF. + * + * @return A value different from zero (i.e., true) if indeed c is an + * uppercase alphabetic letter. Zero (i.e., false) otherwise. + * + */ +int media_os_isupper(int c); + +/** + * @brief Checks whether c is a hexdecimal digit character. + * + * @param[in] Character to be checked, casted as an int, or EOF. + * + * @return A value different from zero (i.e., true) if indeed c is a + * hexadecimal digit. Zero (i.e., false) otherwise. + * + */ +int media_os_isxdigit(int c); + +/** + * @brief Converts c to its lowercase equivalent if c is an uppercase + * letter and has a lowercase equivalent. If no such conversion is possible, the + * value returned is c unchanged. + * + * @param[in] Character to be checked, casted as an int, or EOF. + * + * @return The lowercase equivalent to c, if such value exists, or c + * (unchanged) otherwise. The value is returned as an int value that can be + * implicitly casted to char. + * + */ +int media_os_tolower(int c); + +/** + * @brief Converts c to its uppercase equivalent if c is a lowercase + * letter and has an uppercase equivalent. If no such conversion is possible, + * the value returned is c unchanged. + * + * @param[in] Character to be checked, casted as an int, or EOF. + * + * @return The uppercase equivalent to c, if such value exists, or c + * (unchanged) otherwise. The value is returned as an int value that can be + * implicitly casted to char. + * + */ +int media_os_toupper(int c); + +#ifdef __cplusplus +} +#endif + +#endif /* #ifndef __MEDIA_OS_CTYPE_H__ */ diff --git a/components/audio_sal/media_os_ctype.c b/components/audio_sal/media_os_ctype.c new file mode 100644 index 00000000..a922d642 --- /dev/null +++ b/components/audio_sal/media_os_ctype.c @@ -0,0 +1,55 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2021 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include "ctype.h" + +int media_os_isalnum(int c) { return isalnum(c); } + +int media_os_isalpha(int c) { return isalpha(c); } + +int media_os_isblank(int c) { return isblank(c); } + +int media_os_iscntrl(int c) { return iscntrl(c); } + +int media_os_isdigit(int c) { return isdigit(c); } + +int media_os_isgraph(int c) { return isgraph(c); } + +int media_os_islower(int c) { return islower(c); } + +int media_os_isprint(int c) { return isprint(c); } + +int media_os_ispunct(int c) { return ispunct(c); } + +int media_os_isspace(int c) { return isspace(c); } + +int media_os_isupper(int c) { return isupper(c); } + +int media_os_isxdigit(int c) { return isxdigit(c); } + +int media_os_tolower(int c) { return tolower(c); } + +int media_os_toupper(int c) { return toupper(c); } diff --git a/components/audio_sal/test/audio_mem_test.c b/components/audio_sal/test/audio_mem_test.c index bb3cf055..00f7854b 100644 --- a/components/audio_sal/test/audio_mem_test.c +++ b/components/audio_sal/test/audio_mem_test.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,72 +18,72 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "audio_mem.h" + +#include + #include "esp_err.h" #include "esp_log.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "unity.h" -#include -static const char *TAG = "AUDIO_MEM_TEST"; +static const char* TAG = "AUDIO_MEM_TEST"; -TEST_CASE ("audio_mem", "esp-adf") -{ - esp_log_level_set ("AUDIO_MEM", ESP_LOG_VERBOSE); +TEST_CASE("audio_mem", "esp-adf") { + esp_log_level_set("AUDIO_MEM", ESP_LOG_VERBOSE); - ESP_LOGI (TAG, "[✓] audio_malloc,audio_callo,audio_calloc_inner, " - "audio_inaudio memory print"); - AUDIO_MEM_SHOW (TAG); - uint8_t *pdata = audio_malloc (1024); - TEST_ASSERT_NOT_NULL (pdata); - AUDIO_MEM_SHOW (TAG); - audio_free (pdata); + ESP_LOGI(TAG, + "[✓] audio_malloc,audio_callo,audio_calloc_inner, audio_inaudio " + "memory print"); + AUDIO_MEM_SHOW(TAG); + uint8_t* pdata = audio_malloc(1024); + TEST_ASSERT_NOT_NULL(pdata); + AUDIO_MEM_SHOW(TAG); + audio_free(pdata); - AUDIO_MEM_SHOW (TAG); - pdata = audio_calloc (1, 2 * 1024 * 1024); - TEST_ASSERT_NOT_NULL (pdata); - AUDIO_MEM_SHOW (TAG); - audio_free (pdata); + AUDIO_MEM_SHOW(TAG); + pdata = audio_calloc(1, 2 * 1024 * 1024); + TEST_ASSERT_NOT_NULL(pdata); + AUDIO_MEM_SHOW(TAG); + audio_free(pdata); - AUDIO_MEM_SHOW (TAG); - pdata = audio_calloc_inner (1, 1024); - TEST_ASSERT_NOT_NULL (pdata); - AUDIO_MEM_SHOW (TAG); - audio_free (pdata); - AUDIO_MEM_SHOW (TAG); + AUDIO_MEM_SHOW(TAG); + pdata = audio_calloc_inner(1, 1024); + TEST_ASSERT_NOT_NULL(pdata); + AUDIO_MEM_SHOW(TAG); + audio_free(pdata); + AUDIO_MEM_SHOW(TAG); } -TEST_CASE ("audio_strdup", "esp-adf") -{ - esp_log_level_set ("AUDIO_STRDUP", ESP_LOG_VERBOSE); - ESP_LOGI (TAG, "[✓] audio_strdup"); - AUDIO_MEM_SHOW (TAG); - char *strings = "audio string dump"; - char *pdata = audio_strdup (strings); - TEST_ASSERT_NOT_NULL (pdata); - AUDIO_MEM_SHOW (TAG); - audio_free (pdata); - AUDIO_MEM_SHOW (TAG); +TEST_CASE("audio_strdup", "esp-adf") { + esp_log_level_set("AUDIO_STRDUP", ESP_LOG_VERBOSE); + ESP_LOGI(TAG, "[✓] audio_strdup"); + AUDIO_MEM_SHOW(TAG); + char* strings = "audio string dump"; + char* pdata = audio_strdup(strings); + TEST_ASSERT_NOT_NULL(pdata); + AUDIO_MEM_SHOW(TAG); + audio_free(pdata); + AUDIO_MEM_SHOW(TAG); } -TEST_CASE ("audio_realloc", "esp-adf") -{ - esp_log_level_set ("AUDIO_REALLOC", ESP_LOG_VERBOSE); - ESP_LOGI (TAG, "[✓] audio_realloc"); - AUDIO_MEM_SHOW (TAG); - uint8_t *pdata = audio_malloc (1024); - TEST_ASSERT_NOT_NULL (pdata); - AUDIO_MEM_SHOW (TAG); - pdata = audio_realloc (pdata, 2 * 1024); - TEST_ASSERT_NOT_NULL (pdata); - AUDIO_MEM_SHOW (TAG); - audio_free (pdata); - AUDIO_MEM_SHOW (TAG); +TEST_CASE("audio_realloc", "esp-adf") { + esp_log_level_set("AUDIO_REALLOC", ESP_LOG_VERBOSE); + ESP_LOGI(TAG, "[✓] audio_realloc"); + AUDIO_MEM_SHOW(TAG); + uint8_t* pdata = audio_malloc(1024); + TEST_ASSERT_NOT_NULL(pdata); + AUDIO_MEM_SHOW(TAG); + pdata = audio_realloc(pdata, 2 * 1024); + TEST_ASSERT_NOT_NULL(pdata); + AUDIO_MEM_SHOW(TAG); + audio_free(pdata); + AUDIO_MEM_SHOW(TAG); } diff --git a/components/custom_board/CMakeLists.txt b/components/custom_board/CMakeLists.txt index 3ff4ee51..82e0c3db 100644 --- a/components/custom_board/CMakeLists.txt +++ b/components/custom_board/CMakeLists.txt @@ -17,7 +17,7 @@ if(CONFIG_AUDIO_BOARD_CUSTOM) endif() if(CONFIG_DAC_PCM51XX) - message(STATUS "Selected DAC is " CONFIG_DAC_PCM15XX) + message(STATUS "Selected DAC is " CONFIG_DAC_PCM51XX) list(APPEND COMPONENT_ADD_INCLUDEDIRS ./pcm51xx/include) list(APPEND COMPONENT_SRCS ./pcm51xx/pcm51xx.c) endif() @@ -45,6 +45,18 @@ if(CONFIG_AUDIO_BOARD_CUSTOM) list(APPEND COMPONENT_ADD_INCLUDEDIRS ./max98357/include) list(APPEND COMPONENT_SRCS ./max98357/max98357.c) endif() + + if(CONFIG_DAC_TAS5805M) + message(STATUS "Selected DAC is " CONFIG_DAC_TAS5805M) + list(APPEND COMPONENT_ADD_INCLUDEDIRS ./tas5805m/include) + list(APPEND COMPONENT_SRCS ./tas5805m/tas5805m.c) + endif() + + if(CONFIG_DAC_PT8211) + message(STATUS "Selected DAC is " CONFIG_DAC_PT8211) + list(APPEND COMPONENT_ADD_INCLUDEDIRS ./pt8211/include) + list(APPEND COMPONENT_SRCS ./pt8211/pt8211.c) + endif() endif() register_component() diff --git a/components/custom_board/Kconfig.projbuild b/components/custom_board/Kconfig.projbuild index b8c3e4a7..10c871f4 100644 --- a/components/custom_board/Kconfig.projbuild +++ b/components/custom_board/Kconfig.projbuild @@ -1,183 +1 @@ -menu "Custom Audio Board" - depends on AUDIO_BOARD_CUSTOM - - choice GENERIC_BOARD_DAC - prompt "DAC chip" - default DAC_MA120 - help - Select a DAC connected to the generic ESP32 board - - config DAC_PCM51XX - bool "TI PCM51XX/TAS57XX based DAC" - - config DAC_PCM5102A - bool "TI PCM5102A based DAC" - - config DAC_MA120 - bool "Infineon MA120 ClassD AMP" - - config DAC_MA120X0 - bool "Infineon MA120X0 ClassD AMP" - - config DAC_ADAU1961 - bool "Analog Devices ADAU1961 DAC" - - config DAC_MAX98357 - bool "Analog Devices MAX98357 DAC" - - endchoice - - menu "DAC I2C control interface" - config DAC_I2C_SDA - int "SDA pin" - default 12 if DAC_ADAU1961 - default 21 if DAC_MA120 || DAC_PCM51XX || DAC_MA120 || DAC_MA120X0 || DAC_MAX98357 || DAC_PCM5102A - help - I2C SDA pin of the DAC control interface - config DAC_I2C_SCL - int "SCL pin" - default 14 if DAC_ADAU1961 - default 22 if DAC_MA120 || DAC_PCM51XX || DAC_MA120 || DAC_MA120X0 || DAC_MAX98357 || DAC_PCM5102A - help - I2C SCL pin of the DAC control interface - config DAC_I2C_ADDR - hex "I2C address" - default 0x70 if DAC_ADAU1961 - default 0x20 if DAC_MA120 || DAC_PCM51XX || DAC_MA120 || DAC_MA120X0 || DAC_MAX98357 || DAC_PCM5102A - help - I2C Address of the DAC control interface - endmenu - - menu "I2S master interface" - config MASTER_I2S_MCLK_PIN - int "Master i2s mclk" - default 0 - help - Master audio interface master clock. - - config MASTER_I2S_BCK_PIN - int "Master i2s bck" - default 23 if DAC_MAX98357 - default 23 - help - Master audio interface bit clock. - - config MASTER_I2S_LRCK_PIN - int "Master i2s lrck" - default 24 if DAC_MAX98357 - default 13 - help - Master audio interface left/right sync clock. - - config MASTER_I2S_DATAOUT_PIN - int "Master i2s data out" - default 25 if DAC_MAX98357 - default 14 - help - Master audio interface data out. - endmenu - - menu "I2S slave interface" - config SLAVE_I2S_BCK_PIN - int "Slave i2s bck" - default 26 - help - Slave audio interface bit clock. - - config SLAVE_I2S_LRCK_PIN - int "Slave i2s lrck" - default 12 - help - Slave audio interface left/right sync clock. - - config SLAVE_I2S_DATAOUT_PIN - int "Slave i2s data out" - default 5 - help - Slave audio interface data out. - endmenu - - menu "Merus MA120x0 interface Configuration" - depends on DAC_MA120X0 - - config MA120X0_NENABLE_PIN - int "Master enable/disable for ma120x0" - default 16 - help - GPIO number to control enable/disable. - - config MA120X0_NMUTE_PIN - int "Master mute/unmute for ma120x0" - default 2 - help - GPIO number to controm mute/unmute. - - config MERUS_NERR_PIN - int "NERR monitor pin" - default 21 - help - GPIO number to monitor NERROR. - - config MERUS_NCLIP_PIN - int "Clip indication pin" - default 22 - help - GPIO number low if clip observed - endmenu - - menu "Merus MA120 interface Configuration" - depends on DAC_MA120 - - config MA120_ENABLE_PIN - int "Master enable/disable for ma120x0" - default 16 - help - GPIO number to control enable/disable. - - config MA120_NMUTE_PIN - int "Master mute/unmute for ma120x0" - default 2 - help - GPIO number to controm mute/unmute. - - config MERUS_NERR_PIN - int "NERR monitor pin" - default 21 - help - GPIO number to monitor NERROR. - - config MERUS_NCLIP_PIN - int "Clip indication pin" - default 22 - help - GPIO number low if clip observed - endmenu - - menu "TI PCM5102A interface Configuration" - depends on DAC_PCM5102A - - config PCM5102A_MUTE_PIN - int "Master mute/unmute for PCM5102A" - default 18 - help - GPIO number to control mute/unmute. - This is labeled "X(S)MT" on chip/boards - endmenu - - menu "MAX98357 interface Configuration" - depends on DAC_MAX98357 - - config MAX98357_MUTE_PIN - int "Master mute/mode for MAX98357" - default 18 - help - GPIO number to control mute/mode. This require a special resistor to select the correct mode. - You need to put a serie resistor to select the mode (GPIO --> Resistor --> SD): - LEFT only : 0ohm (direct connection) - RIGHT only : 220Kohm - (L+R)/2 : 1Mohm - Refer to Analog Devices' doc for more infos. - This is labeled "SD" on chip/boards. - endmenu - -endmenu +# this was moved to audio_board diff --git a/components/custom_board/component.mk b/components/custom_board/component.mk index 3bebfc27..665e5fa3 100644 --- a/components/custom_board/component.mk +++ b/components/custom_board/component.mk @@ -27,4 +27,14 @@ COMPONENT_ADD_INCLUDEDIRS += ./max98357/include COMPONENT_SRCDIRS += ./max98357 endif +ifdef CONFIG_DAC_TAS5805M +COMPONENT_ADD_INCLUDEDIRS += ./tas5805m/include +COMPONENT_SRCDIRS += ./tas5805m +endif + +ifdef CONFIG_DAC_PT8211 +COMPONENT_ADD_INCLUDEDIRS += ./pt8211/include +COMPONENT_SRCDIRS += ./pt8211 +endif + endif diff --git a/components/custom_board/generic_board/board.c b/components/custom_board/generic_board/board.c index 3b50a43a..202e298a 100644 --- a/components/custom_board/generic_board/board.c +++ b/components/custom_board/generic_board/board.c @@ -49,6 +49,12 @@ extern audio_hal_func_t AUDIO_CODEC_ADAU1961_DEFAULT_HANDLE; #elif CONFIG_DAC_MAX98357 extern audio_hal_func_t AUDIO_CODEC_MAX98357_DEFAULT_HANDLE; #define AUDIO_CODEC_DEFAULT_HANDLE AUDIO_CODEC_MAX98357_DEFAULT_HANDLE +#elif CONFIG_DAC_TAS5805M +extern audio_hal_func_t AUDIO_CODEC_TAS5805M_DEFAULT_HANDLE; +#define AUDIO_CODEC_DEFAULT_HANDLE AUDIO_CODEC_TAS5805M_DEFAULT_HANDLE +#elif CONFIG_DAC_PT8211 +extern audio_hal_func_t AUDIO_CODEC_PT8211_DEFAULT_HANDLE; +#define AUDIO_CODEC_DEFAULT_HANDLE AUDIO_CODEC_PT8211_DEFAULT_HANDLE #endif static const char *TAG = "AUDIO_BOARD"; diff --git a/components/custom_board/generic_board/board_pins_config.c b/components/custom_board/generic_board/board_pins_config.c index 502237b7..205cca49 100644 --- a/components/custom_board/generic_board/board_pins_config.c +++ b/components/custom_board/generic_board/board_pins_config.c @@ -32,6 +32,10 @@ #include "driver/gpio.h" #include "esp_log.h" +#if SOC_I2S_NUM > 1 +#define I2S_NUM_MAX I2S_NUM_1 + 1 +#endif + static const char *TAG = "GENERIC_BOARD"; esp_err_t get_i2c_pins(i2c_port_t port, i2c_config_t *i2c_config) { @@ -48,20 +52,22 @@ esp_err_t get_i2c_pins(i2c_port_t port, i2c_config_t *i2c_config) { return ESP_OK; } -esp_err_t get_i2s_pins(i2s_port_t port, i2s_pin_config_t *i2s_config) { +esp_err_t get_i2s_pins(i2s_port_t port, board_i2s_pin_t *i2s_config) { AUDIO_NULL_CHECK(TAG, i2s_config, return ESP_FAIL); if (port == I2S_NUM_0) { + i2s_config->mck_io_num = CONFIG_MASTER_I2S_MCLK_PIN; i2s_config->bck_io_num = CONFIG_MASTER_I2S_BCK_PIN; i2s_config->ws_io_num = CONFIG_MASTER_I2S_LRCK_PIN; i2s_config->data_out_num = CONFIG_MASTER_I2S_DATAOUT_PIN; i2s_config->data_in_num = -1; } else if (port == I2S_NUM_1) { + i2s_config->mck_io_num = CONFIG_SLAVE_I2S_MCLK_PIN; i2s_config->bck_io_num = CONFIG_SLAVE_I2S_BCK_PIN; i2s_config->ws_io_num = CONFIG_SLAVE_I2S_LRCK_PIN; i2s_config->data_out_num = CONFIG_SLAVE_I2S_DATAOUT_PIN; i2s_config->data_in_num = -1; } else { - memset(i2s_config, -1, sizeof(i2s_pin_config_t)); + memset(i2s_config, -1, sizeof(board_i2s_pin_t)); ESP_LOGE(TAG, "i2s port %d is not supported", port); return ESP_FAIL; } @@ -69,32 +75,6 @@ esp_err_t get_i2s_pins(i2s_port_t port, i2s_pin_config_t *i2s_config) { return ESP_OK; } -esp_err_t i2s_mclk_gpio_select(i2s_port_t i2s_num, gpio_num_t gpio_num) { - if (i2s_num >= I2S_NUM_MAX) { - ESP_LOGE(TAG, "Does not support i2s number(%d)", i2s_num); - return ESP_ERR_INVALID_ARG; - } - if (gpio_num != GPIO_NUM_0 && gpio_num != GPIO_NUM_1 && - gpio_num != GPIO_NUM_3) { - ESP_LOGE(TAG, "Only support GPIO0/GPIO1/GPIO3, gpio_num:%d", gpio_num); - return ESP_ERR_INVALID_ARG; - } - ESP_LOGI(TAG, "I2S%d, MCLK output by GPIO%d", i2s_num, gpio_num); - if (i2s_num == I2S_NUM_0) { - if (gpio_num == GPIO_NUM_0) { - PIN_FUNC_SELECT(PERIPHS_IO_MUX_GPIO0_U, FUNC_GPIO0_CLK_OUT1); - WRITE_PERI_REG(PIN_CTRL, 0xFFF0); - } else if (gpio_num == GPIO_NUM_1) { - PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD_CLK_OUT3); - WRITE_PERI_REG(PIN_CTRL, 0xF0F0); - } else { - PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD_CLK_OUT2); - WRITE_PERI_REG(PIN_CTRL, 0xFF00); - } - } - return ESP_OK; -} - esp_err_t get_spi_pins( spi_bus_config_t *spi_config, spi_device_interface_config_t *spi_device_interface_config) { diff --git a/components/custom_board/generic_board/include/board_def.h b/components/custom_board/generic_board/include/board_def.h index 40c4e220..60e91ac9 100644 --- a/components/custom_board/generic_board/include/board_def.h +++ b/components/custom_board/generic_board/include/board_def.h @@ -27,6 +27,8 @@ #ifndef _AUDIO_BOARD_DEFINITION_H_ #define _AUDIO_BOARD_DEFINITION_H_ +#define BOARD_PA_GAIN (0) /* Power amplifier gain defined by board (dB) */ + #define BUTTON_VOLUP_ID 0 #define BUTTON_VOLDOWN_ID 1 #define BUTTON_MUTE_ID 2 diff --git a/components/custom_board/ma120/ma120.c b/components/custom_board/ma120/ma120.c index 3a5842b7..4399c2f7 100644 --- a/components/custom_board/ma120/ma120.c +++ b/components/custom_board/ma120/ma120.c @@ -9,15 +9,15 @@ // // +#include "ma120.h" + #include #include -#include "ma120.h" #include "board.h" #include "driver/i2c.h" #include "esp_log.h" - static const char *TAG = "MA120"; #define MA_ENABLE_IO CONFIG_MA120_ENABLE_PIN @@ -66,12 +66,12 @@ esp_err_t ma120_deinit(void) { } esp_err_t ma120_ctrl(audio_hal_codec_mode_t mode, audio_hal_ctrl_t ctrl_state) { - ESP_LOGI("MA120 Driver", "ctrl w. mode and ctrl_state"); + ESP_LOGI("MA120 Driver", "ctrl w. mode and ctrl_state"); return ESP_OK; } esp_err_t ma120_config_iface(audio_hal_codec_mode_t mode, - audio_hal_codec_i2s_iface_t *iface) { + audio_hal_codec_i2s_iface_t *iface) { ESP_LOGI("MA120 Driver", "config_iface w. mode and interface"); return ESP_OK; } @@ -111,13 +111,13 @@ esp_err_t ma120_get_mute(bool *enabled) { esp_err_t ma120_init(audio_hal_codec_config_t *codec_cfg) { esp_err_t ret = ESP_OK; setup_ma120(); - return ret; -} + return ret; +} -void setup_ma120(void){ +void setup_ma120(void) { gpio_config_t io_conf; - io_conf.intr_type = GPIO_PIN_INTR_DISABLE; + io_conf.intr_type = GPIO_INTR_DISABLE; io_conf.mode = GPIO_MODE_OUTPUT; io_conf.pin_bit_mask = (1ULL << MA_ENABLE_IO | 1ULL << MA_NMUTE_IO); io_conf.pull_down_en = 0; @@ -126,7 +126,7 @@ void setup_ma120(void){ printf("setup output %d %d \n", MA_ENABLE_IO, MA_NMUTE_IO); gpio_config(&io_conf); - io_conf.intr_type = GPIO_PIN_INTR_DISABLE; + io_conf.intr_type = GPIO_INTR_DISABLE; io_conf.mode = GPIO_MODE_INPUT; io_conf.pin_bit_mask = (1ULL << MA_NCLIP_IO | 1ULL << MA_NERR_IO); io_conf.pull_down_en = 0; @@ -136,8 +136,7 @@ void setup_ma120(void){ gpio_set_level(MA_NMUTE_IO, 0); gpio_set_level(MA_ENABLE_IO, 0); - - + i2c_master_init(); gpio_set_level(MA_ENABLE_IO, 1); @@ -145,7 +144,7 @@ void setup_ma120(void){ uint8_t res = ma_write_byte(MA120_ADDR, 2, 0x060c, 0); res = ma_read_byte(MA120_ADDR, 2, 0x060c); printf("Hardware version: 0x%02x\n", res); - + printf("Scan I2C bus: "); for (uint8_t addr = 0x20; addr <= 0x23; addr++) { res = ma_read_byte(addr, 2, 0); @@ -153,7 +152,7 @@ void setup_ma120(void){ // printf("Scan i2c address 0x%02x read address 0 : 0x%02x \n", addr ,res); } printf("\n"); - + uint8_t rxbuf[32]; uint8_t otp[1024]; for (uint8_t i = 0; i < 16; i++) { @@ -234,7 +233,7 @@ void ma120_read_error(uint8_t i2c_addr) { // 0x0118 error now ch0 [clip_stuck // printf("\n"); } -static i2c_config_t i2c_cfg = { +static i2c_config_t i2c_cfg = { .mode = I2C_MODE_MASTER, .sda_pullup_en = GPIO_PULLUP_ENABLE, .scl_pullup_en = GPIO_PULLUP_ENABLE, diff --git a/components/custom_board/ma120x0/MerusAudio.c b/components/custom_board/ma120x0/MerusAudio.c index 1bd762f8..1afd5913 100644 --- a/components/custom_board/ma120x0/MerusAudio.c +++ b/components/custom_board/ma120x0/MerusAudio.c @@ -17,12 +17,12 @@ #include "driver/i2c.h" #include "esp_log.h" #include "ma120x0.h" -//#include "ma120_rev1_all.h" +// #include "ma120_rev1_all.h" +#include "audio_hal.h" static const char *TAG = "MA120X0"; #define MA_NENABLE_IO CONFIG_MA120X0_NENABLE_PIN -#define MA_ENABLE_IO CONFIG_MA120X0_ENABLE_PIN #define MA_NMUTE_IO CONFIG_MA120X0_NMUTE_PIN #define MA_NERR_IO CONFIG_MA120X0_NERR_PIN #define MA_NCLIP_IO CONFIG_MA120X0_NCLIP_PIN @@ -51,6 +51,16 @@ static const char *I2C_TAG = "i2c"; static i2c_config_t i2c_cfg; +esp_err_t ma120x0_init(audio_hal_codec_config_t *codec_cfg); +esp_err_t ma120x0_deinit(void); +esp_err_t ma120x0_config_iface(audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface); +esp_err_t ma120x0_set_volume(int vol); +esp_err_t ma120x0_get_volume(int *vol); +esp_err_t ma120x0_set_mute(bool enable); +esp_err_t ma120x0_ctrl(audio_hal_codec_mode_t mode, + audio_hal_ctrl_t ctrl_state); + audio_hal_func_t AUDIO_CODEC_MA120X0_DEFAULT_HANDLE = { .audio_codec_initialize = ma120x0_init, .audio_codec_deinitialize = ma120x0_deinit, diff --git a/components/custom_board/ma120x0/include/MerusAudio.h b/components/custom_board/ma120x0/include/MerusAudio.h index 6c49cccd..d574926a 100644 --- a/components/custom_board/ma120x0/include/MerusAudio.h +++ b/components/custom_board/ma120x0/include/MerusAudio.h @@ -1,6 +1,10 @@ #ifndef _MERUSAUDIO_H_ #define _MERUSAUDIO_H_ +#include + +#include "esp_err.h" + void setup_ma120x0(void); void setup_ma120(void); void ma120_read_error(uint8_t i2c_addr); diff --git a/components/custom_board/max98357/max98357.c b/components/custom_board/max98357/max98357.c index 8cd16b22..84234392 100644 --- a/components/custom_board/max98357/max98357.c +++ b/components/custom_board/max98357/max98357.c @@ -36,7 +36,7 @@ esp_err_t max98357_init(audio_hal_codec_config_t *codec_cfg) { gpio_config_t io_conf; - io_conf.intr_type = GPIO_PIN_INTR_DISABLE; + io_conf.intr_type = GPIO_INTR_DISABLE; io_conf.mode = GPIO_MODE_OUTPUT; io_conf.pin_bit_mask = (1ULL << CONFIG_MAX98357_MUTE_PIN); io_conf.pull_down_en = 0; diff --git a/components/custom_board/pcm5102a/pcm5102a.c b/components/custom_board/pcm5102a/pcm5102a.c index f1167960..fd151260 100644 --- a/components/custom_board/pcm5102a/pcm5102a.c +++ b/components/custom_board/pcm5102a/pcm5102a.c @@ -1,30 +1,29 @@ /* * TI PCM5102A audio hal - * + * * Mostly stubs (no I2C or volume control) * Configuration of mute/unmute gpio in init (connected to XSMT) */ #include "pcm5102a.h" +#include + #include "board.h" #include "esp_log.h" -#include static const char *TAG = "PCM5102A"; - #define PCM5102A_ASSERT(a, format, b, ...) \ - if ((a) != 0) { \ - ESP_LOGE(TAG, format, ##__VA_ARGS__); \ - return b; \ + if ((a) != 0) { \ + ESP_LOGE(TAG, format, ##__VA_ARGS__); \ + return b; \ } esp_err_t pcm5102a_ctrl(audio_hal_codec_mode_t mode, - audio_hal_ctrl_t ctrl_state); + audio_hal_ctrl_t ctrl_state); esp_err_t pcm5102a_config_iface(audio_hal_codec_mode_t mode, - audio_hal_codec_i2s_iface_t *iface); - + audio_hal_codec_i2s_iface_t *iface); audio_hal_func_t AUDIO_CODEC_PCM5102A_DEFAULT_HANDLE = { .audio_codec_initialize = pcm5102a_init, @@ -43,19 +42,17 @@ esp_err_t pcm5102a_init(audio_hal_codec_config_t *codec_cfg) { gpio_config_t io_conf; - io_conf.intr_type = GPIO_PIN_INTR_DISABLE; + io_conf.intr_type = GPIO_INTR_DISABLE; io_conf.mode = GPIO_MODE_OUTPUT; io_conf.pin_bit_mask = (1ULL << CONFIG_PCM5102A_MUTE_PIN); io_conf.pull_down_en = 0; io_conf.pull_up_en = 0; ret = gpio_config(&io_conf); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Mute gpio config failed for pin %d", CONFIG_PCM5102A_MUTE_PIN); - } - else - { + if (ret != ESP_OK) { + ESP_LOGE(TAG, "Mute gpio config failed for pin %d", + CONFIG_PCM5102A_MUTE_PIN); + } else { gpio_set_level(CONFIG_PCM5102A_MUTE_PIN, 0); ESP_LOGD(TAG, "Setup mute (XMT) output %d\n", CONFIG_PCM5102A_MUTE_PIN); } @@ -63,32 +60,26 @@ esp_err_t pcm5102a_init(audio_hal_codec_config_t *codec_cfg) { return ret; } -esp_err_t pcm5102a_set_volume(int vol) { - return ESP_OK; -} +esp_err_t pcm5102a_set_volume(int vol) { return ESP_OK; } -esp_err_t pcm5102a_get_volume(int *value) { - return ESP_OK; -} +esp_err_t pcm5102a_get_volume(int *value) { return ESP_OK; } esp_err_t pcm5102a_set_mute(bool enable) { return gpio_set_level(CONFIG_PCM5102A_MUTE_PIN, enable ? 0 : 1); } -esp_err_t pcm5102a_get_mute(bool *enabled) { - return ESP_OK; -} +esp_err_t pcm5102a_get_mute(bool *enabled) { return ESP_OK; } esp_err_t pcm5102a_deinit(void) { return gpio_reset_pin(CONFIG_PCM5102A_MUTE_PIN); } esp_err_t pcm5102a_ctrl(audio_hal_codec_mode_t mode, - audio_hal_ctrl_t ctrl_state) { + audio_hal_ctrl_t ctrl_state) { return ESP_OK; } esp_err_t pcm5102a_config_iface(audio_hal_codec_mode_t mode, - audio_hal_codec_i2s_iface_t *iface) { + audio_hal_codec_i2s_iface_t *iface) { return ESP_OK; } diff --git a/components/custom_board/pt8211/include/pt8211.h b/components/custom_board/pt8211/include/pt8211.h new file mode 100644 index 00000000..62b35ee9 --- /dev/null +++ b/components/custom_board/pt8211/include/pt8211.h @@ -0,0 +1,49 @@ +/* + * Princeton Technology PT8211 audio hal + */ + +#ifndef _PT8211_H_ +#define _PT8211_H_ + +#include "audio_hal.h" +#include "esp_err.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Initialize PT8211 codec chip + */ +esp_err_t pt8211_init(audio_hal_codec_config_t *codec_cfg); + +/** + * Deinitialize PT8211 codec chip + */ +esp_err_t pt8211_deinit(void); + +/** + * Set volume - NOT AVAILABLE + */ +esp_err_t pt8211_set_volume(int vol); + +/** + * Get volume - NOT AVAILABLE + */ +esp_err_t pt8211_get_volume(int *value); + +/** + * Set PT8211 mute or not + */ +esp_err_t pt8211_set_mute(bool enable); + +/** + * Get PT8211 mute status - NOT IMPLEMENTED + */ +esp_err_t pt8211_get_mute(bool *enabled); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/components/custom_board/pt8211/pt8211.c b/components/custom_board/pt8211/pt8211.c new file mode 100644 index 00000000..cddbecf5 --- /dev/null +++ b/components/custom_board/pt8211/pt8211.c @@ -0,0 +1,90 @@ +/* + * Princeton Technology PT8211 audio hal + * + * Mostly stubs (no I2C or volume control) + * Configuration of mute/unmute gpio in init (for external amplifier) + */ + +#include "pt8211.h" + +#include + +#include "board.h" +#include "esp_log.h" + +#ifndef CONFIG_PT8211_MUTE_ACTIVE_LOW +#define CONFIG_PT8211_MUTE_ACTIVE_LOW 0 +#endif + +static const char *TAG = "PT8211"; + +esp_err_t pt8211_ctrl(audio_hal_codec_mode_t mode, audio_hal_ctrl_t ctrl_state); +esp_err_t pt8211_config_iface(audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface); + +audio_hal_func_t AUDIO_CODEC_PT8211_DEFAULT_HANDLE = { + .audio_codec_initialize = pt8211_init, + .audio_codec_deinitialize = pt8211_deinit, + .audio_codec_ctrl = pt8211_ctrl, + .audio_codec_config_iface = pt8211_config_iface, + .audio_codec_set_mute = pt8211_set_mute, + .audio_codec_set_volume = pt8211_set_volume, + .audio_codec_get_volume = pt8211_get_volume, + .audio_hal_lock = NULL, + .handle = NULL, +}; + +esp_err_t pt8211_init(audio_hal_codec_config_t *codec_cfg) { + esp_err_t ret = ESP_OK; + +#if CONFIG_PT8211_MUTE_PIN != -1 + gpio_config_t io_conf; + + io_conf.intr_type = GPIO_INTR_DISABLE; + io_conf.mode = GPIO_MODE_OUTPUT; + io_conf.pin_bit_mask = (1ULL << CONFIG_PT8211_MUTE_PIN); + io_conf.pull_down_en = 0; + io_conf.pull_up_en = 0; + + ret = gpio_config(&io_conf); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "Mute gpio config failed for pin %d", CONFIG_PT8211_MUTE_PIN); + } else { + gpio_set_level(CONFIG_PT8211_MUTE_PIN, 0); + ESP_LOGD(TAG, "Setup mute output %d\n", CONFIG_PT8211_MUTE_PIN); + } +#else + ESP_LOGD(TAG, "Mute gpio not specified\n"); +#endif + + return ret; +} + +esp_err_t pt8211_set_volume(int vol) { return ESP_OK; } + +esp_err_t pt8211_get_volume(int *value) { return ESP_OK; } + +esp_err_t pt8211_set_mute(bool enable) { + esp_err_t ret = ESP_OK; + +#if CONFIG_PT8211_MUTE_PIN != -1 + ret = gpio_set_level(CONFIG_PT8211_MUTE_PIN, + enable ^ CONFIG_PT8211_MUTE_ACTIVE_LOW); +#endif + + return ret; +} + +esp_err_t pt8211_get_mute(bool *enabled) { return ESP_OK; } + +esp_err_t pt8211_deinit(void) { return gpio_reset_pin(CONFIG_PT8211_MUTE_PIN); } + +esp_err_t pt8211_ctrl(audio_hal_codec_mode_t mode, + audio_hal_ctrl_t ctrl_state) { + return ESP_OK; +} + +esp_err_t pt8211_config_iface(audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface) { + return ESP_OK; +} diff --git a/components/custom_board/tas5805m/include/tas5805m.h b/components/custom_board/tas5805m/include/tas5805m.h new file mode 100644 index 00000000..ef609a20 --- /dev/null +++ b/components/custom_board/tas5805m/include/tas5805m.h @@ -0,0 +1,146 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2020 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + */ + +#ifndef _TAS5805M_H_ +#define _TAS5805M_H_ + +#include "audio_hal.h" + +#include "esp_err.h" +#include "esp_log.h" +#include "board.h" + +#ifdef __cplusplus +extern "C" +{ +#endif + + +#define I2C_MASTER_FREQ_HZ 400000 /*!< I2C master clock frequency */ +#define I2C_MASTER_TX_BUF_DISABLE 0 /*!< I2C master doesn't need buffer */ +#define I2C_MASTER_RX_BUF_DISABLE 0 /*!< I2C master doesn't need buffer */ +#define I2C_MASTER_TIMEOUT_MS 1000 + +/* Represented in % */ +#define TAS5805M_VOLUME_MIN 0 +#define TAS5805M_VOLUME_MAX 100 + +#define TAS5805M_VOLUME_MUTE 255 +/* See here for the original Implementation : audio_hal/driver/tas5805m */ +/* Its not from me it was developed by Espressif */ +/* Volume steps tas5805m_volume[0] => 255 which means mute */ + static const uint8_t tas5805m_volume[] + = { 0xff, 0x9f, 0x8f, 0x7f, 0x6f, 0x5f, 0x5c, 0x5a, 0x58, 0x54, 0x50, + 0x4c, 0x4a, 0x48, 0x44, 0x40, 0x3d, 0x3b, 0x39, 0x37, 0x35 }; + + int8_t currentVolume = 0; // Last Volume gets updated after a change or before a mute + /** + * @brief Initialize TAS5805 codec chip + * + * @param cfg configuration of TAS5805 + * + * @return + * - ESP_OK + * - ESP_FAIL + */ + esp_err_t tas5805m_init (); + + /** + * @brief Deinitialize TAS5805 codec chip + * + * @return + * - ESP_OK + * - ESP_FAIL + */ + esp_err_t tas5805m_deinit (void); + + /** + * @brief Set voice volume + * + * @param volume: voice volume (0~100) + * + * @return + * - ESP_OK + * - ESP_FAIL + */ + esp_err_t tas5805m_set_volume (int vol); + + /** + * @brief Get voice volume + * + * @param[out] *volume: voice volume (0~100) + * + * @return + * - ESP_OK + * - ESP_FAIL + */ + esp_err_t tas5805m_get_volume(int *vol); + + /** + * @brief Set TAS5805 mute or not + * Continuously call should have an interval time determined by + * tas5805m_set_mute_fade() + * + * @param enable enable(1) or disable(0) + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ + esp_err_t tas5805m_set_mute (bool enable); + + /** + * @brief Mute TAS5805M + * + * @param value Time for mute with millisecond. + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + * + */ + + + /** + * @brief Get TAS5805 mute status + * + * @return + * - ESP_FAIL Parameter error + * - ESP_OK Success + */ + esp_err_t tas5805m_get_mute (bool *enabled); + + esp_err_t tas5805m_ctrl(audio_hal_codec_mode_t mode, + audio_hal_ctrl_t ctrl_state); + + + esp_err_t tas5805m_config_iface(audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/components/custom_board/tas5805m/include/tas5805m_reg_cfg.h b/components/custom_board/tas5805m/include/tas5805m_reg_cfg.h new file mode 100644 index 00000000..b5715311 --- /dev/null +++ b/components/custom_board/tas5805m/include/tas5805m_reg_cfg.h @@ -0,0 +1,100 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2020 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + */ + +#ifndef _TAS5805M_REG_CFG_ +#define _TAS5805M_REG_CFG_ + +#ifdef __cplusplus +extern "C" +{ +#endif +/* Register Naming*/ +#define I2C_MASTER_NUM I2C_NUM_0 /*!< I2C port number for master dev */ +#define WRITE_BIT I2C_MASTER_WRITE /*!< I2C master write */ +#define READ_BIT I2C_MASTER_READ /*!< I2C master read */ +#define ACK_CHECK_EN 0x1 /*!< I2C master will check ack from slave*/ +#define ACK_CHECK_DIS 0x0 /*!< I2C master will not check ack from slave */ +#define ACK_VAL I2C_MASTER_ACK /*!< I2C ack value */ +#define NACK_VAL I2C_MASTER_NACK /*!< I2C nack value */ + +#define I2C_TAS5805M_MASTER_NUM I2C_MASTER_NUM /*!< I2C port number for master dev */ + +#define TAS5805M_ADDRESS 0x2D /*!< 7-bit address with a 15k pull up resistor */ + + +#ifdef PIN_DAC_PWDN +#define TAS5805M_GPIO_PDN PIN_DAC_PWDN +#else +#define TAS5805M_GPIO_PDN GPIO_NUM_33 /*!< GPIO used for !PDN pin */ +#endif + +#define TAS5805M_GPIO_PDN_MASK ((1ULL << TAS5805M_GPIO_PDN)) + +#define TAS5805M_RESET_CTRL_REGISTER 0x01 +#define TAS5805M_DEVICE_CTRL_1_REGISTER 0x02 +#define TAS5805M_DEVICE_CTRL_2_REGISTER 0x03 +#define TAS5805M_I2C_PAGE_AUTO_INC_REGISTER 0x0f +#define TAS5805M_SIG_CH_CTRL_REGISTER 0x28 +#define TAS5805M_CLOCK_DET_CTRL_REGISTER 0x29 +#define TAS5805M_SDOUT_SEL_REGISTER 0x30 +#define TAS5805M_I2S_CTRL_REGISTER 0x31 +#define TAS5805M_SAP_CTRL1_REGISTER 0x33 +#define TAS5805M_SAP_CTRL2_REGISTER 0x34 +#define TAS5805M_SAP_CTRL3_REGISTER 0x35 +#define TAS5805M_FS_MON_REGISTER 0x37 +#define TAS5805M_BCK_MON_REGISTER 0x38 +#define TAS5805M_CLKDET_STATUS_REGISTER 0x39 +#define TAS5805M_CHANNEL_FORCE_HIZ_REGISTER 0x40 +#define TAS5805M_DIG_VOL_CTRL_REGISTER 0x4c +#define TAS5805M_DIG_VOL_CTRL2_REGISTER 0x4e +#define TAS5805M_DIG_VOL_CTRL3_REGISTER 0x4f +#define TAS5805M_AUTO_MUTE_CTRL_REGISTER 0x50 +#define TAS5805M_AUTO_MUTE_TIME_REGISTER 0x51 +#define TAS5805M_ANA_CTRL_REGISTER 0x53 +#define TAS5805M_AGAIN_REGISTER 0x54 +#define TAS5805M_BQ_WR_CTRL1_REGISTER 0x5c +#define TAS5805M_DAC_CTRL_REGISTER 0x5d +#define TAS5805M_ADR_PIN_CTRL_REGISTER 0x60 +#define TAS5805M_ADR_PIN_CONFIG_REGISTER 0x61 +#define TAS5805M_DSP_MISC_REGISTER 0x66 +#define TAS5805M_DIE_ID_REGISTER 0x67 +#define TAS5805M_POWER_STATE_REGISTER 0x68 +#define TAS5805M_AUTOMUTE_STATE_REGISTER 0x69 +#define TAS5805M_PHASE_CTRL_REGISTER 0x6a +#define TAS5805M_SS_CTRL0_REGISTER 0x6b +#define TAS5805M_SS_CTRL1_REGISTER 0x6c +#define TAS5805M_SS_CTRL2_REGISTER 0x6d +#define TAS5805M_SS_CTRL3_REGISTER 0x6e +#define TAS5805M_SS_CTRL4_REGISTER 0x6f +#define TAS5805M_CHAN_FAULT_REGISTER 0x70 +#define TAS5805M_GLOBAL_FAULT1_REGISTER 0x71 +#define TAS5805M_GLOBAL_FAULT2_REGISTER 0x72 +#define TAS5805M_OT_WARNING_REGISTER 0x73 +#define TAS5805M_PIN_CONTROL1_REGISTER 0x74 +#define TAS5805M_PIN_CONTROL2_REGISTER 0x75 +#define TAS5805M_MISC_CONTROL_REGISTER 0x76 +#define TAS5805M_FAULT_CLEAR_REGISTER 0x78 +#endif \ No newline at end of file diff --git a/components/custom_board/tas5805m/tas5805m.c b/components/custom_board/tas5805m/tas5805m.c new file mode 100644 index 00000000..96b501f1 --- /dev/null +++ b/components/custom_board/tas5805m/tas5805m.c @@ -0,0 +1,291 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2020 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS + * IN THE SOFTWARE. + * + */ + +#include "tas5805m.h" +#include "esp_log.h" +#include "i2c_bus.h" +#include "tas5805m_reg_cfg.h" + +static const char *TAG = "TAS5805M"; + +/* Default I2C config */ + +static i2c_config_t i2c_cfg = { + .mode = I2C_MODE_MASTER, + .sda_pullup_en = GPIO_PULLUP_ENABLE, + .scl_pullup_en = GPIO_PULLUP_ENABLE, + .master.clk_speed = I2C_MASTER_FREQ_HZ, +}; + +/* + * Operate fuction of PA + */ +audio_hal_func_t AUDIO_CODEC_TAS5805M_DEFAULT_HANDLE = { + .audio_codec_initialize = tas5805m_init, + .audio_codec_deinitialize = tas5805m_deinit, + .audio_codec_ctrl = tas5805m_ctrl, + .audio_codec_config_iface = tas5805m_config_iface, + .audio_codec_set_mute = tas5805m_set_mute, + .audio_codec_set_volume = tas5805m_set_volume, + .audio_codec_get_volume = tas5805m_get_volume, + .audio_hal_lock = NULL, + .handle = NULL, +}; + +/* Init the I2C Driver */ + +void i2c_master_init() +{ + int i2c_master_port = I2C_MASTER_NUM; + + + ESP_ERROR_CHECK(get_i2c_pins(I2C_NUM_0, &i2c_cfg)); + + ESP_ERROR_CHECK(i2c_param_config(i2c_master_port, &i2c_cfg)); + + + + ESP_ERROR_CHECK(i2c_driver_install(i2c_master_port, i2c_cfg.mode, + I2C_MASTER_RX_BUF_DISABLE, I2C_MASTER_TX_BUF_DISABLE, + 0)); + +} + +/* Helper Functions */ + + +// Reading of TAS5805M-Register + +esp_err_t tas5805m_read_byte(uint8_t register_name, uint8_t *data) +{ + + int ret; + i2c_cmd_handle_t cmd = i2c_cmd_link_create(); + i2c_master_start(cmd); + i2c_master_write_byte(cmd, TAS5805M_ADDRESS << 1 | WRITE_BIT, ACK_CHECK_EN); + i2c_master_write_byte(cmd, register_name, ACK_CHECK_EN); + i2c_master_stop(cmd); + ret = i2c_master_cmd_begin(I2C_TAS5805M_MASTER_NUM, cmd, 1000 / portTICK_RATE_MS); + i2c_cmd_link_delete(cmd); + + if (ret != ESP_OK) + { + ESP_LOGW(TAG, "I2C ERROR"); + } + + vTaskDelay(1 / portTICK_RATE_MS); + cmd = i2c_cmd_link_create(); + i2c_master_start(cmd); + i2c_master_write_byte(cmd, TAS5805M_ADDRESS << 1 | READ_BIT, ACK_CHECK_EN); + i2c_master_read_byte(cmd, data, NACK_VAL); + i2c_master_stop(cmd); + ret = i2c_master_cmd_begin(I2C_TAS5805M_MASTER_NUM, cmd, 1000 / portTICK_RATE_MS); + i2c_cmd_link_delete(cmd); + + return ret; +} + +// Writing of TAS5805M-Register + +esp_err_t tas5805m_write_byte(uint8_t register_name, uint8_t value) +{ + int ret =0; + i2c_cmd_handle_t cmd = i2c_cmd_link_create(); + i2c_master_start(cmd); + i2c_master_write_byte(cmd, TAS5805M_ADDRESS << 1 | WRITE_BIT, ACK_CHECK_EN); + i2c_master_write_byte(cmd, register_name, ACK_CHECK_EN); + i2c_master_write_byte(cmd, value, ACK_CHECK_EN); + i2c_master_stop(cmd); + + ret = i2c_master_cmd_begin(I2C_TAS5805M_MASTER_NUM, cmd, 1000 / portTICK_RATE_MS); + + // Check if ret is OK + if (ret != ESP_OK) { + ESP_LOGE(TAG, "Fehler bei der I2C-Ãœbertragung: %s", esp_err_to_name(ret)); + + } + + i2c_cmd_link_delete(cmd); + + return ret; +} + +// Inits the TAS5805M change Settings in Menuconfig to enable Bridge-Mode + +esp_err_t tas5805m_init() +{ + int ret =0; + // Init the I2C-Driver + i2c_master_init(); + /* Register the PDN pin as output and write 1 to enable the TAS chip */ + /* TAS5805M.INIT() */ + gpio_config_t io_conf; + io_conf.intr_type = GPIO_INTR_DISABLE; + io_conf.mode = GPIO_MODE_OUTPUT; + io_conf.pin_bit_mask = TAS5805M_GPIO_PDN_MASK; + io_conf.pull_down_en = GPIO_PULLDOWN_DISABLE; + io_conf.pull_up_en = GPIO_PULLUP_DISABLE; + ESP_LOGW(TAG, "Power down pin: %d", TAS5805M_GPIO_PDN); + gpio_config(&io_conf); + gpio_set_level(TAS5805M_GPIO_PDN, 0); + vTaskDelay(10 / portTICK_RATE_MS); + gpio_set_level(TAS5805M_GPIO_PDN, 1); + vTaskDelay(10 / portTICK_RATE_MS); + + /* TAS5805M.Begin()*/ + + ESP_LOGW(TAG, "Setting to HI Z"); + + ESP_ERROR_CHECK(tas5805m_write_byte(TAS5805M_DEVICE_CTRL_2_REGISTER, 0x02)); + vTaskDelay(10 / portTICK_RATE_MS); + if (ret != ESP_OK){ + ESP_LOGW(TAG, "TAS5805M_DEVICE_CTRL_2_REGISTER, 0x02 FAILED!!!"); + return ret; + } + + ESP_LOGW(TAG, "Setting to PLAY"); + + ret = tas5805m_write_byte(TAS5805M_DEVICE_CTRL_2_REGISTER, 0x03); + if (ret != ESP_OK){ + ESP_LOGW(TAG, "TAS5805M_DEVICE_CTRL_2_REGISTER, 0x03 FAILED!!"); + return ret; + } + + + // Check if Bridge-Mode is enabled + #ifdef CONFIG_DAC_BRIDGE_MODE + uint8_t value = 0; + ret = tas5805m_read_byte(TAS5805M_DEVICE_CTRL_1_REGISTER, &value); + if (ret != ESP_OK) + return ret; + value = 0b100; + + ret = tas5805m_write_byte(TAS5805M_DEVICE_CTRL_1_REGISTER, value); + if (ret != ESP_OK) + return ret; + #endif + + return ret; +} + +// Setting the Volume + +esp_err_t +tas5805m_set_volume(int vol) +{ + int vol_idx = 0; // Temp-Variable + + /* Checking if Volume is bigger or smaller than the max values */ + if (vol < TAS5805M_VOLUME_MIN) + { + vol = TAS5805M_VOLUME_MIN; + } + if (vol > TAS5805M_VOLUME_MAX) + { + vol = TAS5805M_VOLUME_MAX; + } + /* Mapping the Values from 0-100 to 254-0 */ + vol_idx = vol / 5; + /* Updating the global volume Variable */ + currentVolume = vol_idx; + /* Writing the Volume to the Register*/ + return tas5805m_write_byte(TAS5805M_DIG_VOL_CTRL_REGISTER, tas5805m_volume[vol_idx]); +} + +esp_err_t +tas5805m_get_volume(int *vol) +{ + esp_err_t ret = ESP_OK; + uint8_t rxbuf = 0; + ret = tas5805m_read_byte(TAS5805M_DIG_VOL_CTRL_REGISTER, &rxbuf); + int i; + for (i = 0; i < sizeof (tas5805m_volume); i++) + { + if (rxbuf>= tas5805m_volume[i]) + break; + } + /* Updating the global volume Variable */ + currentVolume = i; + ESP_LOGI (TAG, "Volume is %d", i * 5); + *vol = 5 * i; // Converting it to percent + return ret; +} + +esp_err_t tas5805m_deinit(void) +{ + // TODO + return ESP_OK; +} + + + +esp_err_t +tas5805m_set_mute(bool enable) +{ + + if (enable == true) + { + // Set the Volume to 255 to enable the MUTE + return tas5805m_write_byte(TAS5805M_DIG_VOL_CTRL_REGISTER, TAS5805M_VOLUME_MUTE); + } + else{ + return tas5805m_write_byte(TAS5805M_DIG_VOL_CTRL_REGISTER,tas5805m_volume[currentVolume]); // Restore Volume to its old value + } + return ESP_OK; +} + +esp_err_t +tas5805m_get_mute(bool *enabled) +{ + int currentVolume; + if (tas5805m_get_volume(¤tVolume) != ESP_OK) + { + ESP_LOGW(TAG, "Cant get volume in get-Mute-Function"); + } + if (currentVolume == TAS5805M_VOLUME_MUTE) + { + *enabled = true; + } + else + { + *enabled = false; + } + return ESP_OK; +} + +esp_err_t tas5805m_ctrl(audio_hal_codec_mode_t mode, + audio_hal_ctrl_t ctrl_state) +{ + // TODO + return ESP_OK; +} + +esp_err_t tas5805m_config_iface(audio_hal_codec_mode_t mode, + audio_hal_codec_i2s_iface_t *iface) +{ + // TODO + return ESP_OK; +} diff --git a/components/custom_driver/CMakeLists.txt b/components/custom_driver/CMakeLists.txt deleted file mode 100644 index 7bd6050c..00000000 --- a/components/custom_driver/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ -idf_component_register( SRCS "i2s.c" - INCLUDE_DIRS "include") diff --git a/components/custom_driver/component.mk b/components/custom_driver/component.mk deleted file mode 100644 index 3272a3c1..00000000 --- a/components/custom_driver/component.mk +++ /dev/null @@ -1,2 +0,0 @@ -COMPONENT_SRCDIRS := . -# CFLAGS += diff --git a/components/custom_driver/i2s.c b/components/custom_driver/i2s.c deleted file mode 100644 index 6f9d3419..00000000 --- a/components/custom_driver/i2s.c +++ /dev/null @@ -1,1290 +0,0 @@ -// Copyright 2015-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. - -// Modifications copyright (C) 2021 CarlosDerSeher - -#include -#include -#include -#include - -#include "freertos/FreeRTOS.h" -#include "freertos/queue.h" -#include "freertos/semphr.h" - -#include "driver/gpio.h" -#include "hal/gpio_hal.h" -#include "i2s.h" -#include "soc/lldesc.h" - -#include "soc/rtc.h" - -#include "esp_attr.h" -#include "soc/chip_revision.h" -#include "hal/efuse_hal.h" -#include "esp_err.h" -#include "esp_intr_alloc.h" -#include "esp_log.h" -#include "esp_pm.h" -#include "esp_rom_gpio.h" - -#include "sdkconfig.h" - -static const char *I2S_TAG = "c_I2S"; - -#define I2S_CHECK(a, str, ret) \ - if (!(a)) { \ - ESP_LOGE(I2S_TAG, "%s(%d): %s", __FUNCTION__, __LINE__, str); \ - return (ret); \ - } - -#define I2S_ENTER_CRITICAL_ISR() portENTER_CRITICAL_ISR(&i2s_spinlock[i2s_num]) -#define I2S_EXIT_CRITICAL_ISR() portEXIT_CRITICAL_ISR(&i2s_spinlock[i2s_num]) -#define I2S_ENTER_CRITICAL() portENTER_CRITICAL(&i2s_spinlock[i2s_num]) -#define I2S_EXIT_CRITICAL() portEXIT_CRITICAL(&i2s_spinlock[i2s_num]) -#define I2S_FULL_DUPLEX_SLAVE_MODE_MASK \ - (I2S_MODE_TX | I2S_MODE_RX | I2S_MODE_SLAVE) -#define I2S_FULL_DUPLEX_MASTER_MODE_MASK \ - (I2S_MODE_TX | I2S_MODE_RX | I2S_MODE_MASTER) - -// TODO: Refactor to put this logic into LL -#define I2S_AD_BCK_FACTOR (2) -#define I2S_PDM_BCK_FACTOR (64) -#define I2S_BASE_CLK (2 * APB_CLK_FREQ) - -/** - * @brief DMA buffer object - * - */ -typedef struct { - char **buf; - int buf_size; - int rw_pos; - void *curr_ptr; - SemaphoreHandle_t mux; - xQueueHandle queue; - lldesc_t **desc; -} i2s_dma_t; - -/** - * @brief I2S object instance - * - */ -typedef struct { - i2s_port_t i2s_num; /*!< I2S port number*/ - int queue_size; /*!< I2S event queue size*/ - QueueHandle_t i2s_queue; /*!< I2S queue handler*/ - int dma_buf_count; /*!< DMA buffer count, number of buffer*/ - int dma_buf_len; /*!< DMA buffer length, length of each buffer*/ - i2s_dma_t *rx; /*!< DMA Tx buffer*/ - i2s_dma_t *tx; /*!< DMA Rx buffer*/ - i2s_isr_handle_t i2s_isr_handle; /*!< I2S Interrupt handle*/ - int channel_num; /*!< Number of channels*/ - int bytes_per_sample; /*!< Bytes per sample*/ - int bits_per_sample; /*!< Bits per sample*/ - i2s_mode_t mode; /*!< I2S Working mode*/ - uint32_t sample_rate; /*!< I2S sample rate */ - bool use_apll; /*!< I2S use APLL clock */ - bool tx_desc_auto_clear; /*!< I2S auto clear tx descriptor on underflow */ - int fixed_mclk; /*!< I2S fixed MLCK clock */ - double real_rate; -#ifdef CONFIG_PM_ENABLE - esp_pm_lock_handle_t pm_lock; -#endif - i2s_hal_context_t hal; /*!< I2S hal context*/ -} i2s_obj_t; - -static i2s_obj_t *p_i2s_obj[I2S_NUM_MAX] = {0}; - -static portMUX_TYPE i2s_spinlock[I2S_NUM_MAX]; - -static i2s_dma_t *i2s_create_dma_queue(i2s_port_t i2s_num, int dma_buf_count, - int dma_buf_len); -static esp_err_t i2s_destroy_dma_queue(i2s_port_t i2s_num, i2s_dma_t *dma); - -static inline void gpio_matrix_out_check(int gpio, uint32_t signal_idx, - bool out_inv, bool oen_inv) { - // if pin = -1, do not need to configure - if (gpio != -1) { - gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[gpio], PIN_FUNC_GPIO); - gpio_set_direction(gpio, GPIO_MODE_OUTPUT); - esp_rom_gpio_connect_out_signal(gpio, signal_idx, out_inv, oen_inv); - } -} - -static inline void gpio_matrix_in_check(int gpio, uint32_t signal_idx, - bool inv) { - if (gpio != -1) { - gpio_hal_iomux_func_sel(GPIO_PIN_MUX_REG[gpio], PIN_FUNC_GPIO); - // Set direction, for some GPIOs, the input function are not enabled as - // default. - gpio_set_direction(gpio, GPIO_MODE_INPUT); - esp_rom_gpio_connect_in_signal(gpio, signal_idx, inv); - } -} - -esp_err_t i2s_custom_clear_intr_status(i2s_port_t i2s_num, uint32_t clr_mask) { - I2S_CHECK((i2s_num < I2S_NUM_MAX), "i2s_num error", ESP_ERR_INVALID_ARG); - i2s_hal_clear_intr_status(&(p_i2s_obj[i2s_num]->hal), clr_mask); - return ESP_OK; -} - -esp_err_t i2s_custom_enable_rx_intr(i2s_port_t i2s_num) { - I2S_ENTER_CRITICAL(); - i2s_hal_enable_rx_intr(&(p_i2s_obj[i2s_num]->hal)); - I2S_EXIT_CRITICAL(); - return ESP_OK; -} - -esp_err_t i2s_custom_disable_rx_intr(i2s_port_t i2s_num) { - I2S_ENTER_CRITICAL(); - i2s_hal_disable_rx_intr(&(p_i2s_obj[i2s_num]->hal)); - I2S_EXIT_CRITICAL(); - return ESP_OK; -} - -esp_err_t i2s_custom_disable_tx_intr(i2s_port_t i2s_num) { - I2S_ENTER_CRITICAL(); - i2s_hal_disable_tx_intr(&(p_i2s_obj[i2s_num]->hal)); - I2S_EXIT_CRITICAL(); - return ESP_OK; -} - -esp_err_t i2s_custom_enable_tx_intr(i2s_port_t i2s_num) { - I2S_ENTER_CRITICAL(); - i2s_hal_enable_tx_intr(&(p_i2s_obj[i2s_num]->hal)); - I2S_EXIT_CRITICAL(); - return ESP_OK; -} - -float i2s_custom_get_clk(i2s_port_t i2s_num) { - I2S_CHECK((i2s_num < I2S_NUM_MAX), "i2s_num error", ESP_ERR_INVALID_ARG); - return p_i2s_obj[i2s_num]->real_rate; -} - -static esp_err_t i2s_isr_register(i2s_port_t i2s_num, int intr_alloc_flags, - void (*fn)(void *), void *arg, - i2s_isr_handle_t *handle) { - return esp_intr_alloc(i2s_periph_signal[i2s_num].irq, intr_alloc_flags, fn, - arg, handle); -} - -static float i2s_apll_get_fi2s(int bits_per_sample, int sdm0, int sdm1, - int sdm2, int odir) { - int f_xtal = (int)rtc_clk_xtal_freq_get() * 1000000; - -#if CONFIG_IDF_TARGET_ESP32 - /* ESP32 rev0 silicon issue for APLL range/accuracy, please see ESP32 ECO document for more information on this */ - if (!ESP_CHIP_REV_ABOVE(efuse_hal_chip_revision(), 100)) { - sdm0 = 0; - sdm1 = 0; - } -#endif - float fout = f_xtal * (sdm2 + sdm1 / 256.0f + sdm0 / 65536.0f + 4); - if (fout < SOC_I2S_APLL_MIN_FREQ || fout > SOC_I2S_APLL_MAX_FREQ) { - return SOC_I2S_APLL_MAX_FREQ; - } - float fpll = fout / (2 * (odir + 2)); //== fi2s (N=1, b=0, a=1) - return fpll / 2; -} - -/** - * @brief APLL calculate function, was described by following: - * APLL Output frequency is given by the formula: - * - * apll_freq = xtal_freq * (4 + sdm2 + sdm1/256 + - * sdm0/65536)/((o_div + 2) * 2) apll_freq = fout / ((o_div + 2) * 2) - * - * The dividend in this expression should be in the range of 240 - - * 600 MHz. In rev. 0 of ESP32, sdm0 and sdm1 are unused and always set to 0. - * * sdm0 frequency adjustment parameter, 0..255 - * * sdm1 frequency adjustment parameter, 0..255 - * * sdm2 frequency adjustment parameter, 0..63 - * * o_div frequency divider, 0..31 - * - * The most accurate way to find the sdm0..2 and odir parameters is - * to loop through them all, then apply the above formula, finding the closest - * frequency to the desired one. But 256*256*64*32 = 134.217.728 loops are too - * slow with ESP32 - * 1. We will choose the parameters with the highest level of - * change, With 350MHztx), "tx NULL", ESP_ERR_INVALID_ARG); - - i2s_custom_stop(i2s_num); - - xSemaphoreTake(p_i2s_obj[i2s_num]->tx->mux, (portTickType)portMAX_DELAY); - - i2s_hal_set_out_link_addr(&(p_i2s_obj[i2s_num]->hal), - (uint32_t)p_i2s_obj[i2s_num]->tx->desc[0]); - - p_i2s_obj[i2s_num]->tx->curr_ptr = NULL; - p_i2s_obj[i2s_num]->tx->rw_pos = 0; - - // fill DMA buffers - if ((data != NULL) && (written != NULL) && (size != 0)) { - size_t offset = *currentDescriptorOffset; - size_t maxDmaBufBytes = p_i2s_obj[i2s_num]->dma_buf_len * - p_i2s_obj[i2s_num]->bytes_per_sample * - p_i2s_obj[i2s_num]->channel_num; - - for (i = *currentDescriptor; i < p_i2s_obj[i2s_num]->dma_buf_count; i++) { - char *buf = (char *)p_i2s_obj[i2s_num]->tx->desc[i]->buf; - - if (tmpSize > maxDmaBufBytes) { - memcpy(buf, &data[offset], maxDmaBufBytes); - offset += maxDmaBufBytes; - - // ESP_LOGW(I2S_TAG, "wrote %d to desc[%d]", maxDmaBufBytes, i); - - tmpSize -= maxDmaBufBytes; - } else { - memcpy(buf, &data[offset], tmpSize); - offset += tmpSize; - - // ESP_LOGW(I2S_TAG, "wrote %d to desc[%d]", tmpSize, i); - - tmpSize = 0; - } - - if (tmpSize == 0) { - break; - } - } - - if (currentDescriptor) { - *currentDescriptor = i + 1; - } - - if (currentDescriptorOffset) { - if (offset == size) { - *currentDescriptorOffset = 0; - } else { - *currentDescriptorOffset = offset; - } - } - - *written = offset; - } - - // empty queue - xQueueReset(p_i2s_obj[i2s_num]->tx->queue); - - xSemaphoreGive(p_i2s_obj[i2s_num]->tx->mux); - - return ESP_OK; -} - -esp_err_t i2s_custom_set_clk(i2s_port_t i2s_num, uint32_t rate, - i2s_bits_per_sample_t bits, i2s_channel_t ch) { - int factor = - (256 % bits) ? 384 : 256; // According to hardware codec - // requirement(supported 256fs or 384fs) - int clkmInteger, clkmDecimals, bck = 0; - double denom = (double)1 / 64; - int channel = 2; - i2s_dma_t *save_tx = NULL, *save_rx = NULL; - - I2S_CHECK((i2s_num < I2S_NUM_MAX), "i2s_num error", ESP_ERR_INVALID_ARG); - - if (bits % 8 != 0 || bits > I2S_BITS_PER_SAMPLE_32BIT || - bits < I2S_BITS_PER_SAMPLE_16BIT) { - ESP_LOGE(I2S_TAG, "Invalid bits per sample"); - return ESP_ERR_INVALID_ARG; - } - - if (p_i2s_obj[i2s_num] == NULL) { - ESP_LOGE(I2S_TAG, "Not initialized yet"); - return ESP_ERR_INVALID_ARG; - } - p_i2s_obj[i2s_num]->sample_rate = rate; - double clkmdiv = (double)I2S_BASE_CLK / (rate * factor); - - if (clkmdiv > 256) { - ESP_LOGE(I2S_TAG, "clkmdiv is too large\r\n"); - return ESP_ERR_INVALID_ARG; - } - - // wait all on-going writing finish - if ((p_i2s_obj[i2s_num]->mode & I2S_MODE_TX) && p_i2s_obj[i2s_num]->tx) { - xSemaphoreTake(p_i2s_obj[i2s_num]->tx->mux, (portTickType)portMAX_DELAY); - } - if ((p_i2s_obj[i2s_num]->mode & I2S_MODE_RX) && p_i2s_obj[i2s_num]->rx) { - xSemaphoreTake(p_i2s_obj[i2s_num]->rx->mux, (portTickType)portMAX_DELAY); - } - - i2s_custom_stop(i2s_num); - i2s_hal_set_rx_mode(&(p_i2s_obj[i2s_num]->hal), ch, bits); - i2s_hal_set_tx_mode(&(p_i2s_obj[i2s_num]->hal), ch, bits); - - if (p_i2s_obj[i2s_num]->channel_num != (int)ch) { - p_i2s_obj[i2s_num]->channel_num = (ch == 2) ? 2 : 1; - } - - if ((int)bits != p_i2s_obj[i2s_num]->bits_per_sample) { - p_i2s_obj[i2s_num]->bits_per_sample = bits; - - // Round bytes_per_sample up to next multiple of 16 bits - int halfwords_per_sample = (bits + 15) / 16; - p_i2s_obj[i2s_num]->bytes_per_sample = halfwords_per_sample * 2; - - // Because limited of DMA buffer is 4092 bytes - if (p_i2s_obj[i2s_num]->dma_buf_len * p_i2s_obj[i2s_num]->bytes_per_sample * - p_i2s_obj[i2s_num]->channel_num > - 4092) { - p_i2s_obj[i2s_num]->dma_buf_len = 4092 / - p_i2s_obj[i2s_num]->bytes_per_sample / - p_i2s_obj[i2s_num]->channel_num; - } - // Re-create TX DMA buffer - if (p_i2s_obj[i2s_num]->mode & I2S_MODE_TX) { - save_tx = p_i2s_obj[i2s_num]->tx; - - p_i2s_obj[i2s_num]->tx = - i2s_create_dma_queue(i2s_num, p_i2s_obj[i2s_num]->dma_buf_count, - p_i2s_obj[i2s_num]->dma_buf_len); - if (p_i2s_obj[i2s_num]->tx == NULL) { - ESP_LOGE(I2S_TAG, "Failed to create tx dma buffer"); - i2s_custom_driver_uninstall(i2s_num); - return ESP_ERR_NO_MEM; - } - i2s_hal_set_out_link_addr(&(p_i2s_obj[i2s_num]->hal), - (uint32_t)p_i2s_obj[i2s_num]->tx->desc[0]); - - // destroy old tx dma if exist - if (save_tx) { - i2s_destroy_dma_queue(i2s_num, save_tx); - } - } - // Re-create RX DMA buffer - if (p_i2s_obj[i2s_num]->mode & I2S_MODE_RX) { - save_rx = p_i2s_obj[i2s_num]->rx; - - p_i2s_obj[i2s_num]->rx = - i2s_create_dma_queue(i2s_num, p_i2s_obj[i2s_num]->dma_buf_count, - p_i2s_obj[i2s_num]->dma_buf_len); - if (p_i2s_obj[i2s_num]->rx == NULL) { - ESP_LOGE(I2S_TAG, "Failed to create rx dma buffer"); - i2s_custom_driver_uninstall(i2s_num); - return ESP_ERR_NO_MEM; - } - i2s_hal_set_in_link(&(p_i2s_obj[i2s_num]->hal), - p_i2s_obj[i2s_num]->dma_buf_len * - p_i2s_obj[i2s_num]->channel_num * - p_i2s_obj[i2s_num]->bytes_per_sample, - (uint32_t)p_i2s_obj[i2s_num]->rx->desc[0]); - // destroy old rx dma if exist - if (save_rx) { - i2s_destroy_dma_queue(i2s_num, save_rx); - } - } - } - - double mclk; - int sdm0, sdm1, sdm2, odir, m_scale = 8; - int fi2s_clk = rate * channel * bits * m_scale; -#if SOC_I2S_SUPPORTS_PDM - if (p_i2s_obj[i2s_num]->mode & I2S_MODE_PDM) { - uint32_t b_clk = 0; - if (p_i2s_obj[i2s_num]->mode & I2S_MODE_TX) { - uint32_t fp, fs; - i2s_hal_get_tx_pdm(&(p_i2s_obj[i2s_num]->hal), &fp, &fs); - // Recommended set `fp = 960, fs = sample_rate / 100` - fs = rate / 100; - i2s_hal_tx_pdm_cfg(&(p_i2s_obj[i2s_num]->hal), fp, fs); - b_clk = rate * I2S_PDM_BCK_FACTOR * fp / fs; - } else if (p_i2s_obj[i2s_num]->mode & I2S_MODE_RX) { - uint32_t dsr; - i2s_hal_get_rx_pdm(&(p_i2s_obj[i2s_num]->hal), &dsr); - b_clk = rate * I2S_PDM_BCK_FACTOR * (dsr ? 2 : 1); - } - fi2s_clk = b_clk * m_scale; - int factor2 = 5; - mclk = b_clk * factor2; - clkmdiv = ((double)I2S_BASE_CLK) / mclk; - clkmInteger = clkmdiv; - clkmDecimals = (clkmdiv - clkmInteger) / denom; - bck = mclk / b_clk; - } else -#endif - { - clkmInteger = clkmdiv; - clkmDecimals = (clkmdiv - clkmInteger) / denom; - mclk = clkmInteger + denom * clkmDecimals; - bck = factor / (bits * channel); - } - - if (p_i2s_obj[i2s_num]->use_apll && p_i2s_obj[i2s_num]->fixed_mclk) { - fi2s_clk = p_i2s_obj[i2s_num]->fixed_mclk; - m_scale = fi2s_clk / bits / rate / channel; - } - if (p_i2s_obj[i2s_num]->use_apll && - i2s_apll_calculate_fi2s(fi2s_clk, bits, &sdm0, &sdm1, &sdm2, &odir) == - ESP_OK) { - ESP_LOGD(I2S_TAG, "sdm0=%d, sdm1=%d, sdm2=%d, odir=%d", sdm0, sdm1, sdm2, - odir); - rtc_clk_apll_enable(1, sdm0, sdm1, sdm2, odir); - i2s_hal_set_clk_div(&(p_i2s_obj[i2s_num]->hal), 1, 1, 0, m_scale, m_scale); - i2s_hal_set_clock_sel(&(p_i2s_obj[i2s_num]->hal), I2S_CLK_APLL); - double fi2s_rate = i2s_apll_get_fi2s(bits, sdm0, sdm1, sdm2, odir); - p_i2s_obj[i2s_num]->real_rate = fi2s_rate / bits / channel / m_scale; - ESP_LOGI(I2S_TAG, - "APLL: Req RATE: %d, real rate: %0.3f, BITS: %u, CLKM: %u, " - "BCK_M: %u, MCLK: %0.3f, SCLK: %f, diva: %d, divb: %d", - rate, fi2s_rate / bits / channel / m_scale, bits, 1, m_scale, - fi2s_rate, fi2s_rate / 8, 1, 0); - } else { - i2s_hal_set_clock_sel(&(p_i2s_obj[i2s_num]->hal), I2S_CLK_D2CLK); - i2s_hal_set_clk_div(&(p_i2s_obj[i2s_num]->hal), clkmInteger, 63, - clkmDecimals, bck, bck); - double real_rate = (double)(I2S_BASE_CLK / (bck * bits * clkmInteger) / 2); - p_i2s_obj[i2s_num]->real_rate = real_rate; - ESP_LOGI(I2S_TAG, - "PLL_D2: Req RATE: %d, real rate: %0.3f, BITS: %u, CLKM: %u, " - "BCK: %u, MCLK: %0.3f, SCLK: %f, diva: %d, divb: %d", - rate, real_rate, bits, clkmInteger, bck, - (double)I2S_BASE_CLK / mclk, real_rate * bits * channel, 64, - clkmDecimals); - } - if (p_i2s_obj[i2s_num]->mode & I2S_MODE_TX) { - p_i2s_obj[i2s_num]->tx->curr_ptr = NULL; - p_i2s_obj[i2s_num]->tx->rw_pos = 0; - } - if (p_i2s_obj[i2s_num]->mode & I2S_MODE_RX) { - p_i2s_obj[i2s_num]->rx->curr_ptr = NULL; - p_i2s_obj[i2s_num]->rx->rw_pos = 0; - } - - i2s_hal_set_tx_bits_mod(&(p_i2s_obj[i2s_num]->hal), bits); - i2s_hal_set_rx_bits_mod(&(p_i2s_obj[i2s_num]->hal), bits); - - // wait all writing on-going finish - if ((p_i2s_obj[i2s_num]->mode & I2S_MODE_TX) && p_i2s_obj[i2s_num]->tx) { - xSemaphoreGive(p_i2s_obj[i2s_num]->tx->mux); - } - if ((p_i2s_obj[i2s_num]->mode & I2S_MODE_RX) && p_i2s_obj[i2s_num]->rx) { - xSemaphoreGive(p_i2s_obj[i2s_num]->rx->mux); - } - - // i2s_custom_start(i2s_num); // don't start just yet, we want to - // fill dma buffer first return ESP_OK; - - // ensure all DMA buffers are available right after initialization - // ENSURE i2s_custom_start() isn't called before i2s_write has filled at - // least one buffer - return i2s_custom_init_dma_tx_queues(i2s_num, NULL, 0, NULL, NULL, NULL); -} - -static void IRAM_ATTR i2s_intr_handler_default(void *arg) { - i2s_obj_t *p_i2s = (i2s_obj_t *)arg; - uint32_t status; - i2s_hal_get_intr_status(&(p_i2s->hal), &status); - if (status == 0) { - // Avoid spurious interrupt - return; - } - - i2s_event_t i2s_event; - int dummy; - - portBASE_TYPE high_priority_task_awoken = 0; - - lldesc_t *finish_desc = NULL; - - if ((status & I2S_INTR_OUT_DSCR_ERR) || (status & I2S_INTR_IN_DSCR_ERR)) { - ESP_EARLY_LOGE(I2S_TAG, "dma error, interrupt status: 0x%08x", status); - if (p_i2s->i2s_queue) { - i2s_event.type = I2S_EVENT_DMA_ERROR; - if (xQueueIsQueueFullFromISR(p_i2s->i2s_queue)) { - xQueueReceiveFromISR(p_i2s->i2s_queue, &dummy, - &high_priority_task_awoken); - } - xQueueSendFromISR(p_i2s->i2s_queue, (void *)&i2s_event, - &high_priority_task_awoken); - } - } - - if ((status & I2S_INTR_OUT_EOF) && p_i2s->tx) { - i2s_hal_get_out_eof_des_addr(&(p_i2s->hal), (uint32_t *)&finish_desc); - // All buffers are empty. This means we have an underflow on our hands. - if (xQueueIsQueueFullFromISR(p_i2s->tx->queue)) { - xQueueReceiveFromISR(p_i2s->tx->queue, &dummy, - &high_priority_task_awoken); - // See if tx descriptor needs to be auto cleared: - // This will avoid any kind of noise that may get introduced due to - // transmission of previous data from tx descriptor on I2S line. - if (p_i2s->tx_desc_auto_clear == true) { - memset((void *)dummy, 0, p_i2s->tx->buf_size); - } - } - xQueueSendFromISR(p_i2s->tx->queue, (void *)(&finish_desc->buf), - &high_priority_task_awoken); - if (p_i2s->i2s_queue) { - i2s_event.type = I2S_EVENT_TX_DONE; - if (xQueueIsQueueFullFromISR(p_i2s->i2s_queue)) { - xQueueReceiveFromISR(p_i2s->i2s_queue, &dummy, - &high_priority_task_awoken); - } - xQueueSendFromISR(p_i2s->i2s_queue, (void *)&i2s_event, - &high_priority_task_awoken); - } - } - - if ((status & I2S_INTR_IN_SUC_EOF) && p_i2s->rx) { - // All buffers are full. This means we have an overflow. - i2s_hal_get_in_eof_des_addr(&(p_i2s->hal), (uint32_t *)&finish_desc); - if (xQueueIsQueueFullFromISR(p_i2s->rx->queue)) { - xQueueReceiveFromISR(p_i2s->rx->queue, &dummy, - &high_priority_task_awoken); - } - xQueueSendFromISR(p_i2s->rx->queue, (void *)(&finish_desc->buf), - &high_priority_task_awoken); - if (p_i2s->i2s_queue) { - i2s_event.type = I2S_EVENT_RX_DONE; - if (p_i2s->i2s_queue && xQueueIsQueueFullFromISR(p_i2s->i2s_queue)) { - xQueueReceiveFromISR(p_i2s->i2s_queue, &dummy, - &high_priority_task_awoken); - } - xQueueSendFromISR(p_i2s->i2s_queue, (void *)&i2s_event, - &high_priority_task_awoken); - } - } - i2s_hal_clear_intr_status(&(p_i2s->hal), status); - - if (high_priority_task_awoken == pdTRUE) { - portYIELD_FROM_ISR(); - } -} - -static esp_err_t i2s_destroy_dma_queue(i2s_port_t i2s_num, i2s_dma_t *dma) { - int bux_idx; - if (p_i2s_obj[i2s_num] == NULL) { - ESP_LOGE(I2S_TAG, "Not initialized yet"); - return ESP_ERR_INVALID_ARG; - } - if (dma == NULL) { - ESP_LOGE(I2S_TAG, "dma is NULL"); - return ESP_ERR_INVALID_ARG; - } - for (bux_idx = 0; bux_idx < p_i2s_obj[i2s_num]->dma_buf_count; bux_idx++) { - if (dma->desc && dma->desc[bux_idx]) { - free(dma->desc[bux_idx]); - } - if (dma->buf && dma->buf[bux_idx]) { - free(dma->buf[bux_idx]); - } - } - if (dma->buf) { - free(dma->buf); - } - if (dma->desc) { - free(dma->desc); - } - vQueueDelete(dma->queue); - vSemaphoreDelete(dma->mux); - free(dma); - return ESP_OK; -} - -static i2s_dma_t *i2s_create_dma_queue(i2s_port_t i2s_num, int dma_buf_count, - int dma_buf_len) { - int bux_idx; - int sample_size = - p_i2s_obj[i2s_num]->bytes_per_sample * p_i2s_obj[i2s_num]->channel_num; - i2s_dma_t *dma = (i2s_dma_t *)malloc(sizeof(i2s_dma_t)); - if (dma == NULL) { - ESP_LOGE(I2S_TAG, "Error malloc i2s_dma_t"); - return NULL; - } - memset(dma, 0, sizeof(i2s_dma_t)); - - dma->buf = (char **)malloc(sizeof(char *) * dma_buf_count); - if (dma->buf == NULL) { - ESP_LOGE(I2S_TAG, "Error malloc dma buffer pointer"); - free(dma); - return NULL; - } - memset(dma->buf, 0, sizeof(char *) * dma_buf_count); - - for (bux_idx = 0; bux_idx < dma_buf_count; bux_idx++) { - dma->buf[bux_idx] = - (char *)heap_caps_calloc(1, dma_buf_len * sample_size, MALLOC_CAP_DMA); - if (dma->buf[bux_idx] == NULL) { - ESP_LOGE(I2S_TAG, "Error malloc dma buffer"); - i2s_destroy_dma_queue(i2s_num, dma); - return NULL; - } - ESP_LOGD(I2S_TAG, "Addr[%d] = %d", bux_idx, (int)dma->buf[bux_idx]); - } - - dma->desc = (lldesc_t **)malloc(sizeof(lldesc_t *) * dma_buf_count); - if (dma->desc == NULL) { - ESP_LOGE(I2S_TAG, "Error malloc dma description"); - i2s_destroy_dma_queue(i2s_num, dma); - return NULL; - } - for (bux_idx = 0; bux_idx < dma_buf_count; bux_idx++) { - dma->desc[bux_idx] = - (lldesc_t *)heap_caps_malloc(sizeof(lldesc_t), MALLOC_CAP_DMA); - if (dma->desc[bux_idx] == NULL) { - ESP_LOGE(I2S_TAG, "Error malloc dma description entry"); - i2s_destroy_dma_queue(i2s_num, dma); - return NULL; - } - } - - for (bux_idx = 0; bux_idx < dma_buf_count; bux_idx++) { - dma->desc[bux_idx]->owner = 1; - dma->desc[bux_idx]->eof = 1; - dma->desc[bux_idx]->sosf = 0; - dma->desc[bux_idx]->length = dma_buf_len * sample_size; - dma->desc[bux_idx]->size = dma_buf_len * sample_size; - dma->desc[bux_idx]->buf = (uint8_t *)dma->buf[bux_idx]; - dma->desc[bux_idx]->offset = 0; - dma->desc[bux_idx]->empty = - (uint32_t)((bux_idx < (dma_buf_count - 1)) ? (dma->desc[bux_idx + 1]) - : dma->desc[0]); - } - - dma->queue = xQueueCreate(dma_buf_count - 1, sizeof(char *)); - dma->mux = xSemaphoreCreateMutex(); - dma->buf_size = dma_buf_len * sample_size; - ESP_LOGI(I2S_TAG, "DMA Malloc info, datalen=blocksize=%d, dma_buf_count=%d", - dma_buf_len * sample_size, dma_buf_count); - return dma; -} - -esp_err_t i2s_custom_start(i2s_port_t i2s_num) { - I2S_CHECK((i2s_num < I2S_NUM_MAX), "i2s_num error", ESP_ERR_INVALID_ARG); - // start DMA link - I2S_ENTER_CRITICAL(); - i2s_hal_reset(&(p_i2s_obj[i2s_num]->hal)); - - esp_intr_disable(p_i2s_obj[i2s_num]->i2s_isr_handle); - i2s_hal_clear_intr_status(&(p_i2s_obj[i2s_num]->hal), I2S_INTR_MAX); - if (p_i2s_obj[i2s_num]->mode & I2S_MODE_TX) { - i2s_custom_enable_tx_intr(i2s_num); - i2s_hal_start_tx(&(p_i2s_obj[i2s_num]->hal)); - } - if (p_i2s_obj[i2s_num]->mode & I2S_MODE_RX) { - i2s_custom_enable_rx_intr(i2s_num); - i2s_hal_start_rx(&(p_i2s_obj[i2s_num]->hal)); - } - esp_intr_enable(p_i2s_obj[i2s_num]->i2s_isr_handle); - I2S_EXIT_CRITICAL(); - return ESP_OK; -} - -esp_err_t i2s_custom_stop(i2s_port_t i2s_num) { - I2S_CHECK((i2s_num < I2S_NUM_MAX), "i2s_num error", ESP_ERR_INVALID_ARG); - I2S_ENTER_CRITICAL(); - esp_intr_disable(p_i2s_obj[i2s_num]->i2s_isr_handle); - if (p_i2s_obj[i2s_num]->mode & I2S_MODE_TX) { - i2s_hal_stop_tx(&(p_i2s_obj[i2s_num]->hal)); - i2s_custom_disable_tx_intr(i2s_num); - } - if (p_i2s_obj[i2s_num]->mode & I2S_MODE_RX) { - i2s_hal_stop_rx(&(p_i2s_obj[i2s_num]->hal)); - i2s_custom_disable_rx_intr(i2s_num); - } - uint32_t mask; - i2s_hal_get_intr_status(&(p_i2s_obj[i2s_num]->hal), &mask); - i2s_hal_clear_intr_status(&(p_i2s_obj[i2s_num]->hal), mask); - I2S_EXIT_CRITICAL(); - return ESP_OK; -} - -esp_err_t i2s_custom_set_pin(i2s_port_t i2s_num, const i2s_pin_config_t *pin) { - I2S_CHECK((i2s_num < I2S_NUM_MAX), "i2s_num error", ESP_ERR_INVALID_ARG); - if (pin == NULL) { - return ESP_ERR_INVALID_ARG; - } - - if (pin->bck_io_num != -1 && !GPIO_IS_VALID_GPIO(pin->bck_io_num)) { - ESP_LOGE(I2S_TAG, "bck_io_num error"); - return ESP_FAIL; - } - if (pin->ws_io_num != -1 && !GPIO_IS_VALID_GPIO(pin->ws_io_num)) { - ESP_LOGE(I2S_TAG, "ws_io_num error"); - return ESP_FAIL; - } - if (pin->data_out_num != -1 && - !GPIO_IS_VALID_OUTPUT_GPIO(pin->data_out_num)) { - ESP_LOGE(I2S_TAG, "data_out_num error"); - return ESP_FAIL; - } - if (pin->data_in_num != -1 && !GPIO_IS_VALID_GPIO(pin->data_in_num)) { - ESP_LOGE(I2S_TAG, "data_in_num error"); - return ESP_FAIL; - } - - int bck_sig = -1, ws_sig = -1, data_out_sig = -1, data_in_sig = -1; - // Each IIS hw module has a RX and TX unit. - // For TX unit, the output signal index should be I2SnO_xxx_OUT_IDX - // For TX unit, the input signal index should be I2SnO_xxx_IN_IDX - if (p_i2s_obj[i2s_num]->mode & I2S_MODE_TX) { - if (p_i2s_obj[i2s_num]->mode & I2S_MODE_MASTER) { - bck_sig = i2s_periph_signal[i2s_num].o_bck_out_sig; - ws_sig = i2s_periph_signal[i2s_num].o_ws_out_sig; - data_out_sig = i2s_periph_signal[i2s_num].o_data_out_sig; - } else if (p_i2s_obj[i2s_num]->mode & I2S_MODE_SLAVE) { - bck_sig = i2s_periph_signal[i2s_num].o_bck_in_sig; - ws_sig = i2s_periph_signal[i2s_num].o_ws_in_sig; - data_out_sig = i2s_periph_signal[i2s_num].o_data_out_sig; - } - } - // For RX unit, the output signal index should be I2SnI_xxx_OUT_IDX - // For RX unit, the input signal index should be I2SnI_xxx_IN_IDX - if (p_i2s_obj[i2s_num]->mode & I2S_MODE_RX) { - if (p_i2s_obj[i2s_num]->mode & I2S_MODE_MASTER) { - bck_sig = i2s_periph_signal[i2s_num].i_bck_out_sig; - ws_sig = i2s_periph_signal[i2s_num].i_ws_out_sig; - data_in_sig = i2s_periph_signal[i2s_num].i_data_in_sig; - } else if (p_i2s_obj[i2s_num]->mode & I2S_MODE_SLAVE) { - bck_sig = i2s_periph_signal[i2s_num].i_bck_in_sig; - ws_sig = i2s_periph_signal[i2s_num].i_ws_in_sig; - data_in_sig = i2s_periph_signal[i2s_num].i_data_in_sig; - } - } - // For "full-duplex + slave" mode, we should select RX signal index for ws - // and bck. For "full-duplex + master" mode, we should select TX signal index - // for ws and bck. - if ((p_i2s_obj[i2s_num]->mode & I2S_FULL_DUPLEX_SLAVE_MODE_MASK) == - I2S_FULL_DUPLEX_SLAVE_MODE_MASK) { - bck_sig = i2s_periph_signal[i2s_num].i_bck_in_sig; - ws_sig = i2s_periph_signal[i2s_num].i_ws_in_sig; - } else if ((p_i2s_obj[i2s_num]->mode & I2S_FULL_DUPLEX_MASTER_MODE_MASK) == - I2S_FULL_DUPLEX_MASTER_MODE_MASK) { - bck_sig = i2s_periph_signal[i2s_num].o_bck_out_sig; - ws_sig = i2s_periph_signal[i2s_num].o_ws_out_sig; - } - gpio_matrix_out_check(pin->data_out_num, data_out_sig, 0, 0); - gpio_matrix_in_check(pin->data_in_num, data_in_sig, 0); - if (p_i2s_obj[i2s_num]->mode & I2S_MODE_MASTER) { - gpio_matrix_out_check(pin->ws_io_num, ws_sig, 0, 0); - gpio_matrix_out_check(pin->bck_io_num, bck_sig, 0, 0); - } else if (p_i2s_obj[i2s_num]->mode & I2S_MODE_SLAVE) { - gpio_matrix_in_check(pin->ws_io_num, ws_sig, 0); - gpio_matrix_in_check(pin->bck_io_num, bck_sig, 0); - } - ESP_LOGD(I2S_TAG, "data: out %d, in: %d, ws: %d, bck: %d", data_out_sig, - data_in_sig, ws_sig, bck_sig); - - return ESP_OK; -} - -esp_err_t i2s_custom_set_sample_rates(i2s_port_t i2s_num, uint32_t rate) { - I2S_CHECK((i2s_num < I2S_NUM_MAX), "i2s_num error", ESP_ERR_INVALID_ARG); - I2S_CHECK((p_i2s_obj[i2s_num]->bytes_per_sample > 0), - "bits_per_sample not set", ESP_ERR_INVALID_ARG); - return i2s_custom_set_clk(i2s_num, rate, p_i2s_obj[i2s_num]->bits_per_sample, - p_i2s_obj[i2s_num]->channel_num); -} - -#if SOC_I2S_SUPPORTS_PDM -esp_err_t i2s_custom_set_pdm_rx_down_sample(i2s_port_t i2s_num, - i2s_pdm_dsr_t dsr) { - I2S_CHECK((i2s_num < I2S_NUM_MAX), "i2s_num error", ESP_ERR_INVALID_ARG); - i2s_hal_rx_pdm_cfg(&(p_i2s_obj[i2s_num]->hal), dsr); - return i2s_custom_set_clk(i2s_num, p_i2s_obj[i2s_num]->sample_rate, - p_i2s_obj[i2s_num]->bits_per_sample, - p_i2s_obj[i2s_num]->channel_num); -} -#endif - -static esp_err_t i2s_custom_check_cfg_static(i2s_port_t i2s_num, - const i2s_config_t *cfg) { -#if SOC_I2S_SUPPORTS_PDM - // We only check if the I2S number is invalid when set to PDM mode. - I2S_CHECK(!((cfg->mode & I2S_MODE_PDM) && (i2s_num != I2S_NUM_0)), - "I2S DAC PDM only support on I2S0", ESP_ERR_INVALID_ARG); - return ESP_OK; -#endif - - I2S_CHECK(cfg->communication_format && - (cfg->communication_format < I2S_COMM_FORMAT_STAND_MAX), - "invalid communication formats", ESP_ERR_INVALID_ARG); - I2S_CHECK(!((cfg->communication_format & I2S_COMM_FORMAT_STAND_MSB) && - (cfg->communication_format & I2S_COMM_FORMAT_STAND_PCM_LONG)), - "multiple communication formats specified", ESP_ERR_INVALID_ARG); - return ESP_OK; -} - -static esp_err_t i2s_param_config(i2s_port_t i2s_num, - const i2s_config_t *i2s_config) { - I2S_CHECK((i2s_num < I2S_NUM_MAX), "i2s_num error", ESP_ERR_INVALID_ARG); - I2S_CHECK((i2s_config), "param null", ESP_ERR_INVALID_ARG); - I2S_CHECK((i2s_custom_check_cfg_static(i2s_num, i2s_config) == ESP_OK), - "param check error", ESP_ERR_INVALID_ARG); - - periph_module_enable(i2s_periph_signal[i2s_num].module); - - // configure I2S data port interface. - i2s_hal_config_param(&(p_i2s_obj[i2s_num]->hal), i2s_config); - if ((p_i2s_obj[i2s_num]->mode & I2S_MODE_RX) && - (p_i2s_obj[i2s_num]->mode & I2S_MODE_TX)) { - i2s_hal_enable_sig_loopback(&(p_i2s_obj[i2s_num]->hal)); - if (p_i2s_obj[i2s_num]->mode & I2S_MODE_MASTER) { - i2s_hal_enable_master_mode(&(p_i2s_obj[i2s_num]->hal)); - } else { - i2s_hal_enable_slave_mode(&(p_i2s_obj[i2s_num]->hal)); - } - } - - p_i2s_obj[i2s_num]->use_apll = i2s_config->use_apll; - p_i2s_obj[i2s_num]->tx_desc_auto_clear = i2s_config->tx_desc_auto_clear; - p_i2s_obj[i2s_num]->fixed_mclk = i2s_config->fixed_mclk; - return ESP_OK; -} - -esp_err_t i2s_custom_zero_dma_buffer(i2s_port_t i2s_num) { - I2S_CHECK((i2s_num < I2S_NUM_MAX), "i2s_num error", ESP_ERR_INVALID_ARG); - if (p_i2s_obj[i2s_num]->rx && p_i2s_obj[i2s_num]->rx->buf != NULL && - p_i2s_obj[i2s_num]->rx->buf_size != 0) { - for (int i = 0; i < p_i2s_obj[i2s_num]->dma_buf_count; i++) { - memset(p_i2s_obj[i2s_num]->rx->buf[i], 0, - p_i2s_obj[i2s_num]->rx->buf_size); - } - } - if (p_i2s_obj[i2s_num]->tx && p_i2s_obj[i2s_num]->tx->buf != NULL && - p_i2s_obj[i2s_num]->tx->buf_size != 0) { - int bytes_left = 0; - bytes_left = - (p_i2s_obj[i2s_num]->tx->buf_size - p_i2s_obj[i2s_num]->tx->rw_pos) % 4; - if (bytes_left) { - size_t zero_bytes = 0, bytes_written; - i2s_custom_write(i2s_num, (void *)&zero_bytes, bytes_left, &bytes_written, - portMAX_DELAY); - } - for (int i = 0; i < p_i2s_obj[i2s_num]->dma_buf_count; i++) { - memset(p_i2s_obj[i2s_num]->tx->buf[i], 0, - p_i2s_obj[i2s_num]->tx->buf_size); - } - } - return ESP_OK; -} - -esp_err_t i2s_custom_driver_install(i2s_port_t i2s_num, - const i2s_config_t *i2s_config, - int queue_size, void *i2s_queue) { - esp_err_t err; - I2S_CHECK((i2s_num < I2S_NUM_MAX), "i2s_num error", ESP_ERR_INVALID_ARG); - I2S_CHECK((i2s_config != NULL), "I2S configuration must not NULL", - ESP_ERR_INVALID_ARG); - I2S_CHECK( - (i2s_config->dma_buf_count >= 2 && i2s_config->dma_buf_count <= 128), - "I2S buffer count less than 128 and more than 2", ESP_ERR_INVALID_ARG); - I2S_CHECK((i2s_config->dma_buf_len >= 8 && i2s_config->dma_buf_len <= 1024), - "I2S buffer length at most 1024 and more than 8", - ESP_ERR_INVALID_ARG); - if (p_i2s_obj[i2s_num] == NULL) { - p_i2s_obj[i2s_num] = (i2s_obj_t *)malloc(sizeof(i2s_obj_t)); - if (p_i2s_obj[i2s_num] == NULL) { - ESP_LOGE(I2S_TAG, "Malloc I2S driver error"); - return ESP_ERR_NO_MEM; - } - memset(p_i2s_obj[i2s_num], 0, sizeof(i2s_obj_t)); - - portMUX_TYPE i2s_spinlock_unlocked[1] = {portMUX_INITIALIZER_UNLOCKED}; - for (int x = 0; x < I2S_NUM_MAX; x++) { - i2s_spinlock[x] = i2s_spinlock_unlocked[0]; - } - // To make sure hardware is enabled before any hardware register - // operations. - periph_module_enable(i2s_periph_signal[i2s_num].module); - i2s_hal_init(&(p_i2s_obj[i2s_num]->hal), i2s_num); - - p_i2s_obj[i2s_num]->i2s_num = i2s_num; - p_i2s_obj[i2s_num]->dma_buf_count = i2s_config->dma_buf_count; - p_i2s_obj[i2s_num]->dma_buf_len = i2s_config->dma_buf_len; - p_i2s_obj[i2s_num]->i2s_queue = i2s_queue; - p_i2s_obj[i2s_num]->mode = i2s_config->mode; - - p_i2s_obj[i2s_num]->bits_per_sample = 0; - p_i2s_obj[i2s_num]->bytes_per_sample = 0; // Not initialized yet - p_i2s_obj[i2s_num]->channel_num = - i2s_config->channel_format < I2S_CHANNEL_FMT_ONLY_RIGHT ? 2 : 1; - -#ifdef CONFIG_PM_ENABLE - if (i2s_config->use_apll) { - err = esp_pm_lock_create(ESP_PM_NO_LIGHT_SLEEP, 0, "i2s_driver", - &p_i2s_obj[i2s_num]->pm_lock); - } else { - err = esp_pm_lock_create(ESP_PM_APB_FREQ_MAX, 0, "i2s_driver", - &p_i2s_obj[i2s_num]->pm_lock); - } - if (err != ESP_OK) { - free(p_i2s_obj[i2s_num]); - p_i2s_obj[i2s_num] = NULL; - ESP_LOGE(I2S_TAG, "I2S pm lock error"); - return err; - } -#endif // CONFIG_PM_ENABLE - - // initial interrupt - err = i2s_isr_register(i2s_num, i2s_config->intr_alloc_flags, - i2s_intr_handler_default, p_i2s_obj[i2s_num], - &p_i2s_obj[i2s_num]->i2s_isr_handle); - if (err != ESP_OK) { -#ifdef CONFIG_PM_ENABLE - if (p_i2s_obj[i2s_num]->pm_lock) { - esp_pm_lock_delete(p_i2s_obj[i2s_num]->pm_lock); - } -#endif - free(p_i2s_obj[i2s_num]); - p_i2s_obj[i2s_num] = NULL; - ESP_LOGE(I2S_TAG, "Register I2S Interrupt error"); - return err; - } - i2s_custom_stop(i2s_num); - err = i2s_param_config(i2s_num, i2s_config); - if (err != ESP_OK) { - i2s_custom_driver_uninstall(i2s_num); - ESP_LOGE(I2S_TAG, "I2S param configure error"); - return err; - } - - if (i2s_queue) { - p_i2s_obj[i2s_num]->i2s_queue = - xQueueCreate(queue_size, sizeof(i2s_event_t)); - *((QueueHandle_t *)i2s_queue) = p_i2s_obj[i2s_num]->i2s_queue; - ESP_LOGI(I2S_TAG, "queue free spaces: %d", - uxQueueSpacesAvailable(p_i2s_obj[i2s_num]->i2s_queue)); - } else { - p_i2s_obj[i2s_num]->i2s_queue = NULL; - } - // set clock and start - return i2s_custom_set_clk(i2s_num, i2s_config->sample_rate, - i2s_config->bits_per_sample, - p_i2s_obj[i2s_num]->channel_num); - } - - ESP_LOGW(I2S_TAG, "I2S driver already installed"); - return ESP_OK; -} - -esp_err_t i2s_custom_driver_uninstall(i2s_port_t i2s_num) { - I2S_CHECK((i2s_num < I2S_NUM_MAX), "i2s_num error", ESP_ERR_INVALID_ARG); - if (p_i2s_obj[i2s_num] == NULL) { - ESP_LOGI(I2S_TAG, "already uninstalled"); - return ESP_OK; - } - i2s_custom_stop(i2s_num); - esp_intr_free(p_i2s_obj[i2s_num]->i2s_isr_handle); - - if (p_i2s_obj[i2s_num]->tx != NULL && - (p_i2s_obj[i2s_num]->mode & I2S_MODE_TX)) { - i2s_destroy_dma_queue(i2s_num, p_i2s_obj[i2s_num]->tx); - p_i2s_obj[i2s_num]->tx = NULL; - } - if (p_i2s_obj[i2s_num]->rx != NULL && - (p_i2s_obj[i2s_num]->mode & I2S_MODE_RX)) { - i2s_destroy_dma_queue(i2s_num, p_i2s_obj[i2s_num]->rx); - p_i2s_obj[i2s_num]->rx = NULL; - } - - if (p_i2s_obj[i2s_num]->i2s_queue) { - vQueueDelete(p_i2s_obj[i2s_num]->i2s_queue); - p_i2s_obj[i2s_num]->i2s_queue = NULL; - } - - if (p_i2s_obj[i2s_num]->use_apll) { - rtc_clk_apll_enable(0, 0, 0, 0, 0); - } -#ifdef CONFIG_PM_ENABLE - if (p_i2s_obj[i2s_num]->pm_lock) { - esp_pm_lock_delete(p_i2s_obj[i2s_num]->pm_lock); - } -#endif - - free(p_i2s_obj[i2s_num]); - p_i2s_obj[i2s_num] = NULL; - periph_module_disable(i2s_periph_signal[i2s_num].module); - - return ESP_OK; -} - -esp_err_t i2s_custom_write(i2s_port_t i2s_num, const void *src, size_t size, - size_t *bytes_written, TickType_t ticks_to_wait) { - char *data_ptr, *src_byte; - size_t bytes_can_write; - *bytes_written = 0; - I2S_CHECK((i2s_num < I2S_NUM_MAX), "i2s_num error", ESP_ERR_INVALID_ARG); - I2S_CHECK((size < SOC_I2S_MAX_BUFFER_SIZE), "size is too large", - ESP_ERR_INVALID_ARG); - I2S_CHECK((p_i2s_obj[i2s_num]->tx), "tx NULL", ESP_ERR_INVALID_ARG); - xSemaphoreTake(p_i2s_obj[i2s_num]->tx->mux, (portTickType)portMAX_DELAY); -#ifdef CONFIG_PM_ENABLE - esp_pm_lock_acquire(p_i2s_obj[i2s_num]->pm_lock); -#endif - src_byte = (char *)src; - while (size > 0) { - // for (int i = 0; i < p_i2s_obj[i2s_num]->dma_buf_count; i++) { - // ESP_LOGI(I2S_TAG,"%d: EOF %d", i, - // p_i2s_obj[i2s_num]->tx->desc[i]->eof); - // } - - if (p_i2s_obj[i2s_num]->tx->rw_pos == p_i2s_obj[i2s_num]->tx->buf_size || - p_i2s_obj[i2s_num]->tx->curr_ptr == NULL) { - if (xQueueReceive(p_i2s_obj[i2s_num]->tx->queue, - &p_i2s_obj[i2s_num]->tx->curr_ptr, - ticks_to_wait) == pdFALSE) { - break; - } - p_i2s_obj[i2s_num]->tx->rw_pos = 0; - } - ESP_LOGD(I2S_TAG, "size: %d, rw_pos: %d, buf_size: %d, curr_ptr: %d", size, - p_i2s_obj[i2s_num]->tx->rw_pos, p_i2s_obj[i2s_num]->tx->buf_size, - (int)p_i2s_obj[i2s_num]->tx->curr_ptr); - data_ptr = (char *)p_i2s_obj[i2s_num]->tx->curr_ptr; - data_ptr += p_i2s_obj[i2s_num]->tx->rw_pos; - bytes_can_write = - p_i2s_obj[i2s_num]->tx->buf_size - p_i2s_obj[i2s_num]->tx->rw_pos; - if (bytes_can_write > size) { - bytes_can_write = size; - } - memcpy(data_ptr, src_byte, bytes_can_write); - size -= bytes_can_write; - src_byte += bytes_can_write; - p_i2s_obj[i2s_num]->tx->rw_pos += bytes_can_write; - (*bytes_written) += bytes_can_write; - } -#ifdef CONFIG_PM_ENABLE - esp_pm_lock_release(p_i2s_obj[i2s_num]->pm_lock); -#endif - - xSemaphoreGive(p_i2s_obj[i2s_num]->tx->mux); - return ESP_OK; -} - -esp_err_t i2s_custom_write_expand(i2s_port_t i2s_num, const void *src, - size_t size, size_t src_bits, size_t aim_bits, - size_t *bytes_written, - TickType_t ticks_to_wait) { - char *data_ptr; - int bytes_can_write, tail; - int src_bytes, aim_bytes, zero_bytes; - *bytes_written = 0; - I2S_CHECK((i2s_num < I2S_NUM_MAX), "i2s_num error", ESP_ERR_INVALID_ARG); - I2S_CHECK((size > 0), "size must greater than zero", ESP_ERR_INVALID_ARG); - I2S_CHECK((aim_bits * size < SOC_I2S_MAX_BUFFER_SIZE), "size is too large", - ESP_ERR_INVALID_ARG); - I2S_CHECK((aim_bits >= src_bits), "aim_bits mustn't be less than src_bits", - ESP_ERR_INVALID_ARG); - I2S_CHECK((p_i2s_obj[i2s_num]->tx), "tx NULL", ESP_ERR_INVALID_ARG); - if (src_bits < I2S_BITS_PER_SAMPLE_8BIT || - aim_bits < I2S_BITS_PER_SAMPLE_8BIT) { - ESP_LOGE(I2S_TAG, "bits mustn't be less than 8, src_bits %d aim_bits %d", - src_bits, aim_bits); - return ESP_ERR_INVALID_ARG; - } - if (src_bits > I2S_BITS_PER_SAMPLE_32BIT || - aim_bits > I2S_BITS_PER_SAMPLE_32BIT) { - ESP_LOGE(I2S_TAG, - "bits mustn't be greater than 32, src_bits %d aim_bits %d", - src_bits, aim_bits); - return ESP_ERR_INVALID_ARG; - } - if ((src_bits == I2S_BITS_PER_SAMPLE_16BIT || - src_bits == I2S_BITS_PER_SAMPLE_32BIT) && - (size % 2 != 0)) { - ESP_LOGE(I2S_TAG, - "size must be a even number while src_bits is even, src_bits " - "%d size %d", - src_bits, size); - return ESP_ERR_INVALID_ARG; - } - if (src_bits == I2S_BITS_PER_SAMPLE_24BIT && (size % 3 != 0)) { - ESP_LOGE(I2S_TAG, - "size must be a multiple of 3 while src_bits is 24, size %d", - size); - return ESP_ERR_INVALID_ARG; - } - - src_bytes = src_bits / 8; - aim_bytes = aim_bits / 8; - zero_bytes = aim_bytes - src_bytes; - xSemaphoreTake(p_i2s_obj[i2s_num]->tx->mux, (portTickType)portMAX_DELAY); - size = size * aim_bytes / src_bytes; - ESP_LOGD(I2S_TAG, "aim_bytes %d src_bytes %d size %d", aim_bytes, src_bytes, - size); - while (size > 0) { - if (p_i2s_obj[i2s_num]->tx->rw_pos == p_i2s_obj[i2s_num]->tx->buf_size || - p_i2s_obj[i2s_num]->tx->curr_ptr == NULL) { - if (xQueueReceive(p_i2s_obj[i2s_num]->tx->queue, - &p_i2s_obj[i2s_num]->tx->curr_ptr, - ticks_to_wait) == pdFALSE) { - break; - } - p_i2s_obj[i2s_num]->tx->rw_pos = 0; - } - data_ptr = (char *)p_i2s_obj[i2s_num]->tx->curr_ptr; - data_ptr += p_i2s_obj[i2s_num]->tx->rw_pos; - bytes_can_write = - p_i2s_obj[i2s_num]->tx->buf_size - p_i2s_obj[i2s_num]->tx->rw_pos; - if (bytes_can_write > (int)size) { - bytes_can_write = size; - } - tail = bytes_can_write % aim_bytes; - bytes_can_write = bytes_can_write - tail; - - memset(data_ptr, 0, bytes_can_write); - for (int j = 0; j < bytes_can_write; j += (aim_bytes - zero_bytes)) { - j += zero_bytes; - memcpy(&data_ptr[j], (const char *)(src + *bytes_written), - aim_bytes - zero_bytes); - (*bytes_written) += (aim_bytes - zero_bytes); - } - size -= bytes_can_write; - p_i2s_obj[i2s_num]->tx->rw_pos += bytes_can_write; - } - xSemaphoreGive(p_i2s_obj[i2s_num]->tx->mux); - return ESP_OK; -} - -esp_err_t i2s_custom_read(i2s_port_t i2s_num, void *dest, size_t size, - size_t *bytes_read, TickType_t ticks_to_wait) { - char *data_ptr, *dest_byte; - int bytes_can_read; - *bytes_read = 0; - dest_byte = (char *)dest; - I2S_CHECK((i2s_num < I2S_NUM_MAX), "i2s_num error", ESP_ERR_INVALID_ARG); - I2S_CHECK((size < SOC_I2S_MAX_BUFFER_SIZE), "size is too large", - ESP_ERR_INVALID_ARG); - I2S_CHECK((p_i2s_obj[i2s_num]->rx), "rx NULL", ESP_ERR_INVALID_ARG); - xSemaphoreTake(p_i2s_obj[i2s_num]->rx->mux, (portTickType)portMAX_DELAY); -#ifdef CONFIG_PM_ENABLE - esp_pm_lock_acquire(p_i2s_obj[i2s_num]->pm_lock); -#endif - while (size > 0) { - if (p_i2s_obj[i2s_num]->rx->rw_pos == p_i2s_obj[i2s_num]->rx->buf_size || - p_i2s_obj[i2s_num]->rx->curr_ptr == NULL) { - if (xQueueReceive(p_i2s_obj[i2s_num]->rx->queue, - &p_i2s_obj[i2s_num]->rx->curr_ptr, - ticks_to_wait) == pdFALSE) { - break; - } - p_i2s_obj[i2s_num]->rx->rw_pos = 0; - } - data_ptr = (char *)p_i2s_obj[i2s_num]->rx->curr_ptr; - data_ptr += p_i2s_obj[i2s_num]->rx->rw_pos; - bytes_can_read = - p_i2s_obj[i2s_num]->rx->buf_size - p_i2s_obj[i2s_num]->rx->rw_pos; - if (bytes_can_read > (int)size) { - bytes_can_read = size; - } - memcpy(dest_byte, data_ptr, bytes_can_read); - size -= bytes_can_read; - dest_byte += bytes_can_read; - p_i2s_obj[i2s_num]->rx->rw_pos += bytes_can_read; - (*bytes_read) += bytes_can_read; - } -#ifdef CONFIG_PM_ENABLE - esp_pm_lock_release(p_i2s_obj[i2s_num]->pm_lock); -#endif - xSemaphoreGive(p_i2s_obj[i2s_num]->rx->mux); - return ESP_OK; -} diff --git a/components/custom_driver/include/i2s.h b/components/custom_driver/include/i2s.h deleted file mode 100644 index c5628bce..00000000 --- a/components/custom_driver/include/i2s.h +++ /dev/null @@ -1,379 +0,0 @@ -// Copyright 2015-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. - -// Modifications copyright (C) 2021 CarlosDerSeher - -#pragma once - -#include "driver/periph_ctrl.h" -#include "esp_err.h" -#include "esp_intr_alloc.h" -#include "esp_types.h" -#include "freertos/FreeRTOS.h" -#include "freertos/semphr.h" -#include "hal/i2s_hal.h" -#include "hal/i2s_types.h" -#include "soc/i2s_periph.h" -#include "soc/rtc_periph.h" -#include "soc/soc_caps.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define I2S_PIN_NO_CHANGE \ - (-1) /*!< Use in i2s_pin_config_t for pins which should not be changed */ - -typedef intr_handle_t i2s_isr_handle_t; - -/** - * @brief Set I2S pin number - * - * @note - * The I2S peripheral output signals can be connected to multiple GPIO pads. - * However, the I2S peripheral input signal can only be connected to one GPIO - * pad. - * - * @param i2s_num I2S_NUM_0 or I2S_NUM_1 - * - * @param pin I2S Pin structure, or NULL to set 2-channel 8-bit - * internal DAC pin configuration (GPIO25 & GPIO26) - * - * Inside the pin configuration structure, set I2S_PIN_NO_CHANGE for any pin - * where the current configuration should not be changed. - * - * @note if *pin is set as NULL, this function will initialize both of the - * built-in DAC channels by default. if you don't want this to happen and you - * want to initialize only one of the DAC channels, you can call - * i2s_set_dac_mode instead. - * - * @return - * - ESP_OK Success - * - ESP_ERR_INVALID_ARG Parameter error - * - ESP_FAIL IO error - */ -esp_err_t i2s_custom_set_pin(i2s_port_t i2s_num, const i2s_pin_config_t *pin); - -#if SOC_I2S_SUPPORTS_PDM -/** - * @brief Set PDM mode down-sample rate - * In PDM RX mode, there would be 2 rounds of downsample process in - * hardware. In the first downsample process, the sampling number can be 16 - * or 8. In the second downsample process, the sampling number is fixed as 8. - * So the clock frequency in PDM RX mode would be (fpcm * 64) or (fpcm - * * 128) accordingly. - * @param i2s_num I2S_NUM_0, I2S_NUM_1 - * @param dsr i2s RX down sample rate for PDM mode. - * - * @note After calling this function, it would call i2s_set_clk inside to - * update the clock frequency. Please call this function after I2S driver has - * been initialized. - * - * @return - * - ESP_OK Success - * - ESP_ERR_INVALID_ARG Parameter error - * - ESP_ERR_NO_MEM Out of memory - */ -esp_err_t i2s_custom_set_pdm_rx_down_sample(i2s_port_t i2s_num, - i2s_pdm_dsr_t dsr); -#endif - -/** - * @brief Set I2S dac mode, I2S built-in DAC is disabled by default - * - * @param dac_mode DAC mode configurations - see i2s_dac_mode_t - * - * @note Built-in DAC functions are only supported on I2S0 for current ESP32 - * chip. If either of the built-in DAC channel are enabled, the other one can - * not be used as RTC DAC function at the same time. - * - * @return - * - ESP_OK Success - * - ESP_ERR_INVALID_ARG Parameter error - */ -esp_err_t i2s_custom_set_dac_mode(i2s_dac_mode_t dac_mode); - -/** - * @brief Install and start I2S driver. - * - * @param i2s_num I2S_NUM_0, I2S_NUM_1 - * - * @param i2s_config I2S configurations - see i2s_config_t struct - * - * @param queue_size I2S event queue size/depth. - * - * @param i2s_queue I2S event queue handle, if set NULL, driver will - * not use an event queue. - * - * This function must be called before any I2S driver read/write operations. - * - * @return - * - ESP_OK Success - * - ESP_ERR_INVALID_ARG Parameter error - * - ESP_ERR_NO_MEM Out of memory - */ -esp_err_t i2s_custom_driver_install(i2s_port_t i2s_num, - const i2s_config_t *i2s_config, - int queue_size, void *i2s_queue); - -/** - * @brief Uninstall I2S driver. - * - * @param i2s_num I2S_NUM_0, I2S_NUM_1 - * - * @return - * - ESP_OK Success - * - ESP_ERR_INVALID_ARG Parameter error - */ -esp_err_t i2s_custom_driver_uninstall(i2s_port_t i2s_num); - -/** - * @brief Write data to I2S DMA transmit buffer. - * - * @param i2s_num I2S_NUM_0, I2S_NUM_1 - * - * @param src Source address to write from - * - * @param size Size of data in bytes - * - * @param[out] bytes_written Number of bytes written, if timeout, the result - * will be less than the size passed in. - * - * @param ticks_to_wait TX buffer wait timeout in RTOS ticks. If this - * many ticks pass without space becoming available in the DMA - * transmit buffer, then the function will return (note that if the - * data is written to the DMA buffer in pieces, the overall operation - * may still take longer than this timeout.) Pass portMAX_DELAY for no - * timeout. - * - * @return - * - ESP_OK Success - * - ESP_ERR_INVALID_ARG Parameter error - */ -esp_err_t i2s_custom_write(i2s_port_t i2s_num, const void *src, size_t size, - size_t *bytes_written, TickType_t ticks_to_wait); - -/** - * @brief Write data to I2S DMA transmit buffer while expanding the number of - * bits per sample. For example, expanding 16-bit PCM to 32-bit PCM. - * - * @param i2s_num I2S_NUM_0, I2S_NUM_1 - * - * @param src Source address to write from - * - * @param size Size of data in bytes - * - * @param src_bits Source audio bit - * - * @param aim_bits Bit wanted, no more than 32, and must be - * greater than src_bits - * - * @param[out] bytes_written Number of bytes written, if timeout, the result - * will be less than the size passed in. - * - * @param ticks_to_wait TX buffer wait timeout in RTOS ticks. If this - * many ticks pass without space becoming available in the DMA - * transmit buffer, then the function will return (note that if the - * data is written to the DMA buffer in pieces, the overall operation - * may still take longer than this timeout.) Pass portMAX_DELAY for no - * timeout. - * - * Format of the data in source buffer is determined by the I2S - * configuration (see i2s_config_t). - * - * @return - * - ESP_OK Success - * - ESP_ERR_INVALID_ARG Parameter error - */ -esp_err_t i2s_custom_write_expand(i2s_port_t i2s_num, const void *src, - size_t size, size_t src_bits, size_t aim_bits, - size_t *bytes_written, - TickType_t ticks_to_wait); - -/** - * @brief Read data from I2S DMA receive buffer - * - * @param i2s_num I2S_NUM_0, I2S_NUM_1 - * - * @param dest Destination address to read into - * - * @param size Size of data in bytes - * - * @param[out] bytes_read Number of bytes read, if timeout, bytes read will - * be less than the size passed in. - * - * @param ticks_to_wait RX buffer wait timeout in RTOS ticks. If this many - * ticks pass without bytes becoming available in the DMA receive buffer, - * then the function will return (note that if data is read from the DMA - * buffer in pieces, the overall operation may still take longer than this - * timeout.) Pass portMAX_DELAY for no timeout. - * - * @note If the built-in ADC mode is enabled, we should call i2s_adc_enable - * and i2s_adc_disable around the whole reading process, to prevent the data - * getting corrupted. - * - * @return - * - ESP_OK Success - * - ESP_ERR_INVALID_ARG Parameter error - */ -esp_err_t i2s_custom_read(i2s_port_t i2s_num, void *dest, size_t size, - size_t *bytes_read, TickType_t ticks_to_wait); - -/** - * @brief APLL calculate function, was described by following: - * APLL Output frequency is given by the formula: - * - * apll_freq = xtal_freq * (4 + sdm2 + sdm1/256 + - * sdm0/65536)/((o_div + 2) * 2) apll_freq = fout / ((o_div + 2) * 2) - * - * The dividend in this expression should be in the range of 240 - - * 600 MHz. In rev. 0 of ESP32, sdm0 and sdm1 are unused and always set to 0. - * * sdm0 frequency adjustment parameter, 0..255 - * * sdm1 frequency adjustment parameter, 0..255 - * * sdm2 frequency adjustment parameter, 0..63 - * * o_div frequency divider, 0..31 - * - * The most accurate way to find the sdm0..2 and odir parameters - * is to loop through them all, then apply the above formula, finding the - * closest frequency to the desired one. But 256*256*64*32 = 134.217.728 - * loops are too slow with ESP32 - * 1. We will choose the parameters with the highest level of - * change, With 350MHz/dev/null || exit 1 - eval $(ssh-agent -s) - printf '%s\n' "${GH_PUSH_KEY}" | tr -d '\r' | ssh-add - > /dev/null - mkdir -p ~/.ssh && chmod 700 ~/.ssh - [[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config || ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts - git remote remove github || true - git remote add github ${GH_PUSH_REPO} - -after_script: - # Just for cleaning space, no other causes - - git clean -ffdx - -build: - stage: build - tags: - - build - script: - # Get ESP-IDF - - git clone ${ESP_IDF_GIT} esp-idf - - pushd esp-idf - # Non-recursive getting its submodules - - git submodule update --init - - export IDF_PATH=$PWD - - *setup_idf_tools - - popd - - # Create a copy of the project in "esp-dsp" directory. - # This is needed because CMake build system can not build a component - # when ESP-IDF directory is inside the component. - # After cloning, we will have two directories at the same level: "esp-idf" and "esp-dsp" - - git clone $PWD esp-dsp - - cd esp-dsp - - # Build test app by both Makefiles and CMake ways - - pushd test_app - - make defconfig && make - - rm -rf build - - idf.py build - - popd - - # Build examples - - ./build_examples.sh - -build_docs: - stage: build - tags: - - build_docs - artifacts: - when: always - paths: - - docs/doxygen-warning-log.txt - - docs/sphinx-warning-log.txt - - docs/_build/html - expire_in: 1 day - # No cleaning when the artifacts - after_script: [] - script: - - cd docs - - make html - - ./check_doc_warnings.sh - -push_master_to_github: - stage: deploy - tags: - - deploy - only: - - master - - /^release\/v/ - - /^v\d+\.\d+(\.\d+)?($|-)/ - when: on_success - script: - # Just for a helper script - - git clone --depth 1 ${ESP_IDF_GIT} esp-idf - - *add_gh_key_remote - - esp-idf/tools/ci/push_to_github.sh diff --git a/components/esp-dsp/CMakeLists.txt b/components/esp-dsp/CMakeLists.txt deleted file mode 100644 index 37ab1472..00000000 --- a/components/esp-dsp/CMakeLists.txt +++ /dev/null @@ -1,108 +0,0 @@ -set(COMPONENT_SRCS "modules/common/misc/dsps_pwroftwo.cpp" - "modules/dotprod/float/dsps_dotprod_f32_ae32.S" - "modules/dotprod/float/dsps_dotprod_f32_m_ae32.S" - "modules/dotprod/float/dsps_dotprode_f32_ae32.S" - "modules/dotprod/float/dsps_dotprode_f32_m_ae32.S" - "modules/dotprod/float/dsps_dotprod_f32_ansi.c" - "modules/dotprod/float/dsps_dotprode_f32_ansi.c" - "modules/dotprod/fixed/dsps_dotprod_s16_ae32.S" - "modules/dotprod/fixed/dsps_dotprod_s16_m_ae32.S" - "modules/dotprod/fixed/dsps_dotprod_s16_ansi.c" - "modules/matrix/float/dspm_mult_3x3x1_f32_ae32.S" - "modules/matrix/float/dspm_mult_3x3x3_f32_ae32.S" - "modules/matrix/float/dspm_mult_4x4x1_f32_ae32.S" - "modules/matrix/float/dspm_mult_4x4x4_f32_ae32.S" - "modules/matrix/float/dspm_mult_f32_ae32.S" - "modules/matrix/float/dspm_mult_f32_ansi.c" - "modules/matrix/fixed/dspm_mult_s16_ae32.S" - "modules/matrix/fixed/dspm_mult_s16_m_ae32_vector.S" - "modules/matrix/fixed/dspm_mult_s16_m_ae32.S" - "modules/matrix/fixed/dspm_mult_s16_ansi.c" - "modules/matrix/mat/mat.cpp" - "modules/math/mulc/float/dsps_mulc_f32_ansi.c" - "modules/math/addc/float/dsps_addc_f32_ansi.c" - "modules/math/mulc/fixed/dsps_mulc_s16_ansi.c" - "modules/math/mulc/fixed/dsps_mulc_s16_ae32.S" - "modules/math/add/float/dsps_add_f32_ansi.c" - "modules/math/add/fixed/dsps_add_s16_ansi.c" - "modules/math/add/fixed/dsps_add_s16_ae32.S" - "modules/math/sub/float/dsps_sub_f32_ansi.c" - "modules/math/mul/float/dsps_mul_f32_ansi.c" - "modules/math/mul/fixed/dsps_mul_s16_ansi.c" - "modules/math/mulc/float/dsps_mulc_f32_ae32.S" - "modules/math/addc/float/dsps_addc_f32_ae32.S" - "modules/math/add/float/dsps_add_f32_ae32.S" - "modules/math/sub/float/dsps_sub_f32_ae32.S" - "modules/math/mul/float/dsps_mul_f32_ae32.S" - "modules/math/sqrt/float/dsps_sqrt_f32_ansi.c" - - "modules/fft/float/dsps_fft2r_fc32_ae32_.S" - "modules/fft/float/dsps_fft2r_fc32_ansi.c" - "modules/fft/float/dsps_fft2r_fc32_ae32.c" - "modules/fft/float/dsps_fft4r_fc32_ansi.c" - "modules/fft/float/dsps_fft4r_fc32_ae32.c" - "modules/fft/float/dsps_fft2r_bitrev_tables_fc32.c" - "modules/fft/float/dsps_fft4r_bitrev_tables_fc32.c" - "modules/fft/fixed/dsps_fft2r_sc16_ae32.S" - "modules/fft/fixed/dsps_fft2r_sc16_ansi.c" - - "modules/dct/float/dsps_dct_f32.c" - "modules/support/snr/float/dsps_snr_f32.cpp" - "modules/support/sfdr/float/dsps_sfdr_f32.cpp" - "modules/support/misc/dsps_d_gen.c" - "modules/support/misc/dsps_h_gen.c" - "modules/support/misc/dsps_tone_gen.c" - "modules/support/view/dsps_view.cpp" - "modules/windows/hann/float/dsps_wind_hann_f32.c" - "modules/windows/blackman/float/dsps_wind_blackman_f32.c" - "modules/windows/blackman_harris/float/dsps_wind_blackman_harris_f32.c" - "modules/windows/blackman_nuttall/float/dsps_wind_blackman_nuttall_f32.c" - "modules/windows/nuttall/float/dsps_wind_nuttall_f32.c" - "modules/windows/flat_top/float/dsps_wind_flat_top_f32.c" - "modules/conv/float/dsps_conv_f32_ansi.c" - "modules/conv/float/dsps_conv_f32_ae32.S" - "modules/conv/float/dsps_corr_f32_ansi.c" - "modules/conv/float/dsps_corr_f32_ae32.S" - "modules/conv/float/dsps_ccorr_f32_ansi.c" - "modules/conv/float/dsps_ccorr_f32_ae32.S" - "modules/iir/biquad/dsps_biquad_f32_ae32.S" - "modules/iir/biquad/dsps_biquad_f32_ansi.c" - "modules/iir/biquad/dsps_biquad_gen_f32.c" - "modules/fir/float/dsps_fir_f32_ae32.S" - "modules/fir/float/dsps_fird_f32_ae32.S" - "modules/fir/float/dsps_fir_f32_ansi.c" - "modules/fir/float/dsps_fir_init_f32.c" - "modules/fir/float/dsps_fird_f32_ansi.c" - "modules/fir/float/dsps_fird_init_f32.c") - -set(COMPONENT_ADD_INCLUDEDIRS "modules/dotprod/include" - "modules/support/include" - "modules/windows/include" - "modules/windows/hann/include" - "modules/windows/blackman/include" - "modules/windows/blackman_harris/include" - "modules/windows/blackman_nuttall/include" - "modules/windows/nuttall/include" - "modules/windows/flat_top/include" - "modules/iir/include" - "modules/fir/include" - "modules/math/include" - "modules/math/add/include" - "modules/math/sub/include" - "modules/math/mul/include" - "modules/math/addc/include" - "modules/math/mulc/include" - "modules/math/sqrt/include" - "modules/matrix/include" - "modules/fft/include" - "modules/dct/include" - "modules/conv/include" - "modules/common/include") - -set(COMPONENT_PRIV_INCLUDEDIRS "modules/dotprod/float" - "modules/dotprod/fixed" - "modules/common/private_include") - -register_component() - -#component_compile_options(-ffast-math -O2 -Wno-error=maybe-uninitialized) diff --git a/components/esp-dsp/Kconfig b/components/esp-dsp/Kconfig deleted file mode 100644 index 5c8eaf7b..00000000 --- a/components/esp-dsp/Kconfig +++ /dev/null @@ -1,53 +0,0 @@ -menu "DSP Library" - - -choice DSP_OPTIMIZATION - bool "DSP Optimization for ESP32" - default DSP_OPTIMIZED - help - An Ansi C version could be used for verification and debug purpose. - -config DSP_ANSI - bool "ANSI C" -config DSP_OPTIMIZED - bool "ESP32 Optimized" -endchoice - -config DSP_OPTIMIZATION - int - default 0 if DSP_ANSI - default 1 if DSP_OPTIMIZED - -choice DSP_MAX_FFT_SIZE - bool "Maximum FFT length" - default DSP_MAX_FFT_SIZE_4096 - help - This is default FFT size for internal usage. - -config DSP_MAX_FFT_SIZE_512 - bool "512" -config DSP_MAX_FFT_SIZE_1024 - bool "1024" -config DSP_MAX_FFT_SIZE_2048 - bool "2048" -config DSP_MAX_FFT_SIZE_4096 - bool "4096" -config DSP_MAX_FFT_SIZE_8192 - bool "8192" -config DSP_MAX_FFT_SIZE_16384 - bool "16384" -config DSP_MAX_FFT_SIZE_32768 - bool "32768" -endchoice - -config DSP_MAX_FFT_SIZE - int - default 512 if DSP_MAX_FFT_SIZE_512 - default 1024 if DSP_MAX_FFT_SIZE_1024 - default 2048 if DSP_MAX_FFT_SIZE_2048 - default 4096 if DSP_MAX_FFT_SIZE_4096 - default 8192 if DSP_MAX_FFT_SIZE_8192 - default 16384 if DSP_MAX_FFT_SIZE_16384 - default 32768 if DSP_MAX_FFT_SIZE_32768 - -endmenu diff --git a/components/esp-dsp/LICENSE b/components/esp-dsp/LICENSE deleted file mode 100644 index d6456956..00000000 --- a/components/esp-dsp/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. diff --git a/components/esp-dsp/README.md b/components/esp-dsp/README.md deleted file mode 100644 index ac3efef7..00000000 --- a/components/esp-dsp/README.md +++ /dev/null @@ -1,71 +0,0 @@ -# Espressif DSP Library - -ESP-DSP is the official DSP library for the [ESP32](https://espressif.com/en/products/hardware/esp32/overview) chip. - -## Overview - -ESP-DSP is intended to be used as an [ESP-IDF](https://github.com/espressif/esp-idf) component. For the introduction to ESP-IDF, refer to the [ESP-IDF Programming Guide](https://docs.espressif.com/projects/esp-idf/en/latest/). - -The ESP-DSP library includes implementations of the following functions: -- Matrix multiplication: [reference](https://docs.espressif.com/projects/esp-dsp/en/latest/esp-dsp-apis.html#matrix-operations-apis) -- Dot product: [reference](https://docs.espressif.com/projects/esp-dsp/en/latest/esp-dsp-apis.html#dot-product), [example](https://github.com/espressif/esp-dsp/tree/master/examples/dotprod) -- FFT: [reference](https://docs.espressif.com/projects/esp-dsp/en/latest/esp-dsp-apis.html#fft), [example](https://github.com/espressif/esp-dsp/tree/master/examples/fft) -- IIR: [reference](https://docs.espressif.com/projects/esp-dsp/en/latest/esp-dsp-apis.html#iir), [example](https://github.com/espressif/esp-dsp/tree/master/examples/iir) -- FIR: [reference](https://docs.espressif.com/projects/esp-dsp/en/latest/esp-dsp-apis.html#fir) -- Vector math operations: [reference](https://docs.espressif.com/projects/esp-dsp/en/latest/esp-dsp-apis.html#math) - -Many of the library functions are written in assembly and are optimized for the CPU configuration used in the ESP32. In addition to the optimized implementations, reference implementations written in ANSI C are provided. - -Function implementations are provided for single precision floating point (32-bit float), and 16-bit signed integers. - -## Documentation - -- [ESP-DSP Overview](https://docs.espressif.com/projects/esp-dsp/en/latest/esp-dsp-library.html) -- [ESP-DSP API Reference](https://docs.espressif.com/projects/esp-dsp/en/latest/esp-dsp-apis.html) -- [ESP-DSP Benchmarks](https://docs.espressif.com/projects/esp-dsp/en/latest/esp-dsp-benchmarks.html) - -Documentation found in the above links is automatically generated from the contents of this repository. If you find that some information is missing or incomplete, please report an issue. - -## Installation and Usage - -The ESP-DSP library is a component for the [ESP-IDF build system](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html). It also works with the [new CMake-based build system](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system-cmake.html). - -### Trying out ESP-DSP examples - -If you haven't created an ESP-IDF project yet, and wish to try the examples provided with ESP-DSP, you can clone ESP-DSP repository into any directory, and then run examples from there: - - cd ~/esp - git clone https://github.com/espressif/esp-dsp.git - cd esp-dsp/examples/dotprod - make -j4 flash monitor ESPPORT=PORT - -or, if you are using CMake based build system, - - idf.py -p PORT flash monitor - -where `PORT` is the UART port name of your development board, such as `/dev/ttyUSB0` or `COM1`. - -Note that you need to set up environment variables (`IDF_PATH`, `PATH`) before building the project. Refer to the [ESP-IDF Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/index.html) if you don't have the environment set up yet. - -For the list of the examples, please see [README.md](examples/README.md) in the examples directory. - -### Including ESP-DSP into your own project - -To include ESP-DSP into your ESP-IDF project, clone ESP-DSP repository (or add it as a submodule) into the components directory of the project: - - cd your-project-directory - mkdir -p components - cd components - git clone https://github.com/espressif/esp-dsp.git - -ESP-IDF build system also allows including components which are not located in the project components directory, using `EXTRA_COMPONENT_DIRS` project variable. Please refer to the [ESP-IDF build system documentation](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/build-system.html) for details. - -## Reporting Issues - -If you have found an issue in ESP-DSP, or wish to submit an enhancement request, please use the [Issues](https://github.com/espressif/esp-dsp/issues) section on Github. - -For general questions related to this library, please use the [esp32.com forum](https://esp32.com/). - -## Copyrights and License - -All original source code in this repository is Copyright (C) 2018-2019 Espressif Systems. This source code is licensed under the Apache License 2.0 as described in the file LICENSE. diff --git a/components/esp-dsp/build_examples.sh b/components/esp-dsp/build_examples.sh deleted file mode 100644 index 47974d8f..00000000 --- a/components/esp-dsp/build_examples.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -# -# Build all examples from the examples directory. -# -# ----------------------------------------------------------------------------- -# Safety settings (see https://gist.github.com/ilg-ul/383869cbb01f61a51c4d). - -if [[ ! -z ${DEBUG_SHELL} ]] -then - set -x # Activate the expand mode if DEBUG is anything but empty. -fi - -set -o errexit # Exit if command failed. -set -o pipefail # Exit if pipe failed. -set -o nounset # Exit if variable not set. - -# Remove the initial space and instead use '\n'. -IFS=$'\n\t' - -STARS='***************************************************' - -# ----------------------------------------------------------------------------- - -die() { - echo "${1:-"Unknown Error"}" 1>&2 - exit 1 -} - -pushd examples - -EXAMPLES=$(find . -maxdepth 1 -mindepth 1 -type d | cut -d '/' -f 2) - -for NAME in ${EXAMPLES} -do - echo "$STARS" - echo "Building example $NAME with Make" - pushd $NAME - # -j option will be set via MAKEFLAGS in .gitlab-ci.yml - make defconfig && make || die "Make build for ${NAME} has failed" - rm -rf build - echo "$STARS" - echo "Building example $NAME with CMake for Esp32" - idf.py set-target esp32 - idf.py build || die "CMake build for ${NAME} has failed for Esp32" - echo "Building example $NAME with CMake for Esp32-s2" - idf.py clean - idf.py set-target esp32s2 - idf.py build || die "CMake build for ${NAME} has failed for Esp32-s2" - popd -done - -popd diff --git a/components/esp-dsp/component.mk b/components/esp-dsp/component.mk deleted file mode 100644 index d8730b63..00000000 --- a/components/esp-dsp/component.mk +++ /dev/null @@ -1,87 +0,0 @@ -COMPONENT_ADD_INCLUDEDIRS := modules/dotprod/include \ - modules/support/include \ - modules/windows/include \ - modules/windows/hann/include \ - modules/windows/blackman/include \ - modules/windows/blackman_harris/include \ - modules/windows/blackman_nuttall/include \ - modules/windows/nuttall/include \ - modules/windows/flat_top/include \ - modules/iir/include \ - modules/fir/include \ - modules/math/include \ - modules/math/add/include \ - modules/math/sub/include \ - modules/math/mul/include \ - modules/math/addc/include \ - modules/math/mulc/include \ - modules/math/sqrt/include \ - modules/matrix/include \ - modules/fft/include \ - modules/dct/include \ - modules/conv/include \ - modules/common/include - -COMPONENT_SRCDIRS :=. \ - modules/common \ - modules/common/misc \ - modules/dotprod \ - modules/dotprod/float \ - modules/dotprod/fixed \ - modules/matrix \ - modules/matrix/float \ - modules/matrix/fixed \ - modules/matrix/mat \ - modules/math \ - modules/math/mulc \ - modules/math/mulc/float \ - modules/math/mulc/fixed \ - modules/math/addc \ - modules/math/addc/float \ - modules/math/add \ - modules/math/add/float \ - modules/math/add/fixed \ - modules/math/mul \ - modules/math/mul/float \ - modules/math/mul/fixed \ - modules/math/sub \ - modules/math/sub/float \ - modules/math/sqrt/float \ - modules/fft/float \ - modules/fft/fixed \ - modules/support \ - modules/support/snr/float \ - modules/support/sfdr/float \ - modules/support/misc \ - modules/support/view \ - modules/windows/hann \ - modules/windows/hann/float \ - modules/windows/hann/fixed \ - modules/windows/blackman \ - modules/windows/blackman/float \ - modules/windows/blackman/fixed \ - modules/windows/blackman_harris \ - modules/windows/blackman_harris/float \ - modules/windows/blackman_harris/fixed \ - modules/windows/blackman_nuttall \ - modules/windows/blackman_nuttall/float \ - modules/windows/blackman_nuttall/fixed \ - modules/windows/nuttall \ - modules/windows/nuttall/float \ - modules/windows/nuttall/fixed \ - modules/windows/flat_top \ - modules/windows/flat_top/float \ - modules/windows/flat_top/fixed \ - modules/conv \ - modules/conv/float \ - modules/dct \ - modules/dct/float \ - modules/iir \ - modules/iir/biquad \ - modules/fir \ - modules/fir/float - -COMPONENT_PRIV_INCLUDEDIRS := modules/dotprod/float \ - modules/dotprod/fixed \ - modules/common/private_include - diff --git a/components/esp-dsp/docs/Doxyfile b/components/esp-dsp/docs/Doxyfile deleted file mode 100644 index b276c24f..00000000 --- a/components/esp-dsp/docs/Doxyfile +++ /dev/null @@ -1,109 +0,0 @@ -# This is Doxygen configuration file -# -# Doxygen provides over 260 configuration statements -# To make this file easier to follow, -# it contains only statements that are non-default -# -# NOTE: -# It is recommended not to change defaults unless specifically required -# Test any changes how they affect generated documentation -# Make sure that correct warnings are generated to flag issues with documented code -# -# For the complete list of configuration statements see: -# https://www.stack.nl/~dimitri/doxygen/manual/config.html - - -PROJECT_NAME = "Espressif DSP Library" - -## The 'INPUT' statement below is used as input by script 'gen-df-input.py' -## to automatically generate API reference list files heder_file.inc -## These files are placed in '_inc' directory -## and used to include in API reference documentation - -INPUT = \ - ## - ## Common - API Reference - ## - ../modules/common/include/dsp_common.h \ - ## Dot Product - API Reference - ../modules/dotprod/include/dsps_dotprod.h \ - ## FFT - API Reference - ../modules/fft/include/dsps_fft2r.h \ - ## DCT - API Reference - ../modules/dct/include/dsps_dct.h \ - ## FIR Filter - API Reference - ../modules/fir/include/dsps_fir.h \ - ## IIR Filter - API Reference - ../modules/iir/include/dsps_biquad_gen.h \ - ../modules/iir/include/dsps_biquad.h \ - ## Math - API Reference - ../modules/math/mulc/include/dsps_mulc.h \ - ../modules/math/addc/include/dsps_addc.h \ - ../modules/math/add/include/dsps_add.h \ - ../modules/math/sub/include/dsps_sub.h \ - ../modules/math/mul/include/dsps_mul.h \ - ## Matrix - API Reference - ../modules/matrix/include/dspm_mult.h \ - ../modules/matrix/include/mat.h \ - ## Convolution/Cprrelation - API Reference - ../modules/conv/include/dsps_conv.h \ - ../modules/conv/include/dsps_corr.h \ - ## Support - API Reference - ../modules/support/include/dsps_view.h \ - ../modules/support/include/dsps_tone_gen.h \ - ../modules/support/include/dsps_snr.h \ - ../modules/support/include/dsps_sfdr.h \ - ../modules/support/include/dsps_d_gen.h \ - ../modules/support/include/dsps_h_gen.h \ - ## Windows - API Reference - ../modules/windows/hann/include/dsps_wind_hann.h \ - ../modules/windows/blackman/include/dsps_wind_blackman.h \ - ../modules/windows/blackman_harris/include/dsps_wind_blackman_harris.h \ - ../modules/windows/blackman_nuttall/include/dsps_wind_blackman_nuttall.h \ - ../modules/windows/nuttall/include/dsps_wind_nuttall.h \ - ../modules/windows/flat_top/include/dsps_wind_flat_top.h - - -## Get warnings for functions that have no documentation for their parameters or return value -## -WARN_NO_PARAMDOC = YES - -## Enable preprocessing and remove __attribute__(...) expressions from the INPUT files -## -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = YES -EXPAND_ONLY_PREDEF = YES -PREDEFINED = \ - __attribute__(x)= \ - IRAM_ATTR= \ - configSUPPORT_DYNAMIC_ALLOCATION=1 \ - configSUPPORT_STATIC_ALLOCATION=1 \ - configQUEUE_REGISTRY_SIZE=1 \ - configUSE_RECURSIVE_MUTEXES=1 \ - configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS=1 \ - configNUM_THREAD_LOCAL_STORAGE_POINTERS=1 \ - configUSE_APPLICATION_TASK_TAG=1 \ - configTASKLIST_INCLUDE_COREID=1 - -## Do not complain about not having dot -## -HAVE_DOT = NO - -## Generate XML that is required for Breathe -## -GENERATE_XML = YES -XML_OUTPUT = xml - -GENERATE_HTML = NO -HAVE_DOT = NO -GENERATE_LATEX = NO -GENERATE_MAN = YES -GENERATE_RTF = NO - -## Skip distracting progress messages -## -QUIET = YES -## Log warnings in a file for further review -## -WARN_LOGFILE = "doxygen-warning-log.txt" - diff --git a/components/esp-dsp/docs/Makefile b/components/esp-dsp/docs/Makefile deleted file mode 100644 index cce4db51..00000000 --- a/components/esp-dsp/docs/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -LANGUAGE=en -include docs_common.mk diff --git a/components/esp-dsp/docs/check_doc_warnings.sh b/components/esp-dsp/docs/check_doc_warnings.sh deleted file mode 100644 index e8680da1..00000000 --- a/components/esp-dsp/docs/check_doc_warnings.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# -# Check for Documentation warnings: -# doxygen-warning-log.txt should be an empty file -# sphinx-warning-log.txt should only contain (fuzzy) matches to ../sphinx-known-warnings.txt -RESULT=0 -STARS='***************************************************' - -if [ -s doxygen-warning-log.txt ]; then - echo "$STARS" - echo "Build failed due to doxygen warnings:" - cat doxygen-warning-log.txt - echo "$STARS" - RESULT=1 -fi - - -SED=sed -os_name=`uname -s` -if [[ "${os_name}" == "Darwin" ]]; then - SED=gsed -fi - -# Remove escape characters, file paths, line numbers from -# the Sphinx warning log -# (escape char removal from https://www.commandlinefu.com/commands/view/6141/remove-color-codes-special-characters-with-sed -${SED} -r 's:\x1B\[[0-9;]*[mK]::g' sphinx-warning-log.txt | \ - ${SED} -E "s~${IDF_PATH}~\${IDF_PATH}~" | \ - ${SED} -E "s/:[0-9]+:/:line:/" > sphinx-warning-log-sanitized.txt - -# diff sanitized warnings, ignoring lines which only appear in ../sphinx-known-warnings.txt - -# format is to display only lines new or changed in second argument -DIFF_FORMAT="--unchanged-line-format= --old-line-format= --new-line-format=%L" - -SPHINX_WARNINGS=$(diff $DIFF_FORMAT sphinx-known-warnings.txt sphinx-warning-log-sanitized.txt) -if ! [ -z "$SPHINX_WARNINGS" ]; then - echo "$STARS" - echo "Build failed due to new/different Sphinx warnings:" - echo "$SPHINX_WARNINGS" - echo "$STARS" - RESULT=1 - echo "(Check files sphinx-known-warnings.txt and sphinx-warning-log.txt for full details.)" -fi - -exit $RESULT diff --git a/components/esp-dsp/docs/conf.py b/components/esp-dsp/docs/conf.py deleted file mode 100644 index 08b3e3cf..00000000 --- a/components/esp-dsp/docs/conf.py +++ /dev/null @@ -1,19 +0,0 @@ -# -*- coding: utf-8 -*- -# -# English Language RTD & Sphinx config file -# -# Uses IDF_PATH/conf_common.py for most non-language-specific settings. - -# Importing conf_common adds all the non-language-specific -# parts to this conf module -import sys, os -sys.path.insert(0, os.path.abspath('.')) -from conf_common import * - -# General information about the project. -project = u'Espressif DSP Library' -copyright = u'2016 - 2018, Espressif Systems (Shanghai) PTE LTD' - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -language = 'en' diff --git a/components/esp-dsp/docs/conf_common.py b/components/esp-dsp/docs/conf_common.py deleted file mode 100644 index 4c2f1e6f..00000000 --- a/components/esp-dsp/docs/conf_common.py +++ /dev/null @@ -1,317 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Common (non-language-specific) configuration for Read The Docs & Sphinx -# -# Based on a Read the Docs Template documentation build configuration file, -# created by sphinx-quickstart on Tue Aug 26 14:19:49 2014. -# -# This file is imported from a language-specific conf.py (ie en/conf.py or -# zh_CN/conf.py) -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -from __future__ import print_function -from __future__ import unicode_literals -import sys, os -import re -import subprocess -import shlex - -# Note: If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute -sys.path.insert(0, os.path.abspath('.')) -from local_util import run_cmd_get_output, copy_if_modified - -# build_docs on the CI server sometimes fails under Python3. This is a workaround: -sys.setrecursionlimit(3500) - -try: - builddir = os.environ['BUILDDIR'] -except KeyError: - builddir = '_build' - -def call_with_python(cmd): - # using sys.executable ensures that the scripts are called with the same Python interpreter - if os.system('{} {}'.format(sys.executable, cmd)) != 0: - raise RuntimeError('{} failed'.format(cmd)) - -# Call Doxygen to get XML files from the header files -print("Calling Doxygen to generate latest XML files") -if os.system("doxygen Doxyfile") != 0: - raise RuntimeError('Doxygen call failed') - -# Doxygen has generated XML files in 'xml' directory. -# Copy them to 'xml_in', only touching the files which have changed. -copy_if_modified('xml/', 'xml_in/') - -# Generate 'api_name.inc' files using the XML files by Doxygen -call_with_python('gen-dxd.py') - - -# http://stackoverflow.com/questions/12772927/specifying-an-online-image-in-sphinx-restructuredtext-format -# -suppress_warnings = ['image.nonlocal_uri'] - -# -- General configuration ------------------------------------------------ - -# If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = ['breathe', 'link-roles' ] - -# Enabling this fixes cropping of blockdiag edge labels -seqdiag_antialias = True - -# Breathe extension variables - -# Doxygen regenerates files in 'xml/' directory every time, -# but we copy files to 'xml_in/' only when they change, to speed up -# incremental builds. -breathe_projects = { "esp32-idf": "xml_in/" } -breathe_default_project = "esp32-idf" - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# The suffix of source filenames. -source_suffix = ['.rst', '.md'] - -source_parsers = { - '.md': 'recommonmark.parser.CommonMarkParser', - } - -# The encoding of source files. -#source_encoding = 'utf-8-sig' - -# The master toctree document. -master_doc = 'index' - - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# - -# Readthedocs largely ignores 'version' and 'release', and displays one of -# 'latest', tag name, or branch name, depending on the build type. -# Still, this is useful for non-RTD builds. -# This is supposed to be "the short X.Y version", but it's the only version -# visible when you open index.html. -# Display full version to make things less confusing. -version = run_cmd_get_output('git describe') -# The full version, including alpha/beta/rc tags. -# If needed, nearest tag is returned by 'git describe --abbrev=0'. -release = version -print('Version: {0} Release: {1}'.format(version, release)) - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -#today = '' -# Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -exclude_patterns = ['_build', 'issue_template.md'] - -# The reST default role (used for this markup: `text`) to use for all -# documents. -#default_role = None - -# If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -#add_module_names = True - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -#show_authors = False - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' - -# A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] - -# If true, keep warnings as "system message" paragraphs in the built documents. -#keep_warnings = False - - -# -- Options for HTML output ---------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -html_theme = 'sphinx_rtd_theme' - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -#html_theme_options = {} - -# Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] - -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -#html_title = None - -# A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None - -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -#html_logo = idf_path + "/docs/_static/espressif-logo.svg" - -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -#html_favicon = None - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -#html_static_path = [idf_path + '/docs/_static'] - -# Add any extra paths that contain custom files (such as robots.txt or -# .htaccess) here, relative to this directory. These files are copied -# directly to the root of the documentation. -#html_extra_path = [] - -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -#html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -#html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -#html_additional_pages = {} - -# If false, no module index is generated. -#html_domain_indices = True - -# If false, no index is generated. -#html_use_index = True - -# If true, the index is split into individual pages for each letter. -#html_split_index = False - -# If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True - -# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True - -# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -#html_use_opensearch = '' - -# This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None - -# Output file base name for HTML help builder. -htmlhelp_basename = 'ReadtheDocsTemplatedoc' - - -# -- Options for LaTeX output --------------------------------------------- - -latex_elements = { -# The paper size ('letterpaper' or 'a4paper'). -#'papersize': 'letterpaper', - -# The font size ('10pt', '11pt' or '12pt'). -#'pointsize': '10pt', - -# Additional stuff for the LaTeX preamble. -#'preamble': '', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - ('index', 'ReadtheDocsTemplate.tex', u'Read the Docs Template Documentation', - u'Read the Docs', 'manual'), -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -#latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -#latex_use_parts = False - -# If true, show page references after internal links. -#latex_show_pagerefs = False - -# If true, show URL addresses after external links. -#latex_show_urls = False - -# Documents to append as an appendix to all manuals. -#latex_appendices = [] - -# If false, no module index is generated. -#latex_domain_indices = True - - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - ('index', 'readthedocstemplate', u'Read the Docs Template Documentation', - [u'Read the Docs'], 1) -] - -# If true, show URL addresses after external links. -#man_show_urls = False - - -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - ('index', 'ReadtheDocsTemplate', u'Read the Docs Template Documentation', - u'Read the Docs', 'ReadtheDocsTemplate', 'One line description of project.', - 'Miscellaneous'), -] - -# Documents to append as an appendix to all manuals. -#texinfo_appendices = [] - -# If false, no module index is generated. -#texinfo_domain_indices = True - -# How to display URL addresses: 'footnote', 'no', or 'inline'. -#texinfo_show_urls = 'footnote' - -# If true, do not generate a @detailmenu in the "Top" node's menu. -#texinfo_no_detailmenu = False - -# Override RTD CSS theme to introduce the theme corrections -# https://github.com/rtfd/sphinx_rtd_theme/pull/432 -# def setup(app): -# app.add_stylesheet('theme_overrides.css') -# generate_version_specific_includes(app) diff --git a/components/esp-dsp/docs/docs_common.mk b/components/esp-dsp/docs/docs_common.mk deleted file mode 100644 index 79d4baa9..00000000 --- a/components/esp-dsp/docs/docs_common.mk +++ /dev/null @@ -1,214 +0,0 @@ -# "Common" Makefile for Sphinx documentation -# -# (included from en/Makefile & zh_CN/Makefile -# -# NOTE: This makefile runs with cwd=either en or zh_CN subfolder, so this -# (docs/) directory is '..' relative to it. - -# ************ IMPORTANT ***************** -# -# ReadTheDocs DOES NOT USE THIS MAKEFILE, -# so any behaviour additions must be -# done via Sphinx Config not here -# -# **************************************** - -# You can set these variables from the command line. -SPHINXOPTS = -# note: this is changed from sphinx-build so it depends on default python interpreter, not on /bin/sphinx-build -# (which will be the most recently installed version of sphinx and may not match) -SPHINXBUILD = python -m sphinx -PAPER = -BUILDDIR = _build - -# Internal variables. -PAPEROPT_a4 = -D latex_paper_size=a4 -PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) -w sphinx-warning-log.txt . -# the i18n builder cannot share the environment and doctrees with the others -I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . - -.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext dependencies version-specific-includes check_python_packages - -help: - @echo "Please use \`make \' where is one of" - @echo " html to make standalone HTML files" - @echo " dirhtml to make HTML files named index.html in directories" - @echo " singlehtml to make a single large HTML file" - @echo " pickle to make pickle files" - @echo " json to make JSON files" - @echo " htmlhelp to make HTML files and a HTML help project" - @echo " qthelp to make HTML files and a qthelp project" - @echo " devhelp to make HTML files and a Devhelp project" - @echo " epub to make an epub" - @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" - @echo " latexpdf to make LaTeX files and run them through pdflatex" - @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" - @echo " text to make text files" - @echo " man to make manual pages" - @echo " texinfo to make Texinfo files" - @echo " info to make Texinfo files and run them through makeinfo" - @echo " gettext to make PO message catalogs" - @echo " changes to make an overview of all changed/added/deprecated items" - @echo " xml to make Docutils-native XML files" - @echo " pseudoxml to make pseudoxml-XML files for display purposes" - @echo " linkcheck to check all external links for integrity" - @echo " doctest to run all doctests embedded in the documentation (if enabled) " - -clean: - rm -rf $(BUILDDIR)/* - -check_python_packages: - true - -html: | check_python_packages - @echo "Build the HTML pages are in $(BUILDDIR)/html." - $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." - -dirhtml: | check_python_packages - $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." - -singlehtml: | check_python_packages - $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml - @echo - @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." - -pickle: | check_python_packages - $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle - @echo - @echo "Build finished; now you can process the pickle files." - -json: | check_python_packages - $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json - @echo - @echo "Build finished; now you can process the JSON files." - -htmlhelp: | check_python_packages - $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp - @echo - @echo "Build finished; now you can run HTML Help Workshop with the" \ - ".hhp project file in $(BUILDDIR)/htmlhelp." - -qthelp: | check_python_packages - $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp - @echo - @echo "Build finished; now you can run "qcollectiongenerator" with the" \ - ".qhcp project file in $(BUILDDIR)/qthelp, like this:" - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/ReadtheDocsTemplate.qhcp" - @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/ReadtheDocsTemplate.qhc" - -devhelp: | check_python_packages - $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp - @echo - @echo "Build finished." - @echo "To view the help file:" - @echo "# mkdir -p $$HOME/.local/share/devhelp/ReadtheDocsTemplate" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/ReadtheDocsTemplate" - @echo "# devhelp" - -epub: | check_python_packages - $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub - @echo - @echo "Build finished. The epub file is in $(BUILDDIR)/epub." - -latex: | check_python_packages - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo - @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." - @echo "Run \`make' in that directory to run these through (pdf)latex" \ - "(use \`make latexpdf' here to do that automatically)." - -latexpdf: | check_python_packages - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through pdflatex..." - $(MAKE) -C $(BUILDDIR)/latex all-pdf - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." - -latexpdfja: | check_python_packages - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through platex and dvipdfmx..." - $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." - -text: | check_python_packages - $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text - @echo - @echo "Build finished. The text files are in $(BUILDDIR)/text." - -man: | check_python_packages - $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man - @echo - @echo "Build finished. The manual pages are in $(BUILDDIR)/man." - -texinfo: | check_python_packages - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo - @echo - @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." - @echo "Run \`make' in that directory to run these through makeinfo" \ - "(use \`make info' here to do that automatically)." - -info: | check_python_packages - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo - @echo "Running Texinfo files through makeinfo..." - make -C $(BUILDDIR)/texinfo info - @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." - -gettext: | check_python_packages - $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale - @echo - @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." - -changes: | check_python_packages - $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes - @echo - @echo "The overview file is in $(BUILDDIR)/changes." - -linkcheck: | check_python_packages - $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck - @echo - @echo "Link check complete; look for any errors in the above output " \ - "or in $(BUILDDIR)/linkcheck/output.txt." - -gh-linkcheck: | check_python_packages - @echo "Checking for hardcoded GitHub links" - @if (find ../ -name '*.rst' | xargs grep \ - 'https://github.com/espressif/esp-idf/tree\|https://github.com/espressif/esp-idf/blob\|https://github.com/espressif/esp-idf/raw'\ - ); \ - then \ - echo "WARNINIG: Some .rst files contain hardcoded Github links."; \ - echo "Please check above output and replace links with one of the following:"; \ - echo "- :idf:\`dir\` - points to directory inside ESP-IDF"; \ - echo "- :idf_file:\`file\` - points to file inside ESP-IDF"; \ - echo "- :idf_raw:\`file\` - points to raw view of the file inside ESP-IDF"; \ - echo "- :component:\`dir\` - points to directory inside ESP-IDF components dir"; \ - echo "- :component_file:\`file\` - points to file inside ESP-IDF components dir"; \ - echo "- :component_raw:\`file\` - points to raw view of the file inside ESP-IDF"; \ - echo " components dir"; \ - echo "- :example:\`dir\` - points to directory inside ESP-IDF examples dir"; \ - echo "- :example_file:\`file\` - points to file inside ESP-IDF examples dir"; \ - echo "- :example_raw:\`file\` - points to raw view of the file inside ESP-IDF"; \ - echo " examples dir"; \ - echo "These link types will point to the correct GitHub version automatically"; \ - exit 1; \ - fi - @echo "No hardcoded links found" - -doctest: | check_python_packages - $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest - @echo "Testing of doctests in the sources finished, look at the " \ - "results in $(BUILDDIR)/doctest/output.txt." - -xml: | check_python_packages - $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml - @echo - @echo "Build finished. The XML files are in $(BUILDDIR)/xml." - -pseudoxml: | check_python_packages - $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml - @echo - @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." diff --git a/components/esp-dsp/docs/esp-dsp-apis.rst b/components/esp-dsp/docs/esp-dsp-apis.rst deleted file mode 100644 index ad19cf9a..00000000 --- a/components/esp-dsp/docs/esp-dsp-apis.rst +++ /dev/null @@ -1,108 +0,0 @@ -Espressif DSP Library API Reference -=================================== - -Header Files ------------- - -To use the library, include ``esp_dsp.h`` header file into the source code. - -* :repo_file:`modules/common/include/esp_dsp.h` - - -Signal (1D) Processing APIs ----------------------------- - -Signal processing APIs use ``dsps`` prefix. The following modules are available: - -- Dot-product_ - Calculates dot-product of two vectors -- FFT_ - Fast Fourier Transform functionality -- DCT_ - Discrete Cosine Transform functionality -- IIR_ - IIR filter functionality -- FIR_ - FIR filter functionality -- Math_ - Basic vector operations -- Conv_ - Convolution/correlation functionality -- Support_ - Support functions -- `Window functions`_ - FFT window generation functions - -Dot-product -+++++++++++ - -.. include:: /_build/inc/dsps_dotprod.inc - -FFT -+++ - -.. include:: /_build/inc/dsps_fft2r.inc - -DCT -+++ - -.. include:: /_build/inc/dsps_dct.inc - -FIR -+++ - -.. include:: /_build/inc/dsps_fir.inc - -IIR -+++ - -.. include:: /_build/inc/dsps_biquad_gen.inc -.. include:: /_build/inc/dsps_biquad.inc - -Math -++++ - -.. include:: /_build/inc/dsps_add.inc -.. include:: /_build/inc/dsps_sub.inc -.. include:: /_build/inc/dsps_mul.inc -.. include:: /_build/inc/dsps_addc.inc -.. include:: /_build/inc/dsps_mulc.inc - -Conv -++++ - -.. include:: /_build/inc/dsps_conv.inc -.. include:: /_build/inc/dsps_corr.inc - -Support -+++++++ - -.. include:: /_build/inc/dsps_d_gen.inc -.. include:: /_build/inc/dsps_h_gen.inc -.. include:: /_build/inc/dsps_tone_gen.inc -.. include:: /_build/inc/dsps_view.inc -.. include:: /_build/inc/dsps_snr.inc -.. include:: /_build/inc/dsps_sfdr.inc - -Window Functions -++++++++++++++++ - -.. include:: /_build/inc/dsps_wind_hann.inc - -Matrix Operations APIs ----------------------- - -Matrix operations APIs use ``dspm`` prefix. The following modules are available: - -- Multiplication - basic matrix multiplication operations - -Matrix Multiplication -+++++++++++++++++++++ - -.. include:: /_build/inc/dspm_mult.inc - -Matrix Operations -+++++++++++++++++++++ - -.. include:: /_build/inc/mat.inc - -Miscellaneous -------------- - -Various common functions used by other modules are included in this module. - -Common APIs -+++++++++++ - -.. include:: /_build/inc/dsp_common.inc diff --git a/components/esp-dsp/docs/esp-dsp-benchmarks.rst b/components/esp-dsp/docs/esp-dsp-benchmarks.rst deleted file mode 100644 index 8217d9a3..00000000 --- a/components/esp-dsp/docs/esp-dsp-benchmarks.rst +++ /dev/null @@ -1,66 +0,0 @@ -Espressif DSP Library Benchmarks -================================ - -The table bellow contains benchmarks of functions provided by ESP-DSP library. The values are CPU cycle counts taken to execute each of the functions. Values in "ESP32" column are for the optimized (assembly) implementation, values in "ANSI C" column are for the non-optimized implementation. - -+----------------------------------------------------------+----------+----------+ -| Function name and arguments | CPU cycles | -+----------------------------------------------------------+----------+----------+ -| | ESP32 | ANSI C | -+==========================================================+==========+==========+ -| | | | -+----------------------------------------------------------+----------+----------+ -| **Dot Product** | | | -+----------------------------------------------------------+----------+----------+ -| dsps_dotprod_f32 for N=256 points | 1057 | 2597 | -+----------------------------------------------------------+----------+----------+ -| dsps_dotprode_f32 for N=256 points, with step 1 | 1318 | 2601 | -+----------------------------------------------------------+----------+----------+ -| dsps_dotprod_s16 for N=256 points | 448 | 5185 | -+----------------------------------------------------------+----------+----------+ -| | | | -+----------------------------------------------------------+----------+----------+ -| **FIR Filters** | | | -+----------------------------------------------------------+----------+----------+ -| dsps_fir_f32 1024 input samples and 256 coefficients | 1338418 | 3583556 | -+----------------------------------------------------------+----------+----------+ -| dsps_fird_f32 1024 samples, 256 coeffs and decimation 4 | 37582 | 82535 | -+----------------------------------------------------------+----------+----------+ -| | | | -+----------------------------------------------------------+----------+----------+ -| **FFTs** | | | -+----------------------------------------------------------+----------+----------+ -| dsps_fft2r_fc32 for 64 complex points | 5451 | 8187 | -+----------------------------------------------------------+----------+----------+ -| dsps_fft2r_fc32 for 128 complex points | 12400 | 18756 | -+----------------------------------------------------------+----------+----------+ -| dsps_fft2r_fc32 for 256 complex points | 27829 | 42381 | -+----------------------------------------------------------+----------+----------+ -| dsps_fft2r_fc32 for 512 complex points | 61755 | 94616 | -+----------------------------------------------------------+----------+----------+ -| dsps_fft2r_fc32 for 1024 complex points | 135745 | 209058 | -+----------------------------------------------------------+----------+----------+ -| | | | -+----------------------------------------------------------+----------+----------+ -| **IIR Filters** | | | -+----------------------------------------------------------+----------+----------+ -| dsps_biquad_f32 - biquad filter for 1024 input samples | 17451 | 31778 | -+----------------------------------------------------------+----------+----------+ -| | | | -+----------------------------------------------------------+----------+----------+ -| **Matrix Multiplication** | | | -+----------------------------------------------------------+----------+----------+ -| dspm_mult_f32 - C[16,16] = A[16,16]*B[16,16]; | 24669 | 59690 | -+----------------------------------------------------------+----------+----------+ -| dspm_mult_s16 - C[16,16] = A[16,16]*B[16,16]; | 24964 | 114150 | -+----------------------------------------------------------+----------+----------+ -| dspm_mult_3x3x1_f32 - C[3,1] = A[3,3]*B[3,1]; | 80 | 242 | -+----------------------------------------------------------+----------+----------+ -| dspm_mult_3x3x3_f32 - C[3,3] = A[3,3]*B[3,3]; | 212 | 541 | -+----------------------------------------------------------+----------+----------+ -| dspm_mult_4x4x1_f32 - C[4,1] = A[4,4]*B[4,1]; | 112 | 362 | -+----------------------------------------------------------+----------+----------+ -| dspm_mult_4x4x4_f32 - C[4,4] = A[4,4]*B[4,4]; | 404 | 1130 | -+----------------------------------------------------------+----------+----------+ - -The benchmark test could be reproduced by executing test cases found in :repo_file:`test/test_dsp.c`. diff --git a/components/esp-dsp/docs/esp-dsp-library.rst b/components/esp-dsp/docs/esp-dsp-library.rst deleted file mode 100644 index 190c0542..00000000 --- a/components/esp-dsp/docs/esp-dsp-library.rst +++ /dev/null @@ -1,78 +0,0 @@ -Espressif DSP Library -===================== - -Overview --------- -An Espressif DSP Library (esp-dsp) it's library of functions, modules and components that provides possibility -to use Espressif's CPUs as DSPs in efficient way. - - -Function Naming ---------------- -Naming conventions for the Library functions are similar for all covered domains. You can distinguish signal processing functions by the dsps prefix, while image and video processing functions have dspi prefix, -and functions that are specific for operations on small matrices have dspm prefix in their names. Function names in Library have the following general format: - -dsp___[_]<_impl>(); - -The elements of this format are explained in the sections that follow. - -Data-Domain -^^^^^^^^^^^ - -The data-domain is a single character that expresses the subset of functionality to which a given function belongs. The Library designed to supports the following data-domains: - - - s - for signals (expected data type is a 1D signal) - - i - for images and video (expected data type is a 2D image) - - m - for matrices (expected data type is a matrix) - - r - for realistic rendering functionality and 3D data processing (expected data type depends on supported rendering techniques) - - q - for signals of fixed length - -For example, function names that begin with dspi signify that respective functions are used for image or video processing. - -Name -^^^^ - -The name is an abbreviation for the core operation that the function really does, for example Add, Sqrt, -followed in some cases by a function-specific modifier: = [_modifier] - -This modifier, if present, denotes a slight modification or variation of the given function. - -Data Types -^^^^^^^^^^ - -The library supports two main data types – int16 for fixed point arithmetic and float for floating point arithmetic. The datatype described as: - -Data type suffices: -^^^^^^^^^^^^^^^^^^^ - - s - signed - - u - unsigned - - f - float - -Data type extensions: -^^^^^^^^^^^^^^^^^^^^^ - - c - complex - -Data type Bits resolution: -^^^^^^^^^^^^^^^^^^^^^^^^^^ - - 16 - - 32 - -For example: dsps_mac_sc16 defines that mac operation with 1d array will be made with 16 bit signed complex data. - -Implementation Type -^^^^^^^^^^^^^^^^^^^ -Each function could be implemented different for different platform and could use different style and resources. -That's why every implemented function will have name extension <_impl> that will define which kind of implementation it is. -User can use universal function without extension. - -Implementation extensions: -^^^^^^^^^^^^^^^^^^^^^^^^^^ -By default all functions could be used without extensions. The option that select optimized/ansi can be chosen in menuconfig. - -Inside library the extensions means: - - _ansi - a universal function where body of function implemented on ANSI C. This implementation not includes any hardware optimization - - _ae32 - written on ESP32 assembler and optimized for ESP32 - - _platform - header file with definitions of available CPUs instructions for different functions - - others- depends on amount of supported CPUs. This list will be extended in future - - diff --git a/components/esp-dsp/docs/gen-dxd.py b/components/esp-dsp/docs/gen-dxd.py deleted file mode 100644 index cb2b5429..00000000 --- a/components/esp-dsp/docs/gen-dxd.py +++ /dev/null @@ -1,318 +0,0 @@ -#!/usr/bin/env python -# -# gen-dxd.py - Generate Doxygen Directives -# -# This code is in the Public Domain (or CC0 licensed, at your option.) -# Unless required by applicable law or agreed to in writing, this -# software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR -# CONDITIONS OF ANY KIND, either express or implied. -# - -from __future__ import print_function -from __future__ import unicode_literals -from builtins import range -from io import open -import sys -import os -import re - -# Determime build directory -builddir = '_build' -if 'BUILDDIR' in os.environ: - builddir = os.environ['BUILDDIR'] - -# Script configuration -header_file_path_prefix = "../modules/" -"""string: path prefix for header files. -""" -doxyfile_path = "./Doxyfile" -"""string: path to a file containing header files to processs. -""" -xml_directory_path = "xml" -"""string: path to directory with XML files by Doxygen. -""" -inc_directory_path = os.path.join(builddir, 'inc') -"""string: path prefix for header files. -""" -all_kinds = [ - ("function", "Functions"), - ("union", "Unions"), - ("struct", "Structures"), - ("define", "Macros"), - ("typedef", "Type Definitions"), - ("enum", "Enumerations") - ] -"""list of items that will be generated for a single API file -""" - - -def get_doxyfile_input(): - """Get contents of Doxyfile's INPUT statement. - - Returns: - Contents of Doxyfile's INPUT. - - """ - if not os.path.isfile(doxyfile_path): - print("Doxyfile '%s' does not exist!" % doxyfile_path) - sys.exit() - - print("Getting Doxyfile's INPUT") - - input_file = open(doxyfile_path, "r", encoding='utf-8') - - line = input_file.readline() - # read contents of Doxyfile until 'INPUT' statement - while line: - if line.find("INPUT") == 0: - break - line = input_file.readline() - - doxyfile_INPUT = "" - line = input_file.readline() - # skip input_file contents until end of 'INPUT' statement - while line: - if line.isspace(): - # we have reached the end of 'INPUT' statement - break - # process only lines that are not comments - if line.find("#") == -1: - # extract header file path inside components folder - m = re.search(header_file_path_prefix + "(.*\.h)", line) - header_file_path = m.group(1) - doxyfile_INPUT += "modules/" + header_file_path + "\n" - # proceed reading next line - line = input_file.readline() - - input_file.close() - return doxyfile_INPUT - - -def get_api_name(header_file_path): - """Get name of API from header file path. - - Args: - header_file_path: path to the header file. - - Returns: - The name of API. - - """ - api_name = "" - regex = r".*/(.*)\.h" - m = re.search(regex, header_file_path) - if m: - api_name = m.group(1) - - return api_name - - -def get_rst_header(header_name): - """Get rst formatted code with a header. - - Args: - header_name: name of header. - - Returns: - Formatted rst code with the header. - - """ - - rst_output = "" - rst_output += header_name + "\n" - rst_output += "^" * len(header_name) + "\n" - rst_output += "\n" - - return rst_output - - -def select_unions(innerclass_list): - """Select unions from innerclass list. - - Args: - innerclass_list: raw list with unions and structures - extracted from Dogygen's xml file. - - Returns: - Doxygen directives with unions selected from the list. - - """ - - rst_output = "" - for line in innerclass_list.splitlines(): - # union is denoted by "union" at the beginning of line - if line.find("union") == 0: - union_id, union_name = re.split(r"\t+", line) - rst_output += ".. doxygenunion:: " - rst_output += union_name - rst_output += "\n" - - return rst_output - - -def select_structs(innerclass_list): - """Select structures from innerclass list. - - Args: - innerclass_list: raw list with unions and structures - extracted from Dogygen's xml file. - - Returns: - Doxygen directives with structures selected from the list. - Note: some structures are excluded as described on code below. - - """ - - rst_output = "" - for line in innerclass_list.splitlines(): - # structure is denoted by "struct" at the beginning of line - if line.find("struct") == 0: - # skip structures that are part of union - # they are documented by 'doxygenunion' directive - if line.find("::") > 0: - continue - struct_id, struct_name = re.split(r"\t+", line) - rst_output += ".. doxygenstruct:: " - rst_output += struct_name - rst_output += "\n" - rst_output += " :members:\n" - rst_output += "\n" - - return rst_output - - -def get_directives(tree, kind): - """Get directives for specific 'kind'. - - Args: - tree: the ElementTree 'tree' of XML by Doxygen - kind: name of API "kind" to be generated - - Returns: - Doxygen directives for selected 'kind'. - Note: the header with "kind" name is included. - - """ - - rst_output = "" - if kind in ["union", "struct"]: - innerclass_list = "" - for elem in tree.iterfind('compounddef/innerclass'): - innerclass_list += elem.attrib["refid"] + "\t" + elem.text + "\n" - if kind == "union": - rst_output += select_unions(innerclass_list) - else: - rst_output += select_structs(innerclass_list) - else: - for elem in tree.iterfind( - 'compounddef/sectiondef/memberdef[@kind="%s"]' % kind): - name = elem.find('name') - rst_output += ".. doxygen%s:: " % kind - rst_output += name.text + "\n" - if rst_output: - all_kinds_dict = dict(all_kinds) - rst_output = get_rst_header(all_kinds_dict[kind]) + rst_output + "\n" - - return rst_output - - -def generate_directives(header_file_path): - """Generate API reference with Doxygen directives for a header file. - - Args: - header_file_path: a path to the header file with API. - - Returns: - Doxygen directives for the header file. - - """ - - api_name = get_api_name(header_file_path) - - # in XLT file name each "_" in the api name is expanded by Doxygen to "__" - xlt_api_name = api_name.replace("_", "__") - xml_file_path = "%s/%s_8h.xml" % (xml_directory_path, xlt_api_name) - - rst_output = "" - rst_output = ".. File automatically generated by 'gen-dxd.py'\n" - rst_output += "\n" - rst_output += get_rst_header("Header File") - rst_output += "* :repo_file:`" + header_file_path + "`\n" - rst_output += "\n" - - try: - import xml.etree.cElementTree as ET - except ImportError: - import xml.etree.ElementTree as ET - - tree = ET.ElementTree(file=xml_file_path) - for i in range(len(all_kinds)): - kind = all_kinds[i][0] - rst_output += get_directives(tree, kind) - - return rst_output - - -def generate_api_inc_files(): - """Generate header_file.inc files - with API reference made of doxygen directives - for each header file - specified in the 'INPUT' statement of Doxyfile. - - """ - - if not os.path.isdir(xml_directory_path): - print("Directory %s does not exist!" % xml_directory_path) - sys.exit() - - if not os.path.exists(inc_directory_path): - os.makedirs(inc_directory_path) - - list_to_generate = get_doxyfile_input() - print("Generating 'api_name.inc' files with Doxygen directives") - for header_file_path in list_to_generate.splitlines(): - api_name = get_api_name(header_file_path) - inc_file_path = inc_directory_path + "/" + api_name + ".inc" - rst_output = generate_directives(header_file_path) - - previous_rst_output = '' - if os.path.isfile(inc_file_path): - with open(inc_file_path, "r", encoding='utf-8') as inc_file_old: - previous_rst_output = inc_file_old.read() - - if previous_rst_output != rst_output: - with open(inc_file_path, "w", encoding='utf-8') as inc_file: - inc_file.write(rst_output) - - -if __name__ == "__main__": - """The main script that generates - Doxygen directives. - - """ - - # Process command line arguments, if any - if len(sys.argv) > 1: - if not os.path.isdir(xml_directory_path): - print("Directory %s does not exist!" % xml_directory_path) - sys.exit() - header_file_path = sys.argv[1] - api_name = get_api_name(header_file_path) - if api_name: - rst_output = generate_directives(header_file_path) - print("Doxygen directives for '%s'" % header_file_path) - print() - print(rst_output) - else: - print("Options to execute 'gen-dxd.py' application:") - print("1: $ python gen-dxd.py") - print(" Generate API 'header_file.inc' files for headers defined in '%s'" % doxyfile_path) - print("2: $ python gen-dxd.py header_file_path") - print(" Print out Doxygen directives for a single header file") - print(" example: $ python gen-dxd.py mdns/include/mdns.h") - print(" NOTE: Run Doxygen first to get XML files for the header file") - - sys.exit() - - # No command line arguments given - generate_api_inc_files() diff --git a/components/esp-dsp/docs/index.rst b/components/esp-dsp/docs/index.rst deleted file mode 100644 index 1521e8c0..00000000 --- a/components/esp-dsp/docs/index.rst +++ /dev/null @@ -1,9 +0,0 @@ -ESP-DSP Library -*************** - -.. toctree:: - :maxdepth: 1 - - Introduction - Benchmarks - API Reference diff --git a/components/esp-dsp/docs/issue_template.md b/components/esp-dsp/docs/issue_template.md deleted file mode 100644 index 7bf65e78..00000000 --- a/components/esp-dsp/docs/issue_template.md +++ /dev/null @@ -1,80 +0,0 @@ ------------------------------ Delete below ----------------------------- - -If your issue is a general question, starts similar to "How do I..", or is related to 3rd party development kits/libs, please discuss this on our community forum at esp32.com instead. - -INSTRUCTIONS -============ - -Before submitting a new issue, please follow the checklist and try to find the answer. - -- [ ] I have read the documentation [ESP-IDF Programming Guide](https://docs.espressif.com/projects/esp-idf/en/latest/) and the issue is not addressed there. -- [ ] I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there. -- [ ] I have searched the issue tracker for a similar issue and not found a similar issue. - -If the issue cannot be solved after the steps before, please follow these instructions so we can get the needed information to help you in a quick and effective fashion. - -1. Fill in all the fields under **Environment** marked with [ ] by picking the correct option for you in each case and deleting the others. -2. Describe your problem. -3. Include [debug logs on the monitor](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/idf-monitor.html#automatically-decoding-addresses) or the [coredump](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/core_dump.html). -4. Provide more items under **Other items if possible** can help us better locate your problem. -5. Use markup (buttons above) and the Preview tab to check what the issue will look like. -6. Delete these instructions from the above to the below marker lines before submitting this issue. - ------------------------------ Delete above ----------------------------- - -## Environment - -- Development Kit: [ESP32-Wrover-Kit|ESP32-DevKitC|ESP32-PICO-Kit|ESP32-LyraT|ESP32-LyraTD-MSC|none] -- Kit version (for WroverKit/PicoKit/DevKitC): [v1|v2|v3|v4] -- Module or chip used: [ESP32-WROOM-32|ESP32-WROOM-32D|ESP32-WROOM-32U|ESP32-WROVER|ESP32-WROVER-I|ESP32-WROVER-B|ESP32-WROVER-IB|ESP32-SOLO-1|ESP32-PICO-D4|ESP32] -- IDF version (run ``git describe --tags`` to find it): - // v3.2-dev-1148-g96cd3b75c -- Build System: [Make|CMake] -- Compiler version (run ``xtensa-esp32-elf-gcc --version`` to find it): - // 1.22.0-80-g6c4433a -- Operating System: [Windows|Linux|macOS] -- Power Supply: [USB|external 5V|external 3.3V|Battery] - -## Problem Description - -//Detailed problem description goes here. - -### Expected Behavior - -### Actual Behavior - -### Steps to repropduce - -1. step1 -2. ... - -// It helps if you attach a picture of your setup/wiring here. - - -### Code to reproduce this issue - -```cpp -// the code should be wrapped in the ```cpp tag so that it will be displayed better. -#include "esp_log.h" - -void app_main() -{ - -} - -``` -// If your code is longer than 30 lines, [GIST](https://gist.github.com) is preferred. - -## Debug Logs - -``` -Debug log goes here, should contain the backtrace, as well as the reset source if it is a crash. -Please copy the plain text here for us to search the error log. Or attach the complete logs but leave the main part here if the log is *too* long. -``` - -## Other items if possible - -- [ ] sdkconfig file (attach the sdkconfig file from your project folder) -- [ ] elf file in the ``build`` folder (**note this may contain all the code details and symbols of your project.**) -- [ ] coredump (This provides stacks of tasks.) - diff --git a/components/esp-dsp/docs/link-roles.py b/components/esp-dsp/docs/link-roles.py deleted file mode 100644 index 9cd6b327..00000000 --- a/components/esp-dsp/docs/link-roles.py +++ /dev/null @@ -1,46 +0,0 @@ -# based on http://protips.readthedocs.io/link-roles.html - -from __future__ import print_function -from __future__ import unicode_literals -import re -import os -from docutils import nodes -from local_util import run_cmd_get_output - - -def get_github_rev(): - path = run_cmd_get_output('git rev-parse --short HEAD') - tag = run_cmd_get_output('git describe --exact-match') - print('Git commit ID: ', path) - if len(tag): - print('Git tag: ', tag) - path = tag - return path - - -def setup(app): - rev = get_github_rev() - - # links to files or folders on the GitHub - baseurl = 'https://github.com/espressif/esp-dsp' - app.add_role('repo', autolink('{}/tree/{}/%s'.format(baseurl, rev))) - app.add_role('repo_file', autolink('{}/blob/{}/%s'.format(baseurl, rev))) - app.add_role('repo_raw', autolink('{}/raw/{}/%s'.format(baseurl, rev))) - app.add_role('example', autolink('{}/tree/{}/examples/%s'.format(baseurl, rev))) - app.add_role('example_file', autolink('{}/blob/{}/examples/%s'.format(baseurl, rev))) - app.add_role('example_raw', autolink('{}/raw/{}/examples/%s'.format(baseurl, rev))) - - -def autolink(pattern): - def role(name, rawtext, text, lineno, inliner, options={}, content=[]): - m = re.search('(.*)\s*<(.*)>', text) # noqa: W605 - regular expression - if m: - link_text = m.group(1) - link = m.group(2) - else: - link_text = text - link = text - url = pattern % (link,) - node = nodes.reference(rawtext, link_text, refuri=url, **options) - return [node], [] - return role diff --git a/components/esp-dsp/docs/local_util.py b/components/esp-dsp/docs/local_util.py deleted file mode 100644 index 666afa95..00000000 --- a/components/esp-dsp/docs/local_util.py +++ /dev/null @@ -1,57 +0,0 @@ -# Utility functions used in conf.py -# -# Copyright 2017 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. - -from __future__ import unicode_literals -from io import open -import os -import shutil - - -def run_cmd_get_output(cmd): - return os.popen(cmd).read().strip() - - -def files_equal(path_1, path_2): - if not os.path.exists(path_1) or not os.path.exists(path_2): - return False - file_1_contents = '' - with open(path_1, "r", encoding='utf-8') as f_1: - file_1_contents = f_1.read() - file_2_contents = '' - with open(path_2, "r", encoding='utf-8') as f_2: - file_2_contents = f_2.read() - return file_1_contents == file_2_contents - - -def copy_file_if_modified(src_file_path, dst_file_path): - if not files_equal(src_file_path, dst_file_path): - dst_dir_name = os.path.dirname(dst_file_path) - if not os.path.isdir(dst_dir_name): - os.makedirs(dst_dir_name) - shutil.copy(src_file_path, dst_file_path) - - -def copy_if_modified(src_path, dst_path): - if os.path.isfile(src_path): - copy_file_if_modified(src_path, dst_path) - return - - src_path_len = len(src_path) - for root, dirs, files in os.walk(src_path): - for src_file_name in files: - src_file_path = os.path.join(root, src_file_name) - dst_file_path = os.path.join(dst_path + root[src_path_len:], src_file_name) - copy_file_if_modified(src_file_path, dst_file_path) diff --git a/components/esp-dsp/docs/requirements.txt b/components/esp-dsp/docs/requirements.txt deleted file mode 100644 index 9b4bdad4..00000000 --- a/components/esp-dsp/docs/requirements.txt +++ /dev/null @@ -1,8 +0,0 @@ -# This is a list of python packages used to generate documentation. This file is used with pip: -# pip install --user -r requirements.txt -# -future -sphinx==1.6.5 -sphinx-rtd-theme -breathe==4.7.3 -recommonmark diff --git a/components/esp-dsp/docs/sphinx-known-warnings.txt b/components/esp-dsp/docs/sphinx-known-warnings.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/components/esp-dsp/examples/README.md b/components/esp-dsp/examples/README.md deleted file mode 100644 index 0a050c3d..00000000 --- a/components/esp-dsp/examples/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# ESP-DSP Examples - -This directory contains a range of examples for ESP-DSP library. - -These examples are intended to demonstrate part of ESP-DSP functionality (e.g. initialization, execution) and to provide code that you can copy and adapt into your own projects. - -See the [README.md](../README.md) file in the upper level directory for more information about ESP-DSP. - -# Example Layout - -The examples are grouped into subdirectories by category. Each category directory contains one or more example projects: - -* [Dot Product Calculation](./dotprod/README.md) Example -* [Basic Math Operations](./basic_math/README.md) Example -* [FFT](./fft/README.md) Example -* [Matrix](./matrix/README.md) example -* [FFT Window](./fft_window/README.md) Example -* [IIR Filter](./iir/README.md) Example diff --git a/components/esp-dsp/examples/basic_math/CMakeLists.txt b/components/esp-dsp/examples/basic_math/CMakeLists.txt deleted file mode 100644 index f5e66434..00000000 --- a/components/esp-dsp/examples/basic_math/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# The following lines of boilerplate have to be in your project's -# CMakeLists in this exact order for cmake to work correctly -cmake_minimum_required(VERSION 3.5) - -set(EXTRA_COMPONENT_DIRS "../../") -set(IDF_EXCLUDE_COMPONENTS test test_app) - -include($ENV{IDF_PATH}/tools/cmake/project.cmake) -project(basic_math) \ No newline at end of file diff --git a/components/esp-dsp/examples/basic_math/Makefile b/components/esp-dsp/examples/basic_math/Makefile deleted file mode 100644 index f84a43ec..00000000 --- a/components/esp-dsp/examples/basic_math/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# -# This is a project Makefile. It is assumed the directory this Makefile resides in is a -# project subdirectory. -# - -PROJECT_NAME := basic_math - -# This line has to be included into the make file -# to include components that are located somewhere -# but not in "component" directory - -EXTRA_COMPONENT_DIRS := $(realpath ../..) -EXCLUDE_COMPONENTS := test - -include $(IDF_PATH)/make/project.mk - diff --git a/components/esp-dsp/examples/basic_math/README.md b/components/esp-dsp/examples/basic_math/README.md deleted file mode 100644 index 80bc09c3..00000000 --- a/components/esp-dsp/examples/basic_math/README.md +++ /dev/null @@ -1,83 +0,0 @@ -# Basic Math Example - -(See the README.md file in the upper level 'examples' directory for more information about examples.) - -This example demonstrates how to use basic math functions from esp-dsp library. Example does the following steps: - -1. Initialize the library -2. Initialize input signals with 1024 samples -3. Apply window to input signal by standard C loop. -4. Calculate FFT for 1024 complex samples and show the result -5. Show results on the plots -6. Apply window to input signal by basic math functions dsps_mul_f32 and dsps_mulc_f32. -7. Calculate FFT for 1024 complex samples -8. Show results on the plots - -## How to use example - -### Hardware required - -This example does not require any special hardware, and can be run on any common development board. - -### Configure the project - -If using Make based build system, run `make menuconfig` and set serial port under Serial Flasher Options. -If using CMake based build system, no configuration is required. -Also, under Component Config ---> DSP Library ---> Optimization for ESP32, it's possible to select optimized or ansi implementation to compare. - -### Build and flash - -Build the project and flash it to the board, then run monitor tool to view serial output: - -``` -make -j4 flash monitor -``` - -Or, for CMake based build system (replace PORT with serial port name): - -``` -idf.py -p PORT flash monitor -``` - -(To exit the serial monitor, type ``Ctrl-]``.) - -See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects. - -## Example output - -Here is an typical example console output. - -```bash -I (132) main: *** Start Example. *** -I (132) main: *** Multiply tone signal with Hann window by standard C loop. *** -I (152) view: Data min[432] = -173.749878, Data max[205] = 23.849705 - ________________________________________________________________ -0 | | -1 | | -2 | | -3 || | -4 | | | -5 || | | -6 ||| || | -7 ||||| |||| | -8||||||||||||||| |||||| | -9 ||||||||||||||||||||||||| - 0123456789012345678901234567890123456789012345678901234567890123 -I (162) view: Plot: Length=512, min=-120.000000, max=40.000000 -I (162) main: *** Multiply tone signal with Hann window by esp-dsp basic math functions. *** -I (162) view: Data min[432] = -173.749878, Data max[205] = 23.849705 - ________________________________________________________________ -0 | | -1 | | -2 | | -3 || | -4 | | | -5 || | | -6 ||| || | -7 ||||| |||| | -8||||||||||||||| |||||| | -9 ||||||||||||||||||||||||| - 0123456789012345678901234567890123456789012345678901234567890123 -I (172) view: Plot: Length=512, min=-120.000000, max=40.000000 -I (172) main: *** End Example. *** -``` diff --git a/components/esp-dsp/examples/basic_math/main/CMakeLists.txt b/components/esp-dsp/examples/basic_math/main/CMakeLists.txt deleted file mode 100644 index c8c6546f..00000000 --- a/components/esp-dsp/examples/basic_math/main/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -set(COMPONENT_SRCS "dsps_math_main.c") -set(COMPONENT_ADD_INCLUDEDIRS "") - -register_component() \ No newline at end of file diff --git a/components/esp-dsp/examples/basic_math/main/component.mk b/components/esp-dsp/examples/basic_math/main/component.mk deleted file mode 100644 index 5d85ad38..00000000 --- a/components/esp-dsp/examples/basic_math/main/component.mk +++ /dev/null @@ -1,8 +0,0 @@ -# -# Main component makefile. -# -# This Makefile can be left empty. By default, it will take the sources in the -# src/ directory, compile them and link them into lib(subdirectory_name).a -# in the build directory. This behaviour is entirely configurable, -# please read the ESP-IDF documents if you need to do this. -# diff --git a/components/esp-dsp/examples/basic_math/main/dsps_math_main.c b/components/esp-dsp/examples/basic_math/main/dsps_math_main.c deleted file mode 100644 index 3c580a5e..00000000 --- a/components/esp-dsp/examples/basic_math/main/dsps_math_main.c +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2018-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. - - -#include -#include -#include -#include "freertos/FreeRTOS.h" -#include "freertos/task.h" -#include "esp_system.h" -#include "driver/spi_master.h" -#include "soc/gpio_struct.h" -#include "driver/gpio.h" -#include "driver/uart.h" -#include "soc/uart_struct.h" -#include - -#include "esp_dsp.h" - -static const char *TAG = "main"; - -// This example shows how to use FFT from esp-dsp library - -#define N_SAMPLES 1024 -int N = N_SAMPLES; -// Input test array -float x1[N_SAMPLES]; -// Window coefficients -float wind[N_SAMPLES]; -// working complex array -float y_cf[N_SAMPLES*2]; -// Pointers to result arrays -float* y1_cf = &y_cf[0]; - -static void process_and_show(float* data, int length) -{ - dsps_fft2r_fc32(data, length); - // Bit reverse - dsps_bit_rev_fc32(data, length); - // Convert one complex vector to two complex vectors - dsps_cplx2reC_fc32(data, length); - - for (int i = 0 ; i < length/2 ; i++) { - data[i] = 10 * log10f((data[i * 2 + 0] * data[i * 2 + 0] + data[i * 2 + 1] * data[i * 2 + 1])/N); - } - - // Show power spectrum in 64x10 window from -100 to 0 dB from 0..N/4 samples - dsps_view(data, length/2, 64, 10, -120, 40, '|'); -} - -void app_main() -{ - esp_err_t ret; - ESP_LOGI(TAG, "*** Start Example. ***"); - ret = dsps_fft2r_init_fc32(NULL, CONFIG_DSP_MAX_FFT_SIZE); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Not possible to initialize FFT. Error = %i", ret); - return; - } - - // Generate Hann window - dsps_wind_hann_f32(wind, N); - - ESP_LOGI(TAG, "*** Multiply tone signal with Hann window by standard C loop. ***"); - // Generate input signal - dsps_tone_gen_f32(x1, N, 1., 0.2, 0); - // Convert two input vectors to one complex vector - for (int i=0 ; i< N ; i++) - { - y_cf[i*2 + 0] = x1[i]*wind[i]; - y_cf[i*2 + 1] = 0; - } - process_and_show(y_cf, N); - - ESP_LOGI(TAG, "*** Multiply tone signal with Hann window by esp-dsp basic math functions. ***"); - // Convert two input vectors to one complex vector with basic functions - dsps_mul_f32(x1, wind, y_cf, N, 1, 1, 2); // Multiply input array with window and store as real part - dsps_mulc_f32(&y_cf[1], &y_cf[1], N, 0, 2, 2); // Clear imaginary part of the complex signal - process_and_show(y_cf, N); - ESP_LOGI(TAG, "*** End Example. ***"); -} \ No newline at end of file diff --git a/components/esp-dsp/examples/dotprod/CMakeLists.txt b/components/esp-dsp/examples/dotprod/CMakeLists.txt deleted file mode 100644 index 17124efc..00000000 --- a/components/esp-dsp/examples/dotprod/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# The following lines of boilerplate have to be in your project's -# CMakeLists in this exact order for cmake to work correctly -cmake_minimum_required(VERSION 3.5) - -set(EXTRA_COMPONENT_DIRS "../..") -set(IDF_EXCLUDE_COMPONENTS test test_app) - -include($ENV{IDF_PATH}/tools/cmake/project.cmake) -project(dotprod) diff --git a/components/esp-dsp/examples/dotprod/Makefile b/components/esp-dsp/examples/dotprod/Makefile deleted file mode 100644 index 51fb024c..00000000 --- a/components/esp-dsp/examples/dotprod/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# -# This is a project Makefile. It is assumed the directory this Makefile resides in is a -# project subdirectory. -# - -PROJECT_NAME := dotprod - -# This line has to be included into the make file -# to include components that are located somewhere -# but not in "component" directory - -EXTRA_COMPONENT_DIRS := $(realpath ../..) -EXCLUDE_COMPONENTS := test - -include $(IDF_PATH)/make/project.mk - diff --git a/components/esp-dsp/examples/dotprod/README.md b/components/esp-dsp/examples/dotprod/README.md deleted file mode 100644 index 492845bc..00000000 --- a/components/esp-dsp/examples/dotprod/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# Dot Product Calculation Example - -(See the README.md file in the upper level 'examples' directory for more information about examples.) - -This example demonstrates how to use dotprod dsps_dotprod_f32 from esp-dsp library. Example does the following steps: - -1. Initialize the input arrays -2. Calculate dot product of two arrays -3. Compare results and calculate execution time in cycles. - -## How to use example - -### Hardware required - -This example does not require any special hardware, and can be run on any common development board. - -### Configure the project - -If using Make based build system, run `make menuconfig` and set serial port under Serial Flasher Options. -If using CMake based build system, no configuration is required. -Also, under Component Config/DSP Library/Optimization for ESP32, it's possible to select optimized or ansi implementation to compare. - -### Build and flash - -Build the project and flash it to the board, then run monitor tool to view serial output: - -``` -make -j4 flash monitor -``` - -Or, for CMake based build system (replace PORT with serial port name): - -``` -idf.py -p PORT flash monitor -``` - -(To exit the serial monitor, type ``Ctrl-]``.) - -See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects. - -## Example output - -Here is an typical example console output. - -``` -I (55) main: Start Example. -I (55) main: The sum of 101 elements from 0..100 = 5050.000000 -I (55) main: Operation for 101 samples took 1381 cycles -I (65) main: End Example. -``` diff --git a/components/esp-dsp/examples/dotprod/main/CMakeLists.txt b/components/esp-dsp/examples/dotprod/main/CMakeLists.txt deleted file mode 100644 index 82b28170..00000000 --- a/components/esp-dsp/examples/dotprod/main/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -set(COMPONENT_SRCS "dsps_dotproduct_main.c") -set(COMPONENT_ADD_INCLUDEDIRS "") - -register_component() \ No newline at end of file diff --git a/components/esp-dsp/examples/dotprod/main/component.mk b/components/esp-dsp/examples/dotprod/main/component.mk deleted file mode 100644 index 5d85ad38..00000000 --- a/components/esp-dsp/examples/dotprod/main/component.mk +++ /dev/null @@ -1,8 +0,0 @@ -# -# Main component makefile. -# -# This Makefile can be left empty. By default, it will take the sources in the -# src/ directory, compile them and link them into lib(subdirectory_name).a -# in the build directory. This behaviour is entirely configurable, -# please read the ESP-IDF documents if you need to do this. -# diff --git a/components/esp-dsp/examples/dotprod/main/dsps_dotproduct_main.c b/components/esp-dsp/examples/dotprod/main/dsps_dotproduct_main.c deleted file mode 100644 index 3c4e0c39..00000000 --- a/components/esp-dsp/examples/dotprod/main/dsps_dotproduct_main.c +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2018-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. - - -#include -#include -#include -#include "freertos/FreeRTOS.h" -#include "freertos/task.h" -#include "esp_system.h" -#include "driver/spi_master.h" -#include "soc/gpio_struct.h" -#include "driver/gpio.h" -#include "driver/uart.h" -#include "soc/uart_struct.h" - -#include "esp_dsp.h" - -static const char *TAG = "main"; - -// This example shows how to use dsps_dotprod_f32 and dsps_dotprode_f32 functions - -#define N_SAMPLES 256 -int N = N_SAMPLES; -float input1[N_SAMPLES]; -float input2[N_SAMPLES]; - -void app_main() -{ - esp_err_t ret; - ESP_LOGI(TAG, "Start Example."); - - // The example will calculate n! - //Initialize an input arrays - for (int i=0 ; i< N ; i++) - { - input1[i] = 1; - input2[i] = i; - } - float result1 = 0; - unsigned int start_b = xthal_get_ccount(); - ret = dsps_dotprod_f32(input1, input2, &result1, 101); - unsigned int end_b = xthal_get_ccount(); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Operation error = %i", ret); - } - ESP_LOGI(TAG, "The sum of 101 elements from 0..100 = %f", result1); - ESP_LOGI(TAG, "Operation for 101 samples take %i cycles", end_b - start_b); - - ESP_LOGI(TAG, "End Example."); -} diff --git a/components/esp-dsp/examples/fft/CMakeLists.txt b/components/esp-dsp/examples/fft/CMakeLists.txt deleted file mode 100644 index ffa3b20f..00000000 --- a/components/esp-dsp/examples/fft/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# The following lines of boilerplate have to be in your project's -# CMakeLists in this exact order for cmake to work correctly -cmake_minimum_required(VERSION 3.5) - -set(EXTRA_COMPONENT_DIRS "../../") -set(IDF_EXCLUDE_COMPONENTS test test_app) - -include($ENV{IDF_PATH}/tools/cmake/project.cmake) -project(fft2r) diff --git a/components/esp-dsp/examples/fft/Makefile b/components/esp-dsp/examples/fft/Makefile deleted file mode 100644 index 9148b9d2..00000000 --- a/components/esp-dsp/examples/fft/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# -# This is a project Makefile. It is assumed the directory this Makefile resides in is a -# project subdirectory. -# - -PROJECT_NAME := fft2r - -# This line has to be included into the make file -# to include components that are located somewhere -# but not in "component" directory - -EXTRA_COMPONENT_DIRS := $(realpath ../..) -EXCLUDE_COMPONENTS := test - -include $(IDF_PATH)/make/project.mk - diff --git a/components/esp-dsp/examples/fft/README.md b/components/esp-dsp/examples/fft/README.md deleted file mode 100644 index a8da2c48..00000000 --- a/components/esp-dsp/examples/fft/README.md +++ /dev/null @@ -1,99 +0,0 @@ -# FFT Example - -(See the README.md file in the upper level 'examples' directory for more information about examples.) - -This example demonstrates how to use FFT functionality from esp-dsp library. Example does the following steps: - -1. Initialize the library -2. Initialize input signals with 1024 samples: one 0 dB, second with -20 dB -3. Combine two signals as one complex input signal and apply window to input signals paar. -4. Calculate FFT for 1024 complex samples -5. Apply bit reverse operation for output complex vector -6. Split one complex FFT output spectrum to two real signal spectrums -7. Show results on the plots -8. Show execution time of FFT - -## How to use example - -### Hardware required - -This example does not require any special hardware, and can be run on any common development board. - -### Configure the project - -If using Make based build system, run `make menuconfig` and set serial port under Serial Flasher Options. -If using CMake based build system, no configuration is required. -Also, under Component Config/DSP Library/Optimization for ESP32, it's possible to select optimized or ansi implementation to compare. - -### Build and flash - -Build the project and flash it to the board, then run monitor tool to view serial output: - -``` -make -j4 flash monitor -``` - -Or, for CMake based build system (replace PORT with serial port name): - -``` -idf.py -p PORT flash monitor -``` - -(To exit the serial monitor, type ``Ctrl-]``.) - -See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects. - -## Example output - -Here is an typical example console output. - -``` -I (59) main: Start Example. -W (89) main: Signal x1 -I (89) view: Data min[495] = -162.760925, Data max[164] = 23.938747 - ________________________________________________________________ -0 | -1 | | -2 | | -3 | | -4 | | -5 | | -6 | | | -7 | | | -8 || || | -9|||||||||||||||||| |||||||||||||||||||||||||||||||||||||||||| - 0123456789012345678901234567890123456789012345678901234567890123 -I (159) view: Plot: Length=512, min=-60.000000, max=40.000000 -W (169) main: Signal x2 -I (169) view: Data min[502] = -164.545135, Data max[205] = 3.857752 - ________________________________________________________________ -0 | -1 | -2 | -3 | | -4 | | -5 | | -6 | | -7 || | -8 | | | -9|||||||||||||||||||||||| |||||||||||||||||||||||||||||||||||||| - 0123456789012345678901234567890123456789012345678901234567890123 -I (249) view: Plot: Length=512, min=-60.000000, max=40.000000 -W (249) main: Signals x1 and x2 on one plot -I (259) view: Data min[505] = -159.215271, Data max[164] = 23.938747 - ________________________________________________________________ -0 | -1 | | -2 | | -3 | | | -4 | | | -5 | | | -6 | | | | -7 | | || | -8 || || | | | -9|||||||||||||||||| | |||||||||||||||||||||||||||||||||||||| - 0123456789012345678901234567890123456789012345678901234567890123 -I (339) view: Plot: Length=512, min=-60.000000, max=40.000000 -I (339) main: FFT for 1024 complex points take 140472 cycles -I (349) main: End Example. -``` diff --git a/components/esp-dsp/examples/fft/main/CMakeLists.txt b/components/esp-dsp/examples/fft/main/CMakeLists.txt deleted file mode 100644 index f8c38498..00000000 --- a/components/esp-dsp/examples/fft/main/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -set(COMPONENT_SRCS "dsps_fft_main.c") -set(COMPONENT_ADD_INCLUDEDIRS "") - -register_component() \ No newline at end of file diff --git a/components/esp-dsp/examples/fft/main/component.mk b/components/esp-dsp/examples/fft/main/component.mk deleted file mode 100644 index 5d85ad38..00000000 --- a/components/esp-dsp/examples/fft/main/component.mk +++ /dev/null @@ -1,8 +0,0 @@ -# -# Main component makefile. -# -# This Makefile can be left empty. By default, it will take the sources in the -# src/ directory, compile them and link them into lib(subdirectory_name).a -# in the build directory. This behaviour is entirely configurable, -# please read the ESP-IDF documents if you need to do this. -# diff --git a/components/esp-dsp/examples/fft/main/dsps_fft_main.c b/components/esp-dsp/examples/fft/main/dsps_fft_main.c deleted file mode 100644 index 2dc0d390..00000000 --- a/components/esp-dsp/examples/fft/main/dsps_fft_main.c +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright 2018-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. - - -#include -#include -#include -#include "freertos/FreeRTOS.h" -#include "freertos/task.h" -#include "esp_system.h" -#include "driver/spi_master.h" -#include "soc/gpio_struct.h" -#include "driver/gpio.h" -#include "driver/uart.h" -#include "soc/uart_struct.h" -#include - -#include "esp_dsp.h" - -static const char *TAG = "main"; - -// This example shows how to use FFT from esp-dsp library - -#define N_SAMPLES 1024 -int N = N_SAMPLES; -// Input test array -float x1[N_SAMPLES]; -float x2[N_SAMPLES]; -// Window coefficients -float wind[N_SAMPLES]; -// working complex array -float y_cf[N_SAMPLES*2]; -// Pointers to result arrays -float* y1_cf = &y_cf[0]; -float* y2_cf = &y_cf[N_SAMPLES]; - -// Sum of y1 and y2 -float sum_y[N_SAMPLES/2]; - -void app_main() -{ - esp_err_t ret; - ESP_LOGI(TAG, "Start Example."); - ret = dsps_fft2r_init_fc32(NULL, CONFIG_DSP_MAX_FFT_SIZE); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Not possible to initialize FFT. Error = %i", ret); - return; - } - - // Generate hann window - dsps_wind_hann_f32(wind, N); - // Generate input signal for x1 A=1 , F=0.1 - dsps_tone_gen_f32(x1, N, 1.0, 0.16, 0); - // Generate input signal for x2 A=0.1,F=0.2 - dsps_tone_gen_f32(x2, N, 0.1, 0.2, 0); - - // Convert two input vectors to one complex vector - for (int i=0 ; i< N ; i++) - { - y_cf[i*2 + 0] = x1[i] * wind[i]; - y_cf[i*2 + 1] = x2[i] * wind[i]; - } - // FFT - unsigned int start_b = xthal_get_ccount(); - dsps_fft2r_fc32(y_cf, N); - unsigned int end_b = xthal_get_ccount(); - // Bit reverse - dsps_bit_rev_fc32(y_cf, N); - // Convert one complex vector to two complex vectors - dsps_cplx2reC_fc32(y_cf, N); - - for (int i = 0 ; i < N/2 ; i++) { - y1_cf[i] = 10 * log10f((y1_cf[i * 2 + 0] * y1_cf[i * 2 + 0] + y1_cf[i * 2 + 1] * y1_cf[i * 2 + 1])/N); - y2_cf[i] = 10 * log10f((y2_cf[i * 2 + 0] * y2_cf[i * 2 + 0] + y2_cf[i * 2 + 1] * y2_cf[i * 2 + 1])/N); - // Simple way to show two power spectrums as one plot - sum_y[i] = fmax(y1_cf[i], y2_cf[i]); - } - - // Show power spectrum in 64x10 window from -100 to 0 dB from 0..N/4 samples - ESP_LOGW(TAG, "Signal x1"); - dsps_view(y1_cf, N/2, 64, 10, -60, 40, '|'); - ESP_LOGW(TAG, "Signal x2"); - dsps_view(y2_cf, N/2, 64, 10, -60, 40, '|'); - ESP_LOGW(TAG, "Signals x1 and x2 on one plot"); - dsps_view(sum_y, N/2, 64, 10, -60, 40, '|'); - ESP_LOGI(TAG, "FFT for %i complex points take %i cycles", N, end_b - start_b); - - ESP_LOGI(TAG, "End Example."); -} diff --git a/components/esp-dsp/examples/fft4real/CMakeLists.txt b/components/esp-dsp/examples/fft4real/CMakeLists.txt deleted file mode 100644 index 06eec85e..00000000 --- a/components/esp-dsp/examples/fft4real/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# The following lines of boilerplate have to be in your project's -# CMakeLists in this exact order for cmake to work correctly -cmake_minimum_required(VERSION 3.5) - -set(EXTRA_COMPONENT_DIRS "../../") -set(IDF_EXCLUDE_COMPONENTS test test_app) - -include($ENV{IDF_PATH}/tools/cmake/project.cmake) -project(fft4real) diff --git a/components/esp-dsp/examples/fft4real/Makefile b/components/esp-dsp/examples/fft4real/Makefile deleted file mode 100644 index 39c7030a..00000000 --- a/components/esp-dsp/examples/fft4real/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# -# This is a project Makefile. It is assumed the directory this Makefile resides in is a -# project subdirectory. -# - -PROJECT_NAME := fft4real - -# This line has to be included into the make file -# to include components that are located somewhere -# but not in "component" directory - -EXTRA_COMPONENT_DIRS := $(realpath ../..) -EXCLUDE_COMPONENTS := test - -include $(IDF_PATH)/make/project.mk - diff --git a/components/esp-dsp/examples/fft4real/README.md b/components/esp-dsp/examples/fft4real/README.md deleted file mode 100644 index e61930e0..00000000 --- a/components/esp-dsp/examples/fft4real/README.md +++ /dev/null @@ -1,99 +0,0 @@ -# FFT 4 Real Input Example - -(See the README.md file in the upper level 'examples' directory for more information about examples.) - -This example demonstrates how to use FFT functionality from esp-dsp library. Example does the following steps: - -1. Initialize the library -2. Initialize input signals with 1024 samples: one 0 dB, second with -20 dB -4. Calculate FFT Radix-2 for 1024 complex samples -4. Calculate FFT Radix-4 for 1024 complex samples -5. Apply bit reverse operation for output complex vectors -7. Show results on the plots -8. Show execution time of FFTs - -## How to use example - -### Hardware required - -This example does not require any special hardware, and can be run on any common development board. - -### Configure the project - -If using Make based build system, run `make menuconfig` and set serial port under Serial Flasher Options. -If using CMake based build system, no configuration is required. -Also, under Component Config/DSP Library/Optimization for ESP32, it's possible to select optimized or ansi implementation to compare. - -### Build and flash - -Build the project and flash it to the board, then run monitor tool to view serial output: - -``` -make -j4 flash monitor -``` - -Or, for CMake based build system (replace PORT with serial port name): - -``` -idf.py -p PORT flash monitor -``` - -(To exit the serial monitor, type ``Ctrl-]``.) - -See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects. - -## Example output - -Here is an typical example console output. - -``` -I (344) main: Start Example. -W (424) main: Signal x1 -I (424) view: Data min[673] = -103.113297, Data max[328] = 20.490950 - ________________________________________________________________ -0 | -1 | | -2 | | -3 | | -4 | | -5 | | -6 | | -7 | | | -8 | | | -9||||||||||||||||||| ||||||||||||||||||||||||||||||||||||||||||| - 0123456789012345678901234567890123456789012345678901234567890123 -I (494) view: Plot: Length=1024, min=-60.000000, max=40.000000 -W (504) main: Signal x2 -I (504) view: Data min[582] = -103.113297, Data max[328] = 20.490950 - ________________________________________________________________ -0 | -1 | | -2 | | -3 | | -4 | | -5 | | -6 | | -7 | | | -8 | | | -9||||||||||||||||||| ||||||||||||||||||||||||||||||||||||||||||| - 0123456789012345678901234567890123456789012345678901234567890123 -I (584) view: Plot: Length=1024, min=-60.000000, max=40.000000 -W (593) main: Difference between signals x1 and x2 on one plot -I (594) view: Data min[0] = 0.000000, Data max[392] = 0.313019 - ________________________________________________________________ -0 | -1 | -2 | -3 | -4 | -5 | -6 | -7 | -8----------------------------------------------------------------| -9 | - 0123456789012345678901234567890123456789012345678901234567890123 -I (674) view: Plot: Length=1024, min=0.000000, max=40.000000 -I (674) main: FFT Radix 2 for 1024 complex points take 168652 cycles -I (684) main: FFT Radix 4 for 1024 complex points take 104665 cycles -I (694) main: End Example. -``` diff --git a/components/esp-dsp/examples/fft4real/main/CMakeLists.txt b/components/esp-dsp/examples/fft4real/main/CMakeLists.txt deleted file mode 100644 index 45a4a103..00000000 --- a/components/esp-dsp/examples/fft4real/main/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -set(COMPONENT_SRCS "dsps_fft4real_main.c") -set(COMPONENT_ADD_INCLUDEDIRS "") - -register_component() \ No newline at end of file diff --git a/components/esp-dsp/examples/fft4real/main/component.mk b/components/esp-dsp/examples/fft4real/main/component.mk deleted file mode 100644 index 5d85ad38..00000000 --- a/components/esp-dsp/examples/fft4real/main/component.mk +++ /dev/null @@ -1,8 +0,0 @@ -# -# Main component makefile. -# -# This Makefile can be left empty. By default, it will take the sources in the -# src/ directory, compile them and link them into lib(subdirectory_name).a -# in the build directory. This behaviour is entirely configurable, -# please read the ESP-IDF documents if you need to do this. -# diff --git a/components/esp-dsp/examples/fft4real/main/dsps_fft4real_main.c b/components/esp-dsp/examples/fft4real/main/dsps_fft4real_main.c deleted file mode 100644 index 8680a5af..00000000 --- a/components/esp-dsp/examples/fft4real/main/dsps_fft4real_main.c +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright 2018-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. - - -#include -#include -#include -#include "freertos/FreeRTOS.h" -#include "freertos/task.h" -#include "esp_system.h" -#include "driver/spi_master.h" -#include "soc/gpio_struct.h" -#include "driver/gpio.h" -#include "driver/uart.h" -#include "soc/uart_struct.h" -#include - -#include "esp_dsp.h" - -static const char *TAG = "main"; - -// This example shows how to use FFT from esp-dsp library - -#define N_SAMPLES 2048 // Amount of real input samples -int N = N_SAMPLES; -// Input test array -float x1[N_SAMPLES]; -float x2[N_SAMPLES]; -// Window coefficients -float wind[N_SAMPLES]; -// Pointers to result arrays -float* y1_cf = &x1[0]; -float* y2_cf = &x2[0]; - -// diff of y1 and y2 -float diff_y[N_SAMPLES/2]; - -void app_main() -{ - esp_err_t ret; - ESP_LOGI(TAG, "Start Example."); - ret = dsps_fft2r_init_fc32(NULL, N>>1); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Not possible to initialize FFT2R. Error = %i", ret); - return; - } - - ret = dsps_fft4r_init_fc32(NULL, N >> 1); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Not possible to initialize FFT4R. Error = %i", ret); - return; - } - - // Generate hann window - dsps_wind_hann_f32(wind, N); - // Generate input signal for x1 A=1 , F=0.1 - dsps_tone_gen_f32(x1, N, 1.0, 0.16, 0); - - // Convert two input vectors to one complex vector - for (int i=0 ; i< N ; i++) - { - x1[i] = x1[i] * wind[i]; - x2[i] = x1[i]; - } - // FFT Radix-2 - unsigned int start_r2 = xthal_get_ccount(); - dsps_fft2r_fc32(x1, N>>1); - // Bit reverse - dsps_bit_rev2r_fc32(x1, N>>1); - // Convert one complex vector with length N/2 to one real spectrum vector with length N/2 - dsps_cplx2real_fc32(x1, N>>1); - unsigned int end_r2 = xthal_get_ccount(); - - // FFT Radix-4 - unsigned int start_r4 = xthal_get_ccount(); - dsps_fft4r_fc32(x2, N>>1); - // Bit reverse - dsps_bit_rev4r_fc32(x2, N>>1); - // Convert one complex vector with length N/2 to one real spectrum vector with length N/2 - dsps_cplx2real_fc32(x2, N>>1); - unsigned int end_r4 = xthal_get_ccount(); - - for (int i = 0 ; i < N/2 ; i++) { - x1[i] = 10 * log10f((x1[i * 2 + 0] * x1[i * 2 + 0] + x1[i * 2 + 1] * x1[i * 2 + 1] + 0.0000001)/N); - x2[i] = 10 * log10f((x2[i * 2 + 0] * x2[i * 2 + 0] + x2[i * 2 + 1] * x2[i * 2 + 1] + 0.0000001)/N); - // Simple way to show two power spectrums as one plot - diff_y[i] = fabs(x1[i] - x2[i]); - } - - // Show power spectrum in 64x10 window from -100 to 0 dB from 0..N/4 samples - ESP_LOGW(TAG, "Signal x1"); - dsps_view(x1, N/2, 64, 10, -60, 40, '|'); - ESP_LOGW(TAG, "Signal x2"); - dsps_view(x2, N/2, 64, 10, -60, 40, '|'); - ESP_LOGW(TAG, "Difference between signals x1 and x2 on one plot"); - dsps_view(diff_y, N/2, 64, 10, 0, 40, '-'); - ESP_LOGI(TAG, "FFT Radix 2 for %i complex points take %i cycles", N/2, end_r2 - start_r2); - ESP_LOGI(TAG, "FFT Radix 4 for %i complex points take %i cycles", N/2, end_r4 - start_r4); - - ESP_LOGI(TAG, "End Example."); -} diff --git a/components/esp-dsp/examples/fft4real/main/linker.ld b/components/esp-dsp/examples/fft4real/main/linker.ld deleted file mode 100644 index c5aacfa7..00000000 --- a/components/esp-dsp/examples/fft4real/main/linker.ld +++ /dev/null @@ -1,9 +0,0 @@ -[mapping:dsp] -archive: libdsp.a -entries: - * (noflash) - -[mapping:esp-dsp] -archive: libesp-dsp.a -entries: - * (noflash) diff --git a/components/esp-dsp/examples/fft_window/CMakeLists.txt b/components/esp-dsp/examples/fft_window/CMakeLists.txt deleted file mode 100644 index cceb4516..00000000 --- a/components/esp-dsp/examples/fft_window/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# The following lines of boilerplate have to be in your project's -# CMakeLists in this exact order for cmake to work correctly -cmake_minimum_required(VERSION 3.5) - -set(EXTRA_COMPONENT_DIRS "../../") -set(IDF_EXCLUDE_COMPONENTS test test_app) - -include($ENV{IDF_PATH}/tools/cmake/project.cmake) -project(fft_window) diff --git a/components/esp-dsp/examples/fft_window/Makefile b/components/esp-dsp/examples/fft_window/Makefile deleted file mode 100644 index 8c3810a1..00000000 --- a/components/esp-dsp/examples/fft_window/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# -# This is a project Makefile. It is assumed the directory this Makefile resides in is a -# project subdirectory. -# - -PROJECT_NAME := fft_window - -# This line has to be included into the make file -# to include components that are located somewhere -# but not in "component" directory - -EXTRA_COMPONENT_DIRS := $(realpath ../..) -EXCLUDE_COMPONENTS := test - -include $(IDF_PATH)/make/project.mk - diff --git a/components/esp-dsp/examples/fft_window/README.md b/components/esp-dsp/examples/fft_window/README.md deleted file mode 100644 index 7f013fdb..00000000 --- a/components/esp-dsp/examples/fft_window/README.md +++ /dev/null @@ -1,142 +0,0 @@ -# FFT Window Example - -(See the README.md file in the upper level 'examples' directory for more information about examples.) - -This example demonstrates how to use Window and FFT functionality from esp-dsp library. Example does the following steps: - -1. Initialize the library -2. Initialize input signals with 1024 samples -3. Apply window to input signal. -4. Calculate FFT for 1024 complex samples -5. Apply bit reverse operation for output complex vector -6. Split one complex FFT output spectrum to two real signal spectrums -7. Show results on the plots - -## How to use example - -### Hardware required - -This example does not require any special hardware, and can be run on any common development board. - -### Configure the project - -If using Make based build system, run `make menuconfig` and set serial port under Serial Flasher Options. -If using CMake based build system, no configuration is required. -Also, under Component Config/DSP Library/Optimization for ESP32, it's possible to select optimized or ansi implementation to compare. - -### Build and flash - -Build the project and flash it to the board, then run monitor tool to view serial output: - -``` -make -j4 flash monitor -``` - -Or, for CMake based build system (replace PORT with serial port name): - -``` -idf.py -p PORT flash monitor -``` - -(To exit the serial monitor, type ``Ctrl-]``.) - -See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects. - -## Example output - -Here is an typical example console output. - -``` -I (128) main: Start Example. -W (128) main: Hann Window -I (128) view: Data min[256] = -inf, Data max[1] = 24.086628 - ________________________________________________________________ -0| | -1| | -2| | -3| | -4| | -5 | | -6 | | -7 ||||| | -8 ||||||||||||||| | -9 |||||||||||||||||||||||||||||||||||||||||| - 0123456789012345678901234567890123456789012345678901234567890123 -I (138) view: Plot: Length=512, min=-120.000000, max=40.000000 -W (138) main: Blackman Window -I (148) view: Data min[355] = -165.295654, Data max[1] = 24.083012 - ________________________________________________________________ -0| | -1| | -2| | -3| | -4| | -5| | -6 | | -7 ||| | -8 ||||||||| | -9 ||||||||||||||||||||||||||||||||||||||||||||||||||| - 0123456789012345678901234567890123456789012345678901234567890123 -I (158) view: Plot: Length=512, min=-120.000000, max=40.000000 -W (158) main: Blackman-Harris Window -I (168) view: Data min[128] = -inf, Data max[1] = 23.874702 - ________________________________________________________________ -0| | -1| | -2| | -3| | -4| | -5| | -6| | -7|| | -8| |||| | -9 ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| - 0123456789012345678901234567890123456789012345678901234567890123 -I (178) view: Plot: Length=512, min=-120.000000, max=40.000000 -W (178) main: Blackman-Nuttall Window -I (188) view: Data min[128] = -inf, Data max[1] = 23.890663 - ________________________________________________________________ -0| | -1| | -2| | -3| | -4| | -5| | -6| | -7 || | -8 |||| | | -9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||| - 0123456789012345678901234567890123456789012345678901234567890123 -I (198) view: Plot: Length=512, min=-120.000000, max=40.000000 -W (198) main: Nuttall Window -I (208) view: Data min[203] = -175.147400, Data max[1] = 23.858671 - ________________________________________________________________ -0| | -1| | -2| | -3| | -4| | -5| | -6| | -7|| | -8 ||| | -9 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| - 0123456789012345678901234567890123456789012345678901234567890123 -I (218) view: Plot: Length=512, min=-120.000000, max=40.000000 -W (218) main: Flat-Top Window -I (228) view: Data min[256] = -inf, Data max[1] = 22.490753 - ________________________________________________________________ -0| | -1| | -2| | -3| | -4| | -5| | -6| | -7 || | -8 ||||| | -9 ||||||||||||||||||||||||||||||||||||||||||||||||||||||||| - 0123456789012345678901234567890123456789012345678901234567890123 -I (238) view: Plot: Length=512, min=-120.000000, max=40.000000 -I (238) main: End Example. -``` diff --git a/components/esp-dsp/examples/fft_window/main/CMakeLists.txt b/components/esp-dsp/examples/fft_window/main/CMakeLists.txt deleted file mode 100644 index fecbfaf5..00000000 --- a/components/esp-dsp/examples/fft_window/main/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -set(COMPONENT_SRCS "dsps_window_main.c") -set(COMPONENT_ADD_INCLUDEDIRS "") - -register_component() \ No newline at end of file diff --git a/components/esp-dsp/examples/fft_window/main/component.mk b/components/esp-dsp/examples/fft_window/main/component.mk deleted file mode 100644 index 5d85ad38..00000000 --- a/components/esp-dsp/examples/fft_window/main/component.mk +++ /dev/null @@ -1,8 +0,0 @@ -# -# Main component makefile. -# -# This Makefile can be left empty. By default, it will take the sources in the -# src/ directory, compile them and link them into lib(subdirectory_name).a -# in the build directory. This behaviour is entirely configurable, -# please read the ESP-IDF documents if you need to do this. -# diff --git a/components/esp-dsp/examples/fft_window/main/dsps_window_main.c b/components/esp-dsp/examples/fft_window/main/dsps_window_main.c deleted file mode 100644 index 1d196d23..00000000 --- a/components/esp-dsp/examples/fft_window/main/dsps_window_main.c +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright 2018-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. - - -#include -#include -#include -#include "freertos/FreeRTOS.h" -#include "freertos/task.h" -#include "esp_system.h" -#include "driver/spi_master.h" -#include "soc/gpio_struct.h" -#include "driver/gpio.h" -#include "driver/uart.h" -#include "soc/uart_struct.h" -#include - -#include "esp_dsp.h" - -static const char *TAG = "main"; - -// This example shows how to use FFT from esp-dsp library - -#define N_SAMPLES 1024 -int N = N_SAMPLES; -// Input test array -float x1[N_SAMPLES]; -// Window coefficients -float wind[N_SAMPLES]; -// working complex array -float y_cf[N_SAMPLES*2]; -// Pointers to result arrays -float* y1_cf = &y_cf[0]; - -void process_and_show(float* data, int length) -{ - dsps_fft2r_fc32(data, length); - // Bit reverse - dsps_bit_rev_fc32(data, length); - // Convert one complex vector to two complex vectors - dsps_cplx2reC_fc32(data, length); - - for (int i = 0 ; i < length/2 ; i++) { - data[i] = 10 * log10f((data[i * 2 + 0] * data[i * 2 + 0] + data[i * 2 + 1] * data[i * 2 + 1])/N); - } - - // Show power spectrum in 64x10 window from -100 to 0 dB from 0..N/4 samples - dsps_view(data, length/2, 64, 10, -120, 40, '|'); - -} - -void app_main() -{ - esp_err_t ret; - ESP_LOGI(TAG, "Start Example."); - ret = dsps_fft2r_init_fc32(NULL, CONFIG_DSP_MAX_FFT_SIZE); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Not possible to initialize FFT. Error = %i", ret); - return; - } - - ESP_LOGW(TAG, "Hann Window"); - // Generate Hann window - dsps_wind_hann_f32(wind, N); - // Convert two input vectors to one complex vector - for (int i=0 ; i< N ; i++) - { - y_cf[i*2 + 0] = wind[i]; - y_cf[i*2 + 1] = 0; - } - process_and_show(y_cf, N); - - ESP_LOGW(TAG, "Blackman Window"); - // Generate Blackman window - dsps_wind_blackman_f32(wind, N); - // Convert two input vectors to one complex vector - for (int i=0 ; i< N ; i++) - { - y_cf[i*2 + 0] = wind[i]; - y_cf[i*2 + 1] = 0; - } - process_and_show(y_cf, N); - - ESP_LOGW(TAG, "Blackman-Harris Window"); - // Generate Blackman-Harris window - dsps_wind_blackman_harris_f32(wind, N); - // Convert two input vectors to one complex vector - for (int i=0 ; i< N ; i++) - { - y_cf[i*2 + 0] = wind[i]; - y_cf[i*2 + 1] = 0; - } - process_and_show(y_cf, N); - - ESP_LOGW(TAG, "Blackman-Nuttall Window"); - // Generate Blackman-Nuttall window - dsps_wind_blackman_nuttall_f32(wind, N); - // Convert two input vectors to one complex vector - for (int i=0 ; i< N ; i++) - { - y_cf[i*2 + 0] = wind[i]; - y_cf[i*2 + 1] = 0; - } - process_and_show(y_cf, N); - - ESP_LOGW(TAG, "Nuttall Window"); - // Generate Nuttall window - dsps_wind_nuttall_f32(wind, N); - // Convert two input vectors to one complex vector - for (int i=0 ; i< N ; i++) - { - y_cf[i*2 + 0] = wind[i]; - y_cf[i*2 + 1] = 0; - } - process_and_show(y_cf, N); - - ESP_LOGW(TAG, "Flat-Top Window"); - // Generate Flat-Top window - dsps_wind_flat_top_f32(wind, N); - // Convert two input vectors to one complex vector - for (int i=0 ; i< N ; i++) - { - y_cf[i*2 + 0] = wind[i]; - y_cf[i*2 + 1] = 0; - } - process_and_show(y_cf, N); - - ESP_LOGI(TAG, "End Example."); -} diff --git a/components/esp-dsp/examples/iir/CMakeLists.txt b/components/esp-dsp/examples/iir/CMakeLists.txt deleted file mode 100644 index a71cf9c4..00000000 --- a/components/esp-dsp/examples/iir/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# The following lines of boilerplate have to be in your project's -# CMakeLists in this exact order for cmake to work correctly -cmake_minimum_required(VERSION 3.5) - -set(EXTRA_COMPONENT_DIRS "../../") -set(IDF_EXCLUDE_COMPONENTS test test_app) - -include($ENV{IDF_PATH}/tools/cmake/project.cmake) -project(iir) diff --git a/components/esp-dsp/examples/iir/Makefile b/components/esp-dsp/examples/iir/Makefile deleted file mode 100644 index bf570234..00000000 --- a/components/esp-dsp/examples/iir/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# -# This is a project Makefile. It is assumed the directory this Makefile resides in is a -# project subdirectory. -# - -PROJECT_NAME := iir - -# This line has to be included into the make file -# to include components that are located somewhere -# but not in "component" directory - -EXTRA_COMPONENT_DIRS := $(realpath ../..) -EXCLUDE_COMPONENTS := test - -include $(IDF_PATH)/make/project.mk - diff --git a/components/esp-dsp/examples/iir/README.md b/components/esp-dsp/examples/iir/README.md deleted file mode 100644 index ff4936a9..00000000 --- a/components/esp-dsp/examples/iir/README.md +++ /dev/null @@ -1,115 +0,0 @@ -# IIR Filter Example - -(See the README.md file in the upper level 'examples' directory for more information about examples.) - -This example demonstrates how to use IIR filters functionality from esp-dsp library. Example does the following steps: - -1. Initialize the library -2. Initialize input signal -3. Show LPF filter with Q factor 1 - * Calculate iir filter coefficients - * Filter the input test signal (delta function) - * Shows impulse response on the plot - * Shows frequency response on the plot - * Calculate execution performance -4. The same for LPF filter with Q factor 10 - -## How to use example - -### Hardware required - -This example does not require any special hardware, and can be run on any common development board. - -### Configure the project - -If using Make based build system, run `make menuconfig` and set serial port under Serial Flasher Options. -If using CMake based build system, no configuration is required. -Also, under Component Config/DSP Library/Optimization for ESP32, it's possible to select optimized or ansi implementation to compare. - -### Build and flash - -Build the project and flash it to the board, then run monitor tool to view serial output: - -``` -make -j4 flash monitor -``` - -Or, for CMake based build system (replace PORT with serial port name): - -``` -idf.py -p PORT flash monitor -``` - -(To exit the serial monitor, type ``Ctrl-]``.) - -See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects. - -## Example output - -Here is an typical example console output. - -``` -I (58) main: Start Example. -I (58) main: Impulse response of IIR filter with F=0.100000, qFactor=1.000000 -I (68) view: Data min[8] = -0.060052, Data max[2] = 0.333517 - ________________________________________________________________ -0 | -1 | -2 - | -3- - | -4 -------------------------------------------------------------| -5 | -6 | -7 | -8 | -9 | - 0123456789012345678901234567890123456789012345678901234567890123 -I (138) view: Plot: Length=128, min=-1.000000, max=1.000000 -I (148) view: Data min[511] = -149.983795, Data max[0] = 0.000000 - ________________________________________________________________ -0 | -1 | -2----------------- | -3 ---------- | -4 ------------- | -5 ---------- | -6 ------- | -7 --- | -8 -- | -9 --| - 0123456789012345678901234567890123456789012345678901234567890123 -I (228) view: Plot: Length=512, min=-100.000000, max=0.000000 -I (228) main: IIR for 1024 samples take 20276 cycles -I (238) main: Impulse response of IIR filter with F=0.100000, qFactor=10.000000 -I (248) view: Data min[7] = -0.453739, Data max[2] = 0.526114 - ________________________________________________________________ -0 | -1 | -2 - - | -3- - - - --- --- - - | -4- - - - - ---- -------------------------------------| -5 -- -- -- -- | -6 | -7 | -8 | -9 | - 0123456789012345678901234567890123456789012345678901234567890123 -I (318) view: Plot: Length=128, min=-1.000000, max=1.000000 -I (328) view: Data min[511] = -149.480377, Data max[0] = 0.000000 - ________________________________________________________________ -0 -- | -1 -- - | -2---------- ----- | -3 -------- | -4 ------------ | -5 ---------- | -6 ------- | -7 --- | -8 -- | -9 --| - 0123456789012345678901234567890123456789012345678901234567890123 -I (408) view: Plot: Length=512, min=-100.000000, max=0.000000 -I (408) main: IIR for 1024 samples take 17456 cycles -I (418) main: End Example. - -``` diff --git a/components/esp-dsp/examples/iir/main/CMakeLists.txt b/components/esp-dsp/examples/iir/main/CMakeLists.txt deleted file mode 100644 index 0b1886f2..00000000 --- a/components/esp-dsp/examples/iir/main/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -set(COMPONENT_SRCS "dsps_iir_main.c") -set(COMPONENT_ADD_INCLUDEDIRS "") - -register_component() \ No newline at end of file diff --git a/components/esp-dsp/examples/iir/main/component.mk b/components/esp-dsp/examples/iir/main/component.mk deleted file mode 100644 index 5d85ad38..00000000 --- a/components/esp-dsp/examples/iir/main/component.mk +++ /dev/null @@ -1,8 +0,0 @@ -# -# Main component makefile. -# -# This Makefile can be left empty. By default, it will take the sources in the -# src/ directory, compile them and link them into lib(subdirectory_name).a -# in the build directory. This behaviour is entirely configurable, -# please read the ESP-IDF documents if you need to do this. -# diff --git a/components/esp-dsp/examples/iir/main/dsps_iir_main.c b/components/esp-dsp/examples/iir/main/dsps_iir_main.c deleted file mode 100644 index 4866f32e..00000000 --- a/components/esp-dsp/examples/iir/main/dsps_iir_main.c +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2018-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. - -#include -#include -#include -#include "freertos/FreeRTOS.h" -#include "freertos/task.h" -#include "esp_system.h" -#include "driver/spi_master.h" -#include "soc/gpio_struct.h" -#include "driver/gpio.h" -#include "driver/uart.h" -#include "soc/uart_struct.h" -#include - -#include "esp_dsp.h" - -static const char *TAG = "main"; - -// This example shows how to use iir filters from esp-dsp library - -#define N_SAMPLES 1024 -int N = N_SAMPLES; -// Input test array -float d[N_SAMPLES]; -// output array -float y[N_SAMPLES]; -float y_cf[N_SAMPLES*2]; - -// Function shows result of IIR filter -void ShowIIRfilter(float freq, float qFactor) -{ - esp_err_t ret = ESP_OK; - float coeffs_lpf[5]; - float w_lpf[5] = {0,0}; - // Calculate iir filter coefficients - ret = dsps_biquad_gen_lpf_f32(coeffs_lpf, freq, qFactor); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Operation error = %i", ret); - return; - } - // Process input signal - unsigned int start_b = xthal_get_ccount(); - ret = dsps_biquad_f32(d, y, N, coeffs_lpf, w_lpf); - unsigned int end_b = xthal_get_ccount(); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Operation error = %i", ret); - return; - } - - // Show result as a plot - ESP_LOGI(TAG, "Impulse response of IIR filter with F=%f, qFactor=%f", freq, qFactor); - dsps_view(y, 128, 64, 10, -1, 1, '-'); - - // Show result as frequency responce on the plot - for (int i=0 ; i< N ; i++) - { - y_cf[i*2 + 0] = y[i]; - y_cf[i*2 + 1] = 0; - } - - // We making FFT transform - dsps_fft2r_fc32_ansi(y_cf, N); - // Bit reverse - dsps_bit_rev_fc32_ansi(y_cf, N); - // Calculating power of spectrum in dB - for (int i = 0 ; i < N/2 ; i++) { - y_cf[i] = 10 * log10f((y_cf[i * 2 + 0] * y_cf[i * 2 + 0] + y_cf[i * 2 + 1] * y_cf[i * 2 + 1])/N); - } - // Show power spectrum in 64x10 window from -100 to 0 dB from 0..N/2 samples - dsps_view(y_cf, N/2, 64, 10, -100, 0, '-'); - ESP_LOGI(TAG, "IIR for %i samples take %i cycles", N, end_b - start_b); -} - -void app_main() -{ - esp_err_t ret; - ESP_LOGI(TAG, "Start Example."); - // If user don't care about buffer allocation, the defalt - // initialization could be used as shown here: - ret = dsps_fft2r_init_fc32(NULL, CONFIG_DSP_MAX_FFT_SIZE); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Not possible to initialize FFT. Error = %i", ret); - return; - } - - // Initialize input signal - // Generate d function as input signal - dsps_d_gen_f32(d, N, 0); - - // Show filter with Q factor 1 - ShowIIRfilter(0.1, 1); - // Show filter with Q factor 10 - ShowIIRfilter(0.1, 10); - - ESP_LOGI(TAG, "End Example."); -} diff --git a/components/esp-dsp/examples/matrix/CMakeLists.txt b/components/esp-dsp/examples/matrix/CMakeLists.txt deleted file mode 100644 index bc757fca..00000000 --- a/components/esp-dsp/examples/matrix/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# The following lines of boilerplate have to be in your project's -# CMakeLists in this exact order for cmake to work correctly -cmake_minimum_required(VERSION 3.5) - -set(EXTRA_COMPONENT_DIRS "../../") -set(IDF_EXCLUDE_COMPONENTS test test_app) - -include($ENV{IDF_PATH}/tools/cmake/project.cmake) -project(matrix) diff --git a/components/esp-dsp/examples/matrix/Makefile b/components/esp-dsp/examples/matrix/Makefile deleted file mode 100644 index 1af63f74..00000000 --- a/components/esp-dsp/examples/matrix/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# -# This is a project Makefile. It is assumed the directory this Makefile resides in is a -# project subdirectory. -# - -PROJECT_NAME := matrix - -# This line has to be included into the make file -# to include components that are located somewhere -# but not in "component" directory - -EXTRA_COMPONENT_DIRS := $(realpath ../..) -EXCLUDE_COMPONENTS := test - -include $(IDF_PATH)/make/project.mk - diff --git a/components/esp-dsp/examples/matrix/README.md b/components/esp-dsp/examples/matrix/README.md deleted file mode 100644 index b0742462..00000000 --- a/components/esp-dsp/examples/matrix/README.md +++ /dev/null @@ -1,62 +0,0 @@ -# Matrix Operations Example - -(See the README.md file in the upper level 'examples' directory for more information about examples.) - -This example demonstrates how to use Mat class functionality from esp-dsp library. Example does the following steps: - -1. Initialize a matrix A and matirx x -2. Calculate matrix b: b = A*x -3. Find roots x1_: A*x1_ = b, with different methods -4. Print result - -## How to use example - -### Hardware required - -This example does not require any special hardware, and can be run on any common development board. - -### Configure the project - -If using Make based build system, run `make menuconfig` and set serial port under Serial Flasher Options. -If using CMake based build system, no configuration is required. -Also, under Component Config/DSP Library/Optimization for ESP32, it's possible to select optimized or ansi implementation to compare. - -### Build and flash - -Build the project and flash it to the board, then run monitor tool to view serial output: - -``` -make -j4 flash monitor -``` - -Or, for CMake based build system (replace PORT with serial port name): - -``` -idf.py -p PORT flash monitor -``` - -(To exit the serial monitor, type ``Ctrl-]``.) - -See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects. - -## Example output - -Here is an typical example console output. - -``` -I (215) main: Start Example. -I (215) main: Original vector x: -0 -1 -2 -I (215) main: Solve result: -0 -1 -2 -I (215) main: Roots result: -0 -1 -2 -I (215) main: End Example. - -``` diff --git a/components/esp-dsp/examples/matrix/main/CMakeLists.txt b/components/esp-dsp/examples/matrix/main/CMakeLists.txt deleted file mode 100644 index 4c83db35..00000000 --- a/components/esp-dsp/examples/matrix/main/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -set(COMPONENT_SRCS "dspm_matrix_main.cpp") -set(COMPONENT_ADD_INCLUDEDIRS "") - -register_component() \ No newline at end of file diff --git a/components/esp-dsp/examples/matrix/main/component.mk b/components/esp-dsp/examples/matrix/main/component.mk deleted file mode 100644 index 5d85ad38..00000000 --- a/components/esp-dsp/examples/matrix/main/component.mk +++ /dev/null @@ -1,8 +0,0 @@ -# -# Main component makefile. -# -# This Makefile can be left empty. By default, it will take the sources in the -# src/ directory, compile them and link them into lib(subdirectory_name).a -# in the build directory. This behaviour is entirely configurable, -# please read the ESP-IDF documents if you need to do this. -# diff --git a/components/esp-dsp/examples/matrix/main/dspm_matrix_main.cpp b/components/esp-dsp/examples/matrix/main/dspm_matrix_main.cpp deleted file mode 100644 index 3b5ea109..00000000 --- a/components/esp-dsp/examples/matrix/main/dspm_matrix_main.cpp +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2018-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. - -#include -#include -#include -#include "dsp_platform.h" -#include "esp_log.h" - -#include "esp_dsp.h" - -static const char *TAG = "main"; - -// This example shows how to use Mat class from esp-dsp library. -// -// First we create matix A and x, and then calculating matrix b as result -// A*x = b -// Then we can find x as roots of matrices X and b -// -extern "C" void app_main(); - -void app_main() -{ - ESP_LOGI(TAG, "Start Example."); - int M = 3; - int N = 3; - dspm::Mat A(M, N); - dspm::Mat x(N, 1); - for (int m = 0 ; m < M ; m++) { - for (int n = 0 ; n < N ; n++) { - A(m, n) = N * m + n; - } - x(m, 0) = m; - } - A(0, 0) = 10; - A(0, 1) = 11; - - dspm::Mat b = A * x; - // Gaussian method - dspm::Mat x1_ = dspm::Mat::solve(A, b); - // Non Gaussian method - dspm::Mat x2_ = dspm::Mat::roots(A, b); - - ESP_LOGI(TAG, "Original vector x:"); - std::cout << x; - ESP_LOGI(TAG, "Solve result:"); - std::cout << x1_; - ESP_LOGI(TAG, "Roots result:"); - std::cout << x2_; - ESP_LOGI(TAG, "End Example."); -} diff --git a/components/esp-dsp/modules/common/include/dsp_common.h b/components/esp-dsp/modules/common/include/dsp_common.h deleted file mode 100644 index a2b43cbd..00000000 --- a/components/esp-dsp/modules/common/include/dsp_common.h +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2018-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. - -#ifndef _dsp_common_H_ -#define _dsp_common_H_ -#include -#include -#include "dsp_err.h" - - -#ifdef __cplusplus -extern "C" -{ -#endif - -/** - * @brief check power of two - * The function check if the argument is power of 2. - * The implementation use ANSI C and could be compiled and run on any platform - * - * @return - * - true if x is power of two - * - false if no - */ -bool dsp_is_power_of_two(int x); - - -/** - * @brief Power of two - * The function return power of 2 for values 2^N. - * The implementation use ANSI C and could be compiled and run on any platform - * - * @return - * - power of two - */ -int dsp_power_of_two(int x); - -#ifdef __cplusplus -} -#endif - -#endif // _dsp_common_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/common/include/dsp_err.h b/components/esp-dsp/modules/common/include/dsp_err.h deleted file mode 100644 index d769664c..00000000 --- a/components/esp-dsp/modules/common/include/dsp_err.h +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2018-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. - - -#ifndef _DSP_ERR_H_ -#define _DSP_ERR_H_ - -#include "stdint.h" -#include "esp_err.h" -#include "dsp_err_codes.h" - -#endif // _DSP_ERR_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/common/include/dsp_err_codes.h b/components/esp-dsp/modules/common/include/dsp_err_codes.h deleted file mode 100644 index c8827781..00000000 --- a/components/esp-dsp/modules/common/include/dsp_err_codes.h +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2018-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. - -#ifndef _dsp_error_codes_H_ -#define _dsp_error_codes_H_ - -#define DSP_OK 0 // For internal use only. Please use ESP_OK instead -#define ESP_ERR_DSP_BASE 0x70000 -#define ESP_ERR_DSP_INVALID_LENGTH (ESP_ERR_DSP_BASE + 1) -#define ESP_ERR_DSP_INVALID_PARAM (ESP_ERR_DSP_BASE + 2) -#define ESP_ERR_DSP_PARAM_OUTOFRANGE (ESP_ERR_DSP_BASE + 3) -#define ESP_ERR_DSP_UNINITIALIZED (ESP_ERR_DSP_BASE + 4) -#define ESP_ERR_DSP_REINITIALIZED (ESP_ERR_DSP_BASE + 5) - - -#endif // _dsp_error_codes_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/common/include/dsp_platform.h b/components/esp-dsp/modules/common/include/dsp_platform.h deleted file mode 100644 index d04f9dc7..00000000 --- a/components/esp-dsp/modules/common/include/dsp_platform.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2018-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. - - -#ifndef dsp_platform_h_ -#define dsp_platform_h_ -#include "soc/cpu.h" - -#include "freertos/FreeRTOS.h" -#include "freertos/portable.h" -#include "freertos/task.h" -#include "freertos/semphr.h" - -#endif // dsp_platform_h_ \ No newline at end of file diff --git a/components/esp-dsp/modules/common/include/dsp_tests.h b/components/esp-dsp/modules/common/include/dsp_tests.h deleted file mode 100644 index 3042c2d8..00000000 --- a/components/esp-dsp/modules/common/include/dsp_tests.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018-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. - -#ifndef _DSP_TESTS_H_ -#define _DSP_TESTS_H_ - -#define TEST_ASSERT_EXEC_IN_RANGE(min_exec, max_exec, actual) \ - if (actual >= max_exec) { \ - ESP_LOGE("", "Time error. Expected max: %i, reached: %i", (int)max_exec, (int)actual);\ - TEST_ASSERT_MESSAGE (false, "Exec time takes more than expected! ");\ - }\ - if (actual < min_exec) {\ - ESP_LOGE("", "Time error. Expected min: %i, reached: %i", (int)min_exec, (int)actual);\ - TEST_ASSERT_MESSAGE (false, "Exec time takes less then expected!");\ - } - - -#endif // _DSP_TESTS_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/common/include/esp_dsp.h b/components/esp-dsp/modules/common/include/esp_dsp.h deleted file mode 100644 index 61f991f9..00000000 --- a/components/esp-dsp/modules/common/include/esp_dsp.h +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2018-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. - -#ifndef _esp_dsp_H_ -#define _esp_dsp_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -// Common includes -#include "dsp_common.h" - -// Signal processing -#include "dsps_dotprod.h" -#include "dsps_math.h" -#include "dsps_fir.h" -#include "dsps_biquad.h" -#include "dsps_biquad_gen.h" -#include "dsps_wind.h" -#include "dsps_conv.h" -#include "dsps_corr.h" - -#include "dsps_d_gen.h" -#include "dsps_h_gen.h" -#include "dsps_tone_gen.h" -#include "dsps_snr.h" -#include "dsps_sfdr.h" - -#include "dsps_fft2r.h" -#include "dsps_fft4r.h" -#include "dsps_dct.h" - -// Matrix operations -#include "dspm_mult.h" - -// Support functions -#include "dsps_view.h" - - -#ifdef __cplusplus -} -#endif - -#ifdef __cplusplus -#include "mat.h" -#endif - -#endif // _esp_dsp_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/common/misc/dsps_pwroftwo.cpp b/components/esp-dsp/modules/common/misc/dsps_pwroftwo.cpp deleted file mode 100644 index 9c51f6b6..00000000 --- a/components/esp-dsp/modules/common/misc/dsps_pwroftwo.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2018-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. - -#include "dsp_common.h" - -bool dsp_is_power_of_two(int x) -{ - return (x != 0) && ((x & (x - 1)) == 0); -} - -int dsp_power_of_two(int x) -{ - for (size_t i = 0; i < 16; i++) - { - x = x >> 1; - if(0 == x) return i; - } - return 0; -} \ No newline at end of file diff --git a/components/esp-dsp/modules/common/private_include/dsp_types.h b/components/esp-dsp/modules/common/private_include/dsp_types.h deleted file mode 100644 index 02d725f9..00000000 --- a/components/esp-dsp/modules/common/private_include/dsp_types.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef _dsp_types_H_ -#define _dsp_types_H_ -#include -#include - -// union to simplify access to the 16 bit data -typedef union sc16_u -{ - struct - { - int16_t re; - int16_t im; - }; - uint32_t data; -}sc16_t; - -typedef union fc32_u -{ - struct - { - float re; - float im; - }; - uint64_t data; -}fc32_t; - -#endif // _dsp_types_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/conv/float/dsps_ccorr_f32_ae32.S b/components/esp-dsp/modules/conv/float/dsps_ccorr_f32_ae32.S deleted file mode 100644 index a3d594f8..00000000 --- a/components/esp-dsp/modules/conv/float/dsps_ccorr_f32_ae32.S +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_conv_platform.h" -#if (dsps_ccorr_f32_ae32_enabled == 1) - -#include "dsps_conv_f32_m_ae32.S" - -// This is dot product function for ESP32 processor. - .text - .align 4 - .global dsps_ccorr_f32_ae32 - .type dsps_ccorr_f32_ae32,@function -// The function implements the C code from dsps_ccorr_f32_ansi: -//esp_err_t dsps_ccorr_f32_ansi(const float *Signal, const int siglen, const float *Kernel, const int kernlen, float *corrout); -// -dsps_ccorr_f32_ae32: -// Signal - a2 -// siglen - a3 -// Kernel - a4 -// kernlen - a5 -// corrout - a6 -// -// a11 - loop length - - entry a1, 16 - // Array increment for floating point data should be 4 - sub a10, a3, a5 - bgez a10, dsps_ccorr_positive - addi a10, a2, 0 - addi a2, a4, 0 - addi a4, a10, 0 - - addi a10, a3, 0 - addi a3, a5, 0 - addi a5, a10, 0 - -dsps_ccorr_positive: - movi.n a8, 4 - addi a11, a5, 0 // lkern - loop counter - movi.n a14, 0 - addi a9, a14, 1 - - movi.n a7, 4 - movi.n a8, -4 - - mull a13, a5, a7 // a13 - kernlen*4 - add a13, a13, a4 // a13 - Kernel[kernlen] - addi a13, a13, -4 // a13 - Kernel[kernlen - 1] -ccorr_loop1: - // Clear initial state of the result register - addi a10, a13, 0 // a10 - Kernel - addi a12, a2, 0 // a12 - Signal - wfr f1, a14 // clear output: convout[n] = 0; - - // a12 - sig[0] - // a10 - kern[n]; - // a9 - n+1 - // a7 - 4, - // a8 - -4, - conv_f32_ae32 a12, a10, a9, a7, a7, loop1 - - addi a9, a9, 1 // (n+1)++ - addi a13, a13, -4 // kern[n] - a4-- - - ssi f1, a6, 0 // Store result from f1 to memory at a6 - addi a6, a6, 4 // convout++ - increment output pointer - - addi a11, a11, -1 - bnez a11, ccorr_loop1 - - // a11 - loop counter = siglen - kernlen - 1 - addi a9, a2, 4 // sig[1] - sig[kmin] - addi a13, a5, 0 - - // skip loop if 0 - sub a11, a3, a5 // a11 - loop counter - beqz a11, skip_ccorr_loop2 - -ccorr_loop2: - - // Clear initial state of the result register - addi a12, a9, 0 // a12 - Signal[kmin] - addi a10, a4, 0 // a10 - Kernel - wfr f1, a14 // clear output: convout[n] = 0; - - // a12 - sig[kmin] - // a10 - kern[0]; - // a11 - kernlen - // a7 - 4, - conv_f32_ae32 a12, a10, a13, a7, a7, loop2 - - addi a9, a9, 4 // in1++ - - ssi f1, a6, 0 // Store result from f1 to memory at a6 - addi a6, a6, 4 // convout++ - increment output pointer - - addi a11, a11, -1 - bnez a11, ccorr_loop2 - - -skip_ccorr_loop2: - - // a9 - the same - addi a11, a5, -1 - addi a13, a5, -1 -ccorr_loop3: - - // Clear initial state of the result register - addi a12, a9, 0 // a12 - Signal[kmin] - addi a10, a4, 0 // a10 - Kernel - wfr f1, a14 // clear output: convout[n] = 0; - - // a12 - sig[kmin] - // a10 - kern[n - kmin]; - // a11 - length - // a7 - 4, - // a8 - -4, - conv_f32_ae32 a12, a10, a11, a7, a7, loop3 - - addi a9, a9, 4 // n++ - - ssi f1, a6, 0 // Store result from f1 to memory at a6 - addi a6, a6, 4 // convout++ - increment output pointer - - addi a11, a11, -1 - bnez a11, ccorr_loop3 -skip_ccorr_loop3: - - movi.n a2, 0 // return status ESP_OK - retw.n - -#endif // dsps_ccorr_f32_ae32_enabled \ No newline at end of file diff --git a/components/esp-dsp/modules/conv/float/dsps_ccorr_f32_ansi.c b/components/esp-dsp/modules/conv/float/dsps_ccorr_f32_ansi.c deleted file mode 100644 index 9120ff6c..00000000 --- a/components/esp-dsp/modules/conv/float/dsps_ccorr_f32_ansi.c +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_conv.h" -#include "esp_log.h" - -static const char *TAG = "dsps_conv"; - -esp_err_t dsps_ccorr_f32_ansi(const float *Signal, const int siglen, const float *Kernel, const int kernlen, float *corrvout) -{ - if (NULL == Signal) { - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - } - if (NULL == Kernel) { - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - } - if (NULL == corrvout) { - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - } - - float *sig = (float *)Signal; - float *kern = (float *)Kernel; - int lsig = siglen; - int lkern = kernlen; - - if (siglen < kernlen) { - sig = (float *)Kernel; - kern = (float *)Signal; - lsig = kernlen; - lkern = siglen; - } - - for (int n = 0; n < lkern; n++) { - size_t k; - size_t kmin = lkern - 1 - n; - corrvout[n] = 0; - - for (k = 0; k <= n; k++) { - corrvout[n] += sig[k] * kern[kmin + k]; - } - ESP_LOGV(TAG, "L1 k = %i, n = %i , kmin= %i, kmax= %i", 0, n, kmin, kmin + n); - } - for (int n = lkern; n < lsig; n++) { - size_t kmin, kmax, k; - - corrvout[n] = 0; - - kmin = n - lkern + 1; - kmax = n; - for (k = kmin; k <= kmax; k++) { - corrvout[n] += sig[k] * kern[k - kmin]; - } - ESP_LOGV(TAG, "L2 n=%i, kmin = %i, kmax = %i , k-kmin = %i", n, kmin, kmax, 0); - } - - for (int n = lsig; n < lsig + lkern - 1; n++) { - size_t kmin, kmax, k; - - corrvout[n] = 0; - - kmin = n - lkern + 1; - kmax = lsig - 1; - - for (k = kmin; k <= kmax; k++) { - corrvout[n] += sig[k] * kern[k - kmin]; - } - ESP_LOGV(TAG, "L3 n=%i, kmin = %i, kmax = %i , k - kmin = %i", n, kmin, kmax, kmax - kmin); - } - return ESP_OK; -} \ No newline at end of file diff --git a/components/esp-dsp/modules/conv/float/dsps_conv_f32_ae32.S b/components/esp-dsp/modules/conv/float/dsps_conv_f32_ae32.S deleted file mode 100644 index 6939794d..00000000 --- a/components/esp-dsp/modules/conv/float/dsps_conv_f32_ae32.S +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_conv_platform.h" -#if (dsps_conv_f32_ae32_enabled == 1) - -#include "dsps_conv_f32_m_ae32.S" - -// This is dot product function for ESP32 processor. - .text - .align 4 - .global dsps_conv_f32_ae32 - .type dsps_conv_f32_ae32,@function -// The function implements the C code from dsps_conv_f32_ansi: -//esp_err_t dsps_conv_f32_ansi(const float *Signal, const int siglen, const float *Kernel, const int kernlen, float *convout); -// -dsps_conv_f32_ae32: -// Signal - a2 -// siglen - a3 -// Kernel - a4 -// kernlen - a5 -// convout - a6 -// -// a11 - loop length - - entry a1, 16 - // Array increment for floating point data should be 4 - sub a10, a3, a5 - bgez a10, dsps_conv_positive - addi a10, a2, 0 - addi a2, a4, 0 - addi a4, a10, 0 - - addi a10, a3, 0 - addi a3, a5, 0 - addi a5, a10, 0 - -dsps_conv_positive: - movi.n a8, 4 - addi a11, a5, 0 // lkern - loop counter - movi.n a14, 0 - addi a9, a14, 1 - - movi.n a7, 4 - movi.n a8, -4 - -conv_loop1: - // Clear initial state of the result register - addi a10, a4, 0 // a10 - Kernel - addi a12, a2, 0 // a12 - Signal - wfr f1, a14 // clear output: convout[n] = 0; - - // a12 - sig[0] - // a10 - kern[n]; - // a9 - n+1 - // a7 - 4, - // a8 - -4, - conv_f32_ae32 a12, a10, a9, a7, a8, loop1 - - addi a9, a9, 1 // (n+1)++ - addi a4, a4, 4 // kern[n] - a4++ - - ssi f1, a6, 0 // Store result from f1 to memory at a6 - addi a6, a6, 4 // convout++ - increment output pointer - - addi a11, a11, -1 - bnez a11, conv_loop1 - - - // a11 - loop counter = siglen - kernlen - 1 - addi a9, a2, 0 // sig[1] - sig[kmin] - addi a13, a5, 0 - - // skip loop if 0 - sub a11, a3, a5 // a11 - loop counter - beqz a11, skip_conv_loop2 - -conv_loop2: - - // Clear initial state of the result register - addi a12, a9, 4 // a12 - Signal[kmin] - addi a10, a4, -4 // a10 - Kernel - wfr f1, a14 // clear output: convout[n] = 0; - - // a12 - sig[kmin] - // a10 - kern[n - kmin]; - // a11 - length - // a7 - 4, - // a8 - -4, - conv_f32_ae32 a12, a10, a13, a7, a8, loop2 - - addi a9, a9, 4 // (n+1)++ - - ssi f1, a6, 0 // Store result from f1 to memory at a6 - addi a6, a6, 4 // convout++ - increment output pointer - - addi a11, a11, -1 - bnez a11, conv_loop2 - -skip_conv_loop2: - -// sub a11, a3, a5 // a11 - loop counter -// beqz a11, skip_conv_loop3 - // a9 - the same - addi a11, a5, -1 - addi a13, a5, -1 -// beqz a11, skip_conv_loop3 -conv_loop3: - - // Clear initial state of the result register - addi a12, a9, 4 // a12 - Signal[kmin] - addi a10, a4, -4 // a10 - Kernel - wfr f1, a14 // clear output: convout[n] = 0; - - // a12 - sig[kmin] - // a10 - kern[n - kmin]; - // a11 - length - // a7 - 4, - // a8 - -4, - conv_f32_ae32 a12, a10, a13, a7, a8, loop3 - - addi a9, a9, 4 // (n+1)++ - - ssi f1, a6, 0 // Store result from f1 to memory at a6 - addi a6, a6, 4 // convout++ - increment output pointer - - addi a13, a13, -1 - - addi a11, a11, -1 - bnez a11, conv_loop3 -skip_conv_loop3: - - movi.n a2, 0 // return status ESP_OK - retw.n - -#endif // dsps_conv_f32_ae32_enabled \ No newline at end of file diff --git a/components/esp-dsp/modules/conv/float/dsps_conv_f32_ansi.c b/components/esp-dsp/modules/conv/float/dsps_conv_f32_ansi.c deleted file mode 100644 index 66ca2c6d..00000000 --- a/components/esp-dsp/modules/conv/float/dsps_conv_f32_ansi.c +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_conv.h" -#include "esp_log.h" - -static const char *TAG = "dsps_conv"; - -esp_err_t dsps_conv_f32_ansi(const float *Signal, const int siglen, const float *Kernel, const int kernlen, float *convout) -{ - if (NULL == Signal) { - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - } - if (NULL == Kernel) { - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - } - if (NULL == convout) { - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - } - - float *sig = (float *)Signal; - float *kern = (float *)Kernel; - int lsig = siglen; - int lkern = kernlen; - - if (siglen < kernlen) { - sig = (float *)Kernel; - kern = (float *)Signal; - lsig = kernlen; - lkern = siglen; - } - - for (int n = 0; n < lkern; n++) { - size_t k; - - convout[n] = 0; - - for (k = 0; k <= n; k++) { - convout[n] += sig[k] * kern[n - k]; - } - ESP_LOGV(TAG,"L1 kmin = %i, kmax = %i , n-kmin = %i", 0, n, n); - } - for (int n = lkern; n < lsig; n++) { - size_t kmin, kmax, k; - - convout[n] = 0; - - kmin = n - lkern + 1; - kmax = n; - ESP_LOGV(TAG,"L2 n=%i, kmin = %i, kmax = %i , n-kmin = %i", n, kmin, kmax, n-kmin); - for (k = kmin; k <= kmax; k++) { - convout[n] += sig[k] * kern[n - k]; - } - } - - for (int n = lsig; n < lsig + lkern - 1; n++) { - size_t kmin, kmax, k; - - convout[n] = 0; - - kmin = n - lkern + 1; - kmax = lsig - 1; - - for (k = kmin; k <= kmax; k++) { - convout[n] += sig[k] * kern[n - k]; - } - ESP_LOGV(TAG,"L3 n=%i, kmin = %i, kmax = %i , n-kmin = %i", n, kmin, kmax, n-kmin); - } - return ESP_OK; -} \ No newline at end of file diff --git a/components/esp-dsp/modules/conv/float/dsps_conv_f32_m_ae32.S b/components/esp-dsp/modules/conv/float/dsps_conv_f32_m_ae32.S deleted file mode 100644 index 354c0514..00000000 --- a/components/esp-dsp/modules/conv/float/dsps_conv_f32_m_ae32.S +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2018-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. - - -.macro conv_f32_ae32 x1 x2 count step1 step2 name -// This macro calculates floating point dot product for count float samples -// x1, x2 - input arrays -// count - amount of samples -// step1 - start step -//,step2 - A register for array step increment. (should be divided by 4) -// f1 - contains initial value -// -// result in f1 -// -// Macros body: -// f1 += x1[]*x2[]; i: 0..counter-1 -// affected: f0, f1, f2 -// Example: conv_f32_ae32 a2 a3 a5 a8 a9 -// a8 == 4, step is 4 bytes -// a5 == 32, length of array is 32 -// - lsxp f0, \x2, \step2 - loopnez \count, loop_mac_end_m_ae32\name - lsxp f2, \x1, \step1 - madd.s f1, f2, f0 - lsxp f0, \x2, \step2 - loop_mac_end_m_ae32\name: -.endm diff --git a/components/esp-dsp/modules/conv/float/dsps_corr_f32_ae32.S b/components/esp-dsp/modules/conv/float/dsps_corr_f32_ae32.S deleted file mode 100644 index cb36accd..00000000 --- a/components/esp-dsp/modules/conv/float/dsps_corr_f32_ae32.S +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_conv_platform.h" -#if (dsps_corr_f32_ae32_enabled == 1) - -#include "dsps_dotprod_f32_m_ae32.S" - -// This is dot product function for ESP32 processor. - .text - .align 4 - .global dsps_corr_f32_ae32 - .type dsps_corr_f32_ae32,@function -// The function implements the following C code: -//esp_err_t dsps_corr_f32_ansi(const float *Signal, const int siglen, const float *Pattern, const int patlen, float *dest) -//{ -// for (size_t n = 0; n < (siglen - patlen); n++) { -// float k_corr = 0; -// for (size_t m = 0; m < patlen; m++) { -// k_corr += Signal[n + m] * Pattern[m]; -// } -// dest[n] = k_corr; -// } -// return ESP_OK; -//} - -dsps_corr_f32_ae32: -// Signal - a2 -// siglen - a3 -// Pattern - a4 -// patlen - a5 -// dest - a6 -// a11 - loop length - - entry a1, 16 - // Array increment for floating point data should be 4 - movi.n a8, 4 - movi.n a13, 4 - sub a11, a3, a5 // a11 = loop length - addi a12, a2, 0 // move input pointer to the a12 - movi.n a9, 0 - movi.n a14, 0 - -corr_loop: - // Clear initial state of the result register - addi a10, a4, 0 // a10 - pattern - movi.n a9, 0 // clear a9 - wfr f1, a9 // clrar f1 - // a12 - input1 - // a10 - input2 - // a5 - length - // a8 - 4, step in arrays - // a9 - 0 - dotprod_f32_ae32 a12, a10, a5, a9, a8; - - ssi f1, a6, 0 // Store result from f1 to memory at a6 - addi a6, a6, 4 // y++ - increment output pointer - addi a12, a12, 4 // Signal++ - addi a11, a11, -1 - bnez a11, corr_loop - - movi.n a2, 0 // return status ESP_OK - retw.n - -#endif // dsps_corr_f32_ae32_enabled \ No newline at end of file diff --git a/components/esp-dsp/modules/conv/float/dsps_corr_f32_ansi.c b/components/esp-dsp/modules/conv/float/dsps_corr_f32_ansi.c deleted file mode 100644 index 5256a7af..00000000 --- a/components/esp-dsp/modules/conv/float/dsps_corr_f32_ansi.c +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_corr.h" - -esp_err_t dsps_corr_f32_ansi(const float *Signal, const int siglen, const float *Pattern, const int patlen, float *dest) -{ - if (NULL == Signal) { - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - } - if (NULL == Pattern) { - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - } - if (NULL == dest) { - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - } - if (siglen < patlen) { - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - } - - for (size_t n = 0; n < (siglen - patlen); n++) { - float k_corr = 0; - for (size_t m = 0; m < patlen; m++) { - k_corr += Signal[n + m] * Pattern[m]; - } - dest[n] = k_corr; - } - return ESP_OK; -} \ No newline at end of file diff --git a/components/esp-dsp/modules/conv/include/dsps_ccorr.h b/components/esp-dsp/modules/conv/include/dsps_ccorr.h deleted file mode 100644 index 9d838e55..00000000 --- a/components/esp-dsp/modules/conv/include/dsps_ccorr.h +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2018-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. - -#ifndef _dsps_ccorr_H_ -#define _dsps_ccorr_H_ -#include "dsp_err.h" - -#include "dsps_conv_platform.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - - -/**@{*/ -/** - * @brief Cross correlation - * - * The function make cross correlate between two ignals. - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param[in] Signal1: input array with input 1 signal values - * @param[in] siglen1: length of the input 1 signal array - * @param[in] Signal2: input array with input 2 signal values - * @param[in] siglen2: length of the input signal array - * @param corrout: output array with result of cross correlation. The size of dest array must be (siglen1 + siglen2 - 1) !!! - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library (one of the input array are NULL, or if (siglen < patlen)) - */ -esp_err_t dsps_ccorr_f32_ansi(const float *Signal, const int siglen, const float *Pattern, const int patlen, float *corrout); -esp_err_t dsps_ccorr_f32_ae32(const float *Signal, const int siglen, const float *Pattern, const int patlen, float *corrout); -/**}@*/ - -#ifdef __cplusplus -} -#endif - - -#ifdef CONFIG_DSP_OPTIMIZED -#if (dsps_ccorr_f32_ae32_enabled == 1) -#define dsps_ccorr_f32 dsps_ccorr_f32_ae32 -#else -#define dsps_ccorr_f32 dsps_ccorr_f32_ansi -#endif // dsps_ccorr_f32_ae32_enabled -#else -#define dsps_ccorr_f32 dsps_ccorr_f32_ansi -#endif - -#endif // _dsps_conv_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/conv/include/dsps_conv.h b/components/esp-dsp/modules/conv/include/dsps_conv.h deleted file mode 100644 index 7dc9e517..00000000 --- a/components/esp-dsp/modules/conv/include/dsps_conv.h +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2018-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. - -#ifndef _dsps_conv_H_ -#define _dsps_conv_H_ -#include "dsp_err.h" - -#include "dsps_conv_platform.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - - -/**@{*/ -/** - * @brief Convolution - * - * The function convolve Signal array with Kernel array. - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param[in] Signal: input array with signal - * @param[in] siglen: length of the input signal - * @param[in] Kernel: input array with convolution kernel - * @param[in] kernlen: length of the Kernel array - * @param convout: output array with convolution result length of (siglen + Kernel -1) - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_conv_f32_ae32(const float *Signal, const int siglen, const float *Kernel, const int kernlen, float *convout); -esp_err_t dsps_conv_f32_ansi(const float *Signal, const int siglen, const float *Kernel, const int kernlen, float *convout); -/**}@*/ - -#ifdef __cplusplus -} -#endif - - -#ifdef CONFIG_DSP_OPTIMIZED - -#if (dsps_conv_f32_ae32_enabled == 1) -#define dsps_conv_f32 dsps_conv_f32_ae32 -#else -#define dsps_conv_f32 dsps_conv_f32_ansi -#endif // dsps_conv_f32_ae32_enabled - -#else -#define dsps_conv_f32 dsps_conv_f32_ansi -#endif - -#endif // _dsps_conv_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/conv/include/dsps_conv_platform.h b/components/esp-dsp/modules/conv/include/dsps_conv_platform.h deleted file mode 100644 index 0a101956..00000000 --- a/components/esp-dsp/modules/conv/include/dsps_conv_platform.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _dsps_conv_platform_H_ -#define _dsps_conv_platform_H_ - -#include -#include - - -#if ((XCHAL_HAVE_FP == 1) && (XCHAL_HAVE_LOOPS == 1)) - -#define dsps_conv_f32_ae32_enabled 1 -#define dsps_ccorr_f32_ae32_enabled 1 -#define dsps_corr_f32_ae32_enabled 1 - -#endif - -#endif // _dsps_conv_platform_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/conv/include/dsps_corr.h b/components/esp-dsp/modules/conv/include/dsps_corr.h deleted file mode 100644 index 7104d30c..00000000 --- a/components/esp-dsp/modules/conv/include/dsps_corr.h +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2018-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. - -#ifndef _dsps_corr_H_ -#define _dsps_corr_H_ -#include "dsp_err.h" - -#include "dsps_conv_platform.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - - -/**@{*/ -/** - * @brief Correlation with pattern - * - * The function correlate input sigla array with pattern array. - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param[in] Signal: input array with signal values - * @param[in] siglen: length of the signal array - * @param[in] Pattern: input array with pattern values - * @param[in] patlen: length of the pattern array. The siglen must be bigger then patlen! - * @param dest: output array with result of correlation - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library (one of the input array are NULL, or if (siglen < patlen)) - */ -esp_err_t dsps_corr_f32_ansi(const float *Signal, const int siglen, const float *Pattern, const int patlen, float *dest); -esp_err_t dsps_corr_f32_ae32(const float *Signal, const int siglen, const float *Pattern, const int patlen, float *dest); -/**}@*/ - -#ifdef __cplusplus -} -#endif - - -#ifdef CONFIG_DSP_OPTIMIZED -#if (dsps_corr_f32_ae32_enabled == 1) -#define dsps_corr_f32 dsps_corr_f32_ae32 -#else -#define dsps_corr_f32 dsps_corr_f32_ansi -#endif // dsps_corr_f32_ae32_enabled -#else -#define dsps_corr_f32 dsps_corr_f32_ansi -#endif - -#endif // _dsps_corr_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/conv/test/test_dsps_ccorr_f32_ae32.c b/components/esp-dsp/modules/conv/test/test_dsps_ccorr_f32_ae32.c deleted file mode 100644 index fcb9cedd..00000000 --- a/components/esp-dsp/modules/conv/test/test_dsps_ccorr_f32_ae32.c +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_ccorr.h" -#include "esp_attr.h" - -static const char *TAG = "dsps_ccorr"; - -#define lenA 8 -#define lenB 4 - -static float inputA[lenA]; -static float inputB[lenB]; -static float output[lenA + lenB - 1 + 2]; -static float output_ref[lenA + lenB - 1 + 2]; - -TEST_CASE("dsps_ccorr_f32_ae32 functionality", "[dsps]") -{ - for (int i = 0 ; i < lenA ; i++) { - inputA[i] = i + 3; - } - for (int i = 0 ; i < lenB ; i++) { - inputB[i] = i + 10; - } - for (int i = 0 ; i < (lenA + lenB + 2 - 1); i++) { - output[i] = -1; - output_ref[i] = -1; - } - dsps_ccorr_f32_ae32(inputA, lenA, inputB, lenB, &output[0]); - dsps_ccorr_f32_ansi(inputA, lenA, inputB, lenB, &output_ref[0]); - for (size_t i = 0; i < (lenA + lenB - 1) + 2; i++) { - ESP_LOGI(TAG, "Data[%i] = %2.2f, expected = %2.2f", i, output[i], output_ref[i]); - } - for (size_t i = 0; i < (lenA + lenB - 1) + 2; i++) { - TEST_ASSERT_EQUAL(output_ref[i], output[i]); - } -} - -TEST_CASE("dsps_ccorr_f32_ae32 benchmark", "[dsps]") -{ - int max_N = 1024; - int ccorr_size = 64; - float *x = (float *)malloc(max_N * sizeof(float)); - float *y = (float *)malloc(max_N * sizeof(float)); - float *z = (float *)malloc((max_N + ccorr_size - 1) * sizeof(float)); - - for (int i = 0 ; i < max_N ; i++) { - x[i] = 0; - y[i] = 1000; - } - - unsigned int start_b = xthal_get_ccount(); - dsps_ccorr_f32_ae32(x, max_N, y, ccorr_size, &z[0]); - unsigned int end_b = xthal_get_ccount(); - - float cycles = end_b - start_b; - ESP_LOGI(TAG, "dsps_ccorr_f32_ae32 - %f cycles for signal %i and pattern %i", cycles, max_N, ccorr_size); - free(x); - free(y); - free(z); - -} diff --git a/components/esp-dsp/modules/conv/test/test_dsps_ccorr_f32_ansi.c b/components/esp-dsp/modules/conv/test/test_dsps_ccorr_f32_ansi.c deleted file mode 100644 index 406bd953..00000000 --- a/components/esp-dsp/modules/conv/test/test_dsps_ccorr_f32_ansi.c +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright 2018-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. - -#include -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_ccorr.h" -#include "esp_attr.h" -#include "esp_dsp.h" - -static const char *TAG = "dsps_ccorr"; - -#define lenA 20 -#define lenB 20 - -static float inputA[lenA]; -static float inputB[lenB]; -static float output_fwd[lenA + lenB - 1 + 2]; -static float output_back[lenA + lenB - 1 + 2]; - -TEST_CASE("dsps_ccorr_f32_ansi functionality", "[dsps]") -{ - for (size_t la = 1; la < lenA; la++) { - for (size_t lb = 1; lb < lenB; lb++) { - for (int i = 0 ; i < lenA ; i++) { - inputA[i] = (float)rand() / INT32_MAX; - } - for (int i = 0 ; i < lenB ; i++) { - inputB[i] = (float)rand() / INT32_MAX; - } - for (int i = 0 ; i < (lenA + lenB - 1 + 2); i++) { - output_fwd[i] = -1; - output_back[i] = -1; - } - dsps_ccorr_f32_ansi(inputA, la, inputB, lb, &output_fwd[1]); - dsps_ccorr_f32_ansi(inputB, lb, inputA, la, &output_back[1]); - TEST_ASSERT_EQUAL(output_fwd[0], -1); - TEST_ASSERT_EQUAL(output_fwd[la + lb], -1); - TEST_ASSERT_EQUAL(output_back[0], -1); - TEST_ASSERT_EQUAL(output_back[la + lb], -1); - } - } -} - -TEST_CASE("dsps_ccorr_f32_ansi draw", "[dsps]") -{ - int max_N = 1024; - float *x = (float *)malloc(max_N * sizeof(float)); - float *y = (float *)malloc(max_N * sizeof(float)); - float *z = (float *)malloc((max_N * 2 + 1) * sizeof(float)); - int l1 = 8; - int l2 = 4; - for (int i = 0 ; i < max_N ; i++) { - x[i] = 0; - y[i] = 0; - z[i] = 0; - } - x[0] = 20; - x[7] = 30; - y[0] = 10; - y[3] = 8; - dsps_ccorr_f32_ansi(x, l1, y, l2, &z[0]); - - dsps_view(z, l1 + l2, l1 + l2, 10, -1, 400, '+'); - for (int i = 0 ; i < (l1 + l2 - 1) ; i++) { - ESP_LOGI(TAG, "Z[%i] = %2.2f", i, z[i]); - } - - free(x); - free(y); - free(z); -} - -TEST_CASE("dsps_ccorr_f32_ansi benchmark", "[dsps]") -{ - int max_N = 1024; - int conv_size = 64; - float *x = (float *)malloc(max_N * sizeof(float)); - float *y = (float *)malloc(max_N * sizeof(float)); - float *z = (float *)malloc((max_N * 2 + 1) * sizeof(float)); - - for (int i = 0 ; i < max_N ; i++) { - x[i] = 0; - y[i] = 1000; - } - - unsigned int start_b = xthal_get_ccount(); - dsps_ccorr_f32_ansi(x, max_N, y, conv_size, &z[0]); - unsigned int end_b = xthal_get_ccount(); - - float cycles = end_b - start_b; - ESP_LOGI(TAG, "dsps_conv_f32_ansi - %f cycles for signal %i and pattern %i", cycles, max_N, conv_size); - free(x); - free(y); - free(z); -} diff --git a/components/esp-dsp/modules/conv/test/test_dsps_conv_f32_ae32.c b/components/esp-dsp/modules/conv/test/test_dsps_conv_f32_ae32.c deleted file mode 100644 index 9be2ddfc..00000000 --- a/components/esp-dsp/modules/conv/test/test_dsps_conv_f32_ae32.c +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright 2018-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. - -#include -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_conv.h" -#include "esp_attr.h" - -static const char *TAG = "dsps_conv"; - -#define lenA 30 -#define lenB 30 - -static float inputA[lenA]; -static float inputB[lenB]; -static float output_ref[lenA + lenB - 1 + 2]; -static float output_fwd[lenA + lenB - 1 + 2]; -static float output_back[lenA + lenB - 1 + 2]; - -TEST_CASE("dsps_conv_f32_ae32 test output", "[dsps]") -{ - int la = 3; - int lb = 2; - - for (int i = 0; i < lenA; i++) { - inputA[i] = 10 + i; - } - for (int i = 0; i < lenB; i++) { - inputB[i] = 20 + i; - } - for (int i = 0; i < (lenA + lenB - 1 + 2); i++) { - output_ref[i] = -1; - output_fwd[i] = -1; - output_back[i] = -1; - } - dsps_conv_f32_ansi(inputA, la, inputB, lb, &output_ref[1]); - dsps_conv_f32_ae32(inputA, la, inputB, lb, &output_fwd[1]); - - for (size_t i = 0; i < (la + lb + 1); i++) { - ESP_LOGD(TAG, "la=%i, lb=%i, i=%i, ref=%2.3f, fwd=%2.3f", la, lb, i, output_ref[i], output_fwd[i]); - } - float max_eps = 0.000001; - for (size_t i = 0; i < (la + lb + 1); i++) { - if (abs(output_ref[i] - output_fwd[i]) > max_eps) { - ESP_LOGE(TAG, "la=%i, lb=%i, i=%i, ref=%2.3f, fwd=%2.3f", la, lb, i, output_ref[i], output_fwd[i]); - } - TEST_ASSERT_EQUAL(output_ref[i], output_fwd[i]); - } -} - -TEST_CASE("dsps_conv_f32_ae32 functionality", "[dsps]") -{ - for (size_t la = 2; la < lenA; la++) { - for (size_t lb = 2; lb < lenB; lb++) { - for (int i = 0 ; i < lenA ; i++) { - inputA[i] = (float)rand() / INT32_MAX; - } - for (int i = 0 ; i < lenB ; i++) { - inputB[i] = (float)rand() / INT32_MAX; - } - for (int i = 0 ; i < (lenA + lenB - 1 + 2); i++) { - output_ref[i] = -1; - output_fwd[i] = -1; - output_back[i] = -1; - } - dsps_conv_f32_ansi(inputA, la, inputB, lb, &output_ref[1]); - dsps_conv_f32_ae32(inputA, la, inputB, lb, &output_fwd[1]); - dsps_conv_f32_ae32(inputB, lb, inputA, la, &output_back[1]); - float max_eps = 0.000001; - for (size_t i = 0; i < (la + lb + 1); i++) { - if ((abs(output_ref[i] - output_fwd[i]) > max_eps) || (abs(output_ref[i] - output_back[i]) > max_eps) || (abs(output_back[i] - output_fwd[i]) > max_eps)) { - ESP_LOGE(TAG, "la=%i, lb=%i, i=%i, ref=%2.3f, fwd=%2.3f, back=%2.3f", la, lb, i, output_ref[i], output_fwd[i], output_back[i]); - } - TEST_ASSERT_EQUAL(output_ref[i], output_fwd[i]); - TEST_ASSERT_EQUAL(output_ref[i], output_back[i]); - TEST_ASSERT_EQUAL(output_back[i], output_fwd[i]); - } - } - } -} - - -TEST_CASE("dsps_conv_f32_ae32 benchmark", "[dsps]") -{ - int max_N = 1024; - int conv_size = 64; - float *x = (float *)malloc(max_N * sizeof(float)); - float *y = (float *)malloc(max_N * sizeof(float)); - float *z = (float *)malloc((max_N * 2 + 1) * sizeof(float)); - - for (int i = 0 ; i < max_N ; i++) { - x[i] = 0; - y[i] = 1000; - } - - unsigned int start_b = xthal_get_ccount(); - dsps_conv_f32_ae32(x, max_N, y, conv_size, &z[0]); - unsigned int end_b = xthal_get_ccount(); - - float cycles = end_b - start_b; - ESP_LOGI(TAG, "dsps_conv_f32_ae32 - %f cycles for signal %i and pattern %i", cycles, max_N, conv_size); - free(x); - free(y); - free(z); -} diff --git a/components/esp-dsp/modules/conv/test/test_dsps_conv_f32_ansi.c b/components/esp-dsp/modules/conv/test/test_dsps_conv_f32_ansi.c deleted file mode 100644 index 561dce14..00000000 --- a/components/esp-dsp/modules/conv/test/test_dsps_conv_f32_ansi.c +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright 2018-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. - -#include -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_conv.h" -#include "esp_attr.h" -#include "esp_dsp.h" - -static const char *TAG = "dsps_conv"; - -#define lenA 20 -#define lenB 20 - -static float inputA[lenA]; -static float inputB[lenB]; -static float output_ref[lenA + lenB - 1 + 2]; -static float output_fwd[lenA + lenB - 1 + 2]; -static float output_back[lenA + lenB - 1 + 2]; - - -esp_err_t dsps_conv_f32_ref(const float *Signal, const int siglen, const float *Kernel, const int kernlen, float *convout) -{ - if (NULL == Signal) { - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - } - if (NULL == Kernel) { - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - } - if (NULL == convout) { - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - } - - - for (int n = 0; n < siglen + kernlen - 1; n++) { - size_t kmin, kmax, k; - - convout[n] = 0; - - kmin = (n >= kernlen - 1) ? n - (kernlen - 1) : 0; - kmax = (n < siglen - 1) ? n : siglen - 1; - - for (k = kmin; k <= kmax; k++) { - convout[n] += Signal[k] * Kernel[n - k]; - } - } - return ESP_OK; -} - -TEST_CASE("dsps_conv_f32_ansi functionality", "[dsps]") -{ - for (size_t la = 1; la < lenA; la++) { - for (size_t lb = 1; lb < lenB; lb++) { - for (int i = 0 ; i < lenA ; i++) { - inputA[i] = (float)rand() / INT32_MAX; - } - for (int i = 0 ; i < lenB ; i++) { - inputB[i] = (float)rand() / INT32_MAX; - } - for (int i = 0 ; i < (lenA + lenB - 1 + 2); i++) { - output_ref[i] = -1; - output_fwd[i] = -1; - output_back[i] = -1; - } - dsps_conv_f32_ref(inputA, la, inputB, lb, &output_ref[1]); - dsps_conv_f32_ansi(inputA, la, inputB, lb, &output_fwd[1]); - dsps_conv_f32_ansi(inputB, lb, inputA, la, &output_back[1]); - float max_eps = 0.000001; - for (size_t i = 0; i < (la + lb + 1); i++) { - if ((fabs(output_ref[i] - output_fwd[i]) > max_eps) || (fabs(output_ref[i] - output_back[i]) > max_eps) || (fabs(output_back[i] - output_fwd[i]) > max_eps)) { - ESP_LOGE(TAG, "la=%i, lb=%i, i=%i, ref=%2.3f, fwd=%2.3f, back=%2.3f", la, lb, i, output_ref[i], output_fwd[i], output_back[i]); - } - TEST_ASSERT_EQUAL(output_ref[i], output_fwd[i]); - TEST_ASSERT_EQUAL(output_ref[i], output_back[i]); - TEST_ASSERT_EQUAL(output_back[i], output_fwd[i]); - } - } - } -} - -TEST_CASE("dsps_conv_f32_ansi draw", "[dsps]") -{ - int max_N = 1024; - float *x = (float *)malloc(max_N * sizeof(float)); - float *y = (float *)malloc(max_N * sizeof(float)); - float *z = (float *)malloc((max_N * 2 + 1) * sizeof(float)); - - for (int i = 0 ; i < max_N ; i++) { - x[i] = 10; - y[i] = 20; - z[i] = 0; - } - - dsps_conv_f32_ansi(x, 32, y, 16, &z[0]); - - dsps_view(z, 32 + 16, 32 + 16, 10, -1, 4000, '+'); - - free(x); - free(y); - free(z); -} - -TEST_CASE("dsps_conv_f32_ansi benchmark", "[dsps]") -{ - int max_N = 1024; - int conv_size = 64; - float *x = (float *)malloc(max_N * sizeof(float)); - float *y = (float *)malloc(max_N * sizeof(float)); - float *z = (float *)malloc((max_N * 2 + 1) * sizeof(float)); - - for (int i = 0 ; i < max_N ; i++) { - x[i] = 0; - y[i] = 1000; - } - - unsigned int start_b = xthal_get_ccount(); - dsps_conv_f32_ansi(x, max_N, y, conv_size, &z[0]); - unsigned int end_b = xthal_get_ccount(); - - float cycles = end_b - start_b; - ESP_LOGI(TAG, "dsps_conv_f32_ansi - %f cycles for signal %i and pattern %i", cycles, max_N, conv_size); - free(x); - free(y); - free(z); -} diff --git a/components/esp-dsp/modules/conv/test/test_dsps_corr_f32_ae32.c b/components/esp-dsp/modules/conv/test/test_dsps_corr_f32_ae32.c deleted file mode 100644 index 2514edf7..00000000 --- a/components/esp-dsp/modules/conv/test/test_dsps_corr_f32_ae32.c +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_corr.h" -#include "esp_attr.h" - -static const char *TAG = "dsps_corr"; - -#define lenA 15 -#define lenB 10 - -static float inputA[lenA]; -static float inputB[lenB]; -static float output[lenA + lenB - 1 + 2]; -static float output_ref[lenA + lenB - 1 + 2]; - -TEST_CASE("dsps_corr_f32_ae32 functionality", "[dsps]") -{ - for (int i = 0 ; i < lenA ; i++) { - inputA[i] = i; - } - for (int i = 0 ; i < lenB ; i++) { - inputB[i] = 10 + i; - } - for (int i = 0 ; i < (lenA - lenB + 2); i++) { - output[i] = -1; - output_ref[i] = -1; - } - inputB[0] = 1; - dsps_corr_f32_ae32(inputA, lenA, inputB, lenB, &output[1]); - dsps_corr_f32_ansi(inputA, lenA, inputB, lenB, &output_ref[1]); - for (size_t i = 0; i < (lenA - lenB) + 2; i++) { - ESP_LOGD(TAG, "Data[%i] = %2.2f, expected = %2.2f", i, output[i], output_ref[i]); - } - for (size_t i = 0; i < (lenA - lenB) + 2; i++) { - TEST_ASSERT_EQUAL(output_ref[i], output[i]); - } -} - -TEST_CASE("dsps_corr_f32_ae32 benchmark", "[dsps]") -{ - int max_N = 1024; - int corr_size = 64; - float *x = (float *)malloc(max_N * sizeof(float)); - float *y = (float *)malloc(max_N * sizeof(float)); - float *z = (float *)malloc(max_N * sizeof(float)); - - for (int i = 0 ; i < max_N ; i++) { - x[i] = 0; - y[i] = 1000; - } - - unsigned int start_b = xthal_get_ccount(); - dsps_corr_f32_ae32(x, max_N, y, corr_size, &z[0]); - unsigned int end_b = xthal_get_ccount(); - - float cycles = end_b - start_b; - ESP_LOGI(TAG, "dsps_corr_f32_ae32 - %f cycles for signal %i and pattern %i", cycles, max_N, corr_size); - free(x); - free(y); - free(z); - -} diff --git a/components/esp-dsp/modules/conv/test/test_dsps_corr_f32_ansi.c b/components/esp-dsp/modules/conv/test/test_dsps_corr_f32_ansi.c deleted file mode 100644 index 9c95e3a2..00000000 --- a/components/esp-dsp/modules/conv/test/test_dsps_corr_f32_ansi.c +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_corr.h" -#include "esp_attr.h" - -static const char *TAG = "dsps_corr"; - -#define lenA 15 -#define lenB 10 - -static float inputA[lenA]; -static float inputB[lenB]; -static float output[lenA + lenB - 1 + 2]; - -TEST_CASE("dsps_corr_f32_ansi functionality", "[dsps]") -{ - for (int i = 0 ; i < lenA ; i++) { - inputA[i] = i; - } - for (int i = 0 ; i < lenB ; i++) { - inputB[i] = 0; - } - for (int i = 0 ; i < (lenA - lenB + 2); i++) { - output[i] = -1; - } - inputB[0] = 1; - dsps_corr_f32_ansi(inputA, lenA, inputB, lenB, &output[1]); - for (size_t i = 0; i < lenA + lenB; i++) { - ESP_LOGD(TAG, "output[%i] = %2.2f", i, output[i]); - } - - TEST_ASSERT_EQUAL(output[0], -1); - TEST_ASSERT_EQUAL(output[lenA - lenB + 1], -1); - for (size_t i = 0; i < (lenA - lenB); i++) { - TEST_ASSERT_EQUAL(output[i + 1], i); - } -} - -TEST_CASE("dsps_corr_f32_ansi benchmark", "[dsps]") -{ - int max_N = 1024; - int corr_size = 64; - float *x = (float *)malloc(max_N * sizeof(float)); - float *y = (float *)malloc(max_N * sizeof(float)); - float *z = (float *)malloc(max_N * sizeof(float)); - - for (int i = 0 ; i < max_N ; i++) { - x[i] = 0; - y[i] = 1000; - } - - unsigned int start_b = xthal_get_ccount(); - dsps_corr_f32_ansi(x, max_N, y, corr_size, &z[0]); - unsigned int end_b = xthal_get_ccount(); - - float cycles = end_b - start_b; - ESP_LOGI(TAG, "dsps_corr_f32_ansi - %f cycles for signal %i and pattern %i", cycles, max_N, corr_size); - free(x); - free(y); - free(z); - -} diff --git a/components/esp-dsp/modules/dct/float/dsps_dct_f32.c b/components/esp-dsp/modules/dct/float/dsps_dct_f32.c deleted file mode 100644 index 599800e7..00000000 --- a/components/esp-dsp/modules/dct/float/dsps_dct_f32.c +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright 2018-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. - -#include "dsp_common.h" -#include - -#include "dsps_dct.h" -#include "dsps_fft2r.h" - -esp_err_t dsps_dct_f32_ref(float *data, int N, float *result) -{ - float factor = M_PI / N; - for (size_t i = 0; i < N; i++) { - float sum = 0; - for (size_t j = 0; j < N; j++) { - sum += data[j] * cosf((j + 0.5) * i * factor); - } - result[i] = sum; - } - return ESP_OK; -} - -esp_err_t dsps_dct_inverce_f32_ref(float *data, int N, float *result) -{ - float factor = M_PI / N; - for (size_t i = 0; i < N; i++) { - float sum = data[0] / 2; - for (size_t j = 0; j < N; j++) { - sum += data[j] * cosf(j * (i + 0.5) * factor); - } - result[i] = sum; - } - return ESP_OK; -} - -esp_err_t dsps_dct_f32(float *data, int N) -{ - esp_err_t ret = ESP_OK; - if (dsps_fft2r_initialized == 0) { - return ESP_ERR_DSP_REINITIALIZED; - } - - for (int i = 0; i < N / 2; i++) { - data[(N - 1 - i) * 2] = data[i * 2 + 1]; - data[i * 2 + 1] = 0; - data[N + i * 2 + 1] = 0; - } - - ret = dsps_fft2r_fc32(data, N); - - // // The follows code do the same as this one: - // // - // float factor = M_PI / (N * 2); - // ret = dsps_bit_rev_fc32(data, N); - // for (int i = 0; i < N; i++) { - // float temp = i * factor; - // data[i] = data[i*2] * cosf(temp) + data[i*2 + 1] * sinf(temp); - // } - int table_step = 2; - for (int i = 0; i < N; i++) { - float c = dsps_fft_w_table_fc32[i * 2 * table_step]; - float s = dsps_fft_w_table_fc32[i * 2 * table_step + 1]; - data[i * 2] = data[i * 2] * c; - data[i * 2 + 1] = data[i * 2 + 1] * s; - } - ret = dsps_bit_rev_fc32(data, N); - for (int i = 0; i < N; i++) { - data[i] = data[i * 2] + data[i * 2 + 1]; - } - - return ret; -} - -esp_err_t dsps_dct_inv_f32(float *data, int N) -{ - esp_err_t ret = ESP_OK; - if (dsps_fft2r_initialized == 0) { - return ESP_ERR_DSP_REINITIALIZED; - } - - float factor = M_PI / (N * 2); - data[0] *= 0.5; - for (int i = N - 1; i >= 0; i--) { - float temp = i * factor; - data[i * 2] = data[i] * cosf(temp); - data[i * 2 + 1] = data[i] * -sinf(temp); - } - ret = dsps_fft2r_fc32(data, N); - ret = dsps_bit_rev_fc32(data, N); - for (size_t i = 0; i < N / 2; i++) { - data[i * 2 + 1] = data[(N - 1 - i) * 2]; - } - - return ret; -} \ No newline at end of file diff --git a/components/esp-dsp/modules/dct/include/dsps_dct.h b/components/esp-dsp/modules/dct/include/dsps_dct.h deleted file mode 100644 index bc0f415c..00000000 --- a/components/esp-dsp/modules/dct/include/dsps_dct.h +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2018-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. - -#ifndef _dsps_dct_H_ -#define _dsps_dct_H_ -#include "dsp_err.h" -#include "sdkconfig.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - -/**@{*/ -/** - * @brief DCT of radix 2, unscaled - * - * DCT type II of radix 2, unscaled - * Function is FFT based - * The extension (_ansi) use ANSI C and could be compiled and run on any platform. - * The extension (_ae32) is optimized for ESP32 chip. - * - * @param[inout] data: input/output array with size of N*2. An elements located: Re[0],Re[1], , ... Re[N-1], any data... up to N*2 - * result of DCT will be stored to this array from 0...N-1. - * Size of data array must be N*2!!! - * @param[in] N: Size of DCT transform. Size of data array must be N*2!!! - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_dct_f32(float *data, int N); - -/**@}*/ - -/**@{*/ -/** - * @brief Inverce DCT of radix 2 - * - * Inverce DCT type III of radix 2, unscaled - * Function is FFT based - * The extension (_ansi) use ANSI C and could be compiled and run on any platform. - * The extension (_ae32) is optimized for ESP32 chip. - * - * @param[inout] data: input/output array with size of N*2. An elements located: Re[0],Re[1], , ... Re[N-1], any data... up to N*2 - * result of DCT will be stored to this array from 0...N-1. - * Size of data array must be N*2!!! - * @param[in] N: Size of DCT transform. Size of data array must be N*2!!! - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_dct_inv_f32(float *data, int N); - -/**@}*/ - -/**@{*/ -/** - * @brief DCTs - * - * Direct DCT type II and Inverce DCT type III, unscaled - * These functions used as a reference for general purpose. These functions are not optimyzed! - * The extension (_ansi) use ANSI C and could be compiled and run on any platform. - * The extension (_ae32) is optimized for ESP32 chip. - * - * @param[in] data: input/output array with size of N. An elements located: Re[0],Re[1], , ... Re[N-1] - * @param[in] N: Size of DCT transform. Size of data array must be N*2!!! - * @param[out] result: output result array with size of N. - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_dct_f32_ref(float *data, int N, float *result); -esp_err_t dsps_dct_inverce_f32_ref(float *data, int N, float *result); -/**@}*/ - - -#ifdef __cplusplus -} -#endif - -#endif // _dsps_dct_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/dct/test/test_dsps_dct_f32.c b/components/esp-dsp/modules/dct/test/test_dsps_dct_f32.c deleted file mode 100644 index 1dadcb15..00000000 --- a/components/esp-dsp/modules/dct/test/test_dsps_dct_f32.c +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_view.h" -#include "dsps_dct.h" -#include "dsps_fft2r.h" -#include "dsp_tests.h" - -static const char *TAG = "dsps_dct"; - -TEST_CASE("dsps_dct_f32 functionality", "[dsps]") -{ - float* data = calloc(1024*2, sizeof(float)); - float* data_ref = calloc(1024*2, sizeof(float)); - float* data_fft = calloc(1024*2, sizeof(float)); - - int N = 64; - int check_bin = 4; - for (int i = 0 ; i < N ; i++) { - data[i] = 2 * sin(M_PI / N * check_bin * 2 * i); - data_ref[i] = data[i]; - data_fft[i] = data[i]; - data[i + N] = 0; - data_ref[i + N] = 0; - data_fft[i + N] = 0; - } - - dsps_dct_f32_ref(data, N, &data[N]); - dsps_view(&data[N], 32, 32, 10, -2, 2, '.'); - - dsps_dct_inverce_f32_ref(&data[N], N, data); - dsps_view(&data[0], 32, 32, 10, -2, 2, '.'); - - for (size_t i = 0; i < N; i++) { - ESP_LOGD(TAG, "DCT data[%i] = %2.3f\n", i, data[N + i]); - } - float abs_tol = 1e-5; - for (size_t i = 0; i < N; i++) { - ESP_LOGD(TAG, "data[%i] = %f, ref_data = %f\n", i, data[i], data_ref[i]*N / 2); - float error = abs(data[i] - data_ref[i] * N / 2); - if (error > abs_tol) { - ESP_LOGE(TAG, "data[%i] = %f, ref_data = %f, error= %f\n", i, data[i], data_ref[i]*N / 2, error); - TEST_ASSERT_MESSAGE (false, "Result out of range!\n"); - } - } - - free(data); - free(data_ref); - free(data_fft); - -} - -TEST_CASE("dsps_dct_f32 functionality Fast DCT", "[dsps]") -{ - esp_err_t ret = dsps_fft2r_init_fc32(NULL, CONFIG_DSP_MAX_FFT_SIZE); - if (ret != ESP_OK) { - ESP_LOGE(TAG, "Not possible to initialize FFT. Error = %i", ret); - return; - } - - float* data = calloc(1024*2, sizeof(float)); - float* data_ref = calloc(1024*2, sizeof(float)); - float* data_fft = calloc(1024*2, sizeof(float)); - - int N = 64; - int check_bin = 4; - for (int i = 0 ; i < N ; i++) { - data[i] = 2 * sin(M_PI / N * check_bin * 2 * i); - data_ref[i] = data[i]; - data_fft[i] = data[i]; - data[i + N] = 0; - data_ref[i + N] = 0; - data_fft[i + N] = 0; - } - - dsps_dct_f32_ref(data, N, &data[N]); - ret = dsps_dct_f32(data_fft, N); - - if (ret != ESP_OK) { - ESP_LOGE(TAG, "Error!"); - return; - } - float abs_tol = 1e-5; - for (size_t i = 0; i < N; i++) { - ESP_LOGD(TAG, "DCT data[%i] = %2.3f, data_fft = %2.3f\n", i, data[N + i], data_fft[i]); - float error = abs(data[N + i] - data_fft[i]); - if (error > abs_tol) { - ESP_LOGE(TAG, "DCT data[%i] = %f, data_fft = %f, error = %f\n", i, data[N + i], data_fft[i], error); - TEST_ASSERT_MESSAGE (false, "Result out of range!\n"); - } - } - - dsps_dct_inv_f32(data_fft, N); - - for (size_t i = 0; i < N; i++) { - ESP_LOGD(TAG, "IDCT data[%i] = %2.3f, data_fft = %2.3f\n", i, data[i], data_fft[i] / N * 2); - float error = abs(data[i] - data_fft[i] / N * 2); - if (error > abs_tol) { - ESP_LOGE(TAG, "IDCT data[%i] = %f, data_fft = %f, error = %f\n", i, data[i], data_fft[i] / N * 2, error); - TEST_ASSERT_MESSAGE (false, "Result out of range!\n"); - } - } - dsps_fft2r_deinit_fc32(); - free(data); - free(data_ref); - free(data_fft); -} - -TEST_CASE("dsps_dct_f32 benchmark", "[dsps]") -{ - esp_err_t ret = dsps_fft2r_init_fc32(NULL, CONFIG_DSP_MAX_FFT_SIZE); - if (ret != ESP_OK) { - ESP_LOGE(TAG, "Not possible to initialize FFT. Error = %i", ret); - return; - } - - float* data = calloc(1024*2, sizeof(float)); - float* data_ref = calloc(1024*2, sizeof(float)); - float* data_fft = calloc(1024*2, sizeof(float)); - - int N = 64; - int check_bin = 4; - for (int i = 0 ; i < N ; i++) { - data[i] = 2 * sin(M_PI / N * check_bin * 2 * i); - data[i + N] = 0; - } - - unsigned int start_b = xthal_get_ccount(); - ret = dsps_dct_f32(data, N); - unsigned int end_b = xthal_get_ccount(); - - if (ret != ESP_OK) { - TEST_ASSERT_MESSAGE (false, "Error!\n"); - return; - } - - float total_b = end_b - start_b; - float cycles = total_b; - ESP_LOGI(TAG, "Benchmark dsps_dct_f32 - %6i cycles for %6i DCT points FFT.", (int)cycles, N); - dsps_fft2r_deinit_fc32(); - free(data); - free(data_ref); - free(data_fft); -} diff --git a/components/esp-dsp/modules/dotprod/fixed/dsps_dotprod_s16_ae32.S b/components/esp-dsp/modules/dotprod/fixed/dsps_dotprod_s16_ae32.S deleted file mode 100644 index 2eff2554..00000000 --- a/components/esp-dsp/modules/dotprod/fixed/dsps_dotprod_s16_ae32.S +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_dotprod_platform.h" -#if (dsps_dotprod_s16_ae32_enabled == 1) -#include "dsps_dotprod_s16_m_ae32.S" -#include "dsp_err_codes.h" - - .text - .align 4 - .global dsps_dotprod_s16_ae32 - .type dsps_dotprod_s16_ae32,@function - - -//esp_err_t dsps_dotprod_s16_ae32(const int16_t* src1, const int16_t* src2, int16_t* dest, int len, int8_t shift); -dsps_dotprod_s16_ae32: -// src1 - a2 -// src2 - a3 -// dest - a4 -// len - a5 -// shift - a6 - - entry a1, 16 - - // Check minimum length - movi a8, 4 - blt a5, a8, dsps_dotprod_s16_ae32_error - - // Clear accumulator - movi a8, 0 - wsr a8, acchi - - // Prepare and load round value - movi a8, 0x7fff - ssr a6 - srl a8, a8 - wsr a8, acclo // initialize acc with shifted round value - - // Compensate for pre-increment - // Right shift to 16 bits - // RS = -shift + 15 - neg a6, a6 - addi a6, a6, 15 - - /* number of loop iterations (see below): - * a7 = count / 4 - 1 - */ - - srli a7, a5, 2 - addi a7, a7, -1 - - movi.n a10, 0 // load 0 to the a10 to increment second array - - dotprod_s16_ae32_full a2, a3, a7, a5 - - /* Get accumulator */ - ssr a6 - rsr a2, acchi - rsr a3, acclo - src a2, a2, a3 - - s16i a2, a4, 0 - movi.n a2, 0 - retw.n -dsps_dotprod_s16_ae32_error: - movi.n a2, ESP_ERR_DSP_INVALID_LENGTH - retw.n - -#endif // dsps_dotprod_s16_ae32_enabled \ No newline at end of file diff --git a/components/esp-dsp/modules/dotprod/fixed/dsps_dotprod_s16_ansi.c b/components/esp-dsp/modules/dotprod/fixed/dsps_dotprod_s16_ansi.c deleted file mode 100644 index 838ce309..00000000 --- a/components/esp-dsp/modules/dotprod/fixed/dsps_dotprod_s16_ansi.c +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_dotprod.h" - -esp_err_t dsps_dotprod_s16_ansi(const int16_t *src1, const int16_t *src2, int16_t *dest, int len, int8_t shift) -{ - // To make correct round operation we have to shift round value - long long acc = 0x7fff >> shift; - - for (int i = 0 ; i < len ; i++) { - acc += (int32_t)src1[i] * (int32_t)src2[i]; - } - - int final_shift = shift - 15; - if (final_shift > 0) { - *dest = (acc << final_shift); - } else { - *dest = (acc >> (-final_shift)); - } - return ESP_OK; -} - diff --git a/components/esp-dsp/modules/dotprod/fixed/dsps_dotprod_s16_m_ae32.S b/components/esp-dsp/modules/dotprod/fixed/dsps_dotprod_s16_m_ae32.S deleted file mode 100644 index 795c85db..00000000 --- a/components/esp-dsp/modules/dotprod/fixed/dsps_dotprod_s16_m_ae32.S +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2018-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. - - -.macro dotprod_s16_ae32 x1, x2, count -// This macro calculates fixed point dot product for ((count + 1)*4) int16 samples -// x1 - input array1 register (for example a2) -// x2 - input array2 register (for example a3) -// count - counter register (for example a7) -// count - samples_count / 4 - 1 -// acc += x1[i + 0]*x2[i + 0] + x1[i + 1]*x2[i + 1] + x1[i + 2]*x2[i + 2] + x1[i + 3]*x2[i + 3]; i: 0..count -// acchi, and acclo have to be initialize before -// Result - acchi || acclo -// Modifies: -// m0, m1, m2, m3 -// acchi || acclo - must be loaded before (for example 0x3fff to acclo). - - /* - * Data schedule. Each line represents instruction, columns represent - * register contents. Last column (MUL) shows the multiplication which - * takes place. Values loaded in the given cycle are shown in square brackets. - * - * m0 m1 m2 m3 MUL - * --------- pre-load ------------ - *[x0 x1] (no MULs in the first 3 instructions) - * x0 x1 [y0 y1] - * x0 x1 [x2 x3] y0 y1 - * x0 x1 x2 x3 y0 y1 [y2 y3] x0*y0 - * ---------- loop -------------- (the following 4 instructions are - *[x4 x5] x2 x3 y0 y1 y2 y3 x1*y1 repeated as much as needed) - * x4 x5 x2 x3 [y4 y5] y2 y3 x2*y2 - * x4 x5 [x6 x7] y4 y5 y2 y3 x3*y3 - * x4 x5 x6 x7 y4 y5 [y6 y7] x4*y4 - * --------- finalize ------------ - * x4 x5 x6 x7 y4 y5 y6 y7 x5*y5 (nothing is load) - * x4 x5 x6 x7 y4 y5 y6 y7 x6*y6 - * x4 x5 x6 x7 y4 y5 y6 y7 x7*y7 - */ - - addi \x1, \x1, -4 // To arrange fist pointer - addi \x2, \x2, -4 // To arrange fist pointer - //lddec m0, \x1 - //lddec m2, \x2 // To arrange fist pointer - - ldinc m0, \x1 - ldinc m2, \x2 - ldinc m1, \x1 - - mula.dd.ll.ldinc m3, \x2, m0, m2 - loopnez \count, .loop_end - .loop: - mula.dd.hh.ldinc m0, \x1, m0, m2 - mula.dd.ll.ldinc m2, \x2, m1, m3 - mula.dd.hh.ldinc m1, \x1, m1, m3 - mula.dd.ll.ldinc m3, \x2, m0, m2 - .loop_end: - - mula.dd.hh m0, m2 - mula.dd.ll m1, m3 - mula.dd.hh m1, m3 - -.endm // dotprod_s16_ae32 - - -.macro dotprod_s16_ae32_full x1, x2, count, full_count -// This macro calculates fixed point dot product for ((count + 1)*4) int16 samples -// x1 - input array1 register (for example a2) -// x2 - input array2 register (for example a3) -// count - counter register (for example a7) -// count - samples_count / 4 - 1 -// full_count - samples_count -// acc += x1[i + 0]*x2[i + 0] + x1[i + 1]*x2[i + 1] + x1[i + 2]*x2[i + 2] + x1[i + 3]*x2[i + 3]; i: 0..count -// acchi, and acclo have to be initialize before -// Result - acchi || acclo -// Modifies: -// m0, m1, m2, m3 -// acchi || acclo - must be loaded before (for example 0x3fff to acclo). - - dotprod_s16_ae32 \x1, \x2, \count - - bbci \full_count, 1, .mod2chk - ldinc m0, \x1 - ldinc m2, \x2 - mula.dd.hh m0, m2 - mula.dd.ll m0, m2 - .mod2chk: - bbci \full_count, 0, .mod1chk - ldinc m0, \x1 - ldinc m2, \x2 - mula.dd.ll m0, m2 - .mod1chk: - -.endm // dotprod_s16_ae32_full \ No newline at end of file diff --git a/components/esp-dsp/modules/dotprod/float/dsps_dotprod_f32_ae32.S b/components/esp-dsp/modules/dotprod/float/dsps_dotprod_f32_ae32.S deleted file mode 100644 index 0c14c813..00000000 --- a/components/esp-dsp/modules/dotprod/float/dsps_dotprod_f32_ae32.S +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_dotprod_platform.h" -#if (dotprod_f32_ae32_enabled == 1) - -#include "dsps_dotprod_f32_m_ae32.S" - -// This is dot product function for ESP32 processor. - .text - .align 4 - .global dsps_dotprod_f32_ae32 - .type dsps_dotprod_f32_ae32,@function -// The function implements the following C code: -//esp_err_t dsps_dotprod_f32_ae32(const float* src1, const float* src2, float* dest, int len) -//{ -// float acc = 0; -// for (int i=0 ; i< len ; i++) -// { -// acc += src1[i]*src2[i]; -// } -// *dest = acc; -// return ESP_OK; -//} - -dsps_dotprod_f32_ae32: -// src1 - a2 -// src2 - a3 -// dest - a4 -// len - a5 - - entry a1, 16 - // Array increment for floating point data should be 4 - movi.n a8, 4 - // Clear initial state of the result register - movi.n a9, 0 - wfr f1, a9 - // a2 - input1 - // a3 - input2 - // a5 - length - // a8 - 4, step in arrays - dotprod_f32_ae32 a2, a3, a5, a9, a8; - - ssi f1, a4, 0 // Store result from f1 to memory at a4 - - movi.n a2, 0 // return status ESP_OK - retw.n - -#endif // dotprode_f32_ae32_enabled diff --git a/components/esp-dsp/modules/dotprod/float/dsps_dotprod_f32_ansi.c b/components/esp-dsp/modules/dotprod/float/dsps_dotprod_f32_ansi.c deleted file mode 100644 index ec260e6e..00000000 --- a/components/esp-dsp/modules/dotprod/float/dsps_dotprod_f32_ansi.c +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_dotprod.h" - -esp_err_t dsps_dotprod_f32_ansi(const float *src1, const float *src2, float *dest, int len) -{ - float acc = 0; - for (int i = 0 ; i < len ; i++) { - acc += src1[i] * src2[i]; - } - *dest = acc; - return ESP_OK; -} diff --git a/components/esp-dsp/modules/dotprod/float/dsps_dotprod_f32_m_ae32.S b/components/esp-dsp/modules/dotprod/float/dsps_dotprod_f32_m_ae32.S deleted file mode 100644 index facafc6f..00000000 --- a/components/esp-dsp/modules/dotprod/float/dsps_dotprod_f32_m_ae32.S +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2018-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. - - -.macro dotprod_f32_ae32 x1 x2 count step1 step2 -// This macro calculates floating point dot product for count float samples -// x1, x2 - input arrays -// count - amount of samples -// step1 - start step -//,step2 - A register for array step increment. (should be divided by 4) -// f1 - contains initial value -// -// result in f1 -// -// Macros body: -// f1 += x1[i*step1]*x2[i*step2]; i: 0..counter-1 -// affected: f0, f1, f2 -// Example: dotprod_f32_ae32 a2 a3 a5 a8 a9 -// a8 == 4, step is 4 bytes -// a5 == 32, length of array is 32 -// -// mov \step1, \step2 - lsx f0, \x2, \step1 -// sub \x1, \x1, \step1 // To compensate first increment - loopnez \count, loop_mac_end_m_ae32 - lsx f2, \x1, \step1 - madd.s f1, f2, f0 - add.n \step1, \step1, \step2 - lsx f0, \x2, \step1 - loop_mac_end_m_ae32: -.endm diff --git a/components/esp-dsp/modules/dotprod/float/dsps_dotprode_f32_ae32.S b/components/esp-dsp/modules/dotprod/float/dsps_dotprode_f32_ae32.S deleted file mode 100644 index b16245cf..00000000 --- a/components/esp-dsp/modules/dotprod/float/dsps_dotprode_f32_ae32.S +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_dotprod_platform.h" -#if (dotprode_f32_ae32_enabled == 1) - -#include "dsps_dotprode_f32_m_ae32.S" - -// This is dot product function for ESP32 processor. - .text - .align 4 - .global dsps_dotprode_f32_ae32 - .type dsps_dotprode_f32_ae32,@function -// The function implements the following C code: -//esp_err_t dsps_dotprod_f32_ae32(const float* src1, const float* src2, float* dest, int len) -//{ -// float acc = 0; -// for (int i=0 ; i< len ; i++) -// { -// acc += src1[i]*src2[i]; -// } -// *dest = acc; -// return ESP_OK; -//} - -dsps_dotprode_f32_ae32: -// src1 - a2 -// src2 - a3 -// dest - a4 -// len - a5 -// step1- a6 -// step2- a7 - - entry a1, 16 - // Array increment for floating point data should be 4 - - slli a6,a6, 2 - slli a7,a7, 2 - // Clear initial state of the result register - movi.n a9, 0 - wfr f1, a9 - // a2 - input1 - // a3 - input2 - // a5 - length - // a6,a7, step in arrays - dotprode_f32_ae32 a2, a3, a5, a6, a7; - - ssi f1, a4, 0 // Store result from f1 to memory at a4 - - movi.n a2, 0 // return status ESP_OK - retw.n - -#endif //dotprode_f32_ae32_enabled diff --git a/components/esp-dsp/modules/dotprod/float/dsps_dotprode_f32_ansi.c b/components/esp-dsp/modules/dotprod/float/dsps_dotprode_f32_ansi.c deleted file mode 100644 index 531c74ee..00000000 --- a/components/esp-dsp/modules/dotprod/float/dsps_dotprode_f32_ansi.c +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_dotprod.h" - -esp_err_t dsps_dotprode_f32_ansi(const float *src1, const float *src2, float *dest, int len, int step1, int step2) -{ - float acc = 0; - for (int i = 0 ; i < len ; i++) { - acc += src1[i * step1] * src2[i * step2]; - } - *dest = acc; - return ESP_OK; -} diff --git a/components/esp-dsp/modules/dotprod/float/dsps_dotprode_f32_m_ae32.S b/components/esp-dsp/modules/dotprod/float/dsps_dotprode_f32_m_ae32.S deleted file mode 100644 index b2ea4f77..00000000 --- a/components/esp-dsp/modules/dotprod/float/dsps_dotprode_f32_m_ae32.S +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2018-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. - - -.macro dotprode_f32_ae32 x1 x2 count step1 step2 -// This macro calculates floating point dot product for count float samples -// x1, x2 - input arrays -// count - amount of samples -// step1,step2 - A register for array step. (should be divided by 4) -// f1 - contains initial value -// -// result in f1 -// -// Macros body: -// f1 += x1[i*step1]*x2[i*step2]; i: 0..counter-1 -// affected: f0, f1, f2 -// Example: dotprod_f32_ae32 a2 a3 a5 a8 a9 -// a8 == 4, step is 4 bytes -// a5 == 32, length of array is 32 -// - lsi f0, \x2, 0 - sub \x1, \x1, \step1 // To compensate first increment - loopnez \count, loop_mace_end_m_ae32 - add.n \x1, \x1, \step1 - lsi f2, \x1, 0 - madd.s f1, f2, f0 - add.n \x2, \x2, \step2 - lsi f0, \x2, 0 - loop_mace_end_m_ae32: -.endm diff --git a/components/esp-dsp/modules/dotprod/include/dsps_dotprod.h b/components/esp-dsp/modules/dotprod/include/dsps_dotprod.h deleted file mode 100644 index ae2e919b..00000000 --- a/components/esp-dsp/modules/dotprod/include/dsps_dotprod.h +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright 2018-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. - -#ifndef _DSPI_DOTPROD_H_ -#define _DSPI_DOTPROD_H_ - -#include "esp_log.h" -#include "dsp_err.h" - -#include "dsps_dotprod_platform.h" - -#ifdef __cplusplus -extern "C" -{ -#endif -// These functions calculates dotproduct of two vectors. - -/**@{*/ -/** - * @brief dot product of two 16 bit vectors - * Dot product calculation for two signed 16 bit arrays: *dest += (src1[i] * src2[i]) >> (15-shift); i= [0..N) - * The extension (_ansi) use ANSI C and could be compiled and run on any platform. - * The extension (_ae32) is optimized for ESP32 chip. - * - * @param[in] src1 source array 1 - * @param[in] src2 source array 2 - * @param dest destination pointer - * @param[in] len length of input arrays - * @param[in] shift shift of the result. - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_dotprod_s16_ansi(const int16_t *src1, const int16_t *src2, int16_t *dest, int len, int8_t shift); -esp_err_t dsps_dotprod_s16_ae32(const int16_t *src1, const int16_t *src2, int16_t *dest, int len, int8_t shift); -/**@}*/ - - -/**@{*/ -/** - * @brief dot product of two float vectors - * Dot product calculation for two floating point arrays: *dest += (src1[i] * src2[i]); i= [0..N) - * The extension (_ansi) use ANSI C and could be compiled and run on any platform. - * The extension (_ae32) is optimized for ESP32 chip. - * - * @param[in] src1 source array 1 - * @param[in] src2 source array 2 - * @param dest destination pointer - * @param[in] len length of input arrays - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_dotprod_f32_ansi(const float *src1, const float *src2, float *dest, int len); -esp_err_t dsps_dotprod_f32_ae32(const float *src1, const float *src2, float *dest, int len); -/**@}*/ - -/**@{*/ -/** - * @brief dot product of two float vectors with step - * Dot product calculation for two floating point arrays: *dest += (src1[i*step1] * src2[i*step2]); i= [0..N) - * The extension (_ansi) use ANSI C and could be compiled and run on any platform. - * The extension (_ae32) is optimized for ESP32 chip. - * - * @param[in] src1 source array 1 - * @param[in] src2 source array 2 - * @param dest destination pointer - * @param[in] len length of input arrays - * @param[in] step1 step over elements in first array - * @param[in] step2 step over elements in second array - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_dotprode_f32_ansi(const float *src1, const float *src2, float *dest, int len, int step1, int step2); -esp_err_t dsps_dotprode_f32_ae32(const float *src1, const float *src2, float *dest, int len, int step1, int step2); -/**@}*/ - -#ifdef __cplusplus -} -#endif - -#if CONFIG_DSP_OPTIMIZED -#if (dsps_dotprod_s16_ae32_enabled == 1) -#define dsps_dotprod_s16 dsps_dotprod_s16_ae32 -#else -#define dsps_dotprod_s16 dsps_dotprod_s16_ansi -#endif // dsps_dotprod_s16_ae32_enabled -#if (dsps_dotprod_f32_ae32_enabled == 1) -#define dsps_dotprod_f32 dsps_dotprod_f32_ae32 -#else -#define dsps_dotprod_f32 dsps_dotprod_f32_ansi -#endif // dsps_dotprod_f32_ae32_enabled -#if (dsps_dotprode_f32_ae32_enabled == 1) -#define dsps_dotprode_f32 dsps_dotprode_f32_ae32 -#else -#define dsps_dotprode_f32 dsps_dotprode_f32_ansi -#endif // dsps_dotprode_f32_ae32_enabled - -#else // CONFIG_DSP_OPTIMIZED -#define dsps_dotprod_s16 dsps_dotprod_s16_ansi -#define dsps_dotprod_f32 dsps_dotprod_f32_ansi -#define dsps_dotprode_f32 dsps_dotprode_f32_ansi -#endif // CONFIG_DSP_OPTIMIZED - -#endif // _DSPI_DOTPROD_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/dotprod/include/dsps_dotprod_platform.h b/components/esp-dsp/modules/dotprod/include/dsps_dotprod_platform.h deleted file mode 100644 index 83bbafb3..00000000 --- a/components/esp-dsp/modules/dotprod/include/dsps_dotprod_platform.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef _dsps_dotprod_platform_H_ -#define _dsps_dotprod_platform_H_ - -#include -#include - - -#if ((XCHAL_HAVE_FP == 1) && (XCHAL_HAVE_LOOPS == 1)) - -#define dotprod_f32_ae32_enabled 1 -#define dotprode_f32_ae32_enabled 1 - -#endif // - -#if ((XCHAL_HAVE_LOOPS == 1) && (XCHAL_HAVE_MAC16 == 1)) - -#define dsps_dotprod_s16_ae32_enabled 1 - -#endif // - -#endif // _dsps_dotprod_platform_H_ diff --git a/components/esp-dsp/modules/dotprod/test/test_dotprod_f32.c b/components/esp-dsp/modules/dotprod/test/test_dotprod_f32.c deleted file mode 100644 index d3304bf7..00000000 --- a/components/esp-dsp/modules/dotprod/test/test_dotprod_f32.c +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_dotprod.h" -#include "dsp_tests.h" - -TEST_CASE("dsps_dotprod_f32_ae32 functionality", "[dsps]") -{ - float check_value = 1235; - int max_N = 1024; - float *x = (float *)malloc(max_N * sizeof(float)); - float *y = (float *)malloc(max_N * sizeof(float)); - float *z = (float *)malloc(max_N * sizeof(float)); - - for (int i = 0 ; i < max_N ; i++) { - x[i] = 0; - y[i] = 1000; - } - - z[0] = check_value; - z[2] = check_value + 1; - - for (int i = 1 ; i < 1024 ; i++) { - esp_err_t status = dsps_dotprod_f32_ae32(x, y, &z[1], i); - TEST_ASSERT_EQUAL(status, ESP_OK); - TEST_ASSERT_EQUAL(check_value, z[0]); - TEST_ASSERT_EQUAL(check_value + 1, z[2]); - TEST_ASSERT_EQUAL(0, z[1]); - } - for (int i = 0 ; i < max_N ; i++) { - x[i] = 1; - y[i] = 3; - } - for (int i = 1 ; i < 1024 ; i++) { - esp_err_t status = dsps_dotprod_f32_ae32(x, y, &z[1], i); - TEST_ASSERT_EQUAL(status, ESP_OK); - TEST_ASSERT_EQUAL(check_value, z[0]); - TEST_ASSERT_EQUAL(check_value + 1, z[2]); - TEST_ASSERT_EQUAL(i * 3, z[1]); - } - - free(x); - free(y); - free(z); -} - -TEST_CASE("dsps_dotprod_f32_ae32 benchmark", "[dsps]") -{ - int max_N = 1024; - float *x = (float *)malloc(max_N * sizeof(float)); - float *y = (float *)malloc(max_N * sizeof(float)); - float *z = (float *)malloc(max_N * sizeof(float)); - - for (int i = 0 ; i < max_N ; i++) { - x[i] = 0; - y[i] = 1000; - } - - unsigned int start_b = xthal_get_ccount(); - int repeat_count = 1024; - for (int i = 0 ; i < repeat_count ; i++) { - dsps_dotprod_f32_ae32(x, y, &z[1], 1024); - } - unsigned int end_b = xthal_get_ccount(); - - float total_b = end_b - start_b; - float cycles = total_b / (1024 * repeat_count); - printf("Benchmark dsps_dotprod_f32_ae32 - %f per sample + overhead.\n", cycles); - float min_exec = 3; - float max_exec = 6; - TEST_ASSERT_EXEC_IN_RANGE(min_exec, max_exec, cycles); - - free(x); - free(y); - free(z); -} - - -TEST_CASE("dsps_dotprod_f32_ansi functionality", "[dsps]") -{ - float check_value = 1235; - int max_N = 1024; - float *x = (float *)malloc(max_N * sizeof(float)); - float *y = (float *)malloc(max_N * sizeof(float)); - float *z = (float *)malloc(max_N * sizeof(float)); - - for (int i = 0 ; i < max_N ; i++) { - x[i] = 0; - y[i] = 1000; - } - - z[0] = check_value; - z[2] = check_value + 1; - - for (int i = 1 ; i < 1024 ; i++) { - esp_err_t status = dsps_dotprod_f32_ansi(x, y, &z[1], i); - TEST_ASSERT_EQUAL(status, ESP_OK); - TEST_ASSERT_EQUAL(check_value, z[0]); - TEST_ASSERT_EQUAL(check_value + 1, z[2]); - TEST_ASSERT_EQUAL(0, z[1]); - } - for (int i = 0 ; i < max_N ; i++) { - x[i] = 1; - y[i] = 3; - } - for (int i = 1 ; i < 1024 ; i++) { - esp_err_t status = dsps_dotprod_f32_ansi(x, y, &z[1], i); - TEST_ASSERT_EQUAL(status, ESP_OK); - TEST_ASSERT_EQUAL(check_value, z[0]); - TEST_ASSERT_EQUAL(check_value + 1, z[2]); - TEST_ASSERT_EQUAL(i * 3, z[1]); - } - - free(x); - free(y); - free(z); -} - -TEST_CASE("dsps_dotprod_f32_ansi benchmark", "[dsps]") -{ - int max_N = 1024; - float *x = (float *)malloc(max_N * sizeof(float)); - float *y = (float *)malloc(max_N * sizeof(float)); - float *z = (float *)malloc(max_N * sizeof(float)); - - for (int i = 0 ; i < max_N ; i++) { - x[i] = 0; - y[i] = 1000; - } - - unsigned int start_b = xthal_get_ccount(); - int repeat_count = 1024; - for (int i = 0 ; i < repeat_count ; i++) { - dsps_dotprod_f32_ansi(x, y, &z[1], 1024); - } - unsigned int end_b = xthal_get_ccount(); - - float total_b = end_b - start_b; - float cycles = total_b / (1024 * repeat_count); - printf("Benchmark dsps_dotprod_f32_ansi - %f per sample + overhead.\n", cycles); - float min_exec = 4; - float max_exec = 20; - TEST_ASSERT_EXEC_IN_RANGE(min_exec, max_exec, cycles); - - free(x); - free(y); - free(z); -} \ No newline at end of file diff --git a/components/esp-dsp/modules/dotprod/test/test_dotprod_s16.c b/components/esp-dsp/modules/dotprod/test/test_dotprod_s16.c deleted file mode 100644 index dad753d6..00000000 --- a/components/esp-dsp/modules/dotprod/test/test_dotprod_s16.c +++ /dev/null @@ -1,220 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_dotprod.h" -#include "dsp_tests.h" - -// Test dsps_dotprod_s16_ansi function -TEST_CASE("dsps_dotprod_s16_ansi functionality", "[dsps]") -{ - int16_t check_value = 1235; - int max_N = 1024; - int16_t *x = (int16_t *)malloc(max_N * sizeof(int16_t)); - int16_t *y = (int16_t *)malloc(max_N * sizeof(int16_t)); - int16_t *z = (int16_t *)malloc(max_N * sizeof(int16_t)); - - for (int i = 0 ; i < max_N ; i++) { - x[i] = 0; - y[i] = 1000; - } - - z[0] = check_value; - z[2] = check_value + 1; - - // Check result == 0 - for (int i = 1; i < 1024; i++) { - esp_err_t status = dsps_dotprod_s16_ansi(x, y, &z[1], i, 0); - TEST_ASSERT_EQUAL(status, ESP_OK); - TEST_ASSERT_EQUAL(check_value, z[0]); - TEST_ASSERT_EQUAL(check_value + 1, z[2]); - TEST_ASSERT_EQUAL(0, z[1]); - } - - int16_t val_x = 0x080; - int16_t val_y = 0x100; - int16_t val_shift = 0; - - for (int i = 0; i < max_N; i++) { - x[i] = val_x; - y[i] = val_y; - } - - // We check that dotproduct working with shift = 0; - for (int i = 1 ; i < 1024 ; i++) { - esp_err_t status = dsps_dotprod_s16_ansi(x, y, &z[1], i, val_shift); - - TEST_ASSERT_EQUAL(status, ESP_OK); - TEST_ASSERT_EQUAL(check_value, z[0]); - TEST_ASSERT_EQUAL(check_value + 1, z[2]); - TEST_ASSERT_EQUAL((i * (val_x * val_y) + (0x7fff >> val_shift)) >> (15 - val_shift), z[1]); - } - val_shift = 2; - for (int i = 1 ; i < 1024 ; i++) { - esp_err_t status = dsps_dotprod_s16_ansi(x, y, &z[1], i, val_shift); - - TEST_ASSERT_EQUAL(status, ESP_OK); - TEST_ASSERT_EQUAL(check_value, z[0]); - TEST_ASSERT_EQUAL(check_value + 1, z[2]); - TEST_ASSERT_EQUAL(((long long)i * ((long long)val_x * (long long)val_y) + ((long long)0x7fff >> val_shift)) >> (15 - val_shift), z[1]); - } - - free(x); - free(y); - free(z); -} - -// Test dsps_dotprod_s16_ansi function -TEST_CASE("dsps_dotprod_s16_ae32 functionality", "[dsps]") -{ - int16_t check_value = 1235; - int max_N = 1024; - int16_t *x = (int16_t *)malloc(max_N * sizeof(int16_t)); - int16_t *y = (int16_t *)malloc(max_N * sizeof(int16_t)); - int16_t *z = (int16_t *)malloc(max_N * sizeof(int16_t)); - - for (int i = 0 ; i < max_N ; i++) { - x[i] = 0; - y[i] = 1000; - } - - z[0] = check_value; - z[2] = check_value + 1; - - // Check result == 0 - for (int i = 1 ; i < 1024 ; i++) { - esp_err_t status = dsps_dotprod_s16_ae32(x, y, &z[1], i, 0); - if (i < 4) { - TEST_ASSERT_EQUAL(status, ESP_ERR_DSP_INVALID_LENGTH); - } else { - TEST_ASSERT_EQUAL(check_value, z[0]); - TEST_ASSERT_EQUAL(check_value + 1, z[2]); - TEST_ASSERT_EQUAL(0, z[1]); - } - } - - int16_t val_x = 0x080; - int16_t val_y = 0x100; - int16_t val_shift = 0; - - for (int i = 0 ; i < max_N ; i++) { - x[i] = val_x; - y[i] = val_y; - } - // We check that dotproduct working with shift = 0; - for (int i = 1 ; i < 1024 ; i++) { - esp_err_t status = dsps_dotprod_s16_ae32(x, y, &z[1], i, val_shift); - if (i < 4) { - TEST_ASSERT_EQUAL(status, ESP_ERR_DSP_INVALID_LENGTH); - } else { - TEST_ASSERT_EQUAL(status, ESP_OK); - TEST_ASSERT_EQUAL(check_value, z[0]); - TEST_ASSERT_EQUAL(check_value + 1, z[2]); - TEST_ASSERT_EQUAL((i * (val_x * val_y) + (0x7fff >> val_shift)) >> (15 - val_shift), z[1]); - } - } - val_shift = 2; - for (int i = 1 ; i < 1024 ; i++) { - esp_err_t status = dsps_dotprod_s16_ae32(x, y, &z[1], i, val_shift); - if (i < 4) { - TEST_ASSERT_EQUAL(status, ESP_ERR_DSP_INVALID_LENGTH); - } else { - TEST_ASSERT_EQUAL(status, ESP_OK); - TEST_ASSERT_EQUAL(check_value, z[0]); - TEST_ASSERT_EQUAL(check_value + 1, z[2]); - TEST_ASSERT_EQUAL((i * (val_x * val_y) + ((int)0x7fff >> val_shift)) >> (15 - val_shift), z[1]); - } - } - - free(x); - free(y); - free(z); -} - -static portMUX_TYPE testnlock = portMUX_INITIALIZER_UNLOCKED; -TEST_CASE("dsps_dotprod_s16_ae32 benchmark", "[dsps]") -{ - int max_N = 1024; - - int16_t *x = (int16_t *)malloc(max_N * sizeof(int16_t)); - int16_t *y = (int16_t *)malloc(max_N * sizeof(int16_t)); - int16_t *z = (int16_t *)malloc(max_N * sizeof(int16_t)); - - for (int i = 0 ; i < max_N ; i++) { - x[i] = 0x100; - y[i] = 0x200; - } - // Disable interrupt to get exect count - - portENTER_CRITICAL(&testnlock); - - unsigned int start_b = xthal_get_ccount(); - int repeat_count = 1024; - for (int i = 0 ; i < repeat_count ; i++) { - dsps_dotprod_s16_ae32(x, y, &z[1], 1024, 0); - } - unsigned int end_b = xthal_get_ccount(); - portEXIT_CRITICAL(&testnlock); - - float total_b = end_b - start_b; - float cycles = total_b / (1024 * repeat_count); - printf("Benchmark dsps_dotprod_s16 - %f per sample + overhead. Result = %08x\n", cycles, z[1]); - float min_exec = 1.5; - float max_exec = 1.6; - TEST_ASSERT_EXEC_IN_RANGE(min_exec, max_exec, cycles); - - free(x); - free(y); - free(z); -} - -TEST_CASE("dsps_dotprod_s16_ansi benchmark", "[dsps]") -{ - int max_N = 1024; - - int16_t *x = (int16_t *)malloc(max_N * sizeof(int16_t)); - int16_t *y = (int16_t *)malloc(max_N * sizeof(int16_t)); - int16_t *z = (int16_t *)malloc(max_N * sizeof(int16_t)); - - for (int i = 0 ; i < max_N ; i++) { - x[i] = 0x100; - y[i] = 0x200; - } - // Disable interrupt to get exect count - - portENTER_CRITICAL(&testnlock); - - unsigned int start_b = xthal_get_ccount(); - int repeat_count = 1024; - for (int i = 0 ; i < repeat_count ; i++) { - dsps_dotprod_s16_ansi(x, y, &z[1], 1024, 0); - } - unsigned int end_b = xthal_get_ccount(); - portEXIT_CRITICAL(&testnlock); - - float total_b = end_b - start_b; - float cycles = total_b / (1024 * repeat_count); - printf("Benchmark dsps_dotprod_s16 - %f per sample + overhead. Result = %08x\n", cycles, z[1]); - float min_exec = 10; - float max_exec = 30; - TEST_ASSERT_EXEC_IN_RANGE(min_exec, max_exec, cycles); - - free(x); - free(y); - free(z); -} diff --git a/components/esp-dsp/modules/dotprod/test/test_dotprode_f32.c b/components/esp-dsp/modules/dotprod/test/test_dotprode_f32.c deleted file mode 100644 index d9cdf018..00000000 --- a/components/esp-dsp/modules/dotprod/test/test_dotprode_f32.c +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_dotprod.h" -#include "dsp_tests.h" - -TEST_CASE("dsps_dotprode_f32_ae32 functionality", "[dsps]") -{ - float check_value = 1235; - int max_N = 1024; - float *x = (float *)malloc(max_N * sizeof(float)); - float *y = (float *)malloc(max_N * sizeof(float)); - float *z = (float *)malloc(max_N * sizeof(float)); - - for (int i = 0 ; i < max_N ; i++) { - x[i] = 0; - y[i] = 1000; - } - - z[0] = check_value; - z[2] = check_value + 1; - - for (int i = 1 ; i < 1024 ; i++) { - esp_err_t status = dsps_dotprode_f32_ae32(x, y, &z[1], i, 1, 1); - TEST_ASSERT_EQUAL(status, ESP_OK); - TEST_ASSERT_EQUAL(check_value, z[0]); - TEST_ASSERT_EQUAL(check_value + 1, z[2]); - TEST_ASSERT_EQUAL(0, z[1]); - } - for (int i = 0 ; i < max_N ; i++) { - x[i] = 1; - y[i] = 3; - } - for (int i = 1 ; i < 1024 ; i++) { - esp_err_t status = dsps_dotprode_f32_ae32(x, y, &z[1], i, 1, 1); - TEST_ASSERT_EQUAL(status, ESP_OK); - TEST_ASSERT_EQUAL(check_value, z[0]); - TEST_ASSERT_EQUAL(check_value + 1, z[2]); - TEST_ASSERT_EQUAL(i * 3, z[1]); - } - - free(x); - free(y); - free(z); -} - -TEST_CASE("dsps_dotprode_f32_ae32 benchmark", "[dsps]") -{ - int max_N = 1024; - float *x = (float *)malloc(max_N * sizeof(float)); - float *y = (float *)malloc(max_N * sizeof(float)); - float *z = (float *)malloc(max_N * sizeof(float)); - - for (int i = 0 ; i < max_N ; i++) { - x[i] = 0; - y[i] = 1000; - } - - unsigned int start_b = xthal_get_ccount(); - int repeat_count = 1024; - for (int i = 0 ; i < repeat_count ; i++) { - dsps_dotprode_f32_ae32(x, y, &z[1], 1024, 1, 1); - } - unsigned int end_b = xthal_get_ccount(); - - float total_b = end_b - start_b; - float cycles = total_b / (1024 * repeat_count); - printf("Benchmark dsps_dotprode_f32_ae32 - %f per sample + overhead.\n", cycles); - float min_exec = 3; - float max_exec = 6; - TEST_ASSERT_EXEC_IN_RANGE(min_exec, max_exec, cycles); - - free(x); - free(y); - free(z); -} - - -TEST_CASE("dsps_dotprode_f32_ansi functionality", "[dsps]") -{ - float check_value = 1235; - int max_N = 1024; - float *x = (float *)malloc(max_N * sizeof(float)); - float *y = (float *)malloc(max_N * sizeof(float)); - float *z = (float *)malloc(max_N * sizeof(float)); - - for (int i = 0 ; i < max_N ; i++) { - x[i] = 0; - y[i] = 1000; - } - - z[0] = check_value; - z[2] = check_value + 1; - - for (int i = 1 ; i < 1024 ; i++) { - esp_err_t status = dsps_dotprode_f32_ansi(x, y, &z[1], i, 1, 1); - TEST_ASSERT_EQUAL(status, ESP_OK); - TEST_ASSERT_EQUAL(check_value, z[0]); - TEST_ASSERT_EQUAL(check_value + 1, z[2]); - TEST_ASSERT_EQUAL(0, z[1]); - } - for (int i = 0 ; i < max_N ; i++) { - x[i] = 1; - y[i] = 3; - } - for (int i = 1 ; i < 1024 ; i++) { - esp_err_t status = dsps_dotprode_f32_ansi(x, y, &z[1], i, 1, 1); - TEST_ASSERT_EQUAL(status, ESP_OK); - TEST_ASSERT_EQUAL(check_value, z[0]); - TEST_ASSERT_EQUAL(check_value + 1, z[2]); - TEST_ASSERT_EQUAL(i * 3, z[1]); - } - - free(x); - free(y); - free(z); -} - -TEST_CASE("dsps_dotprode_f32_ansi benchmark", "[dsps]") -{ - int max_N = 1024; - float *x = (float *)malloc(max_N * sizeof(float)); - float *y = (float *)malloc(max_N * sizeof(float)); - float *z = (float *)malloc(max_N * sizeof(float)); - - for (int i = 0 ; i < max_N ; i++) { - x[i] = 0; - y[i] = 1000; - } - - unsigned int start_b = xthal_get_ccount(); - int repeat_count = 1024; - for (int i = 0 ; i < repeat_count ; i++) { - dsps_dotprode_f32_ansi(x, y, &z[1], 1024, 1, 1); - } - unsigned int end_b = xthal_get_ccount(); - - float total_b = end_b - start_b; - float cycles = total_b / (1024 * repeat_count); - printf("Benchmark dsps_dotprode_f32_ansi - %f per sample + overhead.\n", cycles); - float min_exec = 10; - float max_exec = 25; - TEST_ASSERT_EXEC_IN_RANGE(min_exec, max_exec, cycles); - - free(x); - free(y); - free(z); -} \ No newline at end of file diff --git a/components/esp-dsp/modules/fft/fixed/dsps_fft2r_sc16_ae32.S b/components/esp-dsp/modules/fft/fixed/dsps_fft2r_sc16_ae32.S deleted file mode 100644 index 3ad400b7..00000000 --- a/components/esp-dsp/modules/fft/fixed/dsps_fft2r_sc16_ae32.S +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_fft2r_platform.h" -#if (dsps_fft2r_sc16_ae32_enabled == 1) - -// This is matrix multipliction function for ESP32 processor. - .text - .align 4 - .global dsps_fft2r_sc16_ae32_ - .type dsps_fft2r_sc16_ae32_,@function - - .global dsps_fft_w_table_sc16; - -//The function implements the following C code: -//esp_err_t dsps_fft2r_sc16_ansi(int16_t *data, int N) -//{ -// esp_err_t result = ESP_OK; -// uint32_t *w = (uint32_t*)dsps_fft_w_table_sc16; -// uint32_t *in_data = (uint32_t *)data; -// int ie, ia, m; -// sc16_t temp; -// sc16_t cs;// c - re, s - im -// sc16_t m_data; -// sc16_t a_data; - -// ie = 1; -// for (int N2 = N / 2; N2 > 0; N2 >>= 1) { -// ia = 0; -// for (int j = 0; j < ie; j++) { -// cs.data = w[j]; -// //c = w[2 * j]; -// //s = w[2 * j + 1]; -// for (int i = 0; i < N2; i++) { -// m = ia + N2; -// m_data.data = in_data[m]; -// a_data.data = in_data[ia]; -// sc16_t m1; -// m1.re = xtfixed_bf_1(a_data.re, cs.re, m_data.re, cs.im, m_data.im, 16);//(a_data.re - temp.re + shift_const) >> 1; -// m1.im = xtfixed_bf_2(a_data.im, cs.re, m_data.im, cs.im, m_data.re, 16);//(a_data.im - temp.im + shift_const) >> 1; -// in_data[m] = m1.data; -// sc16_t m2; -// m2.re = xtfixed_bf_3(a_data.re, cs.re, m_data.re, cs.im, m_data.im, 16);//(a_data.re + temp.re + shift_const) >> 1; -// m2.im = xtfixed_bf_4(a_data.im, cs.re, m_data.im, cs.im, m_data.re, 16);//(a_data.im + temp.im + shift_const)>>1; -// in_data[ia] = m2.data; -// ia++; -// } -// ia += N2; -// } -// ie <<= 1; -// } -// return result; -// } - -dsps_fft2r_sc16_ae32_: -//esp_err_t dsps_fft2r_sc16_ansi(float *data, int N, float* dsps_fft_w_table_sc16) - - entry a1, 16 - // Array increment for floating point data should be 4 -// data - a2 -// N - a3 -// dsps_fft_w_table_sc16 - a4 - for now - -// a5 - 1, used to initialize acc -// a6 - k, main loop counter; N2 - for (int N2 = N/2; N2 > 0; N2 >>= 1) -// a7 - ie -// a8 - j -// a9 - test -// a10 - (j)<<2, or a10 - j<<2 -// a11 - ia -// a12 - m -// a13 - ia pointer -// a14 - m pointer -// a15 - used to shift result - - // This instruction are not working. Have to be fixed!!! - // For now theres no solution... -// l32r a4, dsps_fft_w_table_sc16_ae32 - // To use ldinc operation we have to prepare a4: - addi a4, a4, -4 - addi a9, a2, -4 // prepare input pointer for ldinc operation - - ldinc m1, a4 // Load [0x7fff j0] value to the m1 - addi a4, a4, -4 - - // a5 used to load 0x7fff and clear acch/l - movi.n a5, 1 // a5 = 1; - - srli a6, a3, 1 // a6 = N2 = N/2 - - // Load shift register - movi a7, 16 - ssr a7 - - movi a7, 1 // a7 - ie - -fft2r_l1: - movi a8, 0 // a8 - j - movi a11,0 // a11 = ia = 0; - -fft2r_l2: // loop for j, a8 - j - slli a10, a8, 2 // a10 = j<<2 (4 bytes per address) // shift for cs.data = w[j]; - add.n a10, a10, a4 // a10 - pointer to w tables - ldinc m0, a10 // cs.data = w[j]; - // here we have m0 and m1 - - loopnez a6, fft2r_l3 - add.n a12, a11, a6 // a12 = m = ia + N2 - - slli a14, a12, 2 // a14 - pointer for m, m_data.data = in_data[m]; - slli a13, a11, 2 // a13 - pointer for ia, a_data.data = in_data[ia]; - add.n a14, a14, a9 // pointers to data arrays - add.n a13, a13, a9 // These pointers are -4 from expected values... - - ldinc m2, a14 // m_data, a14 += 4; The pointers ready to store data - mul.da.ll m1, a5 // acc = 0x7fff*1 - ldinc m3, a13 // ai_data a13 += 4; - // re - l, im - h - muls.dd.ll m0, m2 // acc -= cs.re*m_data.re - mula.dd.ll m1, m3 // acc += 0x7fff*a_data.re - muls.dd.hh m0, m2 // acc -= cs.im*m_data.im - // result in acclo in_data[m].re - rsr a15, acclo - mul.da.ll m1, a5 // acc = 0x7fff*1 - sra a15, a15 - muls.dd.lh m0, m2 // acc -= cs.re*m_data.im - s16i a15, a14, 0 - mula.dd.lh m1, m3 // acc += 0x7fff*a_data.im - mula.dd.hl m0, m2 // acc += cs.im*m_data.re - // result in acclo in_data[m].im - rsr a15, acclo - mul.da.ll m1, a5 // acc = 0x7fff*1 - sra a15, a15 - mula.dd.ll m0, m2 // acc += cs.re*m_data.re - s16i a15, a14, 2 - mula.dd.ll m1, m3 // acc += 0x7fff*a_data.re - mula.dd.hh m0, m2 // acc += cs.im*m_data.im - // result in acclo // in_data[ia].re - rsr a15, acclo - mul.da.ll m1, a5 // acc = 0x7fff*1 - - sra a15, a15 - mula.dd.lh m0, m2 // acc += cs.re*m_data.im - s16i a15, a13, 0 - - mula.dd.lh m1, m3 // acc += 0x7fff*a_data.im - muls.dd.hl m0, m2 // acc -= cs.im*m_data.re - // result in acclo // in_data[ia].im - rsr a15, acclo - - sra a15, a15 - s16i a15, a13, 2 - - // Here we have m0 - w, m2 - m_data, m3 - ai_data, - addi a11, a11, 1// ia++ -fft2r_l3: - add a11, a11, a6 - - addi a8, a8, 1 // j++ - BNE a8, a7, fft2r_l2 // - slli a7, a7, 1 // ie = ie<<1 -// main loop: for (int k = N/2; k > 0; k >>= 1) - srli a6, a6, 1 // a6 = a6>>1 - BNEZ a6, fft2r_l1// Jump if > 0 - - movi.n a2, 0 // return status ESP_OK - retw.n - -#endif // dsps_fft2r_sc16_ae32_enabled \ No newline at end of file diff --git a/components/esp-dsp/modules/fft/fixed/dsps_fft2r_sc16_ansi.c b/components/esp-dsp/modules/fft/fixed/dsps_fft2r_sc16_ansi.c deleted file mode 100644 index 244b0657..00000000 --- a/components/esp-dsp/modules/fft/fixed/dsps_fft2r_sc16_ansi.c +++ /dev/null @@ -1,320 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_fft2r.h" -#include "dsp_common.h" -#include "dsp_types.h" -#include -#include "esp_attr.h" - -int16_t* dsps_fft_w_table_sc16; -int dsps_fft_w_table_sc16_size; -uint8_t dsps_fft2r_sc16_initialized = 0; -uint8_t dsps_fft2r_sc16_mem_allocated = 0; - -unsigned short reverse(unsigned short x, unsigned short N, int order); - -static const int add_rount_mult = 0x7fff; -static const int mult_shift_const = 0x7fff; // Used to shift data << 15 - -static inline int16_t xtfixed_bf_1(int16_t a0, int16_t a1, int16_t a2, int16_t a3, int16_t a4, int result_shift) -{ - int result = a0*mult_shift_const; - result -= (int32_t)a1*(int32_t)a2 + (int32_t)a3*(int32_t)a4; - result += add_rount_mult; - result = result >> result_shift; - return (int16_t)result; -} - -static inline int16_t xtfixed_bf_2(int16_t a0, int16_t a1, int16_t a2, int16_t a3, int16_t a4, int result_shift) -{ - int result = a0 *mult_shift_const; - result -= ((int32_t)a1*(int32_t)a2 - (int32_t)a3*(int32_t)a4); - result += add_rount_mult; - result = result >> result_shift; - return (int16_t)result; -} - -static inline int16_t xtfixed_bf_3(int16_t a0, int16_t a1, int16_t a2, int16_t a3, int16_t a4, int result_shift) -{ - int result = a0 *mult_shift_const; - result += (int32_t)a1*(int32_t)a2 + (int32_t)a3*(int32_t)a4; - result += add_rount_mult; - result = result >> result_shift; - return (int16_t)result; -} - -static inline int16_t xtfixed_bf_4(int16_t a0, int16_t a1, int16_t a2, int16_t a3, int16_t a4, int result_shift) -{ - int result = a0 *mult_shift_const; - result += (int32_t)a1*(int32_t)a2 - (int32_t)a3*(int32_t)a4; - result += add_rount_mult; - result = result >> result_shift; - return (int16_t)result; -} - -esp_err_t dsps_fft2r_init_sc16(int16_t* fft_table_buff, int table_size) -{ - esp_err_t result = ESP_OK; - if (dsps_fft2r_sc16_initialized != 0) { - return result; - } - if (table_size > CONFIG_DSP_MAX_FFT_SIZE) - { - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - } - if (table_size == 0){ - return result; - } - if (fft_table_buff != NULL) - { - if (dsps_fft2r_sc16_mem_allocated) - { - return ESP_ERR_DSP_REINITIALIZED; - } - dsps_fft_w_table_sc16 = fft_table_buff; - dsps_fft_w_table_sc16_size = table_size; - } else - { - if (!dsps_fft2r_sc16_mem_allocated) - { - dsps_fft_w_table_sc16 = (int16_t*)malloc(CONFIG_DSP_MAX_FFT_SIZE*sizeof(int16_t)); - } - dsps_fft_w_table_sc16_size = CONFIG_DSP_MAX_FFT_SIZE; - dsps_fft2r_sc16_mem_allocated = 1; - } - - result = dsps_gen_w_r2_sc16(dsps_fft_w_table_sc16, dsps_fft_w_table_sc16_size); - if (result != ESP_OK) { - return result; - } - result = dsps_bit_rev_sc16_ansi(dsps_fft_w_table_sc16, dsps_fft_w_table_sc16_size >> 1); - if (result != ESP_OK) { - return result; - } - dsps_fft2r_sc16_initialized = 1; - return ESP_OK; -} - -void dsps_fft2r_deinit_sc16() -{ - if (dsps_fft2r_sc16_mem_allocated) - { - free(dsps_fft_w_table_sc16); - } - dsps_fft2r_sc16_mem_allocated = 0; - dsps_fft2r_sc16_initialized = 0; -} - -esp_err_t dsps_fft2r_sc16_ansi_(int16_t *data, int N, int16_t* sc_table) -{ - if (!dsp_is_power_of_two(N)) { - return ESP_ERR_DSP_INVALID_LENGTH; - } - if (!dsps_fft2r_sc16_initialized) { - return ESP_ERR_DSP_UNINITIALIZED; - } - - esp_err_t result = ESP_OK; - - uint32_t *w = (uint32_t*)sc_table; - uint32_t *in_data = (uint32_t *)data; - - int ie, ia, m; - sc16_t cs;// c - re, s - im - sc16_t m_data; - sc16_t a_data; - - ie = 1; - for (int N2 = N / 2; N2 > 0; N2 >>= 1) { - ia = 0; - for (int j = 0; j < ie; j++) { - cs.data = w[j]; - //c = w[2 * j]; - //s = w[2 * j + 1]; - for (int i = 0; i < N2; i++) { - m = ia + N2; - m_data.data = in_data[m]; - a_data.data = in_data[ia]; - //data[2 * m] = data[2 * ia] - re_temp; - //data[2 * m + 1] = data[2 * ia + 1] - im_temp; - sc16_t m1; - m1.re = xtfixed_bf_1(a_data.re, cs.re, m_data.re, cs.im, m_data.im, 16);//(a_data.re - temp.re + shift_const) >> 1; - m1.im = xtfixed_bf_2(a_data.im, cs.re, m_data.im, cs.im, m_data.re, 16);//(a_data.im - temp.im + shift_const) >> 1; - in_data[m] = m1.data; - - //data[2 * ia] = data[2 * ia] + re_temp; - //data[2 * ia + 1] = data[2 * ia + 1] + im_temp; - sc16_t m2; - m2.re = xtfixed_bf_3(a_data.re, cs.re, m_data.re, cs.im, m_data.im, 16);//(a_data.re + temp.re + shift_const) >> 1; - m2.im = xtfixed_bf_4(a_data.im, cs.re, m_data.im, cs.im, m_data.re, 16);//(a_data.im + temp.im + shift_const)>>1; - in_data[ia] = m2.data; - ia++; - } - ia += N2; - } - ie <<= 1; - } - return result; -} - - -static inline unsigned short reverse_sc16(unsigned short x, unsigned short N, int order) -{ - unsigned short b = x; - - b = (b & 0xff00) >> 8 | (b & 0x00fF) << 8; - b = (b & 0xf0F0) >> 4 | (b & 0x0f0F) << 4; - b = (b & 0xCCCC) >> 2 | (b & 0x3333) << 2; - b = (b & 0xAAAA) >> 1 | (b & 0x5555) << 1; - return b >> (16 - order); -} - -esp_err_t dsps_bit_rev_sc16_ansi(int16_t *data, int N) -{ - if (!dsp_is_power_of_two(N)) { - return ESP_ERR_DSP_INVALID_LENGTH; - } - esp_err_t result = ESP_OK; - - int j, k; - uint32_t temp; - uint32_t* in_data = (uint32_t*)data; - j = 0; - for (int i = 1; i < (N - 1); i++) { - k = N >> 1; - while (k <= j) { - j -= k; - k >>= 1; - } - j += k; - if (i < j) - { - temp = in_data[j]; - in_data[j] = in_data[i]; - in_data[i] = temp; - } - } - return result; -} - -esp_err_t dsps_gen_w_r2_sc16(int16_t *w, int N) -{ - if (!dsp_is_power_of_two(N)) { - return ESP_ERR_DSP_INVALID_LENGTH; - } - - esp_err_t result = ESP_OK; - - int i; - float e = M_PI * 2.0 / N; - - for (i = 0; i < (N >> 1); i++) { - w[2 * i] = (int16_t)(INT16_MAX * cosf(i * e)); - w[2 * i + 1] = (int16_t)(INT16_MAX * sinf(i * e)); - } - - return result; -} - -esp_err_t dsps_cplx2reC_sc16(int16_t *data, int N) -{ - if (!dsp_is_power_of_two(N)) { - return ESP_ERR_DSP_INVALID_LENGTH; - } - esp_err_t result = ESP_OK; - - int i; - int n2 = N << (1 + 1); // we will operate with int32 indexes - uint32_t* in_data = (uint32_t*)data; - - sc16_t kl; - sc16_t kh; - sc16_t nl; - sc16_t nh; - - for (i = 0; i < (N / 4); i++) { - kl.data = in_data[i + 1]; - nl.data = in_data[n2 - i - 1]; - kh.data = in_data[i + 1 + N/2]; - nh.data = data[n2 - i - 1 - N/2]; - - data[i * 2 + 0 + 2] = kl.re + nl.re; - data[i * 2 + 1 + 2] = kl.im - nl.im; - - data[n2 - i * 2 - 1 - N] = kh.re + nh.re; - data[n2 - i * 2 - 2 - N] = kh.im - nh.im; - - data[i * 2 + 0 + 2 + N] = kl.im + nl.im; - data[i * 2 + 1 + 2 + N] = kl.re - nl.re; - - data[n2 - i * 2 - 1] = kh.im + nh.im; - data[n2 - i * 2 - 2] = kh.re - nh.re; - } - data[N] = data[1]; - data[1] = 0; - data[N + 1] = 0; - - return result; -} - -esp_err_t dsps_cplx2real_sc16_ansi(int16_t *data, int N) -{ - - int order = dsp_power_of_two(N); - sc16_t* table = (sc16_t*)dsps_fft_w_table_sc16; - sc16_t* result = (sc16_t*)data; - // Original formula... - // result[0].re = result[0].re + result[0].im; - // result[N].re = result[0].re - result[0].im; - // result[0].im = 0; - // result[N].im = 0; - // Optimized one: - int16_t tmp_re = result[0].re; - result[0].re = (tmp_re + result[0].im)>>1; - result[0].im = (tmp_re - result[0].im)>>1; - - sc16_t f1k, f2k; - for (int k=1;k <= N/2 ; ++k ) - { - sc16_t fpk = result[k]; - sc16_t fpnk; - fpnk.re = result[N - k].re; - fpnk.im = result[N - k].im; - f1k.re = fpk.re + fpnk.re; - f1k.im = fpk.im - fpnk.im; - f2k.re = fpk.re - fpnk.re; - f2k.im = fpk.im + fpnk.im; - - int table_index = reverse(k, N, order); - - // float c = -dsps_fft_w_table_fc32[table_index*2+1]; - // float s = -dsps_fft_w_table_fc32[table_index*2+0]; - sc16_t w = table[table_index]; - - sc16_t tw; - { - int re = (w.re*f2k.im - w.im*f2k.re)>>15; - int im = (+w.re*f2k.re + w.im*f2k.im)>>15; - tw.re = re; - tw.im = im; - } - - result[k].re = (f1k.re + tw.re)>>2; - result[k].im = (f1k.im - tw.im)>>2; - result[N - k].re = (f1k.re - tw.re)>>2; - result[N - k].im = -(f1k.im + tw.im)>>2; - } - return ESP_OK; -} diff --git a/components/esp-dsp/modules/fft/float/dsps_fft2r_bitrev_tables_fc32.c b/components/esp-dsp/modules/fft/float/dsps_fft2r_bitrev_tables_fc32.c deleted file mode 100644 index 527ce4a5..00000000 --- a/components/esp-dsp/modules/fft/float/dsps_fft2r_bitrev_tables_fc32.c +++ /dev/null @@ -1,590 +0,0 @@ -// Copyright 2018-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. - - -#include -#include "dsps_fft_tables.h" - - -const uint16_t bitrev2r_table_16_fc32[] = { - 8, 64, 16, 32, 24, 96, 40, 80, 56, 112, 88, 104, -}; - -const uint16_t bitrev2r_table_32_fc32[] = { - 8, 128, 16, 64, 24, 192, 40, 160, 48, 96, 56, 224, 72, 144, 88, 208, - 104, 176, 120, 240, 152, 200, 184, 232, -}; - -const uint16_t bitrev2r_table_64_fc32[] = { - 8, 256, 16, 128, 24, 384, 32, 64, 40, 320, 48, 192, 56, 448, 72, 288, - 80, 160, 88, 416, 104, 352, 112, 224, 120, 480, 136, 272, 152, 400, 168, 336, - 176, 208, 184, 464, 200, 304, 216, 432, 232, 368, 248, 496, 280, 392, 296, 328, - 312, 456, 344, 424, 376, 488, 440, 472, -}; - -const uint16_t bitrev2r_table_128_fc32[] = { - 8, 512, 16, 256, 24, 768, 32, 128, 40, 640, 48, 384, 56, 896, 72, 576, - 80, 320, 88, 832, 96, 192, 104, 704, 112, 448, 120, 960, 136, 544, 144, 288, - 152, 800, 168, 672, 176, 416, 184, 928, 200, 608, 208, 352, 216, 864, 232, 736, - 240, 480, 248, 992, 264, 528, 280, 784, 296, 656, 304, 400, 312, 912, 328, 592, - 344, 848, 360, 720, 368, 464, 376, 976, 392, 560, 408, 816, 424, 688, 440, 944, - 456, 624, 472, 880, 488, 752, 504, 1008, 536, 776, 552, 648, 568, 904, 600, 840, - 616, 712, 632, 968, 664, 808, 696, 936, 728, 872, 760, 1000, 824, 920, 888, 984, -}; - -const uint16_t bitrev2r_table_256_fc32[] = { - 8, 1024, 16, 512, 24, 1536, 32, 256, 40, 1280, 48, 768, 56, 1792, 64, 128, - 72, 1152, 80, 640, 88, 1664, 96, 384, 104, 1408, 112, 896, 120, 1920, 136, 1088, - 144, 576, 152, 1600, 160, 320, 168, 1344, 176, 832, 184, 1856, 200, 1216, 208, 704, - 216, 1728, 224, 448, 232, 1472, 240, 960, 248, 1984, 264, 1056, 272, 544, 280, 1568, - 296, 1312, 304, 800, 312, 1824, 328, 1184, 336, 672, 344, 1696, 352, 416, 360, 1440, - 368, 928, 376, 1952, 392, 1120, 400, 608, 408, 1632, 424, 1376, 432, 864, 440, 1888, - 456, 1248, 464, 736, 472, 1760, 488, 1504, 496, 992, 504, 2016, 520, 1040, 536, 1552, - 552, 1296, 560, 784, 568, 1808, 584, 1168, 592, 656, 600, 1680, 616, 1424, 624, 912, - 632, 1936, 648, 1104, 664, 1616, 680, 1360, 688, 848, 696, 1872, 712, 1232, 728, 1744, - 744, 1488, 752, 976, 760, 2000, 776, 1072, 792, 1584, 808, 1328, 824, 1840, 840, 1200, - 856, 1712, 872, 1456, 880, 944, 888, 1968, 904, 1136, 920, 1648, 936, 1392, 952, 1904, - 968, 1264, 984, 1776, 1000, 1520, 1016, 2032, 1048, 1544, 1064, 1288, 1080, 1800, 1096, 1160, - 1112, 1672, 1128, 1416, 1144, 1928, 1176, 1608, 1192, 1352, 1208, 1864, 1240, 1736, 1256, 1480, - 1272, 1992, 1304, 1576, 1336, 1832, 1368, 1704, 1384, 1448, 1400, 1960, 1432, 1640, 1464, 1896, - 1496, 1768, 1528, 2024, 1592, 1816, 1624, 1688, 1656, 1944, 1720, 1880, 1784, 2008, 1912, 1976, -}; - -const uint16_t bitrev2r_table_512_fc32[] = { - 8, 2048, 16, 1024, 24, 3072, 32, 512, 40, 2560, 48, 1536, 56, 3584, 64, 256, - 72, 2304, 80, 1280, 88, 3328, 96, 768, 104, 2816, 112, 1792, 120, 3840, 136, 2176, - 144, 1152, 152, 3200, 160, 640, 168, 2688, 176, 1664, 184, 3712, 192, 384, 200, 2432, - 208, 1408, 216, 3456, 224, 896, 232, 2944, 240, 1920, 248, 3968, 264, 2112, 272, 1088, - 280, 3136, 288, 576, 296, 2624, 304, 1600, 312, 3648, 328, 2368, 336, 1344, 344, 3392, - 352, 832, 360, 2880, 368, 1856, 376, 3904, 392, 2240, 400, 1216, 408, 3264, 416, 704, - 424, 2752, 432, 1728, 440, 3776, 456, 2496, 464, 1472, 472, 3520, 480, 960, 488, 3008, - 496, 1984, 504, 4032, 520, 2080, 528, 1056, 536, 3104, 552, 2592, 560, 1568, 568, 3616, - 584, 2336, 592, 1312, 600, 3360, 608, 800, 616, 2848, 624, 1824, 632, 3872, 648, 2208, - 656, 1184, 664, 3232, 680, 2720, 688, 1696, 696, 3744, 712, 2464, 720, 1440, 728, 3488, - 736, 928, 744, 2976, 752, 1952, 760, 4000, 776, 2144, 784, 1120, 792, 3168, 808, 2656, - 816, 1632, 824, 3680, 840, 2400, 848, 1376, 856, 3424, 872, 2912, 880, 1888, 888, 3936, - 904, 2272, 912, 1248, 920, 3296, 936, 2784, 944, 1760, 952, 3808, 968, 2528, 976, 1504, - 984, 3552, 1000, 3040, 1008, 2016, 1016, 4064, 1032, 2064, 1048, 3088, 1064, 2576, 1072, 1552, - 1080, 3600, 1096, 2320, 1104, 1296, 1112, 3344, 1128, 2832, 1136, 1808, 1144, 3856, 1160, 2192, - 1176, 3216, 1192, 2704, 1200, 1680, 1208, 3728, 1224, 2448, 1232, 1424, 1240, 3472, 1256, 2960, - 1264, 1936, 1272, 3984, 1288, 2128, 1304, 3152, 1320, 2640, 1328, 1616, 1336, 3664, 1352, 2384, - 1368, 3408, 1384, 2896, 1392, 1872, 1400, 3920, 1416, 2256, 1432, 3280, 1448, 2768, 1456, 1744, - 1464, 3792, 1480, 2512, 1496, 3536, 1512, 3024, 1520, 2000, 1528, 4048, 1544, 2096, 1560, 3120, - 1576, 2608, 1592, 3632, 1608, 2352, 1624, 3376, 1640, 2864, 1648, 1840, 1656, 3888, 1672, 2224, - 1688, 3248, 1704, 2736, 1720, 3760, 1736, 2480, 1752, 3504, 1768, 2992, 1776, 1968, 1784, 4016, - 1800, 2160, 1816, 3184, 1832, 2672, 1848, 3696, 1864, 2416, 1880, 3440, 1896, 2928, 1912, 3952, - 1928, 2288, 1944, 3312, 1960, 2800, 1976, 3824, 1992, 2544, 2008, 3568, 2024, 3056, 2040, 4080, - 2072, 3080, 2088, 2568, 2104, 3592, 2120, 2312, 2136, 3336, 2152, 2824, 2168, 3848, 2200, 3208, - 2216, 2696, 2232, 3720, 2248, 2440, 2264, 3464, 2280, 2952, 2296, 3976, 2328, 3144, 2344, 2632, - 2360, 3656, 2392, 3400, 2408, 2888, 2424, 3912, 2456, 3272, 2472, 2760, 2488, 3784, 2520, 3528, - 2536, 3016, 2552, 4040, 2584, 3112, 2616, 3624, 2648, 3368, 2664, 2856, 2680, 3880, 2712, 3240, - 2744, 3752, 2776, 3496, 2792, 2984, 2808, 4008, 2840, 3176, 2872, 3688, 2904, 3432, 2936, 3944, - 2968, 3304, 3000, 3816, 3032, 3560, 3064, 4072, 3128, 3608, 3160, 3352, 3192, 3864, 3256, 3736, - 3288, 3480, 3320, 3992, 3384, 3672, 3448, 3928, 3512, 3800, 3576, 4056, 3704, 3896, 3832, 4024, -}; - -const uint16_t bitrev2r_table_1024_fc32[] = { - 8, 4096, 16, 2048, 24, 6144, 32, 1024, 40, 5120, 48, 3072, 56, 7168, 64, 512, - 72, 4608, 80, 2560, 88, 6656, 96, 1536, 104, 5632, 112, 3584, 120, 7680, 128, 256, - 136, 4352, 144, 2304, 152, 6400, 160, 1280, 168, 5376, 176, 3328, 184, 7424, 192, 768, - 200, 4864, 208, 2816, 216, 6912, 224, 1792, 232, 5888, 240, 3840, 248, 7936, 264, 4224, - 272, 2176, 280, 6272, 288, 1152, 296, 5248, 304, 3200, 312, 7296, 320, 640, 328, 4736, - 336, 2688, 344, 6784, 352, 1664, 360, 5760, 368, 3712, 376, 7808, 392, 4480, 400, 2432, - 408, 6528, 416, 1408, 424, 5504, 432, 3456, 440, 7552, 448, 896, 456, 4992, 464, 2944, - 472, 7040, 480, 1920, 488, 6016, 496, 3968, 504, 8064, 520, 4160, 528, 2112, 536, 6208, - 544, 1088, 552, 5184, 560, 3136, 568, 7232, 584, 4672, 592, 2624, 600, 6720, 608, 1600, - 616, 5696, 624, 3648, 632, 7744, 648, 4416, 656, 2368, 664, 6464, 672, 1344, 680, 5440, - 688, 3392, 696, 7488, 704, 832, 712, 4928, 720, 2880, 728, 6976, 736, 1856, 744, 5952, - 752, 3904, 760, 8000, 776, 4288, 784, 2240, 792, 6336, 800, 1216, 808, 5312, 816, 3264, - 824, 7360, 840, 4800, 848, 2752, 856, 6848, 864, 1728, 872, 5824, 880, 3776, 888, 7872, - 904, 4544, 912, 2496, 920, 6592, 928, 1472, 936, 5568, 944, 3520, 952, 7616, 968, 5056, - 976, 3008, 984, 7104, 992, 1984, 1000, 6080, 1008, 4032, 1016, 8128, 1032, 4128, 1040, 2080, - 1048, 6176, 1064, 5152, 1072, 3104, 1080, 7200, 1096, 4640, 1104, 2592, 1112, 6688, 1120, 1568, - 1128, 5664, 1136, 3616, 1144, 7712, 1160, 4384, 1168, 2336, 1176, 6432, 1184, 1312, 1192, 5408, - 1200, 3360, 1208, 7456, 1224, 4896, 1232, 2848, 1240, 6944, 1248, 1824, 1256, 5920, 1264, 3872, - 1272, 7968, 1288, 4256, 1296, 2208, 1304, 6304, 1320, 5280, 1328, 3232, 1336, 7328, 1352, 4768, - 1360, 2720, 1368, 6816, 1376, 1696, 1384, 5792, 1392, 3744, 1400, 7840, 1416, 4512, 1424, 2464, - 1432, 6560, 1448, 5536, 1456, 3488, 1464, 7584, 1480, 5024, 1488, 2976, 1496, 7072, 1504, 1952, - 1512, 6048, 1520, 4000, 1528, 8096, 1544, 4192, 1552, 2144, 1560, 6240, 1576, 5216, 1584, 3168, - 1592, 7264, 1608, 4704, 1616, 2656, 1624, 6752, 1640, 5728, 1648, 3680, 1656, 7776, 1672, 4448, - 1680, 2400, 1688, 6496, 1704, 5472, 1712, 3424, 1720, 7520, 1736, 4960, 1744, 2912, 1752, 7008, - 1760, 1888, 1768, 5984, 1776, 3936, 1784, 8032, 1800, 4320, 1808, 2272, 1816, 6368, 1832, 5344, - 1840, 3296, 1848, 7392, 1864, 4832, 1872, 2784, 1880, 6880, 1896, 5856, 1904, 3808, 1912, 7904, - 1928, 4576, 1936, 2528, 1944, 6624, 1960, 5600, 1968, 3552, 1976, 7648, 1992, 5088, 2000, 3040, - 2008, 7136, 2024, 6112, 2032, 4064, 2040, 8160, 2056, 4112, 2072, 6160, 2088, 5136, 2096, 3088, - 2104, 7184, 2120, 4624, 2128, 2576, 2136, 6672, 2152, 5648, 2160, 3600, 2168, 7696, 2184, 4368, - 2192, 2320, 2200, 6416, 2216, 5392, 2224, 3344, 2232, 7440, 2248, 4880, 2256, 2832, 2264, 6928, - 2280, 5904, 2288, 3856, 2296, 7952, 2312, 4240, 2328, 6288, 2344, 5264, 2352, 3216, 2360, 7312, - 2376, 4752, 2384, 2704, 2392, 6800, 2408, 5776, 2416, 3728, 2424, 7824, 2440, 4496, 2456, 6544, - 2472, 5520, 2480, 3472, 2488, 7568, 2504, 5008, 2512, 2960, 2520, 7056, 2536, 6032, 2544, 3984, - 2552, 8080, 2568, 4176, 2584, 6224, 2600, 5200, 2608, 3152, 2616, 7248, 2632, 4688, 2648, 6736, - 2664, 5712, 2672, 3664, 2680, 7760, 2696, 4432, 2712, 6480, 2728, 5456, 2736, 3408, 2744, 7504, - 2760, 4944, 2768, 2896, 2776, 6992, 2792, 5968, 2800, 3920, 2808, 8016, 2824, 4304, 2840, 6352, - 2856, 5328, 2864, 3280, 2872, 7376, 2888, 4816, 2904, 6864, 2920, 5840, 2928, 3792, 2936, 7888, - 2952, 4560, 2968, 6608, 2984, 5584, 2992, 3536, 3000, 7632, 3016, 5072, 3032, 7120, 3048, 6096, - 3056, 4048, 3064, 8144, 3080, 4144, 3096, 6192, 3112, 5168, 3128, 7216, 3144, 4656, 3160, 6704, - 3176, 5680, 3184, 3632, 3192, 7728, 3208, 4400, 3224, 6448, 3240, 5424, 3248, 3376, 3256, 7472, - 3272, 4912, 3288, 6960, 3304, 5936, 3312, 3888, 3320, 7984, 3336, 4272, 3352, 6320, 3368, 5296, - 3384, 7344, 3400, 4784, 3416, 6832, 3432, 5808, 3440, 3760, 3448, 7856, 3464, 4528, 3480, 6576, - 3496, 5552, 3512, 7600, 3528, 5040, 3544, 7088, 3560, 6064, 3568, 4016, 3576, 8112, 3592, 4208, - 3608, 6256, 3624, 5232, 3640, 7280, 3656, 4720, 3672, 6768, 3688, 5744, 3704, 7792, 3720, 4464, - 3736, 6512, 3752, 5488, 3768, 7536, 3784, 4976, 3800, 7024, 3816, 6000, 3824, 3952, 3832, 8048, - 3848, 4336, 3864, 6384, 3880, 5360, 3896, 7408, 3912, 4848, 3928, 6896, 3944, 5872, 3960, 7920, - 3976, 4592, 3992, 6640, 4008, 5616, 4024, 7664, 4040, 5104, 4056, 7152, 4072, 6128, 4088, 8176, - 4120, 6152, 4136, 5128, 4152, 7176, 4168, 4616, 4184, 6664, 4200, 5640, 4216, 7688, 4232, 4360, - 4248, 6408, 4264, 5384, 4280, 7432, 4296, 4872, 4312, 6920, 4328, 5896, 4344, 7944, 4376, 6280, - 4392, 5256, 4408, 7304, 4424, 4744, 4440, 6792, 4456, 5768, 4472, 7816, 4504, 6536, 4520, 5512, - 4536, 7560, 4552, 5000, 4568, 7048, 4584, 6024, 4600, 8072, 4632, 6216, 4648, 5192, 4664, 7240, - 4696, 6728, 4712, 5704, 4728, 7752, 4760, 6472, 4776, 5448, 4792, 7496, 4808, 4936, 4824, 6984, - 4840, 5960, 4856, 8008, 4888, 6344, 4904, 5320, 4920, 7368, 4952, 6856, 4968, 5832, 4984, 7880, - 5016, 6600, 5032, 5576, 5048, 7624, 5080, 7112, 5096, 6088, 5112, 8136, 5144, 6184, 5176, 7208, - 5208, 6696, 5224, 5672, 5240, 7720, 5272, 6440, 5288, 5416, 5304, 7464, 5336, 6952, 5352, 5928, - 5368, 7976, 5400, 6312, 5432, 7336, 5464, 6824, 5480, 5800, 5496, 7848, 5528, 6568, 5560, 7592, - 5592, 7080, 5608, 6056, 5624, 8104, 5656, 6248, 5688, 7272, 5720, 6760, 5752, 7784, 5784, 6504, - 5816, 7528, 5848, 7016, 5864, 5992, 5880, 8040, 5912, 6376, 5944, 7400, 5976, 6888, 6008, 7912, - 6040, 6632, 6072, 7656, 6104, 7144, 6136, 8168, 6200, 7192, 6232, 6680, 6264, 7704, 6296, 6424, - 6328, 7448, 6360, 6936, 6392, 7960, 6456, 7320, 6488, 6808, 6520, 7832, 6584, 7576, 6616, 7064, - 6648, 8088, 6712, 7256, 6776, 7768, 6840, 7512, 6872, 7000, 6904, 8024, 6968, 7384, 7032, 7896, - 7096, 7640, 7160, 8152, 7288, 7736, 7352, 7480, 7416, 7992, 7544, 7864, 7672, 8120, 7928, 8056, -}; - -const uint16_t bitrev2r_table_2048_fc32[] = { - 8, 8192, 16, 4096, 24, 12288, 32, 2048, 40, 10240, 48, 6144, 56, 14336, 64, 1024, - 72, 9216, 80, 5120, 88, 13312, 96, 3072, 104, 11264, 112, 7168, 120, 15360, 128, 512, - 136, 8704, 144, 4608, 152, 12800, 160, 2560, 168, 10752, 176, 6656, 184, 14848, 192, 1536, - 200, 9728, 208, 5632, 216, 13824, 224, 3584, 232, 11776, 240, 7680, 248, 15872, 264, 8448, - 272, 4352, 280, 12544, 288, 2304, 296, 10496, 304, 6400, 312, 14592, 320, 1280, 328, 9472, - 336, 5376, 344, 13568, 352, 3328, 360, 11520, 368, 7424, 376, 15616, 384, 768, 392, 8960, - 400, 4864, 408, 13056, 416, 2816, 424, 11008, 432, 6912, 440, 15104, 448, 1792, 456, 9984, - 464, 5888, 472, 14080, 480, 3840, 488, 12032, 496, 7936, 504, 16128, 520, 8320, 528, 4224, - 536, 12416, 544, 2176, 552, 10368, 560, 6272, 568, 14464, 576, 1152, 584, 9344, 592, 5248, - 600, 13440, 608, 3200, 616, 11392, 624, 7296, 632, 15488, 648, 8832, 656, 4736, 664, 12928, - 672, 2688, 680, 10880, 688, 6784, 696, 14976, 704, 1664, 712, 9856, 720, 5760, 728, 13952, - 736, 3712, 744, 11904, 752, 7808, 760, 16000, 776, 8576, 784, 4480, 792, 12672, 800, 2432, - 808, 10624, 816, 6528, 824, 14720, 832, 1408, 840, 9600, 848, 5504, 856, 13696, 864, 3456, - 872, 11648, 880, 7552, 888, 15744, 904, 9088, 912, 4992, 920, 13184, 928, 2944, 936, 11136, - 944, 7040, 952, 15232, 960, 1920, 968, 10112, 976, 6016, 984, 14208, 992, 3968, 1000, 12160, - 1008, 8064, 1016, 16256, 1032, 8256, 1040, 4160, 1048, 12352, 1056, 2112, 1064, 10304, 1072, 6208, - 1080, 14400, 1096, 9280, 1104, 5184, 1112, 13376, 1120, 3136, 1128, 11328, 1136, 7232, 1144, 15424, - 1160, 8768, 1168, 4672, 1176, 12864, 1184, 2624, 1192, 10816, 1200, 6720, 1208, 14912, 1216, 1600, - 1224, 9792, 1232, 5696, 1240, 13888, 1248, 3648, 1256, 11840, 1264, 7744, 1272, 15936, 1288, 8512, - 1296, 4416, 1304, 12608, 1312, 2368, 1320, 10560, 1328, 6464, 1336, 14656, 1352, 9536, 1360, 5440, - 1368, 13632, 1376, 3392, 1384, 11584, 1392, 7488, 1400, 15680, 1416, 9024, 1424, 4928, 1432, 13120, - 1440, 2880, 1448, 11072, 1456, 6976, 1464, 15168, 1472, 1856, 1480, 10048, 1488, 5952, 1496, 14144, - 1504, 3904, 1512, 12096, 1520, 8000, 1528, 16192, 1544, 8384, 1552, 4288, 1560, 12480, 1568, 2240, - 1576, 10432, 1584, 6336, 1592, 14528, 1608, 9408, 1616, 5312, 1624, 13504, 1632, 3264, 1640, 11456, - 1648, 7360, 1656, 15552, 1672, 8896, 1680, 4800, 1688, 12992, 1696, 2752, 1704, 10944, 1712, 6848, - 1720, 15040, 1736, 9920, 1744, 5824, 1752, 14016, 1760, 3776, 1768, 11968, 1776, 7872, 1784, 16064, - 1800, 8640, 1808, 4544, 1816, 12736, 1824, 2496, 1832, 10688, 1840, 6592, 1848, 14784, 1864, 9664, - 1872, 5568, 1880, 13760, 1888, 3520, 1896, 11712, 1904, 7616, 1912, 15808, 1928, 9152, 1936, 5056, - 1944, 13248, 1952, 3008, 1960, 11200, 1968, 7104, 1976, 15296, 1992, 10176, 2000, 6080, 2008, 14272, - 2016, 4032, 2024, 12224, 2032, 8128, 2040, 16320, 2056, 8224, 2064, 4128, 2072, 12320, 2088, 10272, - 2096, 6176, 2104, 14368, 2120, 9248, 2128, 5152, 2136, 13344, 2144, 3104, 2152, 11296, 2160, 7200, - 2168, 15392, 2184, 8736, 2192, 4640, 2200, 12832, 2208, 2592, 2216, 10784, 2224, 6688, 2232, 14880, - 2248, 9760, 2256, 5664, 2264, 13856, 2272, 3616, 2280, 11808, 2288, 7712, 2296, 15904, 2312, 8480, - 2320, 4384, 2328, 12576, 2344, 10528, 2352, 6432, 2360, 14624, 2376, 9504, 2384, 5408, 2392, 13600, - 2400, 3360, 2408, 11552, 2416, 7456, 2424, 15648, 2440, 8992, 2448, 4896, 2456, 13088, 2464, 2848, - 2472, 11040, 2480, 6944, 2488, 15136, 2504, 10016, 2512, 5920, 2520, 14112, 2528, 3872, 2536, 12064, - 2544, 7968, 2552, 16160, 2568, 8352, 2576, 4256, 2584, 12448, 2600, 10400, 2608, 6304, 2616, 14496, - 2632, 9376, 2640, 5280, 2648, 13472, 2656, 3232, 2664, 11424, 2672, 7328, 2680, 15520, 2696, 8864, - 2704, 4768, 2712, 12960, 2728, 10912, 2736, 6816, 2744, 15008, 2760, 9888, 2768, 5792, 2776, 13984, - 2784, 3744, 2792, 11936, 2800, 7840, 2808, 16032, 2824, 8608, 2832, 4512, 2840, 12704, 2856, 10656, - 2864, 6560, 2872, 14752, 2888, 9632, 2896, 5536, 2904, 13728, 2912, 3488, 2920, 11680, 2928, 7584, - 2936, 15776, 2952, 9120, 2960, 5024, 2968, 13216, 2984, 11168, 2992, 7072, 3000, 15264, 3016, 10144, - 3024, 6048, 3032, 14240, 3040, 4000, 3048, 12192, 3056, 8096, 3064, 16288, 3080, 8288, 3088, 4192, - 3096, 12384, 3112, 10336, 3120, 6240, 3128, 14432, 3144, 9312, 3152, 5216, 3160, 13408, 3176, 11360, - 3184, 7264, 3192, 15456, 3208, 8800, 3216, 4704, 3224, 12896, 3240, 10848, 3248, 6752, 3256, 14944, - 3272, 9824, 3280, 5728, 3288, 13920, 3296, 3680, 3304, 11872, 3312, 7776, 3320, 15968, 3336, 8544, - 3344, 4448, 3352, 12640, 3368, 10592, 3376, 6496, 3384, 14688, 3400, 9568, 3408, 5472, 3416, 13664, - 3432, 11616, 3440, 7520, 3448, 15712, 3464, 9056, 3472, 4960, 3480, 13152, 3496, 11104, 3504, 7008, - 3512, 15200, 3528, 10080, 3536, 5984, 3544, 14176, 3552, 3936, 3560, 12128, 3568, 8032, 3576, 16224, - 3592, 8416, 3600, 4320, 3608, 12512, 3624, 10464, 3632, 6368, 3640, 14560, 3656, 9440, 3664, 5344, - 3672, 13536, 3688, 11488, 3696, 7392, 3704, 15584, 3720, 8928, 3728, 4832, 3736, 13024, 3752, 10976, - 3760, 6880, 3768, 15072, 3784, 9952, 3792, 5856, 3800, 14048, 3816, 12000, 3824, 7904, 3832, 16096, - 3848, 8672, 3856, 4576, 3864, 12768, 3880, 10720, 3888, 6624, 3896, 14816, 3912, 9696, 3920, 5600, - 3928, 13792, 3944, 11744, 3952, 7648, 3960, 15840, 3976, 9184, 3984, 5088, 3992, 13280, 4008, 11232, - 4016, 7136, 4024, 15328, 4040, 10208, 4048, 6112, 4056, 14304, 4072, 12256, 4080, 8160, 4088, 16352, - 4104, 8208, 4120, 12304, 4136, 10256, 4144, 6160, 4152, 14352, 4168, 9232, 4176, 5136, 4184, 13328, - 4200, 11280, 4208, 7184, 4216, 15376, 4232, 8720, 4240, 4624, 4248, 12816, 4264, 10768, 4272, 6672, - 4280, 14864, 4296, 9744, 4304, 5648, 4312, 13840, 4328, 11792, 4336, 7696, 4344, 15888, 4360, 8464, - 4376, 12560, 4392, 10512, 4400, 6416, 4408, 14608, 4424, 9488, 4432, 5392, 4440, 13584, 4456, 11536, - 4464, 7440, 4472, 15632, 4488, 8976, 4496, 4880, 4504, 13072, 4520, 11024, 4528, 6928, 4536, 15120, - 4552, 10000, 4560, 5904, 4568, 14096, 4584, 12048, 4592, 7952, 4600, 16144, 4616, 8336, 4632, 12432, - 4648, 10384, 4656, 6288, 4664, 14480, 4680, 9360, 4688, 5264, 4696, 13456, 4712, 11408, 4720, 7312, - 4728, 15504, 4744, 8848, 4760, 12944, 4776, 10896, 4784, 6800, 4792, 14992, 4808, 9872, 4816, 5776, - 4824, 13968, 4840, 11920, 4848, 7824, 4856, 16016, 4872, 8592, 4888, 12688, 4904, 10640, 4912, 6544, - 4920, 14736, 4936, 9616, 4944, 5520, 4952, 13712, 4968, 11664, 4976, 7568, 4984, 15760, 5000, 9104, - 5016, 13200, 5032, 11152, 5040, 7056, 5048, 15248, 5064, 10128, 5072, 6032, 5080, 14224, 5096, 12176, - 5104, 8080, 5112, 16272, 5128, 8272, 5144, 12368, 5160, 10320, 5168, 6224, 5176, 14416, 5192, 9296, - 5208, 13392, 5224, 11344, 5232, 7248, 5240, 15440, 5256, 8784, 5272, 12880, 5288, 10832, 5296, 6736, - 5304, 14928, 5320, 9808, 5328, 5712, 5336, 13904, 5352, 11856, 5360, 7760, 5368, 15952, 5384, 8528, - 5400, 12624, 5416, 10576, 5424, 6480, 5432, 14672, 5448, 9552, 5464, 13648, 5480, 11600, 5488, 7504, - 5496, 15696, 5512, 9040, 5528, 13136, 5544, 11088, 5552, 6992, 5560, 15184, 5576, 10064, 5584, 5968, - 5592, 14160, 5608, 12112, 5616, 8016, 5624, 16208, 5640, 8400, 5656, 12496, 5672, 10448, 5680, 6352, - 5688, 14544, 5704, 9424, 5720, 13520, 5736, 11472, 5744, 7376, 5752, 15568, 5768, 8912, 5784, 13008, - 5800, 10960, 5808, 6864, 5816, 15056, 5832, 9936, 5848, 14032, 5864, 11984, 5872, 7888, 5880, 16080, - 5896, 8656, 5912, 12752, 5928, 10704, 5936, 6608, 5944, 14800, 5960, 9680, 5976, 13776, 5992, 11728, - 6000, 7632, 6008, 15824, 6024, 9168, 6040, 13264, 6056, 11216, 6064, 7120, 6072, 15312, 6088, 10192, - 6104, 14288, 6120, 12240, 6128, 8144, 6136, 16336, 6152, 8240, 6168, 12336, 6184, 10288, 6200, 14384, - 6216, 9264, 6232, 13360, 6248, 11312, 6256, 7216, 6264, 15408, 6280, 8752, 6296, 12848, 6312, 10800, - 6320, 6704, 6328, 14896, 6344, 9776, 6360, 13872, 6376, 11824, 6384, 7728, 6392, 15920, 6408, 8496, - 6424, 12592, 6440, 10544, 6456, 14640, 6472, 9520, 6488, 13616, 6504, 11568, 6512, 7472, 6520, 15664, - 6536, 9008, 6552, 13104, 6568, 11056, 6576, 6960, 6584, 15152, 6600, 10032, 6616, 14128, 6632, 12080, - 6640, 7984, 6648, 16176, 6664, 8368, 6680, 12464, 6696, 10416, 6712, 14512, 6728, 9392, 6744, 13488, - 6760, 11440, 6768, 7344, 6776, 15536, 6792, 8880, 6808, 12976, 6824, 10928, 6840, 15024, 6856, 9904, - 6872, 14000, 6888, 11952, 6896, 7856, 6904, 16048, 6920, 8624, 6936, 12720, 6952, 10672, 6968, 14768, - 6984, 9648, 7000, 13744, 7016, 11696, 7024, 7600, 7032, 15792, 7048, 9136, 7064, 13232, 7080, 11184, - 7096, 15280, 7112, 10160, 7128, 14256, 7144, 12208, 7152, 8112, 7160, 16304, 7176, 8304, 7192, 12400, - 7208, 10352, 7224, 14448, 7240, 9328, 7256, 13424, 7272, 11376, 7288, 15472, 7304, 8816, 7320, 12912, - 7336, 10864, 7352, 14960, 7368, 9840, 7384, 13936, 7400, 11888, 7408, 7792, 7416, 15984, 7432, 8560, - 7448, 12656, 7464, 10608, 7480, 14704, 7496, 9584, 7512, 13680, 7528, 11632, 7544, 15728, 7560, 9072, - 7576, 13168, 7592, 11120, 7608, 15216, 7624, 10096, 7640, 14192, 7656, 12144, 7664, 8048, 7672, 16240, - 7688, 8432, 7704, 12528, 7720, 10480, 7736, 14576, 7752, 9456, 7768, 13552, 7784, 11504, 7800, 15600, - 7816, 8944, 7832, 13040, 7848, 10992, 7864, 15088, 7880, 9968, 7896, 14064, 7912, 12016, 7928, 16112, - 7944, 8688, 7960, 12784, 7976, 10736, 7992, 14832, 8008, 9712, 8024, 13808, 8040, 11760, 8056, 15856, - 8072, 9200, 8088, 13296, 8104, 11248, 8120, 15344, 8136, 10224, 8152, 14320, 8168, 12272, 8184, 16368, - 8216, 12296, 8232, 10248, 8248, 14344, 8264, 9224, 8280, 13320, 8296, 11272, 8312, 15368, 8328, 8712, - 8344, 12808, 8360, 10760, 8376, 14856, 8392, 9736, 8408, 13832, 8424, 11784, 8440, 15880, 8472, 12552, - 8488, 10504, 8504, 14600, 8520, 9480, 8536, 13576, 8552, 11528, 8568, 15624, 8584, 8968, 8600, 13064, - 8616, 11016, 8632, 15112, 8648, 9992, 8664, 14088, 8680, 12040, 8696, 16136, 8728, 12424, 8744, 10376, - 8760, 14472, 8776, 9352, 8792, 13448, 8808, 11400, 8824, 15496, 8856, 12936, 8872, 10888, 8888, 14984, - 8904, 9864, 8920, 13960, 8936, 11912, 8952, 16008, 8984, 12680, 9000, 10632, 9016, 14728, 9032, 9608, - 9048, 13704, 9064, 11656, 9080, 15752, 9112, 13192, 9128, 11144, 9144, 15240, 9160, 10120, 9176, 14216, - 9192, 12168, 9208, 16264, 9240, 12360, 9256, 10312, 9272, 14408, 9304, 13384, 9320, 11336, 9336, 15432, - 9368, 12872, 9384, 10824, 9400, 14920, 9416, 9800, 9432, 13896, 9448, 11848, 9464, 15944, 9496, 12616, - 9512, 10568, 9528, 14664, 9560, 13640, 9576, 11592, 9592, 15688, 9624, 13128, 9640, 11080, 9656, 15176, - 9672, 10056, 9688, 14152, 9704, 12104, 9720, 16200, 9752, 12488, 9768, 10440, 9784, 14536, 9816, 13512, - 9832, 11464, 9848, 15560, 9880, 13000, 9896, 10952, 9912, 15048, 9944, 14024, 9960, 11976, 9976, 16072, - 10008, 12744, 10024, 10696, 10040, 14792, 10072, 13768, 10088, 11720, 10104, 15816, 10136, 13256, 10152, 11208, - 10168, 15304, 10200, 14280, 10216, 12232, 10232, 16328, 10264, 12328, 10296, 14376, 10328, 13352, 10344, 11304, - 10360, 15400, 10392, 12840, 10408, 10792, 10424, 14888, 10456, 13864, 10472, 11816, 10488, 15912, 10520, 12584, - 10552, 14632, 10584, 13608, 10600, 11560, 10616, 15656, 10648, 13096, 10664, 11048, 10680, 15144, 10712, 14120, - 10728, 12072, 10744, 16168, 10776, 12456, 10808, 14504, 10840, 13480, 10856, 11432, 10872, 15528, 10904, 12968, - 10936, 15016, 10968, 13992, 10984, 11944, 11000, 16040, 11032, 12712, 11064, 14760, 11096, 13736, 11112, 11688, - 11128, 15784, 11160, 13224, 11192, 15272, 11224, 14248, 11240, 12200, 11256, 16296, 11288, 12392, 11320, 14440, - 11352, 13416, 11384, 15464, 11416, 12904, 11448, 14952, 11480, 13928, 11496, 11880, 11512, 15976, 11544, 12648, - 11576, 14696, 11608, 13672, 11640, 15720, 11672, 13160, 11704, 15208, 11736, 14184, 11752, 12136, 11768, 16232, - 11800, 12520, 11832, 14568, 11864, 13544, 11896, 15592, 11928, 13032, 11960, 15080, 11992, 14056, 12024, 16104, - 12056, 12776, 12088, 14824, 12120, 13800, 12152, 15848, 12184, 13288, 12216, 15336, 12248, 14312, 12280, 16360, - 12344, 14360, 12376, 13336, 12408, 15384, 12440, 12824, 12472, 14872, 12504, 13848, 12536, 15896, 12600, 14616, - 12632, 13592, 12664, 15640, 12696, 13080, 12728, 15128, 12760, 14104, 12792, 16152, 12856, 14488, 12888, 13464, - 12920, 15512, 12984, 15000, 13016, 13976, 13048, 16024, 13112, 14744, 13144, 13720, 13176, 15768, 13240, 15256, - 13272, 14232, 13304, 16280, 13368, 14424, 13432, 15448, 13496, 14936, 13528, 13912, 13560, 15960, 13624, 14680, - 13688, 15704, 13752, 15192, 13784, 14168, 13816, 16216, 13880, 14552, 13944, 15576, 14008, 15064, 14072, 16088, - 14136, 14808, 14200, 15832, 14264, 15320, 14328, 16344, 14456, 15416, 14520, 14904, 14584, 15928, 14712, 15672, - 14776, 15160, 14840, 16184, 14968, 15544, 15096, 16056, 15224, 15800, 15352, 16312, 15608, 15992, 15864, 16248, -}; - -const uint16_t bitrev2r_table_4096_fc32[] = { - 8, 16384, 16, 8192, 24, 24576, 32, 4096, 40, 20480, 48, 12288, 56, 28672, 64, 2048, - 72, 18432, 80, 10240, 88, 26624, 96, 6144, 104, 22528, 112, 14336, 120, 30720, 128, 1024, - 136, 17408, 144, 9216, 152, 25600, 160, 5120, 168, 21504, 176, 13312, 184, 29696, 192, 3072, - 200, 19456, 208, 11264, 216, 27648, 224, 7168, 232, 23552, 240, 15360, 248, 31744, 256, 512, - 264, 16896, 272, 8704, 280, 25088, 288, 4608, 296, 20992, 304, 12800, 312, 29184, 320, 2560, - 328, 18944, 336, 10752, 344, 27136, 352, 6656, 360, 23040, 368, 14848, 376, 31232, 384, 1536, - 392, 17920, 400, 9728, 408, 26112, 416, 5632, 424, 22016, 432, 13824, 440, 30208, 448, 3584, - 456, 19968, 464, 11776, 472, 28160, 480, 7680, 488, 24064, 496, 15872, 504, 32256, 520, 16640, - 528, 8448, 536, 24832, 544, 4352, 552, 20736, 560, 12544, 568, 28928, 576, 2304, 584, 18688, - 592, 10496, 600, 26880, 608, 6400, 616, 22784, 624, 14592, 632, 30976, 640, 1280, 648, 17664, - 656, 9472, 664, 25856, 672, 5376, 680, 21760, 688, 13568, 696, 29952, 704, 3328, 712, 19712, - 720, 11520, 728, 27904, 736, 7424, 744, 23808, 752, 15616, 760, 32000, 776, 17152, 784, 8960, - 792, 25344, 800, 4864, 808, 21248, 816, 13056, 824, 29440, 832, 2816, 840, 19200, 848, 11008, - 856, 27392, 864, 6912, 872, 23296, 880, 15104, 888, 31488, 896, 1792, 904, 18176, 912, 9984, - 920, 26368, 928, 5888, 936, 22272, 944, 14080, 952, 30464, 960, 3840, 968, 20224, 976, 12032, - 984, 28416, 992, 7936, 1000, 24320, 1008, 16128, 1016, 32512, 1032, 16512, 1040, 8320, 1048, 24704, - 1056, 4224, 1064, 20608, 1072, 12416, 1080, 28800, 1088, 2176, 1096, 18560, 1104, 10368, 1112, 26752, - 1120, 6272, 1128, 22656, 1136, 14464, 1144, 30848, 1160, 17536, 1168, 9344, 1176, 25728, 1184, 5248, - 1192, 21632, 1200, 13440, 1208, 29824, 1216, 3200, 1224, 19584, 1232, 11392, 1240, 27776, 1248, 7296, - 1256, 23680, 1264, 15488, 1272, 31872, 1288, 17024, 1296, 8832, 1304, 25216, 1312, 4736, 1320, 21120, - 1328, 12928, 1336, 29312, 1344, 2688, 1352, 19072, 1360, 10880, 1368, 27264, 1376, 6784, 1384, 23168, - 1392, 14976, 1400, 31360, 1408, 1664, 1416, 18048, 1424, 9856, 1432, 26240, 1440, 5760, 1448, 22144, - 1456, 13952, 1464, 30336, 1472, 3712, 1480, 20096, 1488, 11904, 1496, 28288, 1504, 7808, 1512, 24192, - 1520, 16000, 1528, 32384, 1544, 16768, 1552, 8576, 1560, 24960, 1568, 4480, 1576, 20864, 1584, 12672, - 1592, 29056, 1600, 2432, 1608, 18816, 1616, 10624, 1624, 27008, 1632, 6528, 1640, 22912, 1648, 14720, - 1656, 31104, 1672, 17792, 1680, 9600, 1688, 25984, 1696, 5504, 1704, 21888, 1712, 13696, 1720, 30080, - 1728, 3456, 1736, 19840, 1744, 11648, 1752, 28032, 1760, 7552, 1768, 23936, 1776, 15744, 1784, 32128, - 1800, 17280, 1808, 9088, 1816, 25472, 1824, 4992, 1832, 21376, 1840, 13184, 1848, 29568, 1856, 2944, - 1864, 19328, 1872, 11136, 1880, 27520, 1888, 7040, 1896, 23424, 1904, 15232, 1912, 31616, 1928, 18304, - 1936, 10112, 1944, 26496, 1952, 6016, 1960, 22400, 1968, 14208, 1976, 30592, 1984, 3968, 1992, 20352, - 2000, 12160, 2008, 28544, 2016, 8064, 2024, 24448, 2032, 16256, 2040, 32640, 2056, 16448, 2064, 8256, - 2072, 24640, 2080, 4160, 2088, 20544, 2096, 12352, 2104, 28736, 2120, 18496, 2128, 10304, 2136, 26688, - 2144, 6208, 2152, 22592, 2160, 14400, 2168, 30784, 2184, 17472, 2192, 9280, 2200, 25664, 2208, 5184, - 2216, 21568, 2224, 13376, 2232, 29760, 2240, 3136, 2248, 19520, 2256, 11328, 2264, 27712, 2272, 7232, - 2280, 23616, 2288, 15424, 2296, 31808, 2312, 16960, 2320, 8768, 2328, 25152, 2336, 4672, 2344, 21056, - 2352, 12864, 2360, 29248, 2368, 2624, 2376, 19008, 2384, 10816, 2392, 27200, 2400, 6720, 2408, 23104, - 2416, 14912, 2424, 31296, 2440, 17984, 2448, 9792, 2456, 26176, 2464, 5696, 2472, 22080, 2480, 13888, - 2488, 30272, 2496, 3648, 2504, 20032, 2512, 11840, 2520, 28224, 2528, 7744, 2536, 24128, 2544, 15936, - 2552, 32320, 2568, 16704, 2576, 8512, 2584, 24896, 2592, 4416, 2600, 20800, 2608, 12608, 2616, 28992, - 2632, 18752, 2640, 10560, 2648, 26944, 2656, 6464, 2664, 22848, 2672, 14656, 2680, 31040, 2696, 17728, - 2704, 9536, 2712, 25920, 2720, 5440, 2728, 21824, 2736, 13632, 2744, 30016, 2752, 3392, 2760, 19776, - 2768, 11584, 2776, 27968, 2784, 7488, 2792, 23872, 2800, 15680, 2808, 32064, 2824, 17216, 2832, 9024, - 2840, 25408, 2848, 4928, 2856, 21312, 2864, 13120, 2872, 29504, 2888, 19264, 2896, 11072, 2904, 27456, - 2912, 6976, 2920, 23360, 2928, 15168, 2936, 31552, 2952, 18240, 2960, 10048, 2968, 26432, 2976, 5952, - 2984, 22336, 2992, 14144, 3000, 30528, 3008, 3904, 3016, 20288, 3024, 12096, 3032, 28480, 3040, 8000, - 3048, 24384, 3056, 16192, 3064, 32576, 3080, 16576, 3088, 8384, 3096, 24768, 3104, 4288, 3112, 20672, - 3120, 12480, 3128, 28864, 3144, 18624, 3152, 10432, 3160, 26816, 3168, 6336, 3176, 22720, 3184, 14528, - 3192, 30912, 3208, 17600, 3216, 9408, 3224, 25792, 3232, 5312, 3240, 21696, 3248, 13504, 3256, 29888, - 3272, 19648, 3280, 11456, 3288, 27840, 3296, 7360, 3304, 23744, 3312, 15552, 3320, 31936, 3336, 17088, - 3344, 8896, 3352, 25280, 3360, 4800, 3368, 21184, 3376, 12992, 3384, 29376, 3400, 19136, 3408, 10944, - 3416, 27328, 3424, 6848, 3432, 23232, 3440, 15040, 3448, 31424, 3464, 18112, 3472, 9920, 3480, 26304, - 3488, 5824, 3496, 22208, 3504, 14016, 3512, 30400, 3520, 3776, 3528, 20160, 3536, 11968, 3544, 28352, - 3552, 7872, 3560, 24256, 3568, 16064, 3576, 32448, 3592, 16832, 3600, 8640, 3608, 25024, 3616, 4544, - 3624, 20928, 3632, 12736, 3640, 29120, 3656, 18880, 3664, 10688, 3672, 27072, 3680, 6592, 3688, 22976, - 3696, 14784, 3704, 31168, 3720, 17856, 3728, 9664, 3736, 26048, 3744, 5568, 3752, 21952, 3760, 13760, - 3768, 30144, 3784, 19904, 3792, 11712, 3800, 28096, 3808, 7616, 3816, 24000, 3824, 15808, 3832, 32192, - 3848, 17344, 3856, 9152, 3864, 25536, 3872, 5056, 3880, 21440, 3888, 13248, 3896, 29632, 3912, 19392, - 3920, 11200, 3928, 27584, 3936, 7104, 3944, 23488, 3952, 15296, 3960, 31680, 3976, 18368, 3984, 10176, - 3992, 26560, 4000, 6080, 4008, 22464, 4016, 14272, 4024, 30656, 4040, 20416, 4048, 12224, 4056, 28608, - 4064, 8128, 4072, 24512, 4080, 16320, 4088, 32704, 4104, 16416, 4112, 8224, 4120, 24608, 4136, 20512, - 4144, 12320, 4152, 28704, 4168, 18464, 4176, 10272, 4184, 26656, 4192, 6176, 4200, 22560, 4208, 14368, - 4216, 30752, 4232, 17440, 4240, 9248, 4248, 25632, 4256, 5152, 4264, 21536, 4272, 13344, 4280, 29728, - 4296, 19488, 4304, 11296, 4312, 27680, 4320, 7200, 4328, 23584, 4336, 15392, 4344, 31776, 4360, 16928, - 4368, 8736, 4376, 25120, 4384, 4640, 4392, 21024, 4400, 12832, 4408, 29216, 4424, 18976, 4432, 10784, - 4440, 27168, 4448, 6688, 4456, 23072, 4464, 14880, 4472, 31264, 4488, 17952, 4496, 9760, 4504, 26144, - 4512, 5664, 4520, 22048, 4528, 13856, 4536, 30240, 4552, 20000, 4560, 11808, 4568, 28192, 4576, 7712, - 4584, 24096, 4592, 15904, 4600, 32288, 4616, 16672, 4624, 8480, 4632, 24864, 4648, 20768, 4656, 12576, - 4664, 28960, 4680, 18720, 4688, 10528, 4696, 26912, 4704, 6432, 4712, 22816, 4720, 14624, 4728, 31008, - 4744, 17696, 4752, 9504, 4760, 25888, 4768, 5408, 4776, 21792, 4784, 13600, 4792, 29984, 4808, 19744, - 4816, 11552, 4824, 27936, 4832, 7456, 4840, 23840, 4848, 15648, 4856, 32032, 4872, 17184, 4880, 8992, - 4888, 25376, 4904, 21280, 4912, 13088, 4920, 29472, 4936, 19232, 4944, 11040, 4952, 27424, 4960, 6944, - 4968, 23328, 4976, 15136, 4984, 31520, 5000, 18208, 5008, 10016, 5016, 26400, 5024, 5920, 5032, 22304, - 5040, 14112, 5048, 30496, 5064, 20256, 5072, 12064, 5080, 28448, 5088, 7968, 5096, 24352, 5104, 16160, - 5112, 32544, 5128, 16544, 5136, 8352, 5144, 24736, 5160, 20640, 5168, 12448, 5176, 28832, 5192, 18592, - 5200, 10400, 5208, 26784, 5216, 6304, 5224, 22688, 5232, 14496, 5240, 30880, 5256, 17568, 5264, 9376, - 5272, 25760, 5288, 21664, 5296, 13472, 5304, 29856, 5320, 19616, 5328, 11424, 5336, 27808, 5344, 7328, - 5352, 23712, 5360, 15520, 5368, 31904, 5384, 17056, 5392, 8864, 5400, 25248, 5416, 21152, 5424, 12960, - 5432, 29344, 5448, 19104, 5456, 10912, 5464, 27296, 5472, 6816, 5480, 23200, 5488, 15008, 5496, 31392, - 5512, 18080, 5520, 9888, 5528, 26272, 5536, 5792, 5544, 22176, 5552, 13984, 5560, 30368, 5576, 20128, - 5584, 11936, 5592, 28320, 5600, 7840, 5608, 24224, 5616, 16032, 5624, 32416, 5640, 16800, 5648, 8608, - 5656, 24992, 5672, 20896, 5680, 12704, 5688, 29088, 5704, 18848, 5712, 10656, 5720, 27040, 5728, 6560, - 5736, 22944, 5744, 14752, 5752, 31136, 5768, 17824, 5776, 9632, 5784, 26016, 5800, 21920, 5808, 13728, - 5816, 30112, 5832, 19872, 5840, 11680, 5848, 28064, 5856, 7584, 5864, 23968, 5872, 15776, 5880, 32160, - 5896, 17312, 5904, 9120, 5912, 25504, 5928, 21408, 5936, 13216, 5944, 29600, 5960, 19360, 5968, 11168, - 5976, 27552, 5984, 7072, 5992, 23456, 6000, 15264, 6008, 31648, 6024, 18336, 6032, 10144, 6040, 26528, - 6056, 22432, 6064, 14240, 6072, 30624, 6088, 20384, 6096, 12192, 6104, 28576, 6112, 8096, 6120, 24480, - 6128, 16288, 6136, 32672, 6152, 16480, 6160, 8288, 6168, 24672, 6184, 20576, 6192, 12384, 6200, 28768, - 6216, 18528, 6224, 10336, 6232, 26720, 6248, 22624, 6256, 14432, 6264, 30816, 6280, 17504, 6288, 9312, - 6296, 25696, 6312, 21600, 6320, 13408, 6328, 29792, 6344, 19552, 6352, 11360, 6360, 27744, 6368, 7264, - 6376, 23648, 6384, 15456, 6392, 31840, 6408, 16992, 6416, 8800, 6424, 25184, 6440, 21088, 6448, 12896, - 6456, 29280, 6472, 19040, 6480, 10848, 6488, 27232, 6496, 6752, 6504, 23136, 6512, 14944, 6520, 31328, - 6536, 18016, 6544, 9824, 6552, 26208, 6568, 22112, 6576, 13920, 6584, 30304, 6600, 20064, 6608, 11872, - 6616, 28256, 6624, 7776, 6632, 24160, 6640, 15968, 6648, 32352, 6664, 16736, 6672, 8544, 6680, 24928, - 6696, 20832, 6704, 12640, 6712, 29024, 6728, 18784, 6736, 10592, 6744, 26976, 6760, 22880, 6768, 14688, - 6776, 31072, 6792, 17760, 6800, 9568, 6808, 25952, 6824, 21856, 6832, 13664, 6840, 30048, 6856, 19808, - 6864, 11616, 6872, 28000, 6880, 7520, 6888, 23904, 6896, 15712, 6904, 32096, 6920, 17248, 6928, 9056, - 6936, 25440, 6952, 21344, 6960, 13152, 6968, 29536, 6984, 19296, 6992, 11104, 7000, 27488, 7016, 23392, - 7024, 15200, 7032, 31584, 7048, 18272, 7056, 10080, 7064, 26464, 7080, 22368, 7088, 14176, 7096, 30560, - 7112, 20320, 7120, 12128, 7128, 28512, 7136, 8032, 7144, 24416, 7152, 16224, 7160, 32608, 7176, 16608, - 7184, 8416, 7192, 24800, 7208, 20704, 7216, 12512, 7224, 28896, 7240, 18656, 7248, 10464, 7256, 26848, - 7272, 22752, 7280, 14560, 7288, 30944, 7304, 17632, 7312, 9440, 7320, 25824, 7336, 21728, 7344, 13536, - 7352, 29920, 7368, 19680, 7376, 11488, 7384, 27872, 7400, 23776, 7408, 15584, 7416, 31968, 7432, 17120, - 7440, 8928, 7448, 25312, 7464, 21216, 7472, 13024, 7480, 29408, 7496, 19168, 7504, 10976, 7512, 27360, - 7528, 23264, 7536, 15072, 7544, 31456, 7560, 18144, 7568, 9952, 7576, 26336, 7592, 22240, 7600, 14048, - 7608, 30432, 7624, 20192, 7632, 12000, 7640, 28384, 7648, 7904, 7656, 24288, 7664, 16096, 7672, 32480, - 7688, 16864, 7696, 8672, 7704, 25056, 7720, 20960, 7728, 12768, 7736, 29152, 7752, 18912, 7760, 10720, - 7768, 27104, 7784, 23008, 7792, 14816, 7800, 31200, 7816, 17888, 7824, 9696, 7832, 26080, 7848, 21984, - 7856, 13792, 7864, 30176, 7880, 19936, 7888, 11744, 7896, 28128, 7912, 24032, 7920, 15840, 7928, 32224, - 7944, 17376, 7952, 9184, 7960, 25568, 7976, 21472, 7984, 13280, 7992, 29664, 8008, 19424, 8016, 11232, - 8024, 27616, 8040, 23520, 8048, 15328, 8056, 31712, 8072, 18400, 8080, 10208, 8088, 26592, 8104, 22496, - 8112, 14304, 8120, 30688, 8136, 20448, 8144, 12256, 8152, 28640, 8168, 24544, 8176, 16352, 8184, 32736, - 8200, 16400, 8216, 24592, 8232, 20496, 8240, 12304, 8248, 28688, 8264, 18448, 8272, 10256, 8280, 26640, - 8296, 22544, 8304, 14352, 8312, 30736, 8328, 17424, 8336, 9232, 8344, 25616, 8360, 21520, 8368, 13328, - 8376, 29712, 8392, 19472, 8400, 11280, 8408, 27664, 8424, 23568, 8432, 15376, 8440, 31760, 8456, 16912, - 8464, 8720, 8472, 25104, 8488, 21008, 8496, 12816, 8504, 29200, 8520, 18960, 8528, 10768, 8536, 27152, - 8552, 23056, 8560, 14864, 8568, 31248, 8584, 17936, 8592, 9744, 8600, 26128, 8616, 22032, 8624, 13840, - 8632, 30224, 8648, 19984, 8656, 11792, 8664, 28176, 8680, 24080, 8688, 15888, 8696, 32272, 8712, 16656, - 8728, 24848, 8744, 20752, 8752, 12560, 8760, 28944, 8776, 18704, 8784, 10512, 8792, 26896, 8808, 22800, - 8816, 14608, 8824, 30992, 8840, 17680, 8848, 9488, 8856, 25872, 8872, 21776, 8880, 13584, 8888, 29968, - 8904, 19728, 8912, 11536, 8920, 27920, 8936, 23824, 8944, 15632, 8952, 32016, 8968, 17168, 8984, 25360, - 9000, 21264, 9008, 13072, 9016, 29456, 9032, 19216, 9040, 11024, 9048, 27408, 9064, 23312, 9072, 15120, - 9080, 31504, 9096, 18192, 9104, 10000, 9112, 26384, 9128, 22288, 9136, 14096, 9144, 30480, 9160, 20240, - 9168, 12048, 9176, 28432, 9192, 24336, 9200, 16144, 9208, 32528, 9224, 16528, 9240, 24720, 9256, 20624, - 9264, 12432, 9272, 28816, 9288, 18576, 9296, 10384, 9304, 26768, 9320, 22672, 9328, 14480, 9336, 30864, - 9352, 17552, 9368, 25744, 9384, 21648, 9392, 13456, 9400, 29840, 9416, 19600, 9424, 11408, 9432, 27792, - 9448, 23696, 9456, 15504, 9464, 31888, 9480, 17040, 9496, 25232, 9512, 21136, 9520, 12944, 9528, 29328, - 9544, 19088, 9552, 10896, 9560, 27280, 9576, 23184, 9584, 14992, 9592, 31376, 9608, 18064, 9616, 9872, - 9624, 26256, 9640, 22160, 9648, 13968, 9656, 30352, 9672, 20112, 9680, 11920, 9688, 28304, 9704, 24208, - 9712, 16016, 9720, 32400, 9736, 16784, 9752, 24976, 9768, 20880, 9776, 12688, 9784, 29072, 9800, 18832, - 9808, 10640, 9816, 27024, 9832, 22928, 9840, 14736, 9848, 31120, 9864, 17808, 9880, 26000, 9896, 21904, - 9904, 13712, 9912, 30096, 9928, 19856, 9936, 11664, 9944, 28048, 9960, 23952, 9968, 15760, 9976, 32144, - 9992, 17296, 10008, 25488, 10024, 21392, 10032, 13200, 10040, 29584, 10056, 19344, 10064, 11152, 10072, 27536, - 10088, 23440, 10096, 15248, 10104, 31632, 10120, 18320, 10136, 26512, 10152, 22416, 10160, 14224, 10168, 30608, - 10184, 20368, 10192, 12176, 10200, 28560, 10216, 24464, 10224, 16272, 10232, 32656, 10248, 16464, 10264, 24656, - 10280, 20560, 10288, 12368, 10296, 28752, 10312, 18512, 10328, 26704, 10344, 22608, 10352, 14416, 10360, 30800, - 10376, 17488, 10392, 25680, 10408, 21584, 10416, 13392, 10424, 29776, 10440, 19536, 10448, 11344, 10456, 27728, - 10472, 23632, 10480, 15440, 10488, 31824, 10504, 16976, 10520, 25168, 10536, 21072, 10544, 12880, 10552, 29264, - 10568, 19024, 10576, 10832, 10584, 27216, 10600, 23120, 10608, 14928, 10616, 31312, 10632, 18000, 10648, 26192, - 10664, 22096, 10672, 13904, 10680, 30288, 10696, 20048, 10704, 11856, 10712, 28240, 10728, 24144, 10736, 15952, - 10744, 32336, 10760, 16720, 10776, 24912, 10792, 20816, 10800, 12624, 10808, 29008, 10824, 18768, 10840, 26960, - 10856, 22864, 10864, 14672, 10872, 31056, 10888, 17744, 10904, 25936, 10920, 21840, 10928, 13648, 10936, 30032, - 10952, 19792, 10960, 11600, 10968, 27984, 10984, 23888, 10992, 15696, 11000, 32080, 11016, 17232, 11032, 25424, - 11048, 21328, 11056, 13136, 11064, 29520, 11080, 19280, 11096, 27472, 11112, 23376, 11120, 15184, 11128, 31568, - 11144, 18256, 11160, 26448, 11176, 22352, 11184, 14160, 11192, 30544, 11208, 20304, 11216, 12112, 11224, 28496, - 11240, 24400, 11248, 16208, 11256, 32592, 11272, 16592, 11288, 24784, 11304, 20688, 11312, 12496, 11320, 28880, - 11336, 18640, 11352, 26832, 11368, 22736, 11376, 14544, 11384, 30928, 11400, 17616, 11416, 25808, 11432, 21712, - 11440, 13520, 11448, 29904, 11464, 19664, 11480, 27856, 11496, 23760, 11504, 15568, 11512, 31952, 11528, 17104, - 11544, 25296, 11560, 21200, 11568, 13008, 11576, 29392, 11592, 19152, 11608, 27344, 11624, 23248, 11632, 15056, - 11640, 31440, 11656, 18128, 11672, 26320, 11688, 22224, 11696, 14032, 11704, 30416, 11720, 20176, 11728, 11984, - 11736, 28368, 11752, 24272, 11760, 16080, 11768, 32464, 11784, 16848, 11800, 25040, 11816, 20944, 11824, 12752, - 11832, 29136, 11848, 18896, 11864, 27088, 11880, 22992, 11888, 14800, 11896, 31184, 11912, 17872, 11928, 26064, - 11944, 21968, 11952, 13776, 11960, 30160, 11976, 19920, 11992, 28112, 12008, 24016, 12016, 15824, 12024, 32208, - 12040, 17360, 12056, 25552, 12072, 21456, 12080, 13264, 12088, 29648, 12104, 19408, 12120, 27600, 12136, 23504, - 12144, 15312, 12152, 31696, 12168, 18384, 12184, 26576, 12200, 22480, 12208, 14288, 12216, 30672, 12232, 20432, - 12248, 28624, 12264, 24528, 12272, 16336, 12280, 32720, 12296, 16432, 12312, 24624, 12328, 20528, 12344, 28720, - 12360, 18480, 12376, 26672, 12392, 22576, 12400, 14384, 12408, 30768, 12424, 17456, 12440, 25648, 12456, 21552, - 12464, 13360, 12472, 29744, 12488, 19504, 12504, 27696, 12520, 23600, 12528, 15408, 12536, 31792, 12552, 16944, - 12568, 25136, 12584, 21040, 12592, 12848, 12600, 29232, 12616, 18992, 12632, 27184, 12648, 23088, 12656, 14896, - 12664, 31280, 12680, 17968, 12696, 26160, 12712, 22064, 12720, 13872, 12728, 30256, 12744, 20016, 12760, 28208, - 12776, 24112, 12784, 15920, 12792, 32304, 12808, 16688, 12824, 24880, 12840, 20784, 12856, 28976, 12872, 18736, - 12888, 26928, 12904, 22832, 12912, 14640, 12920, 31024, 12936, 17712, 12952, 25904, 12968, 21808, 12976, 13616, - 12984, 30000, 13000, 19760, 13016, 27952, 13032, 23856, 13040, 15664, 13048, 32048, 13064, 17200, 13080, 25392, - 13096, 21296, 13112, 29488, 13128, 19248, 13144, 27440, 13160, 23344, 13168, 15152, 13176, 31536, 13192, 18224, - 13208, 26416, 13224, 22320, 13232, 14128, 13240, 30512, 13256, 20272, 13272, 28464, 13288, 24368, 13296, 16176, - 13304, 32560, 13320, 16560, 13336, 24752, 13352, 20656, 13368, 28848, 13384, 18608, 13400, 26800, 13416, 22704, - 13424, 14512, 13432, 30896, 13448, 17584, 13464, 25776, 13480, 21680, 13496, 29872, 13512, 19632, 13528, 27824, - 13544, 23728, 13552, 15536, 13560, 31920, 13576, 17072, 13592, 25264, 13608, 21168, 13624, 29360, 13640, 19120, - 13656, 27312, 13672, 23216, 13680, 15024, 13688, 31408, 13704, 18096, 13720, 26288, 13736, 22192, 13744, 14000, - 13752, 30384, 13768, 20144, 13784, 28336, 13800, 24240, 13808, 16048, 13816, 32432, 13832, 16816, 13848, 25008, - 13864, 20912, 13880, 29104, 13896, 18864, 13912, 27056, 13928, 22960, 13936, 14768, 13944, 31152, 13960, 17840, - 13976, 26032, 13992, 21936, 14008, 30128, 14024, 19888, 14040, 28080, 14056, 23984, 14064, 15792, 14072, 32176, - 14088, 17328, 14104, 25520, 14120, 21424, 14136, 29616, 14152, 19376, 14168, 27568, 14184, 23472, 14192, 15280, - 14200, 31664, 14216, 18352, 14232, 26544, 14248, 22448, 14264, 30640, 14280, 20400, 14296, 28592, 14312, 24496, - 14320, 16304, 14328, 32688, 14344, 16496, 14360, 24688, 14376, 20592, 14392, 28784, 14408, 18544, 14424, 26736, - 14440, 22640, 14456, 30832, 14472, 17520, 14488, 25712, 14504, 21616, 14520, 29808, 14536, 19568, 14552, 27760, - 14568, 23664, 14576, 15472, 14584, 31856, 14600, 17008, 14616, 25200, 14632, 21104, 14648, 29296, 14664, 19056, - 14680, 27248, 14696, 23152, 14704, 14960, 14712, 31344, 14728, 18032, 14744, 26224, 14760, 22128, 14776, 30320, - 14792, 20080, 14808, 28272, 14824, 24176, 14832, 15984, 14840, 32368, 14856, 16752, 14872, 24944, 14888, 20848, - 14904, 29040, 14920, 18800, 14936, 26992, 14952, 22896, 14968, 31088, 14984, 17776, 15000, 25968, 15016, 21872, - 15032, 30064, 15048, 19824, 15064, 28016, 15080, 23920, 15088, 15728, 15096, 32112, 15112, 17264, 15128, 25456, - 15144, 21360, 15160, 29552, 15176, 19312, 15192, 27504, 15208, 23408, 15224, 31600, 15240, 18288, 15256, 26480, - 15272, 22384, 15288, 30576, 15304, 20336, 15320, 28528, 15336, 24432, 15344, 16240, 15352, 32624, 15368, 16624, - 15384, 24816, 15400, 20720, 15416, 28912, 15432, 18672, 15448, 26864, 15464, 22768, 15480, 30960, 15496, 17648, - 15512, 25840, 15528, 21744, 15544, 29936, 15560, 19696, 15576, 27888, 15592, 23792, 15608, 31984, 15624, 17136, - 15640, 25328, 15656, 21232, 15672, 29424, 15688, 19184, 15704, 27376, 15720, 23280, 15736, 31472, 15752, 18160, - 15768, 26352, 15784, 22256, 15800, 30448, 15816, 20208, 15832, 28400, 15848, 24304, 15856, 16112, 15864, 32496, - 15880, 16880, 15896, 25072, 15912, 20976, 15928, 29168, 15944, 18928, 15960, 27120, 15976, 23024, 15992, 31216, - 16008, 17904, 16024, 26096, 16040, 22000, 16056, 30192, 16072, 19952, 16088, 28144, 16104, 24048, 16120, 32240, - 16136, 17392, 16152, 25584, 16168, 21488, 16184, 29680, 16200, 19440, 16216, 27632, 16232, 23536, 16248, 31728, - 16264, 18416, 16280, 26608, 16296, 22512, 16312, 30704, 16328, 20464, 16344, 28656, 16360, 24560, 16376, 32752, - 16408, 24584, 16424, 20488, 16440, 28680, 16456, 18440, 16472, 26632, 16488, 22536, 16504, 30728, 16520, 17416, - 16536, 25608, 16552, 21512, 16568, 29704, 16584, 19464, 16600, 27656, 16616, 23560, 16632, 31752, 16648, 16904, - 16664, 25096, 16680, 21000, 16696, 29192, 16712, 18952, 16728, 27144, 16744, 23048, 16760, 31240, 16776, 17928, - 16792, 26120, 16808, 22024, 16824, 30216, 16840, 19976, 16856, 28168, 16872, 24072, 16888, 32264, 16920, 24840, - 16936, 20744, 16952, 28936, 16968, 18696, 16984, 26888, 17000, 22792, 17016, 30984, 17032, 17672, 17048, 25864, - 17064, 21768, 17080, 29960, 17096, 19720, 17112, 27912, 17128, 23816, 17144, 32008, 17176, 25352, 17192, 21256, - 17208, 29448, 17224, 19208, 17240, 27400, 17256, 23304, 17272, 31496, 17288, 18184, 17304, 26376, 17320, 22280, - 17336, 30472, 17352, 20232, 17368, 28424, 17384, 24328, 17400, 32520, 17432, 24712, 17448, 20616, 17464, 28808, - 17480, 18568, 17496, 26760, 17512, 22664, 17528, 30856, 17560, 25736, 17576, 21640, 17592, 29832, 17608, 19592, - 17624, 27784, 17640, 23688, 17656, 31880, 17688, 25224, 17704, 21128, 17720, 29320, 17736, 19080, 17752, 27272, - 17768, 23176, 17784, 31368, 17800, 18056, 17816, 26248, 17832, 22152, 17848, 30344, 17864, 20104, 17880, 28296, - 17896, 24200, 17912, 32392, 17944, 24968, 17960, 20872, 17976, 29064, 17992, 18824, 18008, 27016, 18024, 22920, - 18040, 31112, 18072, 25992, 18088, 21896, 18104, 30088, 18120, 19848, 18136, 28040, 18152, 23944, 18168, 32136, - 18200, 25480, 18216, 21384, 18232, 29576, 18248, 19336, 18264, 27528, 18280, 23432, 18296, 31624, 18328, 26504, - 18344, 22408, 18360, 30600, 18376, 20360, 18392, 28552, 18408, 24456, 18424, 32648, 18456, 24648, 18472, 20552, - 18488, 28744, 18520, 26696, 18536, 22600, 18552, 30792, 18584, 25672, 18600, 21576, 18616, 29768, 18632, 19528, - 18648, 27720, 18664, 23624, 18680, 31816, 18712, 25160, 18728, 21064, 18744, 29256, 18760, 19016, 18776, 27208, - 18792, 23112, 18808, 31304, 18840, 26184, 18856, 22088, 18872, 30280, 18888, 20040, 18904, 28232, 18920, 24136, - 18936, 32328, 18968, 24904, 18984, 20808, 19000, 29000, 19032, 26952, 19048, 22856, 19064, 31048, 19096, 25928, - 19112, 21832, 19128, 30024, 19144, 19784, 19160, 27976, 19176, 23880, 19192, 32072, 19224, 25416, 19240, 21320, - 19256, 29512, 19288, 27464, 19304, 23368, 19320, 31560, 19352, 26440, 19368, 22344, 19384, 30536, 19400, 20296, - 19416, 28488, 19432, 24392, 19448, 32584, 19480, 24776, 19496, 20680, 19512, 28872, 19544, 26824, 19560, 22728, - 19576, 30920, 19608, 25800, 19624, 21704, 19640, 29896, 19672, 27848, 19688, 23752, 19704, 31944, 19736, 25288, - 19752, 21192, 19768, 29384, 19800, 27336, 19816, 23240, 19832, 31432, 19864, 26312, 19880, 22216, 19896, 30408, - 19912, 20168, 19928, 28360, 19944, 24264, 19960, 32456, 19992, 25032, 20008, 20936, 20024, 29128, 20056, 27080, - 20072, 22984, 20088, 31176, 20120, 26056, 20136, 21960, 20152, 30152, 20184, 28104, 20200, 24008, 20216, 32200, - 20248, 25544, 20264, 21448, 20280, 29640, 20312, 27592, 20328, 23496, 20344, 31688, 20376, 26568, 20392, 22472, - 20408, 30664, 20440, 28616, 20456, 24520, 20472, 32712, 20504, 24616, 20536, 28712, 20568, 26664, 20584, 22568, - 20600, 30760, 20632, 25640, 20648, 21544, 20664, 29736, 20696, 27688, 20712, 23592, 20728, 31784, 20760, 25128, - 20776, 21032, 20792, 29224, 20824, 27176, 20840, 23080, 20856, 31272, 20888, 26152, 20904, 22056, 20920, 30248, - 20952, 28200, 20968, 24104, 20984, 32296, 21016, 24872, 21048, 28968, 21080, 26920, 21096, 22824, 21112, 31016, - 21144, 25896, 21160, 21800, 21176, 29992, 21208, 27944, 21224, 23848, 21240, 32040, 21272, 25384, 21304, 29480, - 21336, 27432, 21352, 23336, 21368, 31528, 21400, 26408, 21416, 22312, 21432, 30504, 21464, 28456, 21480, 24360, - 21496, 32552, 21528, 24744, 21560, 28840, 21592, 26792, 21608, 22696, 21624, 30888, 21656, 25768, 21688, 29864, - 21720, 27816, 21736, 23720, 21752, 31912, 21784, 25256, 21816, 29352, 21848, 27304, 21864, 23208, 21880, 31400, - 21912, 26280, 21928, 22184, 21944, 30376, 21976, 28328, 21992, 24232, 22008, 32424, 22040, 25000, 22072, 29096, - 22104, 27048, 22120, 22952, 22136, 31144, 22168, 26024, 22200, 30120, 22232, 28072, 22248, 23976, 22264, 32168, - 22296, 25512, 22328, 29608, 22360, 27560, 22376, 23464, 22392, 31656, 22424, 26536, 22456, 30632, 22488, 28584, - 22504, 24488, 22520, 32680, 22552, 24680, 22584, 28776, 22616, 26728, 22648, 30824, 22680, 25704, 22712, 29800, - 22744, 27752, 22760, 23656, 22776, 31848, 22808, 25192, 22840, 29288, 22872, 27240, 22888, 23144, 22904, 31336, - 22936, 26216, 22968, 30312, 23000, 28264, 23016, 24168, 23032, 32360, 23064, 24936, 23096, 29032, 23128, 26984, - 23160, 31080, 23192, 25960, 23224, 30056, 23256, 28008, 23272, 23912, 23288, 32104, 23320, 25448, 23352, 29544, - 23384, 27496, 23416, 31592, 23448, 26472, 23480, 30568, 23512, 28520, 23528, 24424, 23544, 32616, 23576, 24808, - 23608, 28904, 23640, 26856, 23672, 30952, 23704, 25832, 23736, 29928, 23768, 27880, 23800, 31976, 23832, 25320, - 23864, 29416, 23896, 27368, 23928, 31464, 23960, 26344, 23992, 30440, 24024, 28392, 24040, 24296, 24056, 32488, - 24088, 25064, 24120, 29160, 24152, 27112, 24184, 31208, 24216, 26088, 24248, 30184, 24280, 28136, 24312, 32232, - 24344, 25576, 24376, 29672, 24408, 27624, 24440, 31720, 24472, 26600, 24504, 30696, 24536, 28648, 24568, 32744, - 24632, 28696, 24664, 26648, 24696, 30744, 24728, 25624, 24760, 29720, 24792, 27672, 24824, 31768, 24856, 25112, - 24888, 29208, 24920, 27160, 24952, 31256, 24984, 26136, 25016, 30232, 25048, 28184, 25080, 32280, 25144, 28952, - 25176, 26904, 25208, 31000, 25240, 25880, 25272, 29976, 25304, 27928, 25336, 32024, 25400, 29464, 25432, 27416, - 25464, 31512, 25496, 26392, 25528, 30488, 25560, 28440, 25592, 32536, 25656, 28824, 25688, 26776, 25720, 30872, - 25784, 29848, 25816, 27800, 25848, 31896, 25912, 29336, 25944, 27288, 25976, 31384, 26008, 26264, 26040, 30360, - 26072, 28312, 26104, 32408, 26168, 29080, 26200, 27032, 26232, 31128, 26296, 30104, 26328, 28056, 26360, 32152, - 26424, 29592, 26456, 27544, 26488, 31640, 26552, 30616, 26584, 28568, 26616, 32664, 26680, 28760, 26744, 30808, - 26808, 29784, 26840, 27736, 26872, 31832, 26936, 29272, 26968, 27224, 27000, 31320, 27064, 30296, 27096, 28248, - 27128, 32344, 27192, 29016, 27256, 31064, 27320, 30040, 27352, 27992, 27384, 32088, 27448, 29528, 27512, 31576, - 27576, 30552, 27608, 28504, 27640, 32600, 27704, 28888, 27768, 30936, 27832, 29912, 27896, 31960, 27960, 29400, - 28024, 31448, 28088, 30424, 28120, 28376, 28152, 32472, 28216, 29144, 28280, 31192, 28344, 30168, 28408, 32216, - 28472, 29656, 28536, 31704, 28600, 30680, 28664, 32728, 28792, 30776, 28856, 29752, 28920, 31800, 28984, 29240, - 29048, 31288, 29112, 30264, 29176, 32312, 29304, 31032, 29368, 30008, 29432, 32056, 29560, 31544, 29624, 30520, - 29688, 32568, 29816, 30904, 29944, 31928, 30072, 31416, 30136, 30392, 30200, 32440, 30328, 31160, 30456, 32184, - 30584, 31672, 30712, 32696, 30968, 31864, 31096, 31352, 31224, 32376, 31480, 32120, 31736, 32632, 32248, 32504, -}; - -void dsps_fft2r_rev_tables_init_fc32(void) -{ - dsps_fft2r_rev_tables_fc32[0] = (uint16_t *)bitrev2r_table_16_fc32; - dsps_fft2r_rev_tables_fc32[1] = (uint16_t *)bitrev2r_table_32_fc32; - dsps_fft2r_rev_tables_fc32[2] = (uint16_t *)bitrev2r_table_64_fc32; - dsps_fft2r_rev_tables_fc32[3] = (uint16_t *)bitrev2r_table_128_fc32; - dsps_fft2r_rev_tables_fc32[4] = (uint16_t *)bitrev2r_table_256_fc32; - dsps_fft2r_rev_tables_fc32[5] = (uint16_t *)bitrev2r_table_512_fc32; - dsps_fft2r_rev_tables_fc32[6] = (uint16_t *)bitrev2r_table_1024_fc32; - dsps_fft2r_rev_tables_fc32[7] = (uint16_t *)bitrev2r_table_2048_fc32; - dsps_fft2r_rev_tables_fc32[8] = (uint16_t *)bitrev2r_table_4096_fc32; - -} - -uint16_t *dsps_fft2r_rev_tables_fc32[] = { - (uint16_t *)bitrev2r_table_16_fc32, - (uint16_t *)bitrev2r_table_32_fc32, - (uint16_t *)bitrev2r_table_64_fc32, - (uint16_t *)bitrev2r_table_128_fc32, - (uint16_t *)bitrev2r_table_256_fc32, - (uint16_t *)bitrev2r_table_512_fc32, - (uint16_t *)bitrev2r_table_1024_fc32, - (uint16_t *)bitrev2r_table_2048_fc32, - (uint16_t *)bitrev2r_table_4096_fc32, -}; - -const uint16_t bitrev2r_table_16_fc32_size = 6; -const uint16_t bitrev2r_table_32_fc32_size = 12; -const uint16_t bitrev2r_table_64_fc32_size = 28; -const uint16_t bitrev2r_table_128_fc32_size = 56; -const uint16_t bitrev2r_table_256_fc32_size = 120; -const uint16_t bitrev2r_table_512_fc32_size = 240; -const uint16_t bitrev2r_table_1024_fc32_size = 496; -const uint16_t bitrev2r_table_2048_fc32_size = 992; -const uint16_t bitrev2r_table_4096_fc32_size = 2016; - -const uint16_t dsps_fft2r_rev_tables_fc32_size[] = { - (const uint16_t)6, // bitrev2r_table_16_fc32_size, - (const uint16_t)12, // bitrev2r_table_32_fc32_size, - (const uint16_t)28, // bitrev2r_table_64_fc32_size, - (const uint16_t)56, // bitrev2r_table_128_fc32_size, - (const uint16_t)120, // bitrev2r_table_256_fc32_size, - (const uint16_t)240, // bitrev2r_table_512_fc32_size, - (const uint16_t)496, // bitrev2r_table_1024_fc32_size, - (const uint16_t)992, // bitrev2r_table_2048_fc32_size, - (const uint16_t)2016,// bitrev2r_table_4096_fc32_size, -}; diff --git a/components/esp-dsp/modules/fft/float/dsps_fft2r_fc32_ae32.c b/components/esp-dsp/modules/fft/float/dsps_fft2r_fc32_ae32.c deleted file mode 100644 index 1d7fc786..00000000 --- a/components/esp-dsp/modules/fft/float/dsps_fft2r_fc32_ae32.c +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_fft2r.h" -#include "dsp_common.h" -#include "dsp_types.h" -#include -#include "esp_attr.h" -#include "dsps_fft2r_platform.h" - -#if (dsps_bit_rev_lookup_fc32_ae32_enabled == 1) - -esp_err_t dsps_bit_rev_lookup_fc32_ae32(float *data, int reverse_size, uint16_t *reverse_tab) -{ - int idx_0, idx_1; - int idx_2, idx_3; - - float *data_i; - - asm volatile ("addi %0, %1, 4" : "=a" (data_i) : "a" (data)); ///data_i = &data[1]; - asm volatile ("srli %0, %0, 1" : "+a" (reverse_size)); /// reverse_size >>= 1; - asm volatile ("loopnez %0, __loop_end_radix2_reorder_lookup_table" :: "a" (reverse_size)); ///for (i = 0; i < reverse_size; i++) { - asm volatile ("l16ui %0, %1, 0" : "=a" (idx_0) : "a" (reverse_tab)); //idx_0 = *(reverse_tab + 0); ///idx_0 = reverse_tab[i * 2 + 0]; - asm volatile ("l16ui %0, %1, 2" : "=a" (idx_1) : "a" (reverse_tab)); //idx_1 = *(reverse_tab + 1); ///idx_1 = reverse_tab[i * 2 + 1]; - asm volatile ("l16ui %0, %1, 4" : "=a" (idx_2) : "a" (reverse_tab)); //idx_2 = *(reverse_tab + 2); ///idx_2 = reverse_tab[i * 2 + 2]; - asm volatile ("l16ui %0, %1, 6" : "=a" (idx_3) : "a" (reverse_tab)); //idx_3 = *(reverse_tab + 3); ///idx_3 = reverse_tab[i * 2 + 3]; - asm volatile ("addi %0, %0, 8" : "+a" (reverse_tab)); // reverse_tab += 4; - - asm volatile ("lsx f0, %0, %1" :: "a" (data), "a" (idx_0)); // f0 = *(data + idx_0); //f0 = data[idx_0 + 0]; - asm volatile ("lsx f2, %0, %1" :: "a" (data_i), "a" (idx_0)); // f2 = *(data_i + idx_0); //f2 = data[idx_0 + 1]; - asm volatile ("lsx f1, %0, %1" :: "a" (data), "a" (idx_1)); //f1 = *(data + idx_1); //f1 = data[idx_1 + 0]; - asm volatile ("lsx f3, %0, %1" :: "a" (data_i), "a" (idx_1)); //f3 = *(data_i + idx_1); //f3 = data[idx_1 + 1]; - - asm volatile ("ssx f0, %0, %1" :: "a" (data), "a" (idx_1)); //*(data + idx_1) = f0; //data[idx_1 + 0] = f0; - asm volatile ("ssx f2, %0, %1" :: "a" (data_i), "a" (idx_1)); //*(data_i + idx_1) = f2; //data[idx_1 + 1] = f2; - asm volatile ("ssx f1, %0, %1" :: "a" (data), "a" (idx_0)); //*(data + idx_0) = f1; //data[idx_0 + 0] = f1; - asm volatile ("ssx f3, %0, %1" :: "a" (data_i), "a" (idx_0)); //*(data_i + idx_0) = f3;//data[idx_0 + 1] = f3; - - asm volatile ("lsx f0, %0, %1" :: "a" (data), "a" (idx_2)); // f0 = *(data + idx_2); //f0 = data[idx_2 + 0]; - asm volatile ("lsx f2, %0, %1" :: "a" (data_i), "a" (idx_2)); // f2 = *(data_i + idx_2); //f2 = data[idx_2 + 1]; - asm volatile ("lsx f1, %0, %1" :: "a" (data), "a" (idx_3)); //f1 = *(data + idx_3); //f1 = data[idx_3 + 0]; - asm volatile ("lsx f3, %0, %1" :: "a" (data_i), "a" (idx_3)); //f3 = *(data_i + idx_3); //f3 = data[idx_3 + 1]; - - asm volatile ("ssx f0, %0, %1" :: "a" (data), "a" (idx_3)); //*(data + idx_3) = f0; //data[idx_3 + 0] = f0; - asm volatile ("ssx f2, %0, %1" :: "a" (data_i), "a" (idx_3)); //*(data_i + idx_3) = f2; //data[idx_3 + 1] = f2; - asm volatile ("ssx f1, %0, %1" :: "a" (data), "a" (idx_2)); //*(data + idx_2) = f1; //data[idx_2 + 0] = f1; - asm volatile ("ssx f3, %0, %1" :: "a" (data_i), "a" (idx_2)); //*(data_i + idx_2) = f3; //data[idx_2 + 1] = f3; - //} - asm volatile("__loop_end_radix2_reorder_lookup_table: nop"); - return ESP_OK; -} -#endif // dsps_bit_rev_lookup_fc32_ae32_enabled \ No newline at end of file diff --git a/components/esp-dsp/modules/fft/float/dsps_fft2r_fc32_ae32_.S b/components/esp-dsp/modules/fft/float/dsps_fft2r_fc32_ae32_.S deleted file mode 100644 index bf27a649..00000000 --- a/components/esp-dsp/modules/fft/float/dsps_fft2r_fc32_ae32_.S +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_fft2r_platform.h" -#if (dsps_fft2r_fc32_ae32_enabled == 1) - -// This is matrix multipliction function for ESP32 processor. - .text - .align 4 - .global dsps_fft2r_fc32_ae32_ - .type dsps_fft2r_fc32_ae32_,@function - -// .extern dsps_fft_w_table_fc32; - .global dsps_fft_w_table_fc32; - -// The function implements the following C code: -//esp_err_t dsps_fft2r_fc32_ansi(float *data, int N) -//{ -// float *w = dsps_fft_w_table_fc32; -// -// int ie, ia, m; -// float re_temp, im_temp; -// float c, s; -// int N2 = N; -// ie = 1; -// for (int N2 = N/2; N2 > 0; N2 >>= 1) { -// ia = 0; -// for (int j = 0; j < ie; j++) { -// c = w[2 * j]; -// s = w[2 * j + 1]; -// for (int i = 0; i < N2; i++) { -// m = ia + N2; -// re_temp = c * data[2 * m] + s * data[2 * m + 1]; -// im_temp = c * data[2 * m + 1] - s * data[2 * m]; -// data[2 * m] = data[2 * ia] - re_temp; -// data[2 * m + 1] = data[2 * ia + 1] - im_temp; -// data[2 * ia] = data[2 * ia] + re_temp; -// data[2 * ia + 1] = data[2 * ia + 1] + im_temp; -// ia++; -// } -// ia += N2; -// } -// ie <<= 1; -// } -// return result; -//} - - -dsps_fft2r_fc32_ae32_: -//esp_err_t dsps_fft2r_fc32_ansi(float *data, int N, float* dsps_fft_w_table_fc32) - - entry a1, 16 - // Array increment for floating point data should be 4 -// data - a2 -// N - a3 -// dsps_fft_w_table_fc32 - a4 - for now - -// a6 - k, main loop counter; N2 - for (int N2 = N/2; N2 > 0; N2 >>= 1) -// a7 - ie -// a8 - j -// a9 - test -// a10 - (j*2)<<2, or a10 - j<<3 -// f0 - c or w[2 * j] -// f1 - s or w[2 * j + 1] -// a11 - ia -// a12 - m -// a13 - ia pointer -// a14 - m pointer -// f6 - re_temp -// f7 - im_temp - -// a15 - debug - - // This instruction are not working. Have to be fixed!!! - // For now theres no solution... -// l32r a4, dsps_fft_w_table_fc32_ae32 - - // Load shift register with 1 - movi.n a5, 1 // a5 = 1; - ssr a5 // load shift register with 1 - - srli a6, a3, 1 // a6 = N2 = N/2 - movi a7, 1 // a7 - ie - -fft2r_l1: - movi a8, 0 // a8 - j - movi a11,0 // a11 = ia = 0; - -fft2r_l2: // loop for j, a8 - j - slli a10, a8, 3 // a10 = j<<3 // shift for cos () -- c = w[2 * j]; - add.n a10, a10, a4 // a10 - pointer to cos - lsi f0, a10, 0 - lsi f1, a10, 4 - - movi a9, 0 // just for debug - loopnez a6, fft2r_l3 - add.n a12, a11, a6 // a12 = m = ia + N2 - - slli a14, a12, 3 // a14 - pointer for m*2 - slli a13, a11, 3 // a13 - pointer for ia*2 - add.n a14, a14, a2 // pointers to data arrays - add.n a13, a13, a2 // - - lsi f4, a14, 0 // data[2 * m] - mul.s f6, f0, f4 // re_temp = c * data[2 * m] - lsi f5, a14, 4 // data[2 * m + 1] - mul.s f7, f0, f5 // im_temp = c * data[2 * m + 1] - - lsi f2, a13, 0 // data[2 * ia] - madd.s f6, f1, f5 // re_temp += s * data[2 * m + 1]; - lsi f3, a13, 4 // data[2 * ia + 1] - msub.s f7, f1, f4 // im_temp -= s * data[2 * m]; - - sub.s f8, f2, f6 // = data[2 * ia] - re_temp; - sub.s f9, f3, f7 // = data[2 * ia + 1] - im_temp; - - add.s f10, f2, f6 // = data[2 * ia] + re_temp; - ssi f8, a14, 0 - add.s f11, f3, f7 // = data[2 * ia + 1] + im_temp; - ssi f9, a14, 4 - - ssi f10, a13, 0 - addi a11, a11, 1// ia++ - ssi f11, a13, 4 -fft2r_l3: - add a11, a11, a6 - - addi a8, a8, 1 // j++ - BNE a8, a7, fft2r_l2 // - slli a7, a7, 1 // ie = ie<<1 -// main loop: for (int k = N/2; k > 0; k >>= 1) - srli a6, a6, 1 // a6 = a6>>1 - BNEZ a6, fft2r_l1// Jump if > 0 - - movi.n a2, 0 // return status ESP_OK - retw.n - -#endif // dsps_fft2r_fc32_ae32_enabled \ No newline at end of file diff --git a/components/esp-dsp/modules/fft/float/dsps_fft2r_fc32_ansi.c b/components/esp-dsp/modules/fft/float/dsps_fft2r_fc32_ansi.c deleted file mode 100644 index 90a1aaee..00000000 --- a/components/esp-dsp/modules/fft/float/dsps_fft2r_fc32_ansi.c +++ /dev/null @@ -1,346 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_fft2r.h" -#include "dsp_common.h" -#include "dsp_types.h" -#include -#include "esp_attr.h" -#include "esp_log.h" -#include - -static const char *TAG = "fftr2_ansi"; - -float *dsps_fft_w_table_fc32; -int dsps_fft_w_table_size; -uint8_t dsps_fft2r_initialized = 0; -uint8_t dsps_fft2r_mem_allocated = 0; - -uint16_t *dsps_fft2r_ram_rev_table = NULL; - -unsigned short reverse(unsigned short x, unsigned short N, int order); - -esp_err_t dsps_fft2r_init_fc32(float *fft_table_buff, int table_size) -{ - esp_err_t result = ESP_OK; - if (dsps_fft2r_initialized != 0) { - return result; - } - if (table_size > CONFIG_DSP_MAX_FFT_SIZE) { - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - } - if (table_size == 0) { - return result; - } - if (fft_table_buff != NULL) { - if (dsps_fft2r_mem_allocated) { - return ESP_ERR_DSP_REINITIALIZED; - } - dsps_fft_w_table_fc32 = fft_table_buff; - dsps_fft_w_table_size = table_size; - } else { - if (!dsps_fft2r_mem_allocated) { - dsps_fft_w_table_fc32 = (float *)malloc(table_size * sizeof(float)); - if (dsps_fft_w_table_fc32 == NULL) { - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - } - } - dsps_fft_w_table_size = table_size; - dsps_fft2r_mem_allocated = 1; - - } - - // FFT ram_rev table allocated - int pow = dsp_power_of_two(table_size); - if ((pow > 3) && (pow < 13)) { - dsps_fft2r_ram_rev_table = (uint16_t *)malloc(2 * dsps_fft2r_rev_tables_fc32_size[pow - 4] * sizeof(uint16_t)); - if (dsps_fft2r_ram_rev_table == NULL) { - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - } - memcpy(dsps_fft2r_ram_rev_table, dsps_fft2r_rev_tables_fc32[pow - 4], 2 * dsps_fft2r_rev_tables_fc32_size[pow - 4] * sizeof(uint16_t)); - dsps_fft2r_rev_tables_fc32[pow - 4] = dsps_fft2r_ram_rev_table; - } - - result = dsps_gen_w_r2_fc32(dsps_fft_w_table_fc32, dsps_fft_w_table_size); - if (result != ESP_OK) { - return result; - } - result = dsps_bit_rev_fc32_ansi(dsps_fft_w_table_fc32, dsps_fft_w_table_size >> 1); - if (result != ESP_OK) { - return result; - } - dsps_fft2r_initialized = 1; - - return ESP_OK; -} - -void dsps_fft2r_deinit_fc32() -{ - if (dsps_fft2r_mem_allocated) { - free(dsps_fft_w_table_fc32); - } - if (dsps_fft2r_ram_rev_table != NULL) { - free(dsps_fft2r_ram_rev_table); - dsps_fft2r_ram_rev_table = NULL; - } - // Re init bitrev table for next use - dsps_fft2r_rev_tables_init_fc32(); - dsps_fft2r_mem_allocated = 0; - dsps_fft2r_initialized = 0; -} - -esp_err_t dsps_fft2r_fc32_ansi_(float *data, int N, float *w) -{ - if (!dsp_is_power_of_two(N)) { - return ESP_ERR_DSP_INVALID_LENGTH; - } - if (!dsps_fft2r_initialized) { - return ESP_ERR_DSP_UNINITIALIZED; - } - - esp_err_t result = ESP_OK; - - int ie, ia, m; - float re_temp, im_temp; - float c, s; - ie = 1; - for (int N2 = N / 2; N2 > 0; N2 >>= 1) { - ia = 0; - for (int j = 0; j < ie; j++) { - c = w[2 * j]; - s = w[2 * j + 1]; - for (int i = 0; i < N2; i++) { - m = ia + N2; - re_temp = c * data[2 * m] + s * data[2 * m + 1]; - im_temp = c * data[2 * m + 1] - s * data[2 * m]; - data[2 * m] = data[2 * ia] - re_temp; - data[2 * m + 1] = data[2 * ia + 1] - im_temp; - data[2 * ia] = data[2 * ia] + re_temp; - data[2 * ia + 1] = data[2 * ia + 1] + im_temp; - ia++; - } - ia += N2; - } - ie <<= 1; - } - return result; -} - - -unsigned short reverse(unsigned short x, unsigned short N, int order) -{ - unsigned short b = x; - - b = (b & 0xff00) >> 8 | (b & 0x00fF) << 8; - b = (b & 0xf0F0) >> 4 | (b & 0x0f0F) << 4; - b = (b & 0xCCCC) >> 2 | (b & 0x3333) << 2; - b = (b & 0xAAAA) >> 1 | (b & 0x5555) << 1; - return b >> (16 - order); -} - -esp_err_t dsps_bit_rev_fc32_ansi(float *data, int N) -{ - if (!dsp_is_power_of_two(N)) { - return ESP_ERR_DSP_INVALID_LENGTH; - } - - esp_err_t result = ESP_OK; - - int j, k; - float r_temp, i_temp; - j = 0; - for (int i = 1; i < (N - 1); i++) { - k = N >> 1; - while (k <= j) { - j -= k; - k >>= 1; - } - j += k; - if (i < j) { - r_temp = data[j * 2]; - data[j * 2] = data[i * 2]; - data[i * 2] = r_temp; - i_temp = data[j * 2 + 1]; - data[j * 2 + 1] = data[i * 2 + 1]; - data[i * 2 + 1] = i_temp; - } - } - return result; -} - -esp_err_t dsps_gen_w_r2_fc32(float *w, int N) -{ - if (!dsp_is_power_of_two(N)) { - return ESP_ERR_DSP_INVALID_LENGTH; - } - - esp_err_t result = ESP_OK; - - int i; - float e = M_PI * 2.0 / N; - - for (i = 0; i < (N >> 1); i++) { - w[2 * i] = cosf(i * e); - w[2 * i + 1] = sinf(i * e); - } - - return result; -} - -esp_err_t dsps_cplx2reC_fc32_ansi(float *data, int N) -{ - if (!dsp_is_power_of_two(N)) { - return ESP_ERR_DSP_INVALID_LENGTH; - } - esp_err_t result = ESP_OK; - - int i; - int n2 = N << 1; - - float rkl = 0; - float rkh = 0; - float rnl = 0; - float rnh = 0; - float ikl = 0; - float ikh = 0; - float inl = 0; - float inh = 0; - - for (i = 0; i < (N / 4); i++) { - rkl = data[i * 2 + 0 + 2]; - ikl = data[i * 2 + 1 + 2]; - rnl = data[n2 - i * 2 - 2]; - inl = data[n2 - i * 2 - 1]; - - rkh = data[i * 2 + 0 + 2 + N]; - ikh = data[i * 2 + 1 + 2 + N]; - rnh = data[n2 - i * 2 - 2 - N]; - inh = data[n2 - i * 2 - 1 - N]; - - data[i * 2 + 0 + 2] = rkl + rnl; - data[i * 2 + 1 + 2] = ikl - inl; - - data[n2 - i * 2 - 1 - N] = rkh + rnh; - data[n2 - i * 2 - 2 - N] = ikh - inh; - - data[i * 2 + 0 + 2 + N] = ikl + inl; - data[i * 2 + 1 + 2 + N] = rkl - rnl; - - data[n2 - i * 2 - 1] = ikh + inh; - data[n2 - i * 2 - 2] = rkh - rnh; - } - data[N] = data[1]; - data[1] = 0; - data[N + 1] = 0; - - return result; -} - -esp_err_t dsps_gen_bitrev2r_table(int N, int step, char *name_ext) -{ - if (!dsp_is_power_of_two(N)) { - return ESP_ERR_DSP_INVALID_LENGTH; - } - - int j, k; - j = 0; - int items_count = 0; - ESP_LOGD(TAG, "const uint16_t bitrev2r_table_%i_%s[] = { ", N, name_ext); - for (int i = 1; i < (N - 1); i++) { - k = N >> 1; - while (k <= j) { - j -= k; - k >>= 1; - } - j += k; - if (i < j) { - ESP_LOGD(TAG, "%i, %i, ", i * step, j * step); - items_count++; - if ((items_count % 8) == 0) { - ESP_LOGD(TAG, " "); - } - } - } - ESP_LOGD(TAG, "};"); - ESP_LOGD(TAG, "const uint16_t bitrev2r_table_%i_%s_size = %i;\n", N, name_ext, items_count); - - ESP_LOGD(TAG, "extern const uint16_t bitrev2r_table_%i_%s[];", N, name_ext); - ESP_LOGD(TAG, "extern const uint16_t bitrev2r_table_%i_%s_size;\n", N, name_ext); - return ESP_OK; -} - -esp_err_t dsps_bit_rev2r_fc32(float *data, int N) -{ - uint16_t *table; - uint16_t table_size; - switch (N) { - case 16: - table = (uint16_t *)dsps_fft2r_rev_tables_fc32[0]; - table_size = dsps_fft2r_rev_tables_fc32_size[0]; - break; - case 32: - table = (uint16_t *)dsps_fft2r_rev_tables_fc32[1]; - table_size = dsps_fft2r_rev_tables_fc32_size[1]; - break; - case 64: - table = (uint16_t *)dsps_fft2r_rev_tables_fc32[2]; - table_size = dsps_fft2r_rev_tables_fc32_size[2]; - break; - case 128: - table = (uint16_t *)dsps_fft2r_rev_tables_fc32[3]; - table_size = dsps_fft2r_rev_tables_fc32_size[3]; - break; - case 256: - table = (uint16_t *)dsps_fft2r_rev_tables_fc32[4]; - table_size = dsps_fft2r_rev_tables_fc32_size[4]; - break; - case 512: - table = (uint16_t *)dsps_fft2r_rev_tables_fc32[5]; - table_size = dsps_fft2r_rev_tables_fc32_size[5]; - break; - case 1024: - table = (uint16_t *)dsps_fft2r_rev_tables_fc32[6]; - table_size = dsps_fft2r_rev_tables_fc32_size[6]; - break; - case 2048: - table = (uint16_t *)dsps_fft2r_rev_tables_fc32[7]; - table_size = dsps_fft2r_rev_tables_fc32_size[7]; - break; - case 4096: - table = (uint16_t *)dsps_fft2r_rev_tables_fc32[8]; - table_size = dsps_fft2r_rev_tables_fc32_size[8]; - break; - - default: - return dsps_bit_rev_fc32(data, N); - break; - } - return dsps_bit_rev_lookup_fc32(data, table_size, table); -} - -esp_err_t dsps_bit_rev_lookup_fc32_ansi(float *data, int reverse_size, uint16_t *reverse_tab) -{ - float r_temp, i_temp; - for (int n = 0 ; n < reverse_size ; n++) { - uint16_t i = reverse_tab[n * 2 + 0] >> 2; - uint16_t j = reverse_tab[n * 2 + 1] >> 2; - r_temp = data[j]; - data[j] = data[i]; - data[i] = r_temp; - i_temp = data[j + 1]; - data[j + 1] = data[i + 1]; - data[i + 1] = i_temp; - } - return ESP_OK; -} \ No newline at end of file diff --git a/components/esp-dsp/modules/fft/float/dsps_fft4r_bitrev_tables_fc32.c b/components/esp-dsp/modules/fft/float/dsps_fft4r_bitrev_tables_fc32.c deleted file mode 100644 index d91d65ae..00000000 --- a/components/esp-dsp/modules/fft/float/dsps_fft4r_bitrev_tables_fc32.c +++ /dev/null @@ -1,407 +0,0 @@ -// Copyright 2018-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. - - -#include -#include "dsps_fft_tables.h" - - -const uint16_t bitrev4r_table_16_fc32[] = { - 8, 32, 16, 64, 24, 96, 48, 72, 56, 104, 88, 112, -}; -extern const uint16_t bitrev4r_table_16_fc32[]; -extern const uint16_t bitrev4r_table_16_fc32_size; - -const uint16_t bitrev4r_table_64_fc32[] = { - 8, 128, 16, 256, 24, 384, 40, 160, 48, 288, 56, 416, 72, 192, 80, 320, - 88, 448, 104, 224, 112, 352, 120, 480, 144, 264, 152, 392, 176, 296, 184, 424, - 208, 328, 216, 456, 240, 360, 248, 488, 280, 400, 312, 432, 344, 464, 376, 496, -}; -extern const uint16_t bitrev4r_table_64_fc32[]; -extern const uint16_t bitrev4r_table_64_fc32_size; - -const uint16_t bitrev4r_table_256_fc32[] = { - 8, 512, 16, 1024, 24, 1536, 32, 128, 40, 640, 48, 1152, 56, 1664, 64, 256, - 72, 768, 80, 1280, 88, 1792, 96, 384, 104, 896, 112, 1408, 120, 1920, 136, 544, - 144, 1056, 152, 1568, 168, 672, 176, 1184, 184, 1696, 192, 288, 200, 800, 208, 1312, - 216, 1824, 224, 416, 232, 928, 240, 1440, 248, 1952, 264, 576, 272, 1088, 280, 1600, - 296, 704, 304, 1216, 312, 1728, 328, 832, 336, 1344, 344, 1856, 352, 448, 360, 960, - 368, 1472, 376, 1984, 392, 608, 400, 1120, 408, 1632, 424, 736, 432, 1248, 440, 1760, - 456, 864, 464, 1376, 472, 1888, 488, 992, 496, 1504, 504, 2016, 528, 1032, 536, 1544, - 552, 648, 560, 1160, 568, 1672, 584, 776, 592, 1288, 600, 1800, 616, 904, 624, 1416, - 632, 1928, 656, 1064, 664, 1576, 688, 1192, 696, 1704, 712, 808, 720, 1320, 728, 1832, - 744, 936, 752, 1448, 760, 1960, 784, 1096, 792, 1608, 816, 1224, 824, 1736, 848, 1352, - 856, 1864, 872, 968, 880, 1480, 888, 1992, 912, 1128, 920, 1640, 944, 1256, 952, 1768, - 976, 1384, 984, 1896, 1008, 1512, 1016, 2024, 1048, 1552, 1072, 1168, 1080, 1680, 1104, 1296, - 1112, 1808, 1136, 1424, 1144, 1936, 1176, 1584, 1208, 1712, 1232, 1328, 1240, 1840, 1264, 1456, - 1272, 1968, 1304, 1616, 1336, 1744, 1368, 1872, 1392, 1488, 1400, 2000, 1432, 1648, 1464, 1776, - 1496, 1904, 1528, 2032, 1592, 1688, 1624, 1816, 1656, 1944, 1752, 1848, 1784, 1976, 1912, 2008, -}; -extern const uint16_t bitrev4r_table_256_fc32[]; -extern const uint16_t bitrev4r_table_256_fc32_size; - -const uint16_t bitrev4r_table_1024_fc32[] = { - 8, 2048, 16, 4096, 24, 6144, 32, 512, 40, 2560, 48, 4608, 56, 6656, 64, 1024, - 72, 3072, 80, 5120, 88, 7168, 96, 1536, 104, 3584, 112, 5632, 120, 7680, 136, 2176, - 144, 4224, 152, 6272, 160, 640, 168, 2688, 176, 4736, 184, 6784, 192, 1152, 200, 3200, - 208, 5248, 216, 7296, 224, 1664, 232, 3712, 240, 5760, 248, 7808, 264, 2304, 272, 4352, - 280, 6400, 288, 768, 296, 2816, 304, 4864, 312, 6912, 320, 1280, 328, 3328, 336, 5376, - 344, 7424, 352, 1792, 360, 3840, 368, 5888, 376, 7936, 392, 2432, 400, 4480, 408, 6528, - 416, 896, 424, 2944, 432, 4992, 440, 7040, 448, 1408, 456, 3456, 464, 5504, 472, 7552, - 480, 1920, 488, 3968, 496, 6016, 504, 8064, 520, 2080, 528, 4128, 536, 6176, 552, 2592, - 560, 4640, 568, 6688, 576, 1056, 584, 3104, 592, 5152, 600, 7200, 608, 1568, 616, 3616, - 624, 5664, 632, 7712, 648, 2208, 656, 4256, 664, 6304, 680, 2720, 688, 4768, 696, 6816, - 704, 1184, 712, 3232, 720, 5280, 728, 7328, 736, 1696, 744, 3744, 752, 5792, 760, 7840, - 776, 2336, 784, 4384, 792, 6432, 808, 2848, 816, 4896, 824, 6944, 832, 1312, 840, 3360, - 848, 5408, 856, 7456, 864, 1824, 872, 3872, 880, 5920, 888, 7968, 904, 2464, 912, 4512, - 920, 6560, 936, 2976, 944, 5024, 952, 7072, 960, 1440, 968, 3488, 976, 5536, 984, 7584, - 992, 1952, 1000, 4000, 1008, 6048, 1016, 8096, 1032, 2112, 1040, 4160, 1048, 6208, 1064, 2624, - 1072, 4672, 1080, 6720, 1096, 3136, 1104, 5184, 1112, 7232, 1120, 1600, 1128, 3648, 1136, 5696, - 1144, 7744, 1160, 2240, 1168, 4288, 1176, 6336, 1192, 2752, 1200, 4800, 1208, 6848, 1224, 3264, - 1232, 5312, 1240, 7360, 1248, 1728, 1256, 3776, 1264, 5824, 1272, 7872, 1288, 2368, 1296, 4416, - 1304, 6464, 1320, 2880, 1328, 4928, 1336, 6976, 1352, 3392, 1360, 5440, 1368, 7488, 1376, 1856, - 1384, 3904, 1392, 5952, 1400, 8000, 1416, 2496, 1424, 4544, 1432, 6592, 1448, 3008, 1456, 5056, - 1464, 7104, 1480, 3520, 1488, 5568, 1496, 7616, 1504, 1984, 1512, 4032, 1520, 6080, 1528, 8128, - 1544, 2144, 1552, 4192, 1560, 6240, 1576, 2656, 1584, 4704, 1592, 6752, 1608, 3168, 1616, 5216, - 1624, 7264, 1640, 3680, 1648, 5728, 1656, 7776, 1672, 2272, 1680, 4320, 1688, 6368, 1704, 2784, - 1712, 4832, 1720, 6880, 1736, 3296, 1744, 5344, 1752, 7392, 1768, 3808, 1776, 5856, 1784, 7904, - 1800, 2400, 1808, 4448, 1816, 6496, 1832, 2912, 1840, 4960, 1848, 7008, 1864, 3424, 1872, 5472, - 1880, 7520, 1896, 3936, 1904, 5984, 1912, 8032, 1928, 2528, 1936, 4576, 1944, 6624, 1960, 3040, - 1968, 5088, 1976, 7136, 1992, 3552, 2000, 5600, 2008, 7648, 2024, 4064, 2032, 6112, 2040, 8160, - 2064, 4104, 2072, 6152, 2088, 2568, 2096, 4616, 2104, 6664, 2120, 3080, 2128, 5128, 2136, 7176, - 2152, 3592, 2160, 5640, 2168, 7688, 2192, 4232, 2200, 6280, 2216, 2696, 2224, 4744, 2232, 6792, - 2248, 3208, 2256, 5256, 2264, 7304, 2280, 3720, 2288, 5768, 2296, 7816, 2320, 4360, 2328, 6408, - 2344, 2824, 2352, 4872, 2360, 6920, 2376, 3336, 2384, 5384, 2392, 7432, 2408, 3848, 2416, 5896, - 2424, 7944, 2448, 4488, 2456, 6536, 2472, 2952, 2480, 5000, 2488, 7048, 2504, 3464, 2512, 5512, - 2520, 7560, 2536, 3976, 2544, 6024, 2552, 8072, 2576, 4136, 2584, 6184, 2608, 4648, 2616, 6696, - 2632, 3112, 2640, 5160, 2648, 7208, 2664, 3624, 2672, 5672, 2680, 7720, 2704, 4264, 2712, 6312, - 2736, 4776, 2744, 6824, 2760, 3240, 2768, 5288, 2776, 7336, 2792, 3752, 2800, 5800, 2808, 7848, - 2832, 4392, 2840, 6440, 2864, 4904, 2872, 6952, 2888, 3368, 2896, 5416, 2904, 7464, 2920, 3880, - 2928, 5928, 2936, 7976, 2960, 4520, 2968, 6568, 2992, 5032, 3000, 7080, 3016, 3496, 3024, 5544, - 3032, 7592, 3048, 4008, 3056, 6056, 3064, 8104, 3088, 4168, 3096, 6216, 3120, 4680, 3128, 6728, - 3152, 5192, 3160, 7240, 3176, 3656, 3184, 5704, 3192, 7752, 3216, 4296, 3224, 6344, 3248, 4808, - 3256, 6856, 3280, 5320, 3288, 7368, 3304, 3784, 3312, 5832, 3320, 7880, 3344, 4424, 3352, 6472, - 3376, 4936, 3384, 6984, 3408, 5448, 3416, 7496, 3432, 3912, 3440, 5960, 3448, 8008, 3472, 4552, - 3480, 6600, 3504, 5064, 3512, 7112, 3536, 5576, 3544, 7624, 3560, 4040, 3568, 6088, 3576, 8136, - 3600, 4200, 3608, 6248, 3632, 4712, 3640, 6760, 3664, 5224, 3672, 7272, 3696, 5736, 3704, 7784, - 3728, 4328, 3736, 6376, 3760, 4840, 3768, 6888, 3792, 5352, 3800, 7400, 3824, 5864, 3832, 7912, - 3856, 4456, 3864, 6504, 3888, 4968, 3896, 7016, 3920, 5480, 3928, 7528, 3952, 5992, 3960, 8040, - 3984, 4584, 3992, 6632, 4016, 5096, 4024, 7144, 4048, 5608, 4056, 7656, 4080, 6120, 4088, 8168, - 4120, 6160, 4144, 4624, 4152, 6672, 4176, 5136, 4184, 7184, 4208, 5648, 4216, 7696, 4248, 6288, - 4272, 4752, 4280, 6800, 4304, 5264, 4312, 7312, 4336, 5776, 4344, 7824, 4376, 6416, 4400, 4880, - 4408, 6928, 4432, 5392, 4440, 7440, 4464, 5904, 4472, 7952, 4504, 6544, 4528, 5008, 4536, 7056, - 4560, 5520, 4568, 7568, 4592, 6032, 4600, 8080, 4632, 6192, 4664, 6704, 4688, 5168, 4696, 7216, - 4720, 5680, 4728, 7728, 4760, 6320, 4792, 6832, 4816, 5296, 4824, 7344, 4848, 5808, 4856, 7856, - 4888, 6448, 4920, 6960, 4944, 5424, 4952, 7472, 4976, 5936, 4984, 7984, 5016, 6576, 5048, 7088, - 5072, 5552, 5080, 7600, 5104, 6064, 5112, 8112, 5144, 6224, 5176, 6736, 5208, 7248, 5232, 5712, - 5240, 7760, 5272, 6352, 5304, 6864, 5336, 7376, 5360, 5840, 5368, 7888, 5400, 6480, 5432, 6992, - 5464, 7504, 5488, 5968, 5496, 8016, 5528, 6608, 5560, 7120, 5592, 7632, 5616, 6096, 5624, 8144, - 5656, 6256, 5688, 6768, 5720, 7280, 5752, 7792, 5784, 6384, 5816, 6896, 5848, 7408, 5880, 7920, - 5912, 6512, 5944, 7024, 5976, 7536, 6008, 8048, 6040, 6640, 6072, 7152, 6104, 7664, 6136, 8176, - 6200, 6680, 6232, 7192, 6264, 7704, 6328, 6808, 6360, 7320, 6392, 7832, 6456, 6936, 6488, 7448, - 6520, 7960, 6584, 7064, 6616, 7576, 6648, 8088, 6744, 7224, 6776, 7736, 6872, 7352, 6904, 7864, - 7000, 7480, 7032, 7992, 7128, 7608, 7160, 8120, 7288, 7768, 7416, 7896, 7544, 8024, 7672, 8152, -}; -extern const uint16_t bitrev4r_table_1024_fc32[]; -extern const uint16_t bitrev4r_table_1024_fc32_size; - -const uint16_t bitrev4r_table_4096_fc32[] = { - 8, 8192, 16, 16384, 24, 24576, 32, 2048, 40, 10240, 48, 18432, 56, 26624, 64, 4096, - 72, 12288, 80, 20480, 88, 28672, 96, 6144, 104, 14336, 112, 22528, 120, 30720, 128, 512, - 136, 8704, 144, 16896, 152, 25088, 160, 2560, 168, 10752, 176, 18944, 184, 27136, 192, 4608, - 200, 12800, 208, 20992, 216, 29184, 224, 6656, 232, 14848, 240, 23040, 248, 31232, 256, 1024, - 264, 9216, 272, 17408, 280, 25600, 288, 3072, 296, 11264, 304, 19456, 312, 27648, 320, 5120, - 328, 13312, 336, 21504, 344, 29696, 352, 7168, 360, 15360, 368, 23552, 376, 31744, 384, 1536, - 392, 9728, 400, 17920, 408, 26112, 416, 3584, 424, 11776, 432, 19968, 440, 28160, 448, 5632, - 456, 13824, 464, 22016, 472, 30208, 480, 7680, 488, 15872, 496, 24064, 504, 32256, 520, 8320, - 528, 16512, 536, 24704, 544, 2176, 552, 10368, 560, 18560, 568, 26752, 576, 4224, 584, 12416, - 592, 20608, 600, 28800, 608, 6272, 616, 14464, 624, 22656, 632, 30848, 648, 8832, 656, 17024, - 664, 25216, 672, 2688, 680, 10880, 688, 19072, 696, 27264, 704, 4736, 712, 12928, 720, 21120, - 728, 29312, 736, 6784, 744, 14976, 752, 23168, 760, 31360, 768, 1152, 776, 9344, 784, 17536, - 792, 25728, 800, 3200, 808, 11392, 816, 19584, 824, 27776, 832, 5248, 840, 13440, 848, 21632, - 856, 29824, 864, 7296, 872, 15488, 880, 23680, 888, 31872, 896, 1664, 904, 9856, 912, 18048, - 920, 26240, 928, 3712, 936, 11904, 944, 20096, 952, 28288, 960, 5760, 968, 13952, 976, 22144, - 984, 30336, 992, 7808, 1000, 16000, 1008, 24192, 1016, 32384, 1032, 8448, 1040, 16640, 1048, 24832, - 1056, 2304, 1064, 10496, 1072, 18688, 1080, 26880, 1088, 4352, 1096, 12544, 1104, 20736, 1112, 28928, - 1120, 6400, 1128, 14592, 1136, 22784, 1144, 30976, 1160, 8960, 1168, 17152, 1176, 25344, 1184, 2816, - 1192, 11008, 1200, 19200, 1208, 27392, 1216, 4864, 1224, 13056, 1232, 21248, 1240, 29440, 1248, 6912, - 1256, 15104, 1264, 23296, 1272, 31488, 1288, 9472, 1296, 17664, 1304, 25856, 1312, 3328, 1320, 11520, - 1328, 19712, 1336, 27904, 1344, 5376, 1352, 13568, 1360, 21760, 1368, 29952, 1376, 7424, 1384, 15616, - 1392, 23808, 1400, 32000, 1408, 1792, 1416, 9984, 1424, 18176, 1432, 26368, 1440, 3840, 1448, 12032, - 1456, 20224, 1464, 28416, 1472, 5888, 1480, 14080, 1488, 22272, 1496, 30464, 1504, 7936, 1512, 16128, - 1520, 24320, 1528, 32512, 1544, 8576, 1552, 16768, 1560, 24960, 1568, 2432, 1576, 10624, 1584, 18816, - 1592, 27008, 1600, 4480, 1608, 12672, 1616, 20864, 1624, 29056, 1632, 6528, 1640, 14720, 1648, 22912, - 1656, 31104, 1672, 9088, 1680, 17280, 1688, 25472, 1696, 2944, 1704, 11136, 1712, 19328, 1720, 27520, - 1728, 4992, 1736, 13184, 1744, 21376, 1752, 29568, 1760, 7040, 1768, 15232, 1776, 23424, 1784, 31616, - 1800, 9600, 1808, 17792, 1816, 25984, 1824, 3456, 1832, 11648, 1840, 19840, 1848, 28032, 1856, 5504, - 1864, 13696, 1872, 21888, 1880, 30080, 1888, 7552, 1896, 15744, 1904, 23936, 1912, 32128, 1928, 10112, - 1936, 18304, 1944, 26496, 1952, 3968, 1960, 12160, 1968, 20352, 1976, 28544, 1984, 6016, 1992, 14208, - 2000, 22400, 2008, 30592, 2016, 8064, 2024, 16256, 2032, 24448, 2040, 32640, 2056, 8224, 2064, 16416, - 2072, 24608, 2088, 10272, 2096, 18464, 2104, 26656, 2112, 4128, 2120, 12320, 2128, 20512, 2136, 28704, - 2144, 6176, 2152, 14368, 2160, 22560, 2168, 30752, 2184, 8736, 2192, 16928, 2200, 25120, 2208, 2592, - 2216, 10784, 2224, 18976, 2232, 27168, 2240, 4640, 2248, 12832, 2256, 21024, 2264, 29216, 2272, 6688, - 2280, 14880, 2288, 23072, 2296, 31264, 2312, 9248, 2320, 17440, 2328, 25632, 2336, 3104, 2344, 11296, - 2352, 19488, 2360, 27680, 2368, 5152, 2376, 13344, 2384, 21536, 2392, 29728, 2400, 7200, 2408, 15392, - 2416, 23584, 2424, 31776, 2440, 9760, 2448, 17952, 2456, 26144, 2464, 3616, 2472, 11808, 2480, 20000, - 2488, 28192, 2496, 5664, 2504, 13856, 2512, 22048, 2520, 30240, 2528, 7712, 2536, 15904, 2544, 24096, - 2552, 32288, 2568, 8352, 2576, 16544, 2584, 24736, 2600, 10400, 2608, 18592, 2616, 26784, 2624, 4256, - 2632, 12448, 2640, 20640, 2648, 28832, 2656, 6304, 2664, 14496, 2672, 22688, 2680, 30880, 2696, 8864, - 2704, 17056, 2712, 25248, 2728, 10912, 2736, 19104, 2744, 27296, 2752, 4768, 2760, 12960, 2768, 21152, - 2776, 29344, 2784, 6816, 2792, 15008, 2800, 23200, 2808, 31392, 2824, 9376, 2832, 17568, 2840, 25760, - 2848, 3232, 2856, 11424, 2864, 19616, 2872, 27808, 2880, 5280, 2888, 13472, 2896, 21664, 2904, 29856, - 2912, 7328, 2920, 15520, 2928, 23712, 2936, 31904, 2952, 9888, 2960, 18080, 2968, 26272, 2976, 3744, - 2984, 11936, 2992, 20128, 3000, 28320, 3008, 5792, 3016, 13984, 3024, 22176, 3032, 30368, 3040, 7840, - 3048, 16032, 3056, 24224, 3064, 32416, 3080, 8480, 3088, 16672, 3096, 24864, 3112, 10528, 3120, 18720, - 3128, 26912, 3136, 4384, 3144, 12576, 3152, 20768, 3160, 28960, 3168, 6432, 3176, 14624, 3184, 22816, - 3192, 31008, 3208, 8992, 3216, 17184, 3224, 25376, 3240, 11040, 3248, 19232, 3256, 27424, 3264, 4896, - 3272, 13088, 3280, 21280, 3288, 29472, 3296, 6944, 3304, 15136, 3312, 23328, 3320, 31520, 3336, 9504, - 3344, 17696, 3352, 25888, 3368, 11552, 3376, 19744, 3384, 27936, 3392, 5408, 3400, 13600, 3408, 21792, - 3416, 29984, 3424, 7456, 3432, 15648, 3440, 23840, 3448, 32032, 3464, 10016, 3472, 18208, 3480, 26400, - 3488, 3872, 3496, 12064, 3504, 20256, 3512, 28448, 3520, 5920, 3528, 14112, 3536, 22304, 3544, 30496, - 3552, 7968, 3560, 16160, 3568, 24352, 3576, 32544, 3592, 8608, 3600, 16800, 3608, 24992, 3624, 10656, - 3632, 18848, 3640, 27040, 3648, 4512, 3656, 12704, 3664, 20896, 3672, 29088, 3680, 6560, 3688, 14752, - 3696, 22944, 3704, 31136, 3720, 9120, 3728, 17312, 3736, 25504, 3752, 11168, 3760, 19360, 3768, 27552, - 3776, 5024, 3784, 13216, 3792, 21408, 3800, 29600, 3808, 7072, 3816, 15264, 3824, 23456, 3832, 31648, - 3848, 9632, 3856, 17824, 3864, 26016, 3880, 11680, 3888, 19872, 3896, 28064, 3904, 5536, 3912, 13728, - 3920, 21920, 3928, 30112, 3936, 7584, 3944, 15776, 3952, 23968, 3960, 32160, 3976, 10144, 3984, 18336, - 3992, 26528, 4008, 12192, 4016, 20384, 4024, 28576, 4032, 6048, 4040, 14240, 4048, 22432, 4056, 30624, - 4064, 8096, 4072, 16288, 4080, 24480, 4088, 32672, 4104, 8256, 4112, 16448, 4120, 24640, 4136, 10304, - 4144, 18496, 4152, 26688, 4168, 12352, 4176, 20544, 4184, 28736, 4192, 6208, 4200, 14400, 4208, 22592, - 4216, 30784, 4232, 8768, 4240, 16960, 4248, 25152, 4264, 10816, 4272, 19008, 4280, 27200, 4288, 4672, - 4296, 12864, 4304, 21056, 4312, 29248, 4320, 6720, 4328, 14912, 4336, 23104, 4344, 31296, 4360, 9280, - 4368, 17472, 4376, 25664, 4392, 11328, 4400, 19520, 4408, 27712, 4416, 5184, 4424, 13376, 4432, 21568, - 4440, 29760, 4448, 7232, 4456, 15424, 4464, 23616, 4472, 31808, 4488, 9792, 4496, 17984, 4504, 26176, - 4520, 11840, 4528, 20032, 4536, 28224, 4544, 5696, 4552, 13888, 4560, 22080, 4568, 30272, 4576, 7744, - 4584, 15936, 4592, 24128, 4600, 32320, 4616, 8384, 4624, 16576, 4632, 24768, 4648, 10432, 4656, 18624, - 4664, 26816, 4680, 12480, 4688, 20672, 4696, 28864, 4704, 6336, 4712, 14528, 4720, 22720, 4728, 30912, - 4744, 8896, 4752, 17088, 4760, 25280, 4776, 10944, 4784, 19136, 4792, 27328, 4808, 12992, 4816, 21184, - 4824, 29376, 4832, 6848, 4840, 15040, 4848, 23232, 4856, 31424, 4872, 9408, 4880, 17600, 4888, 25792, - 4904, 11456, 4912, 19648, 4920, 27840, 4928, 5312, 4936, 13504, 4944, 21696, 4952, 29888, 4960, 7360, - 4968, 15552, 4976, 23744, 4984, 31936, 5000, 9920, 5008, 18112, 5016, 26304, 5032, 11968, 5040, 20160, - 5048, 28352, 5056, 5824, 5064, 14016, 5072, 22208, 5080, 30400, 5088, 7872, 5096, 16064, 5104, 24256, - 5112, 32448, 5128, 8512, 5136, 16704, 5144, 24896, 5160, 10560, 5168, 18752, 5176, 26944, 5192, 12608, - 5200, 20800, 5208, 28992, 5216, 6464, 5224, 14656, 5232, 22848, 5240, 31040, 5256, 9024, 5264, 17216, - 5272, 25408, 5288, 11072, 5296, 19264, 5304, 27456, 5320, 13120, 5328, 21312, 5336, 29504, 5344, 6976, - 5352, 15168, 5360, 23360, 5368, 31552, 5384, 9536, 5392, 17728, 5400, 25920, 5416, 11584, 5424, 19776, - 5432, 27968, 5448, 13632, 5456, 21824, 5464, 30016, 5472, 7488, 5480, 15680, 5488, 23872, 5496, 32064, - 5512, 10048, 5520, 18240, 5528, 26432, 5544, 12096, 5552, 20288, 5560, 28480, 5568, 5952, 5576, 14144, - 5584, 22336, 5592, 30528, 5600, 8000, 5608, 16192, 5616, 24384, 5624, 32576, 5640, 8640, 5648, 16832, - 5656, 25024, 5672, 10688, 5680, 18880, 5688, 27072, 5704, 12736, 5712, 20928, 5720, 29120, 5728, 6592, - 5736, 14784, 5744, 22976, 5752, 31168, 5768, 9152, 5776, 17344, 5784, 25536, 5800, 11200, 5808, 19392, - 5816, 27584, 5832, 13248, 5840, 21440, 5848, 29632, 5856, 7104, 5864, 15296, 5872, 23488, 5880, 31680, - 5896, 9664, 5904, 17856, 5912, 26048, 5928, 11712, 5936, 19904, 5944, 28096, 5960, 13760, 5968, 21952, - 5976, 30144, 5984, 7616, 5992, 15808, 6000, 24000, 6008, 32192, 6024, 10176, 6032, 18368, 6040, 26560, - 6056, 12224, 6064, 20416, 6072, 28608, 6088, 14272, 6096, 22464, 6104, 30656, 6112, 8128, 6120, 16320, - 6128, 24512, 6136, 32704, 6152, 8288, 6160, 16480, 6168, 24672, 6184, 10336, 6192, 18528, 6200, 26720, - 6216, 12384, 6224, 20576, 6232, 28768, 6248, 14432, 6256, 22624, 6264, 30816, 6280, 8800, 6288, 16992, - 6296, 25184, 6312, 10848, 6320, 19040, 6328, 27232, 6344, 12896, 6352, 21088, 6360, 29280, 6368, 6752, - 6376, 14944, 6384, 23136, 6392, 31328, 6408, 9312, 6416, 17504, 6424, 25696, 6440, 11360, 6448, 19552, - 6456, 27744, 6472, 13408, 6480, 21600, 6488, 29792, 6496, 7264, 6504, 15456, 6512, 23648, 6520, 31840, - 6536, 9824, 6544, 18016, 6552, 26208, 6568, 11872, 6576, 20064, 6584, 28256, 6600, 13920, 6608, 22112, - 6616, 30304, 6624, 7776, 6632, 15968, 6640, 24160, 6648, 32352, 6664, 8416, 6672, 16608, 6680, 24800, - 6696, 10464, 6704, 18656, 6712, 26848, 6728, 12512, 6736, 20704, 6744, 28896, 6760, 14560, 6768, 22752, - 6776, 30944, 6792, 8928, 6800, 17120, 6808, 25312, 6824, 10976, 6832, 19168, 6840, 27360, 6856, 13024, - 6864, 21216, 6872, 29408, 6888, 15072, 6896, 23264, 6904, 31456, 6920, 9440, 6928, 17632, 6936, 25824, - 6952, 11488, 6960, 19680, 6968, 27872, 6984, 13536, 6992, 21728, 7000, 29920, 7008, 7392, 7016, 15584, - 7024, 23776, 7032, 31968, 7048, 9952, 7056, 18144, 7064, 26336, 7080, 12000, 7088, 20192, 7096, 28384, - 7112, 14048, 7120, 22240, 7128, 30432, 7136, 7904, 7144, 16096, 7152, 24288, 7160, 32480, 7176, 8544, - 7184, 16736, 7192, 24928, 7208, 10592, 7216, 18784, 7224, 26976, 7240, 12640, 7248, 20832, 7256, 29024, - 7272, 14688, 7280, 22880, 7288, 31072, 7304, 9056, 7312, 17248, 7320, 25440, 7336, 11104, 7344, 19296, - 7352, 27488, 7368, 13152, 7376, 21344, 7384, 29536, 7400, 15200, 7408, 23392, 7416, 31584, 7432, 9568, - 7440, 17760, 7448, 25952, 7464, 11616, 7472, 19808, 7480, 28000, 7496, 13664, 7504, 21856, 7512, 30048, - 7528, 15712, 7536, 23904, 7544, 32096, 7560, 10080, 7568, 18272, 7576, 26464, 7592, 12128, 7600, 20320, - 7608, 28512, 7624, 14176, 7632, 22368, 7640, 30560, 7648, 8032, 7656, 16224, 7664, 24416, 7672, 32608, - 7688, 8672, 7696, 16864, 7704, 25056, 7720, 10720, 7728, 18912, 7736, 27104, 7752, 12768, 7760, 20960, - 7768, 29152, 7784, 14816, 7792, 23008, 7800, 31200, 7816, 9184, 7824, 17376, 7832, 25568, 7848, 11232, - 7856, 19424, 7864, 27616, 7880, 13280, 7888, 21472, 7896, 29664, 7912, 15328, 7920, 23520, 7928, 31712, - 7944, 9696, 7952, 17888, 7960, 26080, 7976, 11744, 7984, 19936, 7992, 28128, 8008, 13792, 8016, 21984, - 8024, 30176, 8040, 15840, 8048, 24032, 8056, 32224, 8072, 10208, 8080, 18400, 8088, 26592, 8104, 12256, - 8112, 20448, 8120, 28640, 8136, 14304, 8144, 22496, 8152, 30688, 8168, 16352, 8176, 24544, 8184, 32736, - 8208, 16392, 8216, 24584, 8232, 10248, 8240, 18440, 8248, 26632, 8264, 12296, 8272, 20488, 8280, 28680, - 8296, 14344, 8304, 22536, 8312, 30728, 8328, 8712, 8336, 16904, 8344, 25096, 8360, 10760, 8368, 18952, - 8376, 27144, 8392, 12808, 8400, 21000, 8408, 29192, 8424, 14856, 8432, 23048, 8440, 31240, 8456, 9224, - 8464, 17416, 8472, 25608, 8488, 11272, 8496, 19464, 8504, 27656, 8520, 13320, 8528, 21512, 8536, 29704, - 8552, 15368, 8560, 23560, 8568, 31752, 8584, 9736, 8592, 17928, 8600, 26120, 8616, 11784, 8624, 19976, - 8632, 28168, 8648, 13832, 8656, 22024, 8664, 30216, 8680, 15880, 8688, 24072, 8696, 32264, 8720, 16520, - 8728, 24712, 8744, 10376, 8752, 18568, 8760, 26760, 8776, 12424, 8784, 20616, 8792, 28808, 8808, 14472, - 8816, 22664, 8824, 30856, 8848, 17032, 8856, 25224, 8872, 10888, 8880, 19080, 8888, 27272, 8904, 12936, - 8912, 21128, 8920, 29320, 8936, 14984, 8944, 23176, 8952, 31368, 8968, 9352, 8976, 17544, 8984, 25736, - 9000, 11400, 9008, 19592, 9016, 27784, 9032, 13448, 9040, 21640, 9048, 29832, 9064, 15496, 9072, 23688, - 9080, 31880, 9096, 9864, 9104, 18056, 9112, 26248, 9128, 11912, 9136, 20104, 9144, 28296, 9160, 13960, - 9168, 22152, 9176, 30344, 9192, 16008, 9200, 24200, 9208, 32392, 9232, 16648, 9240, 24840, 9256, 10504, - 9264, 18696, 9272, 26888, 9288, 12552, 9296, 20744, 9304, 28936, 9320, 14600, 9328, 22792, 9336, 30984, - 9360, 17160, 9368, 25352, 9384, 11016, 9392, 19208, 9400, 27400, 9416, 13064, 9424, 21256, 9432, 29448, - 9448, 15112, 9456, 23304, 9464, 31496, 9488, 17672, 9496, 25864, 9512, 11528, 9520, 19720, 9528, 27912, - 9544, 13576, 9552, 21768, 9560, 29960, 9576, 15624, 9584, 23816, 9592, 32008, 9608, 9992, 9616, 18184, - 9624, 26376, 9640, 12040, 9648, 20232, 9656, 28424, 9672, 14088, 9680, 22280, 9688, 30472, 9704, 16136, - 9712, 24328, 9720, 32520, 9744, 16776, 9752, 24968, 9768, 10632, 9776, 18824, 9784, 27016, 9800, 12680, - 9808, 20872, 9816, 29064, 9832, 14728, 9840, 22920, 9848, 31112, 9872, 17288, 9880, 25480, 9896, 11144, - 9904, 19336, 9912, 27528, 9928, 13192, 9936, 21384, 9944, 29576, 9960, 15240, 9968, 23432, 9976, 31624, - 10000, 17800, 10008, 25992, 10024, 11656, 10032, 19848, 10040, 28040, 10056, 13704, 10064, 21896, 10072, 30088, - 10088, 15752, 10096, 23944, 10104, 32136, 10128, 18312, 10136, 26504, 10152, 12168, 10160, 20360, 10168, 28552, - 10184, 14216, 10192, 22408, 10200, 30600, 10216, 16264, 10224, 24456, 10232, 32648, 10256, 16424, 10264, 24616, - 10288, 18472, 10296, 26664, 10312, 12328, 10320, 20520, 10328, 28712, 10344, 14376, 10352, 22568, 10360, 30760, - 10384, 16936, 10392, 25128, 10408, 10792, 10416, 18984, 10424, 27176, 10440, 12840, 10448, 21032, 10456, 29224, - 10472, 14888, 10480, 23080, 10488, 31272, 10512, 17448, 10520, 25640, 10536, 11304, 10544, 19496, 10552, 27688, - 10568, 13352, 10576, 21544, 10584, 29736, 10600, 15400, 10608, 23592, 10616, 31784, 10640, 17960, 10648, 26152, - 10664, 11816, 10672, 20008, 10680, 28200, 10696, 13864, 10704, 22056, 10712, 30248, 10728, 15912, 10736, 24104, - 10744, 32296, 10768, 16552, 10776, 24744, 10800, 18600, 10808, 26792, 10824, 12456, 10832, 20648, 10840, 28840, - 10856, 14504, 10864, 22696, 10872, 30888, 10896, 17064, 10904, 25256, 10928, 19112, 10936, 27304, 10952, 12968, - 10960, 21160, 10968, 29352, 10984, 15016, 10992, 23208, 11000, 31400, 11024, 17576, 11032, 25768, 11048, 11432, - 11056, 19624, 11064, 27816, 11080, 13480, 11088, 21672, 11096, 29864, 11112, 15528, 11120, 23720, 11128, 31912, - 11152, 18088, 11160, 26280, 11176, 11944, 11184, 20136, 11192, 28328, 11208, 13992, 11216, 22184, 11224, 30376, - 11240, 16040, 11248, 24232, 11256, 32424, 11280, 16680, 11288, 24872, 11312, 18728, 11320, 26920, 11336, 12584, - 11344, 20776, 11352, 28968, 11368, 14632, 11376, 22824, 11384, 31016, 11408, 17192, 11416, 25384, 11440, 19240, - 11448, 27432, 11464, 13096, 11472, 21288, 11480, 29480, 11496, 15144, 11504, 23336, 11512, 31528, 11536, 17704, - 11544, 25896, 11568, 19752, 11576, 27944, 11592, 13608, 11600, 21800, 11608, 29992, 11624, 15656, 11632, 23848, - 11640, 32040, 11664, 18216, 11672, 26408, 11688, 12072, 11696, 20264, 11704, 28456, 11720, 14120, 11728, 22312, - 11736, 30504, 11752, 16168, 11760, 24360, 11768, 32552, 11792, 16808, 11800, 25000, 11824, 18856, 11832, 27048, - 11848, 12712, 11856, 20904, 11864, 29096, 11880, 14760, 11888, 22952, 11896, 31144, 11920, 17320, 11928, 25512, - 11952, 19368, 11960, 27560, 11976, 13224, 11984, 21416, 11992, 29608, 12008, 15272, 12016, 23464, 12024, 31656, - 12048, 17832, 12056, 26024, 12080, 19880, 12088, 28072, 12104, 13736, 12112, 21928, 12120, 30120, 12136, 15784, - 12144, 23976, 12152, 32168, 12176, 18344, 12184, 26536, 12208, 20392, 12216, 28584, 12232, 14248, 12240, 22440, - 12248, 30632, 12264, 16296, 12272, 24488, 12280, 32680, 12304, 16456, 12312, 24648, 12336, 18504, 12344, 26696, - 12368, 20552, 12376, 28744, 12392, 14408, 12400, 22600, 12408, 30792, 12432, 16968, 12440, 25160, 12464, 19016, - 12472, 27208, 12488, 12872, 12496, 21064, 12504, 29256, 12520, 14920, 12528, 23112, 12536, 31304, 12560, 17480, - 12568, 25672, 12592, 19528, 12600, 27720, 12616, 13384, 12624, 21576, 12632, 29768, 12648, 15432, 12656, 23624, - 12664, 31816, 12688, 17992, 12696, 26184, 12720, 20040, 12728, 28232, 12744, 13896, 12752, 22088, 12760, 30280, - 12776, 15944, 12784, 24136, 12792, 32328, 12816, 16584, 12824, 24776, 12848, 18632, 12856, 26824, 12880, 20680, - 12888, 28872, 12904, 14536, 12912, 22728, 12920, 30920, 12944, 17096, 12952, 25288, 12976, 19144, 12984, 27336, - 13008, 21192, 13016, 29384, 13032, 15048, 13040, 23240, 13048, 31432, 13072, 17608, 13080, 25800, 13104, 19656, - 13112, 27848, 13128, 13512, 13136, 21704, 13144, 29896, 13160, 15560, 13168, 23752, 13176, 31944, 13200, 18120, - 13208, 26312, 13232, 20168, 13240, 28360, 13256, 14024, 13264, 22216, 13272, 30408, 13288, 16072, 13296, 24264, - 13304, 32456, 13328, 16712, 13336, 24904, 13360, 18760, 13368, 26952, 13392, 20808, 13400, 29000, 13416, 14664, - 13424, 22856, 13432, 31048, 13456, 17224, 13464, 25416, 13488, 19272, 13496, 27464, 13520, 21320, 13528, 29512, - 13544, 15176, 13552, 23368, 13560, 31560, 13584, 17736, 13592, 25928, 13616, 19784, 13624, 27976, 13648, 21832, - 13656, 30024, 13672, 15688, 13680, 23880, 13688, 32072, 13712, 18248, 13720, 26440, 13744, 20296, 13752, 28488, - 13768, 14152, 13776, 22344, 13784, 30536, 13800, 16200, 13808, 24392, 13816, 32584, 13840, 16840, 13848, 25032, - 13872, 18888, 13880, 27080, 13904, 20936, 13912, 29128, 13928, 14792, 13936, 22984, 13944, 31176, 13968, 17352, - 13976, 25544, 14000, 19400, 14008, 27592, 14032, 21448, 14040, 29640, 14056, 15304, 14064, 23496, 14072, 31688, - 14096, 17864, 14104, 26056, 14128, 19912, 14136, 28104, 14160, 21960, 14168, 30152, 14184, 15816, 14192, 24008, - 14200, 32200, 14224, 18376, 14232, 26568, 14256, 20424, 14264, 28616, 14288, 22472, 14296, 30664, 14312, 16328, - 14320, 24520, 14328, 32712, 14352, 16488, 14360, 24680, 14384, 18536, 14392, 26728, 14416, 20584, 14424, 28776, - 14448, 22632, 14456, 30824, 14480, 17000, 14488, 25192, 14512, 19048, 14520, 27240, 14544, 21096, 14552, 29288, - 14568, 14952, 14576, 23144, 14584, 31336, 14608, 17512, 14616, 25704, 14640, 19560, 14648, 27752, 14672, 21608, - 14680, 29800, 14696, 15464, 14704, 23656, 14712, 31848, 14736, 18024, 14744, 26216, 14768, 20072, 14776, 28264, - 14800, 22120, 14808, 30312, 14824, 15976, 14832, 24168, 14840, 32360, 14864, 16616, 14872, 24808, 14896, 18664, - 14904, 26856, 14928, 20712, 14936, 28904, 14960, 22760, 14968, 30952, 14992, 17128, 15000, 25320, 15024, 19176, - 15032, 27368, 15056, 21224, 15064, 29416, 15088, 23272, 15096, 31464, 15120, 17640, 15128, 25832, 15152, 19688, - 15160, 27880, 15184, 21736, 15192, 29928, 15208, 15592, 15216, 23784, 15224, 31976, 15248, 18152, 15256, 26344, - 15280, 20200, 15288, 28392, 15312, 22248, 15320, 30440, 15336, 16104, 15344, 24296, 15352, 32488, 15376, 16744, - 15384, 24936, 15408, 18792, 15416, 26984, 15440, 20840, 15448, 29032, 15472, 22888, 15480, 31080, 15504, 17256, - 15512, 25448, 15536, 19304, 15544, 27496, 15568, 21352, 15576, 29544, 15600, 23400, 15608, 31592, 15632, 17768, - 15640, 25960, 15664, 19816, 15672, 28008, 15696, 21864, 15704, 30056, 15728, 23912, 15736, 32104, 15760, 18280, - 15768, 26472, 15792, 20328, 15800, 28520, 15824, 22376, 15832, 30568, 15848, 16232, 15856, 24424, 15864, 32616, - 15888, 16872, 15896, 25064, 15920, 18920, 15928, 27112, 15952, 20968, 15960, 29160, 15984, 23016, 15992, 31208, - 16016, 17384, 16024, 25576, 16048, 19432, 16056, 27624, 16080, 21480, 16088, 29672, 16112, 23528, 16120, 31720, - 16144, 17896, 16152, 26088, 16176, 19944, 16184, 28136, 16208, 21992, 16216, 30184, 16240, 24040, 16248, 32232, - 16272, 18408, 16280, 26600, 16304, 20456, 16312, 28648, 16336, 22504, 16344, 30696, 16368, 24552, 16376, 32744, - 16408, 24592, 16432, 18448, 16440, 26640, 16464, 20496, 16472, 28688, 16496, 22544, 16504, 30736, 16528, 16912, - 16536, 25104, 16560, 18960, 16568, 27152, 16592, 21008, 16600, 29200, 16624, 23056, 16632, 31248, 16656, 17424, - 16664, 25616, 16688, 19472, 16696, 27664, 16720, 21520, 16728, 29712, 16752, 23568, 16760, 31760, 16784, 17936, - 16792, 26128, 16816, 19984, 16824, 28176, 16848, 22032, 16856, 30224, 16880, 24080, 16888, 32272, 16920, 24720, - 16944, 18576, 16952, 26768, 16976, 20624, 16984, 28816, 17008, 22672, 17016, 30864, 17048, 25232, 17072, 19088, - 17080, 27280, 17104, 21136, 17112, 29328, 17136, 23184, 17144, 31376, 17168, 17552, 17176, 25744, 17200, 19600, - 17208, 27792, 17232, 21648, 17240, 29840, 17264, 23696, 17272, 31888, 17296, 18064, 17304, 26256, 17328, 20112, - 17336, 28304, 17360, 22160, 17368, 30352, 17392, 24208, 17400, 32400, 17432, 24848, 17456, 18704, 17464, 26896, - 17488, 20752, 17496, 28944, 17520, 22800, 17528, 30992, 17560, 25360, 17584, 19216, 17592, 27408, 17616, 21264, - 17624, 29456, 17648, 23312, 17656, 31504, 17688, 25872, 17712, 19728, 17720, 27920, 17744, 21776, 17752, 29968, - 17776, 23824, 17784, 32016, 17808, 18192, 17816, 26384, 17840, 20240, 17848, 28432, 17872, 22288, 17880, 30480, - 17904, 24336, 17912, 32528, 17944, 24976, 17968, 18832, 17976, 27024, 18000, 20880, 18008, 29072, 18032, 22928, - 18040, 31120, 18072, 25488, 18096, 19344, 18104, 27536, 18128, 21392, 18136, 29584, 18160, 23440, 18168, 31632, - 18200, 26000, 18224, 19856, 18232, 28048, 18256, 21904, 18264, 30096, 18288, 23952, 18296, 32144, 18328, 26512, - 18352, 20368, 18360, 28560, 18384, 22416, 18392, 30608, 18416, 24464, 18424, 32656, 18456, 24624, 18488, 26672, - 18512, 20528, 18520, 28720, 18544, 22576, 18552, 30768, 18584, 25136, 18608, 18992, 18616, 27184, 18640, 21040, - 18648, 29232, 18672, 23088, 18680, 31280, 18712, 25648, 18736, 19504, 18744, 27696, 18768, 21552, 18776, 29744, - 18800, 23600, 18808, 31792, 18840, 26160, 18864, 20016, 18872, 28208, 18896, 22064, 18904, 30256, 18928, 24112, - 18936, 32304, 18968, 24752, 19000, 26800, 19024, 20656, 19032, 28848, 19056, 22704, 19064, 30896, 19096, 25264, - 19128, 27312, 19152, 21168, 19160, 29360, 19184, 23216, 19192, 31408, 19224, 25776, 19248, 19632, 19256, 27824, - 19280, 21680, 19288, 29872, 19312, 23728, 19320, 31920, 19352, 26288, 19376, 20144, 19384, 28336, 19408, 22192, - 19416, 30384, 19440, 24240, 19448, 32432, 19480, 24880, 19512, 26928, 19536, 20784, 19544, 28976, 19568, 22832, - 19576, 31024, 19608, 25392, 19640, 27440, 19664, 21296, 19672, 29488, 19696, 23344, 19704, 31536, 19736, 25904, - 19768, 27952, 19792, 21808, 19800, 30000, 19824, 23856, 19832, 32048, 19864, 26416, 19888, 20272, 19896, 28464, - 19920, 22320, 19928, 30512, 19952, 24368, 19960, 32560, 19992, 25008, 20024, 27056, 20048, 20912, 20056, 29104, - 20080, 22960, 20088, 31152, 20120, 25520, 20152, 27568, 20176, 21424, 20184, 29616, 20208, 23472, 20216, 31664, - 20248, 26032, 20280, 28080, 20304, 21936, 20312, 30128, 20336, 23984, 20344, 32176, 20376, 26544, 20408, 28592, - 20432, 22448, 20440, 30640, 20464, 24496, 20472, 32688, 20504, 24656, 20536, 26704, 20568, 28752, 20592, 22608, - 20600, 30800, 20632, 25168, 20664, 27216, 20688, 21072, 20696, 29264, 20720, 23120, 20728, 31312, 20760, 25680, - 20792, 27728, 20816, 21584, 20824, 29776, 20848, 23632, 20856, 31824, 20888, 26192, 20920, 28240, 20944, 22096, - 20952, 30288, 20976, 24144, 20984, 32336, 21016, 24784, 21048, 26832, 21080, 28880, 21104, 22736, 21112, 30928, - 21144, 25296, 21176, 27344, 21208, 29392, 21232, 23248, 21240, 31440, 21272, 25808, 21304, 27856, 21328, 21712, - 21336, 29904, 21360, 23760, 21368, 31952, 21400, 26320, 21432, 28368, 21456, 22224, 21464, 30416, 21488, 24272, - 21496, 32464, 21528, 24912, 21560, 26960, 21592, 29008, 21616, 22864, 21624, 31056, 21656, 25424, 21688, 27472, - 21720, 29520, 21744, 23376, 21752, 31568, 21784, 25936, 21816, 27984, 21848, 30032, 21872, 23888, 21880, 32080, - 21912, 26448, 21944, 28496, 21968, 22352, 21976, 30544, 22000, 24400, 22008, 32592, 22040, 25040, 22072, 27088, - 22104, 29136, 22128, 22992, 22136, 31184, 22168, 25552, 22200, 27600, 22232, 29648, 22256, 23504, 22264, 31696, - 22296, 26064, 22328, 28112, 22360, 30160, 22384, 24016, 22392, 32208, 22424, 26576, 22456, 28624, 22488, 30672, - 22512, 24528, 22520, 32720, 22552, 24688, 22584, 26736, 22616, 28784, 22648, 30832, 22680, 25200, 22712, 27248, - 22744, 29296, 22768, 23152, 22776, 31344, 22808, 25712, 22840, 27760, 22872, 29808, 22896, 23664, 22904, 31856, - 22936, 26224, 22968, 28272, 23000, 30320, 23024, 24176, 23032, 32368, 23064, 24816, 23096, 26864, 23128, 28912, - 23160, 30960, 23192, 25328, 23224, 27376, 23256, 29424, 23288, 31472, 23320, 25840, 23352, 27888, 23384, 29936, - 23408, 23792, 23416, 31984, 23448, 26352, 23480, 28400, 23512, 30448, 23536, 24304, 23544, 32496, 23576, 24944, - 23608, 26992, 23640, 29040, 23672, 31088, 23704, 25456, 23736, 27504, 23768, 29552, 23800, 31600, 23832, 25968, - 23864, 28016, 23896, 30064, 23928, 32112, 23960, 26480, 23992, 28528, 24024, 30576, 24048, 24432, 24056, 32624, - 24088, 25072, 24120, 27120, 24152, 29168, 24184, 31216, 24216, 25584, 24248, 27632, 24280, 29680, 24312, 31728, - 24344, 26096, 24376, 28144, 24408, 30192, 24440, 32240, 24472, 26608, 24504, 28656, 24536, 30704, 24568, 32752, - 24632, 26648, 24664, 28696, 24696, 30744, 24728, 25112, 24760, 27160, 24792, 29208, 24824, 31256, 24856, 25624, - 24888, 27672, 24920, 29720, 24952, 31768, 24984, 26136, 25016, 28184, 25048, 30232, 25080, 32280, 25144, 26776, - 25176, 28824, 25208, 30872, 25272, 27288, 25304, 29336, 25336, 31384, 25368, 25752, 25400, 27800, 25432, 29848, - 25464, 31896, 25496, 26264, 25528, 28312, 25560, 30360, 25592, 32408, 25656, 26904, 25688, 28952, 25720, 31000, - 25784, 27416, 25816, 29464, 25848, 31512, 25912, 27928, 25944, 29976, 25976, 32024, 26008, 26392, 26040, 28440, - 26072, 30488, 26104, 32536, 26168, 27032, 26200, 29080, 26232, 31128, 26296, 27544, 26328, 29592, 26360, 31640, - 26424, 28056, 26456, 30104, 26488, 32152, 26552, 28568, 26584, 30616, 26616, 32664, 26712, 28728, 26744, 30776, - 26808, 27192, 26840, 29240, 26872, 31288, 26936, 27704, 26968, 29752, 27000, 31800, 27064, 28216, 27096, 30264, - 27128, 32312, 27224, 28856, 27256, 30904, 27352, 29368, 27384, 31416, 27448, 27832, 27480, 29880, 27512, 31928, - 27576, 28344, 27608, 30392, 27640, 32440, 27736, 28984, 27768, 31032, 27864, 29496, 27896, 31544, 27992, 30008, - 28024, 32056, 28088, 28472, 28120, 30520, 28152, 32568, 28248, 29112, 28280, 31160, 28376, 29624, 28408, 31672, - 28504, 30136, 28536, 32184, 28632, 30648, 28664, 32696, 28792, 30808, 28888, 29272, 28920, 31320, 29016, 29784, - 29048, 31832, 29144, 30296, 29176, 32344, 29304, 30936, 29432, 31448, 29528, 29912, 29560, 31960, 29656, 30424, - 29688, 32472, 29816, 31064, 29944, 31576, 30072, 32088, 30168, 30552, 30200, 32600, 30328, 31192, 30456, 31704, - 30584, 32216, 30712, 32728, 30968, 31352, 31096, 31864, 31224, 32376, 31608, 31992, 31736, 32504, 32248, 32632, -}; -extern const uint16_t bitrev4r_table_4096_fc32[]; -extern const uint16_t bitrev4r_table_4096_fc32_size; - - -void dsps_fft4r_rev_tables_init_fc32(void) -{ - dsps_fft4r_rev_tables_fc32[0] = (uint16_t *)bitrev4r_table_16_fc32; - dsps_fft4r_rev_tables_fc32[1] = (uint16_t *)bitrev4r_table_64_fc32; - dsps_fft4r_rev_tables_fc32[2] = (uint16_t *)bitrev4r_table_256_fc32; - dsps_fft4r_rev_tables_fc32[3] = (uint16_t *)bitrev4r_table_1024_fc32; - dsps_fft4r_rev_tables_fc32[4] = (uint16_t *)bitrev4r_table_4096_fc32; - -} - -uint16_t *dsps_fft4r_rev_tables_fc32[] = { - (uint16_t *)bitrev4r_table_16_fc32, - (uint16_t *)bitrev4r_table_64_fc32, - (uint16_t *)bitrev4r_table_256_fc32, - (uint16_t *)bitrev4r_table_1024_fc32, - (uint16_t *)bitrev4r_table_4096_fc32, -}; - -const uint16_t bitrev4r_table_16_fc32_size = 6; -const uint16_t bitrev4r_table_64_fc32_size = 24; -const uint16_t bitrev4r_table_256_fc32_size = 120; -const uint16_t bitrev4r_table_1024_fc32_size = 480; -const uint16_t bitrev4r_table_4096_fc32_size = 2016; - -const uint16_t dsps_fft4r_rev_tables_fc32_size[] = { - (const uint16_t)6, // bitrev4r_table_16_fc32_size, - (const uint16_t)24, // bitrev4r_table_64_fc32_size, - (const uint16_t)120, // bitrev4r_table_256_fc32_size, - (const uint16_t)480, // bitrev4r_table_1024_fc32_size, - (const uint16_t)2016,// bitrev4r_table_4096_fc32_size, -}; diff --git a/components/esp-dsp/modules/fft/float/dsps_fft4r_fc32_ae32.c b/components/esp-dsp/modules/fft/float/dsps_fft4r_fc32_ae32.c deleted file mode 100644 index 4868ca09..00000000 --- a/components/esp-dsp/modules/fft/float/dsps_fft4r_fc32_ae32.c +++ /dev/null @@ -1,251 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_fft2r.h" -#include "dsps_fft4r.h" -#include "dsp_common.h" -#include "dsp_types.h" -#include -#include "esp_attr.h" - -#include "dsps_fft4r_platform.h" - -#if (dsps_fft4r_fc32_ae32_enabled == 1) -esp_err_t dsps_fft4r_fc32_ae32_(float *data, int N, float *table, int table_size) -{ - int log4N = dsp_power_of_two(N) / 2; - int m = 2; - int j; - float *win = table; - - float *ptr0; - float *ptr1; - float *ptr2; - float *ptr3; - float *win0; - float *win1; - float *win2; - int start_index; - int wind_step = table_size >> (2 * log4N - 1); - - asm volatile ("mov %0, %1" : "=a" (ptr0) : "a" (data)); - asm volatile ("mov %0, %1" : "=a" (ptr1) : "a" (data)); - asm volatile ("mov %0, %1" : "=a" (ptr2) : "a" (data)); - asm volatile ("mov %0, %1" : "=a" (ptr3) : "a" (data)); - asm volatile ("mov %0, %1" : "=a" (win0) : "a" (win)); //win0 = win; - asm volatile ("mov %0, %1" : "=a" (win1) : "a" (win)); //win1 = win; - asm volatile ("mov %0, %1" : "=a" (win2) : "a" (win)); //win2 = win; - - //asm volatile ("slli %0, %0, 1" : "+a" (m)); ////m <<= 1; - - while (1) { ///radix 4 - if (log4N == 0) { - break; - } - asm volatile ("srli %0, %0, 2" : "+a" (N)); //N = N >> 2; - for (j = 0; j < m; j += 2) { // j: which FFT of this step - asm volatile ("mul16u %0, %1, %2" : "=a" (start_index) : "a" (j), "a" (N)); ///int start_index = j * (N << 1); // N: N-point FFT - asm volatile ("slli %0, %0, 1" : "+a" (start_index)); - asm volatile ("addx8 %0, %1, %2" : "+a" (ptr0) : "a" (start_index), "a" (data)); //ptr0 = data + (start_index << 1); - asm volatile ("addx8 %0, %1, %2" : "+a" (ptr1) : "a" (N), "a" (ptr0)); //ptr1 = ptr0 + (N << 1); - asm volatile ("addx8 %0, %1, %2" : "+a" (ptr2) : "a" (N), "a" (ptr1)); //ptr2 = ptr1 + (N << 1); - asm volatile ("addx8 %0, %1, %2" : "+a" (ptr3) : "a" (N), "a" (ptr2)); //ptr3 = ptr2 + (N << 1); - - asm volatile ("loopnez %0, _loop_end_radix4_butterfly4_fft" :: "a"(N)); /// for (k = 0; k < N; k++) { - asm volatile ("lsi f1, %0, 4" :: "a" (ptr0)); //f1 = *(ptr0 + 1); - asm volatile ("lsi f3, %0, 4" :: "a" (ptr2)); //f3 = *(ptr2 + 1); - asm volatile ("lsi f0, %0, 0" :: "a" (ptr0)); //f0 = *ptr0; - asm volatile ("lsi f2, %0, 0" :: "a" (ptr2)); //f2 = *ptr2; - asm volatile ("add.s f5, f1, f3"); //f5 = f1 + f3; - asm volatile ("sub.s f7, f1, f3"); //f7 = f1 - f3; - asm volatile ("lsi f1, %0, 4" :: "a" (ptr1)); //f1 = *(ptr1 + 1); - asm volatile ("lsi f3, %0, 4" :: "a" (ptr3)); //f3 = *(ptr3 + 1); - - asm volatile ("add.s f4, f0, f2"); //f4 = f0 + f2; - asm volatile ("sub.s f6, f0, f2"); //f6 = f0 - f2; - asm volatile ("add.s f9, f1, f3"); //f9 = f1 + f3; - asm volatile ("sub.s f11, f1, f3"); //f11 = f1 - f3; - - asm volatile ("lsi f0, %0, 0" :: "a" (ptr1)); //f0 = *ptr1; - asm volatile ("lsi f2, %0, 0" :: "a" (ptr3)); //f2 = *ptr3; - - asm volatile ("lsi f12, %0, 0" :: "a" (win0)); //f12 = *win0; //f12 = win[k * 1 * m * 2 + 0]; - asm volatile ("lsi f13, %0, 0" :: "a" (win1)); //f13 = *win1; //f13 = win[k * 2 * m * 2 + 0]; - asm volatile ("add.s f8, f0, f2"); //f8 = f0 + f2; - asm volatile ("sub.s f10, f0, f2"); //f10 = f0 - f2; - - asm volatile ("sub.s f1, f5, f9"); //f1 = f5 - f9; - asm volatile ("add.s f5, f5, f9"); //f5 = f5 + f9; - asm volatile ("add.s f2, f6, f11"); //f2 = f6 + f11; ///this fft & ifft is different - asm volatile ("sub.s f6, f6, f11"); //f6 = f6 - f11; ///this fft & ifft is different - - asm volatile ("sub.s f0, f4, f8"); //f0 = f4 - f8; - asm volatile ("add.s f4, f4, f8"); //f4 = f4 + f8; - asm volatile ("sub.s f3, f7, f10"); //f3 = f7 - f10; ///this fft & ifft is different - asm volatile ("add.s f7, f7, f10"); //f7 = f7 + f10; ///this fft & ifft is different - - asm volatile ("lsi f14, %0, 0" :: "a" (win2)); //f14 = *win2; //f14 = win[k * 3 * m * 2 + 0]; - - asm volatile ("ssi f5, %0, 4" :: "a" (ptr0)); //*(ptr0 + 1) = f5; - asm volatile ("ssip f4, %0, 8" :: "a" (ptr0)); //*ptr0 = f4; ptr0 += 2; - asm volatile ("mul.s f5, f3, f12"); //f5 = f3 * f12; - asm volatile ("mul.s f4, f2, f12"); //f4 = f2 * f12; - asm volatile ("mul.s f9, f1, f13"); //f9 = f1 * f13; - asm volatile ("mul.s f8, f0, f13"); //f8 = f0 * f13; - asm volatile ("mul.s f11, f7, f14"); //f11 = f7 * f14; - asm volatile ("mul.s f10, f6, f14"); //f10 = f6 * f14; - asm volatile ("lsi f12, %0, 4" :: "a" (win0)); //f12 = *(win0 + 1); //f12 = win[k * 1 * m * 2 + 1]; - asm volatile ("lsi f13, %0, 4" :: "a" (win1)); //f13 = *(win1 + 1); //si2 = win[k * 2 * m * 2 + 1]; - asm volatile ("lsi f14, %0, 4" :: "a" (win2)); //f14 = *(win2 + 1); //si3 = win[k * 3 * m * 2 + 1] - - asm volatile ("addx4 %0, %1, %0" : "+a" (win0) : "a" (wind_step)); //win0 += 1 * m; - asm volatile ("addx8 %0, %1, %0" : "+a" (win1) : "a" (wind_step)); //win1 += 2 * m; - asm volatile ("addx8 %0, %1, %0" : "+a" (win2) : "a" (wind_step)); //win2 += 2 * m; - asm volatile ("addx4 %0, %1, %0" : "+a" (win2) : "a" (wind_step)); //win2 += 1 * m; - asm volatile ("msub.s f5, f2, f12"); //f5 -= f2 * f12; - asm volatile ("madd.s f4, f3, f12"); //f4 += f3 * f12; - asm volatile ("msub.s f9, f0, f13"); //f9 -= f0 * f13; - asm volatile ("madd.s f8, f1, f13"); //f8 += f1 * f13; - asm volatile ("msub.s f11, f6, f14"); //f11 -= f6 * f14; - asm volatile ("madd.s f10, f7, f14"); //f10 += f7 * f14; - asm volatile ("ssi f5, %0, 4" :: "a" (ptr1)); //*(ptr1 + 1) = f5; - asm volatile ("ssip f4, %0, 8" :: "a" (ptr1)); //*ptr1 = f4; ptr1 += 2; - asm volatile ("ssi f9, %0, 4" :: "a" (ptr2)); //*(ptr2 + 1) = f9; - asm volatile ("ssip f8, %0, 8" :: "a" (ptr2)); //*ptr2 = f8; ptr2 += 2; - asm volatile ("ssi f11, %0, 4" :: "a" (ptr3)); //*(ptr3 + 1) = f11; - asm volatile ("ssip f10, %0, 8" :: "a" (ptr3)); //*ptr3 = f10; ptr3 += 2; - //} - asm volatile ("_loop_end_radix4_butterfly4_fft: mov %0, %1" : "=a" (win0) : "a" (win)); //win0 = win; - asm volatile ("mov %0, %1" : "=a" (win0) : "a" (win)); //win0 = win; - asm volatile ("mov %0, %1" : "=a" (win1) : "a" (win)); //win1 = win; - asm volatile ("mov %0, %1" : "=a" (win2) : "a" (win)); //win2 = win; - } - asm volatile ("slli %0, %0, 2" : "+a" (m)); /// m = m << 2; - asm volatile ("slli %0, %0, 2" : "+a" (wind_step)); /// m = m << 2; - asm volatile ("addi %0, %0, -1" : "+a" (log4N)); ///log4N--; - } - return ESP_OK; -} -#endif // dsps_fft4r_fc32_ae32_enabled - -#if (dsps_cplx2real_fc32_ae32_enabled == 1) -esp_err_t dsps_cplx2real_fc32_ae32_(float *data, int fft_points, float *table, int table_size) -{ - float *ptr_inv; - - int wind_step = table_size / (fft_points); - - float *win0 = table + wind_step; - float *win1 = table + wind_step * 2; - - ////0 & 1 => dc frequency - ///fft_points * 2 + 0 & fft_points * 2 + 1 => Nyquist frequency - asm volatile ("const.s f14, 0"); //f14 = 0f; - asm volatile ("lsi f0, %0, 0" :: "a" (data)); //f0 = *data; - asm volatile ("lsi f1, %0, 4" :: "a" (data)); //f1 = *(data + 1); - asm volatile ("addx8 %0, %1, %2" : "=a" (ptr_inv) : "a" (fft_points), "a" (data)); //ptr_inv = data + fft_points * 2; - asm volatile ("add.s f6, f0, f1"); //f6 = f0 + f1; - asm volatile ("sub.s f7, f0, f1"); //f7 = f0 - f1; - - asm volatile ("srli %0, %0, 2" : "+a" (fft_points)); //fft_points >>= 2; - - asm volatile ("const.s f14, 3"); //f14 = 0.5f;, this is for multiply 0.5 - asm volatile ("neg.s f15, f14"); //f15 = -f14; - - asm volatile ("ssi f6, %0, 0" :: "a" (data)); //*data = f6; - asm volatile ("ssi f7, %0, 4" :: "a" (data)); //*ptr_inv = f7; - asm volatile ("addi %0, %0, -16" : "+a" (ptr_inv)); //ptr_inv -= 4; ///here increase address by -4 because float load/store not support negective immediate offset - - asm volatile ("loopnez %0, __loop_end_fftr_real_post_proc" :: "a" (fft_points)); //for (k = 0; k < fft_points; k++) { - asm volatile ("lsi f1, %0, 12" :: "a" (data)); //f1 = *(data + 3); - asm volatile ("lsi f3, %0, 12" :: "a" (ptr_inv)); //f3 = *(ptr_inv + 3); - asm volatile ("lsi f0, %0, 8" :: "a" (data)); //f0 = *(data + 2); - asm volatile ("lsi f2, %0, 8" :: "a" (ptr_inv)); //f2 = *(ptr_inv + 2); - - asm volatile ("lsi f7, %0, 20" :: "a" (data)); //f7 = *(data + 5); - asm volatile ("lsi f9, %0, 4" :: "a" (ptr_inv)); //f9 = *(ptr_inv + 1); - - asm volatile ("lsi f6, %0, 16" :: "a" (data)); //f6 = *(data + 4); - asm volatile ("lsi f8, %0, 0" :: "a" (ptr_inv)); //f8 = *ptr_inv; - asm volatile ("sub.s f5, f1, f3"); //f5 = f1 - f3; - asm volatile ("add.s f4, f0, f2"); //f4 = f0 + f2; - asm volatile ("sub.s f11, f7, f9"); //f11 = f7 - f9; - asm volatile ("add.s f10, f6, f8"); //f10 = f6 + f8; - - asm volatile ("add.s f1, f1, f3"); //f1 = f1 + f3; - asm volatile ("sub.s f0, f0, f2"); //f0 = f0 - f2; - - asm volatile ("lsi f12, %0, 4" :: "a" (win0)); //f12 = *(win + 1); - asm volatile ("add.s f7, f7, f9"); //f7 = f7 + f9; - asm volatile ("sub.s f6, f6, f8"); //f6 = f6 - f8; - asm volatile ("lsi f13, %0, 4" :: "a" (win1)); //f13 = *(win + 3); - - asm volatile ("mul.s f3, f1, f12"); //f3 = f1 * f12; - asm volatile ("mul.s f2, f0, f12"); //f2 = f0 * f12; - asm volatile ("lsi f12, %0, 0" :: "a" (win0)); //f12 = *(win + 0); - - asm volatile ("mul.s f9, f7, f13"); //f9 = f7 * f13; - asm volatile ("mul.s f8, f6, f13"); //f8 = f6 * f13; - - asm volatile ("lsi f13, %0, 0" :: "a" (win1)); //f13 = *(win + 2); - - asm volatile ("madd.s f3, f0, f12"); //f3 += f0 * f12; - asm volatile ("msub.s f2, f1, f12"); //f2 -= f1 * f12; - asm volatile ("madd.s f9, f6, f13"); //f9 += f6 * f13; - asm volatile ("msub.s f8, f7, f13"); //f8 -= f7 * f13; - asm volatile ("addx8 %0, %1, %0" : "+a" (win0) : "a" (wind_step)); //win0 += 8 * wind_step; - asm volatile ("addx8 %0, %1, %0" : "+a" (win1) : "a" (wind_step)); //win1 += 8 * wind_step; - // Here we have tw1: f2,f3 and tw2: f8,f9 - - asm volatile ("sub.s f1, f5, f3"); //f1 = f5 - f3; - asm volatile ("sub.s f0, f4, f2"); //f0 = f4 - f2; - - asm volatile ("add.s f3, f3, f5"); //f3 = f3 + f5; - asm volatile ("add.s f2, f4, f2"); //f2 = f4 + f2; - - asm volatile ("sub.s f7, f11, f9"); //f7 = f11 - f9; - asm volatile ("sub.s f6, f10, f8"); //f6 = f10 - f8; - asm volatile ("add.s f9, f9, f11"); //f9 = f9 + f11; - asm volatile ("add.s f8, f10, f8"); //f8 = f10 + f8; - - asm volatile ("mul.s f1, f1, f14"); //f1 *= f14; - asm volatile ("mul.s f0, f0, f14"); //f0 *= f14; - - asm volatile ("mul.s f3, f3, f15"); //f3 *= -f14; - asm volatile ("mul.s f2, f2, f14"); //f2 *= f14; - - asm volatile ("mul.s f7, f7, f14"); //f7 *= f14; - asm volatile ("mul.s f6, f6, f14"); //f6 *= f14; - asm volatile ("mul.s f9, f9, f15"); //f9 *= -f14; - asm volatile ("mul.s f8, f8, f14"); //f8 *= f14; - - asm volatile ("ssi f1, %0, 12" :: "a" (data)); //*(data + 3) = f1; - asm volatile ("ssi f0, %0, 8" :: "a" (data)); //*(data + 2) = f0; - - asm volatile ("ssi f3, %0, 12" :: "a" (ptr_inv)); //*(ptr_inv + 3) = f3; - asm volatile ("ssi f2, %0, 8" :: "a" (ptr_inv)); //*(ptr_inv + 2) = f2; - - asm volatile ("ssi f7, %0, 20" :: "a" (data)); //*(data + 5) = f7; - asm volatile ("ssi f6, %0, 16" :: "a" (data)); //*(data + 4) = f6; - asm volatile ("addi %0, %0, 16" : "+a" (data)); //data += 4; - - asm volatile ("ssi f9, %0, 4" :: "a" (ptr_inv)); //*(ptr_inv + 1) = f9; - asm volatile ("ssi f8, %0, 0" :: "a" (ptr_inv)); //*ptr_inv = f8; - asm volatile ("addi %0, %0, -16" : "+a" (ptr_inv)); //ptr_inv -= 4; - //} - asm volatile ("__loop_end_fftr_real_post_proc: nop"); - - return ESP_OK; -} -#endif // dsps_cplx2real_fc32_ae32_enabled diff --git a/components/esp-dsp/modules/fft/float/dsps_fft4r_fc32_ansi.c b/components/esp-dsp/modules/fft/float/dsps_fft4r_fc32_ansi.c deleted file mode 100644 index 303e2090..00000000 --- a/components/esp-dsp/modules/fft/float/dsps_fft4r_fc32_ansi.c +++ /dev/null @@ -1,331 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_fft2r.h" -#include "dsps_fft4r.h" -#include "dsp_common.h" -#include "dsp_types.h" -#include -#include "esp_attr.h" -#include "esp_log.h" -#include - -static const char *TAG = "fftr4 ansi"; - -float *dsps_fft4r_w_table_fc32; -int dsps_fft4r_w_table_size; -uint8_t dsps_fft4r_initialized = 0; -uint8_t dsps_fft4r_mem_allocated = 0; -//float* win2; -uint16_t *dsps_fft4r_ram_rev_table = NULL; - -esp_err_t dsps_fft4r_init_fc32(float *fft_table_buff, int max_fft_size) -{ - esp_err_t result = ESP_OK; - if (dsps_fft4r_initialized != 0) { - return result; - } - if (max_fft_size > CONFIG_DSP_MAX_FFT_SIZE) { - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - } - if (max_fft_size == 0) { - return result; - } - if (fft_table_buff != NULL) { - if (dsps_fft4r_mem_allocated) { - return ESP_ERR_DSP_REINITIALIZED; - } - dsps_fft4r_w_table_fc32 = fft_table_buff; - dsps_fft4r_w_table_size = max_fft_size * 2; - } else { - if (!dsps_fft4r_mem_allocated) { - dsps_fft4r_w_table_fc32 = (float *)malloc(max_fft_size * sizeof(float) * 4); - if (NULL == dsps_fft4r_w_table_fc32) { - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - } - } - dsps_fft4r_w_table_size = max_fft_size * 2; - dsps_fft4r_mem_allocated = 1; - } - - // FFT ram_rev table allocated - int pow = dsp_power_of_two(max_fft_size) >> 1; - if ((pow >= 2) && (pow <= 6)) { - dsps_fft4r_ram_rev_table = (uint16_t *)malloc(2 * dsps_fft4r_rev_tables_fc32_size[pow - 2] * sizeof(uint16_t)); - if (NULL == dsps_fft4r_ram_rev_table) { - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - } - memcpy(dsps_fft4r_ram_rev_table, dsps_fft4r_rev_tables_fc32[pow - 2], 2 * dsps_fft4r_rev_tables_fc32_size[pow - 2] * sizeof(uint16_t)); - dsps_fft4r_rev_tables_fc32[pow - 2] = dsps_fft4r_ram_rev_table; - } - - for (int i = 0; i < dsps_fft4r_w_table_size; i++) { - float angle = 2 * M_PI * i / (float)dsps_fft4r_w_table_size; - dsps_fft4r_w_table_fc32[2 * i + 0] = cosf(angle); - dsps_fft4r_w_table_fc32[2 * i + 1] = sinf(angle); - } - - dsps_fft4r_initialized = 1; - - return ESP_OK; -} - -void dsps_fft4r_deinit_fc32() -{ - if (dsps_fft4r_mem_allocated) { - free(dsps_fft4r_w_table_fc32); - } - if (dsps_fft4r_ram_rev_table != NULL) { - free(dsps_fft4r_ram_rev_table); - dsps_fft4r_ram_rev_table = NULL; - } - // Re init bitrev table for next use - dsps_fft4r_rev_tables_init_fc32(); - - dsps_fft4r_mem_allocated = 0; - dsps_fft4r_initialized = 0; -} - -esp_err_t dsps_bit_rev4r_direct_fc32_ansi(float *data, int N) -{ - if (!dsp_is_power_of_two(N)) { - return ESP_ERR_DSP_INVALID_LENGTH; - } - if (0 == dsps_fft4r_initialized) { - return ESP_ERR_DSP_UNINITIALIZED; - } - esp_err_t result = ESP_OK; - int log2N = dsp_power_of_two(N); - int log4N = log2N >> 1; - if ((log2N & 0x01) != 0) { - return ESP_ERR_DSP_INVALID_LENGTH; - } - float r_temp, i_temp; - for (int i = 0; i < N; i++) { - int cnt; - int xx; - int bits2; - xx = 0; - cnt = log4N; - int j = i; - while (cnt > 0) { - bits2 = j & 0x3; - xx = (xx << 2) + bits2; - j = j >> 2; - cnt--; - } - if (i < xx) { - r_temp = data[i * 2 + 0]; - i_temp = data[i * 2 + 1]; - data[i * 2 + 0] = data[xx * 2 + 0]; - data[i * 2 + 1] = data[xx * 2 + 1]; - data[xx * 2 + 0] = r_temp; - data[xx * 2 + 1] = i_temp; - } - } - return result; -} - -esp_err_t dsps_fft4r_fc32_ansi_(float *data, int length, float *table, int table_size) -{ - if (0 == dsps_fft4r_initialized) { - return ESP_ERR_DSP_UNINITIALIZED; - } - - fc32_t bfly[4]; - int log2N = dsp_power_of_two(length); - int log4N = log2N >> 1; - if ((log2N & 0x01) != 0) { - return ESP_ERR_DSP_INVALID_LENGTH; - } - - int m = 2; - int wind_step = table_size / length; - while (1) { ///radix 4 - if (log4N == 0) { - break; - } - length = length >> 2; - for (int j = 0; j < m; j += 2) { // j: which FFT of this step - int start_index = j * (length << 1); // n: n-point FFT - - fc32_t *ptrc0 = (fc32_t *)data + start_index; - fc32_t *ptrc1 = ptrc0 + length; - fc32_t *ptrc2 = ptrc1 + length; - fc32_t *ptrc3 = ptrc2 + length; - - fc32_t *winc0 = (fc32_t *)table; - fc32_t *winc1 = winc0; - fc32_t *winc2 = winc0; - - for (int k = 0; k < length; k++) { - fc32_t in0 = *ptrc0; - fc32_t in2 = *ptrc2; - fc32_t in1 = *ptrc1; - fc32_t in3 = *ptrc3; - - bfly[0].re = in0.re + in2.re + in1.re + in3.re; - bfly[0].im = in0.im + in2.im + in1.im + in3.im; - - bfly[1].re = in0.re - in2.re + in1.im - in3.im; - bfly[1].im = in0.im - in2.im - in1.re + in3.re; - - bfly[2].re = in0.re + in2.re - in1.re - in3.re; - bfly[2].im = in0.im + in2.im - in1.im - in3.im; - - bfly[3].re = in0.re - in2.re - in1.im + in3.im; - bfly[3].im = in0.im - in2.im + in1.re - in3.re; - - - - *ptrc0 = bfly[0]; - ptrc1->re = bfly[1].re * winc0->re + bfly[1].im * winc0->im; - ptrc1->im = bfly[1].im * winc0->re - bfly[1].re * winc0->im; - ptrc2->re = bfly[2].re * winc1->re + bfly[2].im * winc1->im; - ptrc2->im = bfly[2].im * winc1->re - bfly[2].re * winc1->im; - ptrc3->re = bfly[3].re * winc2->re + bfly[3].im * winc2->im; - ptrc3->im = bfly[3].im * winc2->re - bfly[3].re * winc2->im; - - winc0 += 1 * wind_step; - winc1 += 2 * wind_step; - winc2 += 3 * wind_step; - - ptrc0++; - ptrc1++; - ptrc2++; - ptrc3++; - } - } - m = m << 2; - wind_step = wind_step << 2; - log4N--; - } - return ESP_OK; -} - -esp_err_t dsps_cplx2real_fc32_ansi_(float *data, int N, float *table, int table_size) -{ - if (0 == dsps_fft4r_initialized) { - return ESP_ERR_DSP_UNINITIALIZED; - } - int wind_step = table_size / (N); - fc32_t *result = (fc32_t *)data; - // Original formula... - // result[0].re = result[0].re + result[0].im; - // result[N].re = result[0].re - result[0].im; - // result[0].im = 0; - // result[N].im = 0; - // Optimized one: - float tmp_re = result[0].re; - result[0].re = tmp_re + result[0].im; - result[0].im = tmp_re - result[0].im; - - fc32_t f1k, f2k; - for (int k = 1; k <= N / 2 ; k++ ) { - fc32_t fpk = result[k]; - fc32_t fpnk = result[N - k]; - f1k.re = fpk.re + fpnk.re; - f1k.im = fpk.im - fpnk.im; - f2k.re = fpk.re - fpnk.re; - f2k.im = fpk.im + fpnk.im; - - float c = -table[k * wind_step + 1]; - float s = -table[k * wind_step + 0]; - fc32_t tw; - tw.re = c * f2k.re - s * f2k.im; - tw.im = s * f2k.re + c * f2k.im; - - result[k].re = 0.5 * (f1k.re + tw.re); - result[k].im = 0.5 * (f1k.im + tw.im); - result[N - k].re = 0.5 * (f1k.re - tw.re); - result[N - k].im = 0.5 * (tw.im - f1k.im); - } - return ESP_OK; -} - -esp_err_t dsps_gen_bitrev4r_table(int N, int step, char *name_ext) -{ - if (!dsp_is_power_of_two(N)) { - return ESP_ERR_DSP_INVALID_LENGTH; - } - - int items_count = 0; - ESP_LOGD(TAG, "const uint16_t bitrev4r_table_%i_%s[] = { ", N, name_ext); - int log2N = dsp_power_of_two(N); - int log4N = log2N >> 1; - - for (int i = 1; i < N - 1; i++) { - int cnt; - int xx; - int bits2; - xx = 0; - cnt = log4N; - int j = i; - while (cnt > 0) { - bits2 = j & 0x3; - xx = (xx << 2) + bits2; - j = j >> 2; - cnt--; - } - if (i < xx) { - ESP_LOGD(TAG, "%i, %i, ", i * step, xx * step); - items_count++; - if ((items_count % 8) == 0) { - ESP_LOGD(TAG, " "); - } - } - } - - ESP_LOGD(TAG, "};"); - ESP_LOGD(TAG, "const uint16_t bitrev4r_table_%i_%s_size = %i;\n", N, name_ext, items_count); - - ESP_LOGD(TAG, "extern const uint16_t bitrev4r_table_%i_%s[];", N, name_ext); - ESP_LOGD(TAG, "extern const uint16_t bitrev4r_table_%i_%s_size;\n", N, name_ext); - return ESP_OK; -} - -esp_err_t dsps_bit_rev4r_fc32(float *data, int N) -{ - uint16_t *table; - uint16_t table_size; - switch (N) { - case 16: - table = (uint16_t *)dsps_fft4r_rev_tables_fc32[0]; - table_size = dsps_fft4r_rev_tables_fc32_size[0]; - break; - case 64: - table = (uint16_t *)dsps_fft4r_rev_tables_fc32[1]; - table_size = dsps_fft4r_rev_tables_fc32_size[1]; - break; - case 256: - table = (uint16_t *)dsps_fft4r_rev_tables_fc32[2]; - table_size = dsps_fft4r_rev_tables_fc32_size[2]; - break; - case 1024: - table = (uint16_t *)dsps_fft4r_rev_tables_fc32[3]; - table_size = dsps_fft4r_rev_tables_fc32_size[3]; - break; - case 4096: - table = (uint16_t *)dsps_fft4r_rev_tables_fc32[4]; - table_size = dsps_fft4r_rev_tables_fc32_size[4]; - break; - - default: - return dsps_bit_rev4r_direct_fc32_ansi(data, N); - break; - } - - return dsps_bit_rev_lookup_fc32(data, table_size, table); -} - diff --git a/components/esp-dsp/modules/fft/include/dsps_fft2r.h b/components/esp-dsp/modules/fft/include/dsps_fft2r.h deleted file mode 100644 index 25f6fb8a..00000000 --- a/components/esp-dsp/modules/fft/include/dsps_fft2r.h +++ /dev/null @@ -1,233 +0,0 @@ -// Copyright 2018-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. - -#ifndef _dsps_fft2r_H_ -#define _dsps_fft2r_H_ - -#include "dsp_err.h" -#include "sdkconfig.h" -#include "dsps_fft_tables.h" - -#ifndef CONFIG_DSP_MAX_FFT_SIZE -#define CONFIG_DSP_MAX_FFT_SIZE 4096 -#endif // CONFIG_DSP_MAX_FFT_SIZE - -#ifdef __cplusplus -extern "C" -{ -#endif - -extern float *dsps_fft_w_table_fc32; -extern int dsps_fft_w_table_size; -extern uint8_t dsps_fft2r_initialized; - -extern int16_t *dsps_fft_w_table_sc16; -extern int dsps_fft_w_table_sc16_size; -extern uint8_t dsps_fft2r_sc16_initialized; - - -/**@{*/ -/** - * @brief init fft tables - * - * Initialization of Complex FFT. This function initialize coefficients table. - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param[inout] fft_table_buff: pointer to floating point buffer where sin/cos table will be stored - * if this parameter set to NULL, and table_size value is more then 0, then - * dsps_fft2r_init_fc32 will allocate buffer internally - * @param[in] table_size: size of the buffer in float words - * if fft_table_buff is NULL and table_size is not 0, buffer will be allocated internally. - * If table_size is 0, buffer will not be allocated. - * - * @return - * - ESP_OK on success - * - ESP_ERR_DSP_PARAM_OUTOFRANGE if table_size > CONFIG_DSP_MAX_FFT_SIZE - * - ESP_ERR_DSP_REINITIALIZED if buffer already allocated internally by other function - * - One of the error codes from DSP library - */ -esp_err_t dsps_fft2r_init_fc32(float *fft_table_buff, int table_size); -esp_err_t dsps_fft2r_init_sc16(int16_t *fft_table_buff, int table_size); -/**@}*/ - -/**@{*/ -/** - * @brief deinit fft tables - * - * Free resources of Complex FFT. This function delete coefficients table if it was allocated by dsps_fft2r_init_fc32. - * The implementation use ANSI C and could be compiled and run on any platform - * - * - * @return - */ -void dsps_fft2r_deinit_fc32(); -void dsps_fft2r_deinit_sc16(); -/**@}*/ - -/**@{*/ -/** - * @brief complex FFT of radix 2 - * - * Complex FFT of radix 2 - * The extension (_ansi) use ANSI C and could be compiled and run on any platform. - * The extension (_ae32) is optimized for ESP32 chip. - * - * @param[inout] data: input/output complex array. An elements located: Re[0], Im[0], ... Re[N-1], Im[N-1] - * result of FFT will be stored to this array. - * @param[in] N: Number of complex elements in input array - * @param[in] w: pointer to the sin/cos table - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_fft2r_fc32_ansi_(float *data, int N, float *w); -esp_err_t dsps_fft2r_fc32_ae32_(float *data, int N, float *w); -esp_err_t dsps_fft2r_sc16_ansi_(int16_t *data, int N, int16_t *w); -esp_err_t dsps_fft2r_sc16_ae32_(int16_t *data, int N, int16_t *w); -/**@}*/ -// This is workaround because linker generates permanent error when assembler uses -// direct access to the table pointer -#define dsps_fft2r_fc32_ae32(data, N) dsps_fft2r_fc32_ae32_(data, N, dsps_fft_w_table_fc32) -#define dsps_fft2r_sc16_ae32(data, N) dsps_fft2r_sc16_ae32_(data, N, dsps_fft_w_table_sc16) -#define dsps_fft2r_fc32_ansi(data, N) dsps_fft2r_fc32_ansi_(data, N, dsps_fft_w_table_fc32) -#define dsps_fft2r_sc16_ansi(data, N) dsps_fft2r_sc16_ansi_(data, N, dsps_fft_w_table_sc16) - - -/**@{*/ -/** - * @brief bit reverse operation for the complex input array - * - * Bit reverse operation for the complex input array - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param[inout] data: input/ complex array. An elements located: Re[0], Im[0], ... Re[N-1], Im[N-1] - * result of FFT will be stored to this array. - * @param[in] N: Number of complex elements in input array - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_bit_rev_fc32_ansi(float *data, int N); -esp_err_t dsps_bit_rev_sc16_ansi(int16_t *data, int N); -esp_err_t dsps_bit_rev2r_fc32(float *data, int N); - -/**@{*/ - -esp_err_t dsps_bit_rev_lookup_fc32_ansi(float *data, int reverse_size, uint16_t *reverse_tab); -esp_err_t dsps_bit_rev_lookup_fc32_ae32(float *data, int reverse_size, uint16_t *reverse_tab); - -/** - * @brief Generate coefficients table for the FFT radix 2 - * - * Generate coefficients table for the FFT radix 2. This function called inside init. - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param[inout] w: memory location to store coefficients. - * By default coefficients will be stored to the dsps_fft_w_table_fc32. - * Maximum size of the FFT must be setup in menuconfig - * @param[in] N: maximum size of the FFT that will be used - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_gen_w_r2_fc32(float *w, int N); -esp_err_t dsps_gen_w_r2_sc16(int16_t *w, int N); -/**@}*/ - -/**@{*/ -/** - * @brief Convert complex array to two real arrays - * - * Convert complex array to two real arrays in case if input was two real arrays. - * This function have to be used if FFT used to process real data. - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param[inout] data: Input complex array and result of FFT2R. - * input has size of 2*N, because contains real and imaginary part. - * result will be stored to the same array. - * Input1: input[0..N-1], Input2: input[N..2*N-1] - * @param[in] N: Number of complex elements in input array - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_cplx2reC_fc32_ansi(float *data, int N); -esp_err_t dsps_cplx2reC_sc16(int16_t *data, int N); -/**@}*/ - -/**@{*/ -/** - * @brief Convert complex FFT result to real array - * - * Convert FFT result of complex FFT for resl input to real array. - * This function have to be used if FFT used to process real data. - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param[inout] data: Input complex array and result of FFT2R. - * input has size of 2*N, because contains real and imaginary part. - * result will be stored to the same array. - * Input1: input[0..N-1], Input2: input[N..2*N-1] - * @param[in] N: Number of complex elements in input array - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_cplx2real_sc16_ansi(int16_t *data, int N); -/**@}*/ -esp_err_t dsps_cplx2real256_fc32_ansi(float *data); - -esp_err_t dsps_gen_bitrev2r_table(int N, int step, char *name_ext); - -#ifdef __cplusplus -} -#endif - -#if CONFIG_DSP_OPTIMIZED -#define dsps_bit_rev_fc32 dsps_bit_rev_fc32_ansi -#define dsps_cplx2reC_fc32 dsps_cplx2reC_fc32_ansi - -#if (dsps_fft2r_fc32_ae32_enabled == 1) -#define dsps_fft2r_fc32 dsps_fft2r_fc32_ae32 -#else -#define dsps_fft2r_fc32 dsps_fft2r_fc32_ansi -#endif - -#if (dsps_fft2r_sc16_ae32_enabled == 1) -#define dsps_fft2r_sc16 dsps_fft2r_sc16_ae32 -#else -#define dsps_fft2r_sc16 dsps_fft2r_sc16_ansi -#endif - -#if (dsps_bit_rev_lookup_fc32_ae32_enabled == 1) -# define dsps_bit_rev_lookup_fc32 dsps_bit_rev_lookup_fc32_ae32 -#else -#define dsps_bit_rev_lookup_fc32 dsps_bit_rev_lookup_fc32_ansi -#endif - -#else // CONFIG_DSP_OPTIMIZED - -#define dsps_fft2r_fc32 dsps_fft2r_fc32_ansi -#define dsps_bit_rev_fc32 dsps_bit_rev_fc32_ansi -#define dsps_cplx2reC_fc32 dsps_cplx2reC_fc32_ansi -#define dsps_bit_rev_sc16 dsps_bit_rev_sc16_ansi -#define dsps_bit_rev_lookup_fc32 dsps_bit_rev_lookup_fc32_ansi - -#endif // CONFIG_DSP_OPTIMIZED - -#endif // _dsps_fft2r_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/fft/include/dsps_fft2r_platform.h b/components/esp-dsp/modules/fft/include/dsps_fft2r_platform.h deleted file mode 100644 index 90a67ffa..00000000 --- a/components/esp-dsp/modules/fft/include/dsps_fft2r_platform.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef _dsps_fft2r_platform_H_ -#define _dsps_fft2r_platform_H_ - -#include -#include - - -#if ((XCHAL_HAVE_FP == 1) && (XCHAL_HAVE_LOOPS == 1)) - -#define dsps_fft2r_fc32_ae32_enabled 1 - -#endif // - -#if ((XCHAL_HAVE_LOOPS == 1) && (XCHAL_HAVE_MAC16 == 1)) - -#define dsps_fft2r_sc16_ae32_enabled 1 - -#endif // - -#if (XCHAL_HAVE_LOOPS == 1) - -#define dsps_bit_rev_lookup_fc32_ae32_enabled 1 - -#endif // - - - -#endif // _dsps_fft2r_platform_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/fft/include/dsps_fft4r.h b/components/esp-dsp/modules/fft/include/dsps_fft4r.h deleted file mode 100644 index 675e716f..00000000 --- a/components/esp-dsp/modules/fft/include/dsps_fft4r.h +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright 2018-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. - -#ifndef _dsps_fft4r_H_ -#define _dsps_fft4r_H_ -#include "dsp_err.h" -#include "sdkconfig.h" - -#include "dsps_fft_tables.h" -#include "dsps_fft4r_platform.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - -extern float *dsps_fft4r_w_table_fc32; -extern int dsps_fft4r_w_table_size; -extern uint8_t dsps_fft4r_initialized; - -extern int16_t *dsps_fft4r_w_table_sc16; -extern int dsps_fft4r_w_table_sc16_size; -extern uint8_t dsps_fft4r_sc16_initialized; - -/**@{*/ -/** - * @brief init fft tables - * - * Initialization of Complex FFT Radix-4. This function initialize coefficients table. - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param[inout] fft_table_buff: pointer to floating point buffer where sin/cos table will be stored - * if this parameter set to NULL, and table_size value is more then 0, then - * dsps_fft4r_init_fc32 will allocate buffer internally - * @param[in] max_fft_size: maximum fft size. The buffer for sin/cos table that will be used for radix-4 it's - * four times maximum length of FFT. - * if fft_table_buff is NULL and table_size is not 0, buffer will be allocated internally. - * If table_size is 0, buffer will not be allocated. - * - * @return - * - ESP_OK on success - * - ESP_ERR_DSP_PARAM_OUTOFRANGE if table_size > CONFIG_DSP_MAX_FFT_SIZE - * - ESP_ERR_DSP_REINITIALIZED if buffer already allocated internally by other function - * - One of the error codes from DSP library - */ -esp_err_t dsps_fft4r_init_fc32(float *fft_table_buff, int max_fft_size); -/**@}*/ - -/**@{*/ -/** - * @brief deinit fft tables - * - * Free resources of Complex FFT Radix-4. This function delete coefficients table if it was allocated by dsps_fft4r_init_fc32. - * The implementation use ANSI C and could be compiled and run on any platform - * - * - * @return - */ -void dsps_fft4r_deinit_fc32(); -/**@}*/ - -/**@{*/ -/** - * @brief complex FFT of radix 4 - * - * Complex FFT of radix 4 - * The extension (_ansi) use ANSI C and could be compiled and run on any platform. - * The extension (_ae32) is optimized for ESP32 chip. - * - * @param[inout] data: input/output complex array. An elements located: Re[0], Im[0], ... Re[N-1], Im[N-1] - * result of FFT will be stored to this array. - * @param[in] N: Number of complex elements in input array - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_fft4r_fc32_ansi_(float *data, int N, float *table, int table_size); -esp_err_t dsps_fft4r_fc32_ae32_(float *data, int N, float *table, int table_size); -/**@}*/ -// This is workaround because linker generates permanent error when assembler uses -// direct access to the table pointer -#define dsps_fft4r_fc32_ansi(data, N) dsps_fft4r_fc32_ansi_(data, N, dsps_fft4r_w_table_fc32, dsps_fft4r_w_table_size) -#define dsps_fft4r_fc32_ae32(data, N) dsps_fft4r_fc32_ae32_(data, N, dsps_fft4r_w_table_fc32, dsps_fft4r_w_table_size) - -/**@{*/ -/** - * @brief bit reverse operation for the complex input array radix-4 - * - * Bit reverse operation for the complex input array - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param[inout] data: input/ complex array. An elements located: Re[0], Im[0], ... Re[N-1], Im[N-1] - * result of FFT will be stored to this array. - * @param[in] N: Number of complex elements in input array - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_bit_rev4r_fc32(float *data, int N); -esp_err_t dsps_bit_rev4r_fc32_ae32(float *data, int N); -esp_err_t dsps_bit_rev4r_direct_fc32_ansi(float *data, int N); -esp_err_t dsps_bit_rev4r_sc16_ansi(int16_t *data, int N); - - -/**@{*/ -/** - * @brief Convert complex FFT result to real array - * - * Convert FFT result of complex FFT for real input to real array. - * This function have to be used if FFT used to process real data. - * This function use tabels inside and can be used only it dsps_fft4r_init_fc32(...) was - * called and FFT4 was initialized. - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param[inout] data: Input complex array and result of FFT2R/FFT4R. - * input has size of 2*N, because contains real and imaginary part. - * result will be stored to the same array. - * Input1: input[0..N-1], Input2: input[N..2*N-1] - * @param[in] N: Number of complex elements in input array - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_cplx2real_fc32_ansi_(float *data, int N, float *table, int table_size); -esp_err_t dsps_cplx2real_fc32_ae32_(float *data, int N, float *table, int table_size); -/**@}*/ -#define dsps_cplx2real_fc32_ansi(data, N) dsps_cplx2real_fc32_ansi_(data, N, dsps_fft4r_w_table_fc32, dsps_fft4r_w_table_size) -#define dsps_cplx2real_fc32_ae32(data, N) dsps_cplx2real_fc32_ae32_(data, N, dsps_fft4r_w_table_fc32, dsps_fft4r_w_table_size) - - -esp_err_t dsps_gen_bitrev4r_table(int N, int step, char *name_ext); - -#ifdef __cplusplus -} -#endif - -#if CONFIG_DSP_OPTIMIZED -#if (dsps_fft4r_fc32_ae32_enabled == 1) -#define dsps_fft4r_fc32 dsps_fft4r_fc32_ae32 -#else -#define dsps_fft4r_fc32 dsps_fft4r_fc32_ansi -#endif // dsps_fft4r_fc32_ae32_enabled - -#define dsps_fft4r_sc16 dsps_fft4r_sc16_ae32 -#define dsps_bit_rev4r_fc32 dsps_bit_rev4r_fc32_ae32 - -#if (dsps_cplx2real_fc32_ae32_enabled == 1) -#define dsps_cplx2real_fc32 dsps_cplx2real_fc32_ae32 -#else -#define dsps_cplx2real_fc32 dsps_cplx2real_fc32_ansi -#endif // dsps_cplx2real_fc32_ae32_enabled - -#else -#define dsps_fft4r_fc32 dsps_fft4r_fc32_ansi -#define dsps_fft4r_sc16 dsps_fft4r_sc16_ansi -#define dsps_bit_rev4r_fc32 dsps_bit_rev4r_fc32_ansi -#define dsps_cplx2real_fc32 dsps_cplx2real_fc32_ansi -#endif - -#endif // _dsps_fft4r_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/fft/include/dsps_fft4r_platform.h b/components/esp-dsp/modules/fft/include/dsps_fft4r_platform.h deleted file mode 100644 index 05344922..00000000 --- a/components/esp-dsp/modules/fft/include/dsps_fft4r_platform.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef _dsps_fft4r_platform_H_ -#define _dsps_fft4r_platform_H_ - -#include -#include - - -#if ((XCHAL_HAVE_FP == 1) && (XCHAL_HAVE_LOOPS == 1)) - -#define dsps_fft4r_fc32_ae32_enabled 1 -#define dsps_cplx2real_fc32_ae32_enabled 1 - -#endif // - - -#if ((XCHAL_HAVE_LOOPS == 1) && (XCHAL_HAVE_MAC16 == 1)) - -#define dsps_fft2r_sc16_ae32_enabled 1 - -#endif // - -#if (XCHAL_HAVE_LOOPS == 1) - -#define dsps_bit_rev_lookup_fc32_ae32_enabled 1 - -#endif // - - - -#endif // _dsps_fft4r_platform_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/fft/include/dsps_fft_tables.h b/components/esp-dsp/modules/fft/include/dsps_fft_tables.h deleted file mode 100644 index 94fbab50..00000000 --- a/components/esp-dsp/modules/fft/include/dsps_fft_tables.h +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2018-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. - -#ifndef _dsps_fft_tables_H_ -#define _dsps_fft_tables_H_ - - -#ifdef __cplusplus -extern "C" -{ -#endif -extern const uint16_t bitrev2r_table_16_fc32[]; -extern const uint16_t bitrev2r_table_16_fc32_size; - -extern const uint16_t bitrev2r_table_32_fc32[]; -extern const uint16_t bitrev2r_table_32_fc32_size; - -extern const uint16_t bitrev2r_table_64_fc32[]; -extern const uint16_t bitrev2r_table_64_fc32_size; - -extern const uint16_t bitrev2r_table_128_fc32[]; -extern const uint16_t bitrev2r_table_128_fc32_size; - -extern const uint16_t bitrev2r_table_256_fc32[]; -extern const uint16_t bitrev2r_table_256_fc32_size; - -extern const uint16_t bitrev2r_table_512_fc32[]; -extern const uint16_t bitrev2r_table_512_fc32_size; - -extern const uint16_t bitrev2r_table_1024_fc32[]; -extern const uint16_t bitrev2r_table_1024_fc32_size; - -extern const uint16_t bitrev2r_table_2048_fc32[]; -extern const uint16_t bitrev2r_table_2048_fc32_size; - -extern const uint16_t bitrev2r_table_4096_fc32[]; -extern const uint16_t bitrev2r_table_4096_fc32_size; - -void dsps_fft2r_rev_tables_init_fc32(void); -extern uint16_t *dsps_fft2r_rev_tables_fc32[]; -extern const uint16_t dsps_fft2r_rev_tables_fc32_size[]; - -extern const uint16_t bitrev4r_table_16_fc32[]; -extern const uint16_t bitrev4r_table_16_fc32_size; - -extern const uint16_t bitrev4r_table_32_fc32[]; -extern const uint16_t bitrev4r_table_32_fc32_size; - -extern const uint16_t bitrev4r_table_64_fc32[]; -extern const uint16_t bitrev4r_table_64_fc32_size; - -extern const uint16_t bitrev4r_table_128_fc32[]; -extern const uint16_t bitrev4r_table_128_fc32_size; - -extern const uint16_t bitrev4r_table_256_fc32[]; -extern const uint16_t bitrev4r_table_256_fc32_size; - -extern const uint16_t bitrev4r_table_512_fc32[]; -extern const uint16_t bitrev4r_table_512_fc32_size; - -extern const uint16_t bitrev4r_table_1024_fc32[]; -extern const uint16_t bitrev4r_table_1024_fc32_size; - -extern const uint16_t bitrev4r_table_2048_fc32[]; -extern const uint16_t bitrev4r_table_2048_fc32_size; - -extern const uint16_t bitrev4r_table_4096_fc32[]; -extern const uint16_t bitrev4r_table_4096_fc32_size; - -void dsps_fft4r_rev_tables_init_fc32(void); -extern uint16_t *dsps_fft4r_rev_tables_fc32[]; -extern const uint16_t dsps_fft4r_rev_tables_fc32_size[]; - -#ifdef __cplusplus -} -#endif - -#endif // _dsps_fft_tables_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/fft/test/test_dsps_fft2r_fc32_ae32.c b/components/esp-dsp/modules/fft/test/test_dsps_fft2r_fc32_ae32.c deleted file mode 100644 index 75722444..00000000 --- a/components/esp-dsp/modules/fft/test/test_dsps_fft2r_fc32_ae32.c +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_view.h" -#include "dsps_fft2r.h" -#include "dsp_tests.h" - -static const char *TAG = "fft2r_ae32"; - -static float data[1024*2]; -static float check_data[1024*2]; -static float data_test[1024*2]; - -TEST_CASE("dsps_fft2r_fc32_ae32 functionality", "[dsps]") -{ - int N = sizeof(data) / sizeof(float) / 2; - int check_bin = 32; - float check_ampl = 2; - for (int i = 0 ; i < N ; i++) { - data[i * 2 + 0] = check_ampl * sinf(M_PI / N * check_bin * 2 * i) / (N / 2); - data[i * 2 + 1] = 0; - } - for (int i = 0 ; i < N*2 ; i++) { - check_data[i] = data[i]; - data_test[i] = -1; - } - - // Init FFT tables - esp_err_t ret = dsps_fft2r_init_fc32(NULL, CONFIG_DSP_MAX_FFT_SIZE); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Not possible to initialize FFT. Error = %i", ret); - return; - } - int N_check = N; - - dsps_fft2r_fc32_ae32(data, N_check); - dsps_fft2r_fc32_ansi(check_data, N_check); - - for (int i=0 ; i< N_check ; i++) - { - if (abs(check_data[i] - data[i]) == 0) ESP_LOGD(TAG, "Data[%i] =%8.4f, %8.4f, %8.4f", i, data[i], check_data[i], check_data[i] - data[i]); - else ESP_LOGE(TAG, "Data[%i] =%f, %f, %f", i, data[i], check_data[i], check_data[i] - data[i]); - } - - dsps_bit_rev_fc32_ansi(data, N); - - float min = 10000; - float max = -10000; - int max_pos = 0; - for (int i = 0 ; i < N ; i++) { - data[i] = 10 * log10f(data[i * 2 + 0] * data[i * 2 + 0] + data[i * 2 + 1] * data[i * 2 + 1]); - if (data[i] < min) { - min = data[i]; - } - if (data[i] > max) { - max = data[i]; - max_pos = i; - } - ESP_LOGD(TAG, "FFT Data[%i] =%8.4f dB", i, data[i]); - } - dsps_view_spectrum(data, 256, -160, 40); - - TEST_ASSERT_EQUAL( check_bin, max_pos); - float round_pow = round(max * 10); - TEST_ASSERT_EQUAL( 6 * 10, round_pow); - ESP_LOGI(TAG, "Calculation error is less then 0.1 dB"); - dsps_fft2r_deinit_fc32(); -} - -TEST_CASE("dsps_fft2r_fc32_ae32 benchmark", "[dsps]") -{ - esp_err_t ret = dsps_fft2r_init_fc32(NULL, CONFIG_DSP_MAX_FFT_SIZE); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Not possible to initialize FFT. Error = %i", ret); - return; - } - for (int i= 5 ; i< 10 ; i++) - { - int N_check = 2< -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_view.h" -#include "dsps_fft2r.h" -#include "dsp_tests.h" - -static const char *TAG = "dsps_fft2r_ansi"; - -TEST_CASE("dsps_fft2r_fc32_ansi functionality", "[dsps]") -{ - float* data = (float*)malloc(2*4096*sizeof(float)); - float* check_data = (float*)malloc(2*4096*sizeof(float)); - - int N = 1024; - int check_bin = 32; - for (int i = 0 ; i < N ; i++) { - data[i * 2 + 0] = 2 * sinf(M_PI / N * check_bin * 2 * i) / (N / 2); - data[i * 2 + 1] = 0; - } - - float* fft_table_buff = (float*)malloc((N+2)*sizeof(float)); - fft_table_buff[0] = 1234; - fft_table_buff[N+1] = 5678; - - esp_err_t ret = dsps_fft2r_init_fc32(&fft_table_buff[1], N); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Not possible to initialize FFT. Error = %i", ret); - return; - } - - dsps_fft2r_fc32_ansi(data, N); - unsigned int start_b = xthal_get_ccount(); - dsps_bit_rev_fc32_ansi(data, N); - unsigned int end_b = xthal_get_ccount(); - - float min = 10000; - float max = -10000; - int max_pos = 0; - for (int i = 0 ; i < N ; i++) { - data[i] = 10 * log10f(data[i * 2 + 0] * data[i * 2 + 0] + data[i * 2 + 1] * data[i * 2 + 1]); - if (data[i] < min) { - min = data[i]; - } - if (data[i] > max) { - max = data[i]; - max_pos = i; - } - ESP_LOGD(TAG, "FFT Data[%i] =%8.4f dB", i, data[i]); - } - dsps_view_spectrum(data, 256, -160, 40); - - TEST_ASSERT_EQUAL( check_bin, max_pos); - float round_pow = round(max * 10); - TEST_ASSERT_EQUAL( 6 * 10, round_pow); - ESP_LOGI(TAG, "Calculation error is less then 0.1 dB"); - ESP_LOGI(TAG, "cycles - %i", end_b - start_b); - - ESP_LOGI(TAG, "fft_table_buff[0] = %f, fft_table_buff[N+1] = %f", fft_table_buff[0], fft_table_buff[N+1]); - TEST_ASSERT_EQUAL( fft_table_buff[0], 1234); - TEST_ASSERT_EQUAL( fft_table_buff[N+1], 5678); - free(fft_table_buff); - - free(data); - free(check_data); - dsps_fft2r_deinit_fc32(); -} - -TEST_CASE("dsps_fft2r_fc32_ansi benchmark", "[dsps]") -{ - esp_err_t ret = dsps_fft2r_init_fc32(NULL, CONFIG_DSP_MAX_FFT_SIZE); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Not possible to initialize FFT. Error = %i", ret); - return; - } - float* data = (float*)malloc(2*4096*sizeof(float)); - float* check_data = (float*)malloc(2*4096*sizeof(float)); - for (int i= 5 ; i< 10 ; i++) - { - int N_check = 2< -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_view.h" -#include "dsps_fft2r.h" -#include "dsp_tests.h" - -static const char *TAG = "dsps_fft2r_ae32_s16"; - -static int16_t data[1024*2]; -static int16_t check_data[1024*2]; -static float result_data[1024*2]; - -TEST_CASE("dsps_fft2r_sc16_ae32 functionality", "[dsps]") -{ - int N = sizeof(data) / sizeof(float) / 2; - N = 1024; - int check_bin = 64; - for (int i = 0 ; i < N ; i++) { - data[i * 2 + 0] = (INT16_MAX)*sin(M_PI / N * check_bin *2* i)*0.5 * (1 - cosf(i * 2 * M_PI / (float)(N-1))); - data[i * 2 + 1] = 0; - } - - esp_err_t ret = dsps_fft2r_init_sc16(NULL, CONFIG_DSP_MAX_FFT_SIZE); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Not possible to initialize FFT. Error = %i", ret); - return; - } - - dsps_fft2r_sc16_ae32(data, N); - unsigned int start_b = xthal_get_ccount(); - dsps_bit_rev_sc16_ansi(data, N); - unsigned int end_b = xthal_get_ccount(); - - - for (int i=0 ; i< N ; i++) - { - ESP_LOGD(TAG, "Data[%i] %04x\n", i/2, data[i]); - } - - float min = 10000; - float max = -10000; - int max_pos = 0; - for (int i = 0 ; i < (N*2) ; i++) - { - result_data[i] = data[i]; - result_data[i] = result_data[i]/INT16_MAX; - } - - for (int i = 0 ; i < N ; i++) { - result_data[i] = 10 * log10f(0.0000000000001 + result_data[i * 2 + 0] * result_data[i * 2 + 0] + result_data[i * 2 + 1] * result_data[i * 2 + 1]); - if (result_data[i] < min) { - min = result_data[i]; - } - if (result_data[i] > max) { - max = result_data[i]; - max_pos = i; - } - ESP_LOGD(TAG, "FFT Data[%i] =%8.4f dB", i, result_data[i]); - } - dsps_view_spectrum(result_data, N, -100, 0); - float round_pow = round(max*5); - - ESP_LOGI(TAG, "max_bin=%i, check_bin=%i, round_pow=%f\n", max_pos, check_bin, round_pow); - - if (max_pos < N/2) TEST_ASSERT_EQUAL( check_bin, max_pos); - else TEST_ASSERT_EQUAL( N - check_bin, max_pos); - TEST_ASSERT_EQUAL( -12*5, round_pow); - ESP_LOGI(TAG, "Calculation error is less then 0.2 dB"); - ESP_LOGI(TAG, "cycles - %i", end_b - start_b); - dsps_fft2r_deinit_sc16(); -} - - -TEST_CASE("dsps_fft2r_sc16_ae32 overflow check", "[dsps]") -{ - int N = sizeof(data) / sizeof(float) / 2; - N = 1024; - int check_bin = 32; - int bins_count = 4; - for (int i = 0 ; i < N ; i++) { - data[i * 2 + 0] = 0; - data[i * 2 + 1] = 0; - for (int n=1; n<=bins_count ; n++ ) - { - data[i * 2 + 0] += (INT16_MAX)*cos(M_PI / N * check_bin *2* i*n)/bins_count; - data[i * 2 + 1] += (INT16_MAX)*sin(M_PI / N * check_bin *2* i*n)/bins_count; - } - } - - esp_err_t ret = dsps_fft2r_init_sc16(NULL, CONFIG_DSP_MAX_FFT_SIZE); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Not possible to initialize FFT. Error = %i", ret); - return; - } - - dsps_fft2r_sc16_ae32(data, N); - unsigned int start_b = xthal_get_ccount(); - dsps_bit_rev_sc16_ansi(data, N); - unsigned int end_b = xthal_get_ccount(); - - - for (int i=0 ; i< N ; i++) - { - ESP_LOGD(TAG, "Data[%i] %04x\n", i/2, data[i]); - } - - float min = 10000; - float max = -10000; - int max_pos = 0; - for (int i = 0 ; i < (N*2) ; i++) - { - result_data[i] = data[i]; - result_data[i] = result_data[i]/INT16_MAX; - } - - for (int i = 0 ; i < N ; i++) { - result_data[i] = 10 * log10f(0.0000000000001 + result_data[i * 2 + 0] * result_data[i * 2 + 0] + result_data[i * 2 + 1] * result_data[i * 2 + 1]); - if (result_data[i] < min) { - min = result_data[i]; - } - if (result_data[i] > max) { - max = result_data[i]; - max_pos = i; - } - ESP_LOGD(TAG, "FFT Data[%i] =%8.4f dB", i, result_data[i]); - } - dsps_view_spectrum(result_data, N, -100, 0); - float round_pow = round(max*5); - - float noise_pow = -100; - for (int i=(bins_count*check_bin + 10) ; i< N ; i++) - { - if (result_data[i] > noise_pow) - { - noise_pow = result_data[i]; - } - } - ESP_LOGI(TAG, "max_bin=%i, check_bin=%i, round_pow=%f, noise power=%f\n", max_pos, check_bin, round_pow, noise_pow); - - if (noise_pow > (-65)) - { - TEST_ASSERT_MESSAGE (false, "Exec time takes more than expected!"); - } - - ESP_LOGI(TAG, "cycles - %i", end_b - start_b); - dsps_fft2r_deinit_sc16(); -} - -TEST_CASE("dsps_fft2r_sc16_ae32 benchmark", "[dsps]") -{ - esp_err_t ret = dsps_fft2r_init_sc16(NULL, CONFIG_DSP_MAX_FFT_SIZE); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Not possible to initialize FFT. Error = %i", ret); - return; - } - for (int i= 5 ; i< 10 ; i++) - { - int N_check = 2< -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_view.h" -#include "dsps_fft2r.h" -#include "dsp_tests.h" - -static const char *TAG = "dsps_fft2r_ansi_s16"; - -static int16_t data[1024*2]; -static float result_data[1024*2]; - -TEST_CASE("dsps_fft2r_sc16_ansi functionality", "[dsps]") -{ - int N = sizeof(data) / sizeof(float) / 2; - N = 1024; - int check_bin = 64; - for (int i = 0 ; i < N ; i++) { - data[i * 2 + 0] = (INT16_MAX)*sin(M_PI / N * check_bin *2* i)*0.5 * (1 - cosf(i * 2 * M_PI / (float)(N-1))); - data[i * 2 + 1] = 0; - } - int16_t* fft_table_buff = (int16_t*)malloc((N+2)*sizeof(int16_t)); - fft_table_buff[0] = 1234; - fft_table_buff[N+1] = 5678; - esp_err_t ret = dsps_fft2r_init_sc16(&fft_table_buff[1], N); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Not possible to initialize FFT. Error = 0x%8.8x", ret); - return; - } - - dsps_fft2r_sc16_ansi(data, N); - unsigned int start_b = xthal_get_ccount(); - dsps_bit_rev_sc16_ansi(data, N); - unsigned int end_b = xthal_get_ccount(); - - - for (int i=0 ; i< N ; i++) - { - ESP_LOGD(TAG, "Data[%i] %i\n", i/2, data[i]); - } - - float min = 10000; - float max = -10000; - int max_pos = 0; - for (int i = 0 ; i < (N*2) ; i++) - { - result_data[i] = data[i]; - result_data[i] = result_data[i]/INT16_MAX; - } - - for (int i = 0 ; i < N ; i++) { - result_data[i] = 10 * log10f(0.0000000000001 + result_data[i * 2 + 0] * result_data[i * 2 + 0] + result_data[i * 2 + 1] * result_data[i * 2 + 1]); - if (result_data[i] < min) { - min = result_data[i]; - } - if (result_data[i] > max) { - max = result_data[i]; - max_pos = i; - } - ESP_LOGD(TAG, "FFT Data[%i] =%8.4f dB", i, result_data[i]); - } - dsps_view_spectrum(result_data, N, -100, 0); - float round_pow = round(max*5); - - ESP_LOGI(TAG, "max_bin=%i, check_bin=%i, round_pow=%f\n", max_pos, check_bin, round_pow); - - if (max_pos < N/2) TEST_ASSERT_EQUAL( check_bin, max_pos); - else TEST_ASSERT_EQUAL( N - check_bin, max_pos); - TEST_ASSERT_EQUAL( -12*5, round_pow); - ESP_LOGI(TAG, "Calculation error is less then 0.2 dB"); - ESP_LOGI(TAG, "cycles - %i", end_b - start_b); - // Check if we not out of range - ESP_LOGI(TAG, "fft_table_buff[0] = %i, fft_table_buff[N+1] = %i", fft_table_buff[0], fft_table_buff[N+1]); - TEST_ASSERT_EQUAL( fft_table_buff[0], 1234); - TEST_ASSERT_EQUAL( fft_table_buff[N+1], 5678); - free(fft_table_buff); - dsps_fft2r_deinit_sc16(); -} - -TEST_CASE("dsps_fft2r_sc16_ansi benchmark", "[dsps]") -{ - esp_err_t ret = dsps_fft2r_init_sc16(NULL, CONFIG_DSP_MAX_FFT_SIZE); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Not possible to initialize FFT. Error = %i", ret); - return; - } - for (int i= 5 ; i< 10 ; i++) - { - int N_check = 2< -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_view.h" -#include "dsps_fft2r.h" -#include "dsps_fft4r.h" -#include "dsp_tests.h" - - -static const char *TAG = "dsps_fft4r_ae32"; - -TEST_CASE("dsps_fft4r_fc32_ae32 functionality", "[dsps]") -{ - float* data = (float*)malloc(sizeof(float) * 4096*2); - float* check_data_fft = (float*)malloc(sizeof(float) * 4096*2); - if (data == NULL) - { - ESP_LOGE(TAG, "Not possible to allocate data."); - return; - } - if (check_data_fft == NULL) - { - ESP_LOGE(TAG, "Not possible to allocate check_data_fft."); - return; - } - esp_err_t ret = dsps_fft4r_init_fc32(NULL, CONFIG_DSP_MAX_FFT_SIZE); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Not possible to initialize FFT. Error = %i", ret); - return; - } - int N_check = 256; - for (size_t pow = 2; pow < 7; pow++) - { - N_check = 1<< (pow*2); - for (size_t i = 0; i < N_check; i++) - { - data[i*2] = cosf(2*M_PI*4/256*i); - data[i*2+1] = sinf(2*M_PI*18/256*i); - - check_data_fft[i*2] = data[i*2]; - check_data_fft[i*2+1] = data[i*2 + 1]; - } - - dsps_fft4r_fc32_ansi(data, N_check); - dsps_bit_rev4r_fc32(data, N_check); - - dsps_fft4r_fc32_ae32(check_data_fft, N_check); - dsps_bit_rev4r_fc32(check_data_fft, N_check); - float diff = 0; - for (size_t i = 0; i < N_check*2; i++) - { - diff += fabs(data[i] - check_data_fft[i]); - } - diff = diff/N_check; - if (diff > 0.00001) - { - TEST_ASSERT_MESSAGE (false, "Result out of range!\n"); - } - ESP_LOGI(TAG, "diff[%i] = %f\n", N_check, diff); - } - - dsps_view(data, N_check*2, 128, 16, -256, 256, '.'); - dsps_view(check_data_fft, N_check*2, 128, 16, -256, 256, '.'); - - dsps_fft2r_deinit_fc32(); - dsps_fft4r_deinit_fc32(); - free(data); - free(check_data_fft); -} - -static portMUX_TYPE testnlock = portMUX_INITIALIZER_UNLOCKED; - -TEST_CASE("dsps_fft4r_fc32_ae32 benchmark", "[dsps]") -{ - float* check_data_fft = (float*)malloc(sizeof(float) * 4096*2); - - unsigned int start_b; - float cycles; - - esp_err_t ret = dsps_fft4r_init_fc32(NULL, CONFIG_DSP_MAX_FFT_SIZE); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Not possible to initialize FFT. Error = %i", ret); - return; - } - int N_check = 256; - for (size_t pow = 2; pow < 7; pow++) - { - N_check = 1<< (pow*2); - for (size_t i = 0; i < N_check; i++) - { - check_data_fft[i*2] = cosf(2*M_PI*4/256*i); - check_data_fft[i*2+1] = sinf(2*M_PI*18/256*i); - } - - portENTER_CRITICAL(&testnlock); - start_b = xthal_get_ccount(); - dsps_fft4r_fc32_ae32(check_data_fft, N_check); - dsps_bit_rev4r_fc32(check_data_fft, N_check); - cycles = xthal_get_ccount() - start_b; - portEXIT_CRITICAL(&testnlock); - - ESP_LOGI(TAG, "Benchmark dsps_fft4r_fc32_ae32 - %6i cycles for %6i points FFT.", (int)cycles, N_check); - } - - dsps_fft4r_deinit_fc32(); - free(check_data_fft); -} - -TEST_CASE("dsps_cplx2real_fc32_ae32 benchmark", "[dsps]") -{ - float* check_data_fft = (float*)malloc(sizeof(float) * 4096*2); - - unsigned int start_b; - float cycles; - - esp_err_t ret = dsps_fft4r_init_fc32(NULL, CONFIG_DSP_MAX_FFT_SIZE); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Not possible to initialize FFT. Error = %i", ret); - return; - } - int N_check = 256; - for (size_t pow = 4; pow < 13; pow++) - { - N_check = 1<< (pow); - for (size_t i = 0; i < N_check; i++) - { - check_data_fft[i*2] = cosf(2*M_PI*4/256*i); - check_data_fft[i*2+1] = sinf(2*M_PI*18/256*i); - } - - portENTER_CRITICAL(&testnlock); - start_b = xthal_get_ccount(); - dsps_cplx2real_fc32_ae32(check_data_fft, N_check); - cycles = xthal_get_ccount() - start_b; - portEXIT_CRITICAL(&testnlock); - - ESP_LOGI(TAG, "Benchmark dsps_cplx2real_fc32_ae32 - %6i cycles for %6i points FFT.", (int)cycles, N_check); - } - - dsps_fft4r_deinit_fc32(); - free(check_data_fft); -} - -TEST_CASE("dsps_bit_rev4r_fc32_ansi benchmark", "[dsps]") -{ - float* check_data_fft = (float*)malloc(sizeof(float) * 4096*2); - - unsigned int start_b; - float cycles; - - esp_err_t ret = dsps_fft4r_init_fc32(NULL, CONFIG_DSP_MAX_FFT_SIZE); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Not possible to initialize FFT. Error = %i", ret); - return; - } - int N_check = 256; - for (size_t pow = 3; pow < 7; pow++) - { - N_check = 1<< (2*pow); - for (size_t i = 0; i < N_check; i++) - { - check_data_fft[i*2] = cosf(2*M_PI*4/256*i); - check_data_fft[i*2+1] = sinf(2*M_PI*18/256*i); - } - - portENTER_CRITICAL(&testnlock); - start_b = xthal_get_ccount(); - dsps_bit_rev4r_fc32(check_data_fft, N_check); - cycles = xthal_get_ccount() - start_b; - portEXIT_CRITICAL(&testnlock); - - ESP_LOGI(TAG, "Benchmark dsps_bit_rev4r_fc32_ansi - %6i cycles for %6i points FFT.", (int)cycles, N_check); - } - - dsps_fft4r_deinit_fc32(); - free(check_data_fft); -} - diff --git a/components/esp-dsp/modules/fft/test/test_dsps_fft4r_fc32_ansi.c b/components/esp-dsp/modules/fft/test/test_dsps_fft4r_fc32_ansi.c deleted file mode 100644 index da3fceaa..00000000 --- a/components/esp-dsp/modules/fft/test/test_dsps_fft4r_fc32_ansi.c +++ /dev/null @@ -1,236 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_view.h" -#include "dsps_fft2r.h" -#include "dsps_fft4r.h" -#include "dsp_tests.h" - - -static const char *TAG = "dsps_fft4r_ansi"; - -TEST_CASE("dsps_fft4r_fc32_ansi functionality", "[dsps]") -{ - float* data = (float*)malloc(sizeof(float) * 1024*2); - float* check_data_fft = (float*)malloc(sizeof(float) * 1024*2); - esp_err_t ret; - ret = dsps_fft2r_init_fc32(NULL, 1024); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Not possible to initialize FFT2R. Error = %i", ret); - return; - } - ret = dsps_fft4r_init_fc32(NULL, 1024); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Not possible to initialize FFT4R. Error = %i", ret); - return; - } - int N_check = 256; - for (size_t pow = 2; pow < 6; pow++) - { - N_check = 1<< (pow*2); - for (size_t i = 0; i < N_check; i++) - { - data[i*2] = cosf(2*M_PI*4/256*i); - data[i*2+1] = sinf(2*M_PI*18/256*i); - - check_data_fft[i*2] = data[i*2]; - check_data_fft[i*2+1] = data[i*2 + 1]; - } - - dsps_fft2r_fc32_ansi(data, N_check); - dsps_bit_rev_fc32_ansi(data, N_check); - - dsps_fft4r_fc32_ansi(check_data_fft, N_check); - dsps_bit_rev4r_fc32(check_data_fft, N_check); - - float diff = 0; - for (size_t i = 0; i < N_check*2; i++) - { - diff += fabs(data[i] - check_data_fft[i]); - } - diff = diff/N_check; - ESP_LOGI(TAG, "diff[%i] = %f\n", N_check, diff); - if (diff > 0.00001) - { - dsps_view(data, N_check*2, 128, 16, -N_check, N_check, '.'); - dsps_view(check_data_fft, N_check*2, 128, 16, -N_check, N_check, '.'); - - TEST_ASSERT_MESSAGE (false, "Result out of range!\n"); - } - } - - dsps_view(data, N_check*2, 128, 16, -N_check, N_check, '.'); - dsps_view(check_data_fft, N_check*2, 128, 16, -N_check, N_check, '.'); - - dsps_fft2r_deinit_fc32(); - dsps_fft4r_deinit_fc32(); - free(data); - free(check_data_fft); -} - -TEST_CASE("dsps_fft4r_fc32_ansi benchmark", "[dsps]") -{ - float* check_data_fft = (float*)malloc(sizeof(float) * 4096*2); - - unsigned int start_b; - float cycles; - - esp_err_t ret = dsps_fft4r_init_fc32(NULL, CONFIG_DSP_MAX_FFT_SIZE); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Not possible to initialize FFT. Error = %i", ret); - return; - } - int N_check = 256; - for (size_t pow = 2; pow < 7; pow++) - { - N_check = 1<< (pow*2); - for (size_t i = 0; i < N_check; i++) - { - check_data_fft[i*2] = cosf(2*M_PI*4/256*i); - check_data_fft[i*2+1] = sinf(2*M_PI*18/256*i); - } - - start_b = xthal_get_ccount(); - dsps_fft4r_fc32_ansi(check_data_fft, N_check); - dsps_bit_rev4r_fc32(check_data_fft, N_check); - cycles = xthal_get_ccount() - start_b; - - ESP_LOGI(TAG, "Benchmark dsps_fft4r_fc32_ansi - %6i cycles for %6i points FFT.", (int)cycles, N_check); - } - - dsps_fft4r_deinit_fc32(); - free(check_data_fft); -} - - -TEST_CASE("dsps_cplx2real_fc32 functionality", "[dsps]") -{ - float* data = (float*)malloc(sizeof(float) * 1024*2); - float* check_data_fft = (float*)malloc(sizeof(float) * 1024*2); - - esp_err_t ret = dsps_fft4r_init_fc32(NULL, 1024); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Not possible to initialize FFT. Error = %i", ret); - return; - } - ret = dsps_fft2r_init_fc32(NULL, 1024); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Not possible to initialize FFT. Error = %i", ret); - return; - } - - int N_check = 256; - for (size_t pow = 4; pow < 11; pow++) - { - N_check = 1<< (pow); - for (size_t i = 0; i < N_check*2; i++) - { - data[i] = 0; - check_data_fft[i] = data[i]; - } - data[1] = N_check; - check_data_fft[1] = data[1]; - - dsps_fft2r_fc32_ansi(data, N_check); - dsps_bit_rev_fc32_ansi(data, N_check); - dsps_cplx2real_fc32_ansi(data, N_check); - - dsps_fft2r_fc32_ansi(check_data_fft, N_check); - dsps_bit_rev_fc32_ansi(check_data_fft, N_check); - dsps_cplx2real_fc32_ae32(check_data_fft, N_check); - - float diff = 0; - for (size_t i = 0; i < N_check*2; i++) - { - diff += fabs(data[i] - check_data_fft[i]); - } - diff = diff/N_check; - if (diff > 0.00001) - { - for (size_t i = 0; i < N_check*2; i++) - { - ESP_LOGD(TAG, "data[%i]= %f, %f = check_data_fft[%i], diff=%f\n", i, data[i], check_data_fft[i], i, data[i] - check_data_fft[i]); - } - - dsps_view(data, N_check*2, 128, 16, -N_check, N_check, '.'); - dsps_view(check_data_fft, N_check*2, 128, 16, -N_check, N_check, '.'); - ESP_LOGE(TAG, "Error diff[%i] = %f\n", N_check, diff); - TEST_ASSERT_MESSAGE (false, "Result out of range!\n"); - } - - ESP_LOGI(TAG, "diff[%i] = %f\n", N_check, diff); - } - - free(data); - free(check_data_fft); - - dsps_fft4r_deinit_fc32(); - dsps_fft2r_deinit_fc32(); -} - -static portMUX_TYPE testnlock = portMUX_INITIALIZER_UNLOCKED; - -TEST_CASE("dsps_cplx2real_fc32_ansi benchmark", "[dsps]") -{ - float* check_data_fft = (float*)malloc(sizeof(float) * 4096*2); - unsigned int start_b; - float cycles; - - esp_err_t ret = dsps_fft4r_init_fc32(NULL, CONFIG_DSP_MAX_FFT_SIZE); - if (ret != ESP_OK) - { - ESP_LOGE(TAG, "Not possible to initialize FFT. Error = %i", ret); - return; - } - int N_check = 256; - for (size_t pow = 4; pow < 13; pow++) - { - N_check = 1<< (pow); - for (size_t i = 0; i < N_check; i++) - { - check_data_fft[i*2] = cosf(2*M_PI*4/256*i); - check_data_fft[i*2+1] = sinf(2*M_PI*18/256*i); - } - - portENTER_CRITICAL(&testnlock); - start_b = xthal_get_ccount(); - dsps_cplx2real_fc32_ansi(check_data_fft, N_check); - cycles = xthal_get_ccount() - start_b; - portEXIT_CRITICAL(&testnlock); - - ESP_LOGI(TAG, "Benchmark dsps_cplx2real_fc32_ansi - %6i cycles for %6i points FFT.", (int)cycles, N_check); - } - - dsps_fft4r_deinit_fc32(); - free(check_data_fft); -} - -TEST_CASE("dsps_gen_bitrev4r_table bitrev table generation.", "[dsps]") -{ - for (int i= 2 ; i< 7 ; i++) - { - int N_check = 1<<(i*2); - dsps_gen_bitrev4r_table(N_check, 8, "fc32"); - } -} diff --git a/components/esp-dsp/modules/fir/float/dsps_fir_f32_ae32.S b/components/esp-dsp/modules/fir/float/dsps_fir_f32_ae32.S deleted file mode 100644 index 0d023c50..00000000 --- a/components/esp-dsp/modules/fir/float/dsps_fir_f32_ae32.S +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_fir_platform.h" -#if (dsps_fir_f32_ae32_enabled == 1) - -#include "dsps_dotprod_f32_m_ae32.S" - -// This is FIR filter for ESP32 processor. - .text - .align 4 - .global dsps_fir_f32_ae32 - .type dsps_fir_f32_ae32,@function -// The function implements the following C code: -//esp_err_t dsps_fir_f32_ae32(fir_f32_t* fir, const float* input, float* output, int len); - -dsps_fir_f32_ae32: -// fir - a2 -// input - a3 -// output - a4 -// len - a5 - - entry a1, 16 - // Array increment for floating point data should be 4 - l32i a7, a2, 12 // a7 - pos - movi a10, 4 - mull a13, a7, a10// a13 - a7*4 - l32i a6, a2, 8 // a6 - N - mull a6, a6, a10// a6 = a6*4 - l32i a10, a2, 0 // a10 - coeffs - add a10, a10, a6 // a10 = &coeffs[N]; - addi a10, a10, -4 // a10 = &coeffs[N-1]; - l32i a11, a2, 4 // a11 - delay line - l32i a6, a2, 8 // a6 - N - movi.n a9, 0 - -// a13 - delay index -fir_loop_len: - // Store to delay line - lsi f0, a3, 0 // f0 = x[i] - addi a3, a3, 4 // x++ - ssx f0, a11, a13 // delay[a13] = f0; - addi a13, a13, 4 // a13++ - addi a7, a7, 1 // a7++ - // verify deley line - blt a7, a6, do_not_reset_a13 - movi a13, 0 - movi a7, 0 - do_not_reset_a13: - // Calc amount for delay line before end - mov a15, a10 // a15 - coeffs - wfr f2, a9 // f2 = 0; - sub a14, a6, a7 // a14 = N-pos - loopnez a14, first_fir_loop // pos...N-1 - lsi f1, a15, 0 - addi a15, a15, -4 // a15-- - lsx f0, a11, a13 // load delay f0 = delay[pos] - addi a13, a13, 4 // a13++, pos++ - madd.s f2, f0, f1 // f2 += f0*f1 -first_fir_loop: - movi a13, 0 // load delay line counter to 0 - loopnez a7, second_fir_loop // 0..pos - lsi f1, a15, 0 - addi a15, a15, -4 // a15-- - lsx f0, a11, a13 // load delay f0 = delay[pos] - addi a13, a13, 4 // a13++, pos++ - madd.s f2, f0, f1 // f2 += f0*f1 -second_fir_loop: - - // and after end - // Store result - ssi f2, a4, 0 - //s32i a13, a4, 0// just for debug *a4 = a13 - addi a4, a4, 4 // y++ - increment output pointer - // Check loop - addi a5, a5, -1 - bnez a5, fir_loop_len - // store state - - s32i a7, a2, 12 // pos = a7 - movi.n a2, 0 // return status ESP_OK - retw.n - -#endif // dsps_fir_f32_ae32_enabled \ No newline at end of file diff --git a/components/esp-dsp/modules/fir/float/dsps_fir_f32_ansi.c b/components/esp-dsp/modules/fir/float/dsps_fir_f32_ansi.c deleted file mode 100644 index 7a50c23f..00000000 --- a/components/esp-dsp/modules/fir/float/dsps_fir_f32_ansi.c +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_fir.h" - -esp_err_t dsps_fir_f32_ansi(fir_f32_t *fir, const float *input, float *output, int len) -{ - for (int i = 0 ; i < len ; i++) { - float acc = 0; - int coeff_pos = fir->N - 1; - fir->delay[fir->pos] = input[i]; - fir->pos++; - if (fir->pos >= fir->N) { - fir->pos = 0; - } - for (int n = fir->pos; n < fir->N ; n++) { - acc += fir->coeffs[coeff_pos--] * fir->delay[n]; - } - for (int n = 0; n < fir->pos ; n++) { - acc += fir->coeffs[coeff_pos--] * fir->delay[n]; - } - output[i] = acc; - } - return ESP_OK; -} - diff --git a/components/esp-dsp/modules/fir/float/dsps_fir_init_f32.c b/components/esp-dsp/modules/fir/float/dsps_fir_init_f32.c deleted file mode 100644 index 56360d89..00000000 --- a/components/esp-dsp/modules/fir/float/dsps_fir_init_f32.c +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_fir.h" - - -esp_err_t dsps_fir_init_f32(fir_f32_t *fir, float *coeffs, float *delay, int N) -{ - fir->coeffs = coeffs; - fir->delay = delay; - fir->N = N; - fir->pos = 0; - - for (int i = 0 ; i < N; i++) { - fir->delay[i] = 0; - } - return ESP_OK; -} diff --git a/components/esp-dsp/modules/fir/float/dsps_fird_f32_ae32.S b/components/esp-dsp/modules/fir/float/dsps_fird_f32_ae32.S deleted file mode 100644 index b876548c..00000000 --- a/components/esp-dsp/modules/fir/float/dsps_fird_f32_ae32.S +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_fir_platform.h" -#if (dsps_fird_f32_ae32_enabled == 1) - -#include "dsps_dotprod_f32_m_ae32.S" - -// This is FIR filter for ESP32 processor. - .text - .align 4 - .global dsps_fird_f32_ae32 - .type dsps_fird_f32_ae32,@function -// The function implements the following C code: -//esp_err_t dsps_fir_f32_ae32(fir_f32_t* fir, const float* input, float* output, int len); - -dsps_fird_f32_ae32: -// fir - a2 -// input - a3 -// output - a4 -// len - a5 - - entry a1, 16 - // Array increment for floating point data should be 4 - l32i a7, a2, 12 // a7 - pos - movi a10, 4 - mull a13, a7, a10// a13 - a7*4 - l32i a6, a2, 8 // a6 - N - mull a6, a6, a10// a6 = a6*4 - l32i a10, a2, 0 // a10 - coeffs - add a10, a10, a6 // a10 = &coeffs[N]; - addi a10, a10, -4 // a10 = &coeffs[N-1]; - l32i a11, a2, 4 // a11 - delay line - l32i a6, a2, 8 // a6 - N - l32i a12, a2, 16 // a12 - decimation - l32i a9, a2, 20 // a9 - d_pos - movi a8, 0 // result = 0; - -// a13 - delay index -fird_loop_len: - // Store to delay line - lsi f0, a3, 0 // f0 = x[i] - addi a3, a3, 4 // x++ - ssx f0, a11, a13 // delay[a13] = f0; - addi a13, a13, 4 // a13++ - addi a7, a7, 1 // a7++ - // verify deley line - blt a7, a6, do_not_reset_a13 - movi a13, 0 - movi a7, 0 - do_not_reset_a13: - // calc d_pos - addi a9, a9, 1 - blt a9, a12, next_itt_fir32 // Jump if d_pos < d - addi a8, a8, 1 - movi a9, 0 // reset d_pos - // Calc amount for delay line before end - mov a15, a10 // a15 - coeffs - wfr f2, a9 // f2 = 0; - sub a14, a6, a7 // a14 = N-pos - loopnez a14, first_fird_loop // pos...N-1 - lsi f1, a15, 0 - addi a15, a15, -4 // a15-- - lsx f0, a11, a13 // load delay f0 = delay[pos] - addi a13, a13, 4 // a13++, pos++ - madd.s f2, f0, f1 // f2 += f0*f1 -first_fird_loop: - movi a13, 0 // load delay line counter to 0 - loopnez a7, second_fird_loop // 0..pos - lsi f1, a15, 0 - addi a15, a15, -4 // a15-- - lsx f0, a11, a13 // load delay f0 = delay[pos] - addi a13, a13, 4 // a13++, pos++ - madd.s f2, f0, f1 // f2 += f0*f1 -second_fird_loop: - - // and after end - // Store result - ssi f2, a4, 0 - addi a4, a4, 4 // y++ - increment output pointer -next_itt_fir32: - // Check loop - addi a5, a5, -1 - bnez a5, fird_loop_len - // store state - - s32i a7, a2, 12 // pos = a7 - s32i a9, a2, 20 // d_pos = a9 - - mov a2, a8 // return status ESP_OK - retw.n - -#endif // dsps_fird_f32_ae32_enabled \ No newline at end of file diff --git a/components/esp-dsp/modules/fir/float/dsps_fird_f32_ansi.c b/components/esp-dsp/modules/fir/float/dsps_fird_f32_ansi.c deleted file mode 100644 index efdce1a5..00000000 --- a/components/esp-dsp/modules/fir/float/dsps_fird_f32_ansi.c +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_fir.h" - -int dsps_fird_f32_ansi(fir_f32_t *fir, const float *input, float *output, int len) -{ - int result = 0; - for (int i = 0; i < len ; i++) { - fir->delay[fir->pos++] = input[i]; - if (fir->pos >= fir->N) { - fir->pos = 0; - } - fir->d_pos++; - if (fir->d_pos >= fir->decim) { - fir->d_pos = 0; - float acc = 0; - int coeff_pos = fir->N - 1; - for (int n = fir->pos; n < fir->N ; n++) { - acc += fir->coeffs[coeff_pos--] * fir->delay[n]; - } - for (int n = 0; n < fir->pos ; n++) { - acc += fir->coeffs[coeff_pos--] * fir->delay[n]; - } - output[result++] = acc; - } - } - return result; -} \ No newline at end of file diff --git a/components/esp-dsp/modules/fir/float/dsps_fird_init_f32.c b/components/esp-dsp/modules/fir/float/dsps_fird_init_f32.c deleted file mode 100644 index bb4fa4cd..00000000 --- a/components/esp-dsp/modules/fir/float/dsps_fird_init_f32.c +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_fir.h" - - -esp_err_t dsps_fird_init_f32(fir_f32_t *fir, float *coeffs, float *delay, int N, int decim, int start_pos) -{ - fir->coeffs = coeffs; - fir->delay = delay; - fir->N = N; - fir->pos = 0; - fir->decim = decim; - fir->d_pos = start_pos; - if (fir->d_pos >= fir->decim) { - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - } - - for (int i = 0 ; i < N; i++) { - fir->delay[i] = 0; - } - return ESP_OK; -} diff --git a/components/esp-dsp/modules/fir/include/dsps_fir.h b/components/esp-dsp/modules/fir/include/dsps_fir.h deleted file mode 100644 index b18fc9c5..00000000 --- a/components/esp-dsp/modules/fir/include/dsps_fir.h +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright 2018-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. - -#ifndef _dsps_fir_H_ -#define _dsps_fir_H_ - - -#include "dsp_err.h" - -#include "dsps_fir_platform.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - -/** - * @brief Data struct of f32 fir filter - * - * This structure used by filter internally. User should access this structure only in case of - * extensions for the DSP Library. - * All fields of this structure initialized by dsps_fir_init_f32(...) function. - */ -typedef struct fir_f32_s { - float *coeffs; /*!< Pointer to the coefficient buffer.*/ - float *delay; /*!< Pointer to the delay line buffer.*/ - int N; /*!< FIR filter coefficients amount.*/ - int pos; /*!< Position in delay line.*/ - int decim; /*!< Decimation factor.*/ - int d_pos; /*!< Actual decimation counter.*/ -} fir_f32_t; - -/** - * @brief initialize structure for 32 bit FIR filter - * - * Function initialize structure for 32 bit floating point FIR filter - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param fir: pointer to fir filter structure, that must be preallocated - * @param coeffs: array with FIR filter coefficients. Must be length N - * @param delay: array for FIR filter delay line. Must be length N - * @param N: FIR filter length. Length of coeffs and delay arrays. - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_fir_init_f32(fir_f32_t *fir, float *coeffs, float *delay, int N); - -/** - * @brief initialize structure for 32 bit Decimation FIR filter - * Function initialize structure for 32 bit floating point FIR filter with decimation - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param fir: pointer to fir filter structure, that must be preallocated - * @param coeffs: array with FIR filter coefficients. Must be length N - * @param delay: array for FIR filter delay line. Must be length N - * @param N: FIR filter length. Length of coeffs and delay arrays. - * @param decim: decimation factor. - * @param start_pos: initial value of decimation counter. Must be [0..d) - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_fird_init_f32(fir_f32_t *fir, float *coeffs, float *delay, int N, int decim, int start_pos); - - -/**@{*/ -/** - * @brief FIR filter - * - * Function implements FIR filter - * The extension (_ansi) use ANSI C and could be compiled and run on any platform. - * The extension (_ae32) is optimized for ESP32 chip. - * - * @param fir: pointer to fir filter structure, that must be initialized before - * @param[in] input: input array - * @param[out] output: array with result of FIR filter - * @param[in] len: length of input and result arrays - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_fir_f32_ansi(fir_f32_t *fir, const float *input, float *output, int len); -esp_err_t dsps_fir_f32_ae32(fir_f32_t *fir, const float *input, float *output, int len); -/**@}*/ - -/**@{*/ -/** - * @brief Decimation FIR filter - * - * Function implements FIR filter with decimation - * The extension (_ansi) use ANSI C and could be compiled and run on any platform. - * The extension (_ae32) is optimized for ESP32 chip. - * - * @param fir: pointer to fir filter structure, that must be initialized before - * @param input: input array - * @param output: array with result of FIR filter - * @param len: length of input and result arrays - * - * @return: function returns amount of samples stored to the output array - * depends on the previous state value could be [0..len/decimation] - */ -int dsps_fird_f32_ansi(fir_f32_t *fir, const float *input, float *output, int len); -int dsps_fird_f32_ae32(fir_f32_t *fir, const float *input, float *output, int len); -/**@}*/ - - -#ifdef __cplusplus -} -#endif - - -#if CONFIG_DSP_OPTIMIZED - -#if (dsps_fir_f32_ae32_enabled == 1) -#define dsps_fir_f32 dsps_fir_f32_ae32 -#else -#define dsps_fir_f32 dsps_fir_f32_ansi -#endif - -#if (dsps_fird_f32_ae32_enabled == 1) -#define dsps_fird_f32 dsps_fird_f32_ae32 -#else -#define dsps_fird_f32 dsps_fird_f32_ansi -#endif - -#else // CONFIG_DSP_OPTIMIZED -#define dsps_fir_f32 dsps_fir_f32_ansi -#define dsps_fird_f32 dsps_fird_f32_ansi -#endif // CONFIG_DSP_OPTIMIZED - -#endif // _dsps_fir_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/fir/include/dsps_fir_platform.h b/components/esp-dsp/modules/fir/include/dsps_fir_platform.h deleted file mode 100644 index 3715edef..00000000 --- a/components/esp-dsp/modules/fir/include/dsps_fir_platform.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef _dsps_fir_platform_H_ -#define _dsps_fir_platform_H_ - -#include -#include - - -#if ((XCHAL_HAVE_FP == 1) && (XCHAL_HAVE_LOOPS == 1)) - -#define dsps_fir_f32_ae32_enabled 1 -#define dsps_fird_f32_ae32_enabled 1 - -#endif // - -#endif // _dsps_fir_platform_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/fir/test/test_dsps_fir_f32_ae32.c b/components/esp-dsp/modules/fir/test/test_dsps_fir_f32_ae32.c deleted file mode 100644 index 486f29e9..00000000 --- a/components/esp-dsp/modules/fir/test/test_dsps_fir_f32_ae32.c +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_tone_gen.h" -#include "dsps_d_gen.h" -#include "dsps_fir.h" -#include "dsp_tests.h" - -static const char *TAG = "dsps_fir_f32_ae32"; - -float x[1024]; -float y[1024]; -float y_compare[1024]; - -float coeffs[32]; -float delay[32]; -float delay_compare[32]; - -TEST_CASE("dsps_fir_f32_ae32 functionality", "[dsps]") -{ - // In the test we generate filter with cutt off frequency 0.1 - // and then filtering 0.1 and 0.3 frequencis. - // Result must be better then 24 dB - int len = sizeof(x) / sizeof(float); - int fir_len = sizeof(coeffs) / sizeof(float); - - fir_f32_t fir1; - fir_f32_t fir2; - for (int i = 0 ; i < fir_len ; i++) { - coeffs[i] = i; - } - - for (int i = 0 ; i < len ; i++) { - x[i] = 0; - } - x[0] = 1; - - dsps_fir_init_f32(&fir1, coeffs, delay, fir_len); - dsps_fir_f32_ae32(&fir1, x, y, len); - int32_t *ttt = (int32_t *)y; - for (int i=0 ; i< fir_len*3 ; i++) - { - ESP_LOGD(TAG, "fir[%i] = 0x%08x\n", i, ttt[i]); - } - - for (int i = 0 ; i < fir_len ; i++) { - if (y[i] != i) { - TEST_ASSERT_EQUAL(y[i], i); - } - } - - // Check even length - fir_len--; - for (int i = 0 ; i < fir_len ; i++) { - coeffs[i] = i; - } - - for (int i = 0 ; i < len ; i++) { - x[i] = i; - } - x[0] = 1; - dsps_fir_init_f32(&fir1, coeffs, delay, fir_len); - dsps_fir_init_f32(&fir2, coeffs, delay_compare, fir_len); - - dsps_fir_f32_ae32(&fir1, x, y, len); - dsps_fir_f32_ansi(&fir2, x, y_compare, len); - dsps_fir_f32_ae32(&fir1, x, y, len); - dsps_fir_f32_ansi(&fir2, x, y_compare, len); - dsps_fir_f32_ae32(&fir1, x, y, len); - dsps_fir_f32_ansi(&fir2, x, y_compare, len); - - for (int i = 0 ; i < len ; i++) { - if (y[i] != y_compare[i]) { - TEST_ASSERT_EQUAL(y[i], y_compare[i]); - } - } -} - -TEST_CASE("dsps_fir_f32_ae32 benchmark", "[dsps]") -{ - - int len = sizeof(x) / sizeof(float); - int fir_len = sizeof(coeffs) / sizeof(float); - int repeat_count = 1; - - fir_f32_t fir1; - for (int i = 0 ; i < fir_len ; i++) { - coeffs[i] = i; - } - - for (int i = 0 ; i < len ; i++) { - x[i] = 0; - } - x[0] = 1; - - dsps_fir_init_f32(&fir1, coeffs, delay, fir_len); - - unsigned int start_b = xthal_get_ccount(); - for (int i = 0 ; i < repeat_count ; i++) { - dsps_fir_f32_ae32(&fir1, x, y, len); - } - unsigned int end_b = xthal_get_ccount(); - - float total_b = end_b - start_b; - float cycles = total_b / (len * repeat_count); - - ESP_LOGI(TAG, "dsps_fir_f32_ae32 - %f per sample for for %i coefficients, %f per tap \n", cycles, fir_len, cycles / (float)fir_len); - - float min_exec = 3; - float max_exec = 800; - TEST_ASSERT_EXEC_IN_RANGE(min_exec, max_exec, cycles); -} diff --git a/components/esp-dsp/modules/fir/test/test_dsps_fir_f32_ansi.c b/components/esp-dsp/modules/fir/test/test_dsps_fir_f32_ansi.c deleted file mode 100644 index 9087b51d..00000000 --- a/components/esp-dsp/modules/fir/test/test_dsps_fir_f32_ansi.c +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_tone_gen.h" -#include "dsps_d_gen.h" -#include "dsps_fir.h" -#include "dsp_tests.h" - -static const char *TAG = "dsps_fir_f32_ansi"; - -float x[1024]; -float y[1024]; - -float coeffs[32]; -float delay[32]; - -TEST_CASE("dsps_fir_f32_ansi functionality", "[dsps]") -{ - // In the test we generate filter with cutt off frequency 0.1 - // and then filtering 0.1 and 0.3 frequencis. - // Result must be better then 24 dB - int len = sizeof(x) / sizeof(float); - int fir_len = sizeof(coeffs) / sizeof(float); - - fir_f32_t fir1; - for (int i = 0 ; i < fir_len ; i++) { - coeffs[i] = i; - } - - for (int i = 0 ; i < len ; i++) { - x[i] = 0; - } - x[0] = 1; - - dsps_fir_init_f32(&fir1, coeffs, delay, fir_len); - dsps_fir_f32_ansi(&fir1, x, y, len); - - for (int i = 0 ; i < fir_len ; i++) { - if (y[i] != i) { - TEST_ASSERT_EQUAL(y[i], i); - } - } - - // Check even length - fir_len--; - for (int i = 0 ; i < fir_len ; i++) { - coeffs[i] = i; - } - - for (int i = 0 ; i < len ; i++) { - x[i] = 0; - } - x[0] = 1; - dsps_fir_init_f32(&fir1, coeffs, delay, fir_len); - dsps_fir_f32_ansi(&fir1, x, y, len); - - for (int i = 0 ; i < fir_len ; i++) { - if (y[i] != i) { - TEST_ASSERT_EQUAL(y[i], i); - } - } - for (int i = fir_len ; i < len ; i++) { - if (y[i] != 0) { - TEST_ASSERT_EQUAL(y[i], 0); - } - } -} - -TEST_CASE("dsps_fir_f32_ansi benchmark", "[dsps]") -{ - - int len = sizeof(x) / sizeof(float); - int fir_len = sizeof(coeffs) / sizeof(float); - int repeat_count = 1; - - fir_f32_t fir1; - for (int i = 0 ; i < fir_len ; i++) { - coeffs[i] = i; - } - - for (int i = 0 ; i < len ; i++) { - x[i] = 0; - } - x[0] = 1; - - dsps_fir_init_f32(&fir1, coeffs, delay, fir_len); - - unsigned int start_b = xthal_get_ccount(); - for (int i = 0 ; i < repeat_count ; i++) { - dsps_fir_f32_ansi(&fir1, x, y, len); - } - unsigned int end_b = xthal_get_ccount(); - - float total_b = end_b - start_b; - float cycles = total_b / (len * repeat_count); - - ESP_LOGI(TAG, "dsps_fir_f32_ansi - %f per sample for for %i coefficients, %f per tap \n", cycles, fir_len, cycles / (float)fir_len); - - float min_exec = 10; - float max_exec = 800; - TEST_ASSERT_EXEC_IN_RANGE(min_exec, max_exec, cycles); -} diff --git a/components/esp-dsp/modules/fir/test/test_dsps_fird_f32_ae32.c b/components/esp-dsp/modules/fir/test/test_dsps_fird_f32_ae32.c deleted file mode 100644 index bd7afaba..00000000 --- a/components/esp-dsp/modules/fir/test/test_dsps_fird_f32_ae32.c +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_tone_gen.h" -#include "dsps_d_gen.h" -#include "dsps_fir.h" -#include "dsp_tests.h" - -static const char *TAG = "dsps_fird_f32_ae32"; - -static float x[1024]; -static float y[1024]; -static float y_compare[1024]; - -static float coeffs[32]; -static float delay[32]; -static float delay_compare[32]; - -TEST_CASE("dsps_fird_f32_ae32 functionality", "[dsps]") -{ - // In the test we generate filter with cutt off frequency 0.1 - // and then filtering 0.1 and 0.3 frequencis. - // Result must be better then 24 dB - int len = sizeof(x) / sizeof(float); - int fir_len = sizeof(coeffs) / sizeof(float); - int decim = 4; - - fir_f32_t fir1; - fir_f32_t fir2; - for (int i = 0 ; i < fir_len ; i++) { - coeffs[i] = i; - } - coeffs[0] = 1; - - for (int i = 0 ; i < len ; i++) { - x[i] = i; - } - - dsps_fird_init_f32(&fir1, coeffs, delay, fir_len, decim, 0); - dsps_fird_init_f32(&fir2, coeffs, delay_compare, fir_len, decim, 0); - int total1 = dsps_fird_f32_ae32(&fir1, x, y, len); - int total2 = dsps_fird_f32_ansi(&fir2, x, y_compare, len); - total1 += dsps_fird_f32_ae32(&fir1, x, y, len); - total2 += dsps_fird_f32_ansi(&fir2, x, y_compare, len); - total1 += dsps_fird_f32_ae32(&fir1, x, y, len); - total2 += dsps_fird_f32_ansi(&fir2, x, y_compare, len); - ESP_LOGI(TAG, "Total result = %i, expected %i from %i", total1, total2, len); - TEST_ASSERT_EQUAL(total1, total2); - for (int i=0 ; i< total1 ; i++) - { - ESP_LOGD(TAG, "data[%i] = %f\n", i, y[i]); - } - for (int i = 0 ; i < total1 ; i++) { - if (y[i] != y_compare[i]) { - TEST_ASSERT_EQUAL(y[i], y_compare[i]); - } - } - - -} - - -TEST_CASE("dsps_fird_f32_ae32 benchmark", "[dsps]") -{ - - int len = sizeof(x) / sizeof(float); - int fir_len = sizeof(coeffs) / sizeof(float); - int repeat_count = 1; - int decim = 4; - - fir_f32_t fir1; - for (int i = 0 ; i < fir_len ; i++) { - coeffs[i] = i; - } - - for (int i = 0 ; i < len ; i++) { - x[i] = 0; - } - x[0] = 1; - - dsps_fird_init_f32(&fir1, coeffs, delay, fir_len, decim, 0); - - unsigned int start_b = xthal_get_ccount(); - for (int i = 0 ; i < repeat_count ; i++) { - dsps_fird_f32_ae32(&fir1, x, y, len); - } - unsigned int end_b = xthal_get_ccount(); - - float total_b = end_b - start_b; - float cycles = total_b / (len * repeat_count); - - ESP_LOGI(TAG, "dsps_fir_f32_ae32 - %f per sample for for %i coefficients, %f per decim tap \n", cycles, fir_len, cycles / (float)fir_len * decim); - float min_exec = 3; - float max_exec = 300; - TEST_ASSERT_EXEC_IN_RANGE(min_exec, max_exec, cycles); -} diff --git a/components/esp-dsp/modules/fir/test/test_dsps_fird_f32_ansi.c b/components/esp-dsp/modules/fir/test/test_dsps_fird_f32_ansi.c deleted file mode 100644 index 0bff3be3..00000000 --- a/components/esp-dsp/modules/fir/test/test_dsps_fird_f32_ansi.c +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_tone_gen.h" -#include "dsps_d_gen.h" -#include "dsps_fir.h" -#include "dsp_tests.h" - -static const char *TAG = "dsps_fird_f32_ansi"; - -float x[1024]; -float y[1024]; - -float coeffs[32]; -float delay[32]; - -TEST_CASE("dsps_fird_f32_ansi functionality", "[dsps]") -{ - // In the test we generate filter with cutt off frequency 0.1 - // and then filtering 0.1 and 0.3 frequencis. - // Result must be better then 24 dB - int len = sizeof(x) / sizeof(float); - int fir_len = sizeof(coeffs) / sizeof(float); - int decim = 4; - - fir_f32_t fir1; - for (int i = 0 ; i < fir_len ; i++) { - coeffs[i] = 0; - } - coeffs[0] = 1; - - for (int i = 0 ; i < len ; i++) { - x[i] = i % decim; - } - - dsps_fird_init_f32(&fir1, coeffs, delay, fir_len, decim, 0); - int total = dsps_fird_f32_ansi(&fir1, x, y, len); - ESP_LOGI(TAG, "Total result = %i from %i", total, len); - TEST_ASSERT_EQUAL(total, len / decim); - for (int i=0 ; i< total ; i++) - { - ESP_LOGD(TAG, "data[%i] = %f\n", i, y[i]); - } - for (int i = 0 ; i < total ; i++) { - if (y[i] != (decim - 1)) { - TEST_ASSERT_EQUAL(y[i], (decim - 1)); - } - } - - -} - - -TEST_CASE("dsps_fird_f32_ansi benchmark", "[dsps]") -{ - - int len = sizeof(x) / sizeof(float); - int fir_len = sizeof(coeffs) / sizeof(float); - int repeat_count = 1; - int decim = 4; - - fir_f32_t fir1; - for (int i = 0 ; i < fir_len ; i++) { - coeffs[i] = i; - } - - for (int i = 0 ; i < len ; i++) { - x[i] = 0; - } - x[0] = 1; - - dsps_fird_init_f32(&fir1, coeffs, delay, fir_len, decim, 0); - - unsigned int start_b = xthal_get_ccount(); - for (int i = 0 ; i < repeat_count ; i++) { - dsps_fird_f32_ansi(&fir1, x, y, len); - } - unsigned int end_b = xthal_get_ccount(); - - float total_b = end_b - start_b; - float cycles = total_b / (len * repeat_count); - - ESP_LOGI(TAG, "dsps_fir_f32_ansi - %f per sample for for %i coefficients, %f per decim tap \n", cycles, fir_len, cycles / (float)fir_len * decim); - float min_exec = 10; - float max_exec = 300; - TEST_ASSERT_EXEC_IN_RANGE(min_exec, max_exec, cycles); -} diff --git a/components/esp-dsp/modules/iir/biquad/dsps_biquad_f32_ae32.S b/components/esp-dsp/modules/iir/biquad/dsps_biquad_f32_ae32.S deleted file mode 100644 index 21fc8322..00000000 --- a/components/esp-dsp/modules/iir/biquad/dsps_biquad_f32_ae32.S +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_biquad_platform.h" -#if (dsps_biquad_f32_ae32_enabled == 1) - -// This is bi quad filter form II for ESP32 processor. - .text - .align 4 - .global dsps_biquad_f32_ae32 - .type dsps_biquad_f32_ae32,@function -// The function implements the following C code: -//esp_err_t dsps_biquad_f32_ae32(const float* input, float* output, int len, float* coef, float* w) -// { -// for (int i=0 ; i< len ; i++) -// { -// float d0 = input[i] - coef[3]*w[0] - coef[4]*w[1]; (input[i] - a[1]*w[0] - a[2]*w[1];) -// output[i] = coef[0]*d0 + coef[1]*w[0] + coef[2]*w[1]; -// w[1] = w[0]; -// w[0] = d0; -// } -// return ESP_OK; -// } - -dsps_biquad_f32_ae32: -// input - a2 -// output - a3 -// len - a4 -// coeffs - a5 -// w- a6 - -// f0 - b0 -// f1 - b1 -// f2 - b2 -// f3 - a1 -// f4 - a2 - -// f5 - w0 -// f6 - w1 - - entry a1, 16 - // Array increment for floating point data should be 4 - lsi f0, a5, 0 - lsi f1, a5, 4 - lsi f2, a5, 8 - lsi f3, a5, 12 - lsi f4, a5, 16 - - - neg.s f5, f3 // -a[1] - neg.s f6, f4 // -a[2] - - lsi f7, a6, 0 // w[0] - lsi f8, a6, 4 // w[1] - - addi a3, a3, -4 // i-- // preset a3 - lsi f9, a2, 0 // f9 = x[i] - loopnez a4, loop_bq_end_m_ae32 - madd.s f9, f7, f5 // f9 += -a1*w0 - addi a3, a3, 4 // out++; - mul.s f10, f1, f7 // f10 = b1*w0 - madd.s f9, f8, f6 // f9 += -a2*w1 - madd.s f10, f9, f0 // f10 += b0*d0 - addi a2, a2, 4 // in++; - madd.s f10, f2, f8 // f10+= b2*w1, f10 - result - mov.s f8, f7 // w1 = w0 - mov.s f7, f9 // w0 = d0 - lsi f9, a2, 0 // f9 = x[i] - ssi f10, a3, 0 // y[i] = result -loop_bq_end_m_ae32: - // Store delay line - ssi f7, a6, 0 - ssi f8, a6, 4 - - movi.n a2, 0 // return status ESP_OK - retw.n - -#endif // dsps_biquad_f32_ae32_enabled \ No newline at end of file diff --git a/components/esp-dsp/modules/iir/biquad/dsps_biquad_f32_ansi.c b/components/esp-dsp/modules/iir/biquad/dsps_biquad_f32_ansi.c deleted file mode 100644 index 92216989..00000000 --- a/components/esp-dsp/modules/iir/biquad/dsps_biquad_f32_ansi.c +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2018-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. - - -#include "dsps_biquad.h" - - -esp_err_t dsps_biquad_f32_ansi(const float *input, float *output, int len, float *coef, float *w) -{ - for (int i = 0 ; i < len ; i++) { - float d0 = input[i] - coef[3] * w[0] - coef[4] * w[1]; - output[i] = coef[0] * d0 + coef[1] * w[0] + coef[2] * w[1]; - w[1] = w[0]; - w[0] = d0; - } - return ESP_OK; -} diff --git a/components/esp-dsp/modules/iir/biquad/dsps_biquad_gen_f32.c b/components/esp-dsp/modules/iir/biquad/dsps_biquad_gen_f32.c deleted file mode 100644 index 282e6299..00000000 --- a/components/esp-dsp/modules/iir/biquad/dsps_biquad_gen_f32.c +++ /dev/null @@ -1,290 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_biquad_gen.h" -#include -#include "esp_log.h" - -esp_err_t dsps_biquad_gen_lpf_f32(float *coeffs, float f, float qFactor) -{ - if (qFactor <= 0.0001) { - qFactor = 0.0001; - } - float Fs = 1; - - float w0 = 2 * M_PI * f / Fs; - float c = cosf(w0); - float s = sinf(w0); - float alpha = s / (2 * qFactor); - - float b0 = (1 - c) / 2; - float b1 = 1 - c; - float b2 = b0; - float a0 = 1 + alpha; - float a1 = -2 * c; - float a2 = 1 - alpha; - - coeffs[0] = b0 / a0; - coeffs[1] = b1 / a0; - coeffs[2] = b2 / a0; - coeffs[3] = a1 / a0; - coeffs[4] = a2 / a0; - return ESP_OK; -} - -esp_err_t dsps_biquad_gen_hpf_f32(float *coeffs, float f, float qFactor) -{ - if (qFactor <= 0.0001) { - qFactor = 0.0001; - } - float Fs = 1; - - float w0 = 2 * M_PI * f / Fs; - float c = cosf(w0); - float s = sinf(w0); - float alpha = s / (2 * qFactor); - - float b0 = (1 + c) / 2; - float b1 = -(1 + c); - float b2 = b0; - float a0 = 1 + alpha; - float a1 = -2 * c; - float a2 = 1 - alpha; - - coeffs[0] = b0 / a0; - coeffs[1] = b1 / a0; - coeffs[2] = b2 / a0; - coeffs[3] = a1 / a0; - coeffs[4] = a2 / a0; - return ESP_OK; -} - -esp_err_t dsps_biquad_gen_bpf_f32(float *coeffs, float f, float qFactor) -{ - if (qFactor <= 0.0001) { - qFactor = 0.0001; - } - float Fs = 1; - - float w0 = 2 * M_PI * f / Fs; - float c = cosf(w0); - float s = sinf(w0); - float alpha = s / (2 * qFactor); - - float b0 = s / 2; - float b1 = 0; - float b2 = -b0; - float a0 = 1 + alpha; - float a1 = -2 * c; - float a2 = 1 - alpha; - - coeffs[0] = b0 / a0; - coeffs[1] = b1 / a0; - coeffs[2] = b2 / a0; - coeffs[3] = a1 / a0; - coeffs[4] = a2 / a0; - return ESP_OK; -} - -esp_err_t dsps_biquad_gen_bpf0db_f32(float *coeffs, float f, float qFactor) -{ - if (qFactor <= 0.0001) { - qFactor = 0.0001; - } - float Fs = 1; - - float w0 = 2 * M_PI * f / Fs; - float c = cosf(w0); - float s = sinf(w0); - float alpha = s / (2 * qFactor); - - float b0 = alpha; - float b1 = 0; - float b2 = -alpha; - float a0 = 1 + alpha; - float a1 = -2 * c; - float a2 = 1 - alpha; - - coeffs[0] = b0 / a0; - coeffs[1] = b1 / a0; - coeffs[2] = b2 / a0; - coeffs[3] = a1 / a0; - coeffs[4] = a2 / a0; - return ESP_OK; -} - -esp_err_t dsps_biquad_gen_notch_f32(float *coeffs, float f, float gain, float qFactor) -{ - if (qFactor <= 0.0001) { - qFactor = 0.0001; - } - float Fs = 1; - - float A = sqrtf(pow(10, (double)gain / 20.0)); - float w0 = 2 * M_PI * f / Fs; - float c = cosf(w0); - float s = sinf(w0); - float alpha = s / (2 * qFactor); - - float b0 = 1 + alpha * A; - float b1 = -2 * c; - float b2 = 1 - alpha * A; - float a0 = 1 + alpha; - float a1 = -2 * c; - float a2 = 1 - alpha; - - coeffs[0] = b0 / a0; - coeffs[1] = b1 / a0; - coeffs[2] = b2 / a0; - coeffs[3] = a1 / a0; - coeffs[4] = a2 / a0; - return ESP_OK; -} - -esp_err_t dsps_biquad_gen_allpass360_f32(float *coeffs, float f, float qFactor) -{ - if (qFactor <= 0.0001) { - qFactor = 0.0001; - } - float Fs = 1; - - float w0 = 2 * M_PI * f / Fs; - float c = cosf(w0); - float s = sinf(w0); - float alpha = s / (2 * qFactor); - - float b0 = 1 - alpha; - float b1 = -2 * c; - float b2 = 1 + alpha; - float a0 = 1 + alpha; - float a1 = -2 * c; - float a2 = 1 - alpha; - - coeffs[0] = b0 / a0; - coeffs[1] = b1 / a0; - coeffs[2] = b2 / a0; - coeffs[3] = a1 / a0; - coeffs[4] = a2 / a0; - return ESP_OK; -} - -esp_err_t dsps_biquad_gen_allpass180_f32(float *coeffs, float f, float qFactor) -{ - if (qFactor <= 0.0001) { - qFactor = 0.0001; - } - float Fs = 1; - - float w0 = 2 * M_PI * f / Fs; - float c = cosf(w0); - float s = sinf(w0); - float alpha = s / (2 * qFactor); - - float b0 = 1 - alpha; - float b1 = -2 * c; - float b2 = 1 + alpha; - float a0 = 1 + alpha; - float a1 = -2 * c; - float a2 = 1 - alpha; - - coeffs[0] = b0 / a0; - coeffs[1] = b1 / a0; - coeffs[2] = b2 / a0; - coeffs[3] = a1 / a0; - coeffs[4] = a2 / a0; - return ESP_OK; -} - -esp_err_t dsps_biquad_gen_peakingEQ_f32(float *coeffs, float f, float qFactor) -{ - if (qFactor <= 0.0001) { - qFactor = 0.0001; - } - float Fs = 1; - - float w0 = 2 * M_PI * f / Fs; - float c = cosf(w0); - float s = sinf(w0); - float alpha = s / (2 * qFactor); - - float b0 = alpha; - float b1 = 0; - float b2 = -alpha; - float a0 = 1 + alpha; - float a1 = -2 * c; - float a2 = 1 - alpha; - - coeffs[0] = b0 / a0; - coeffs[1] = b1 / a0; - coeffs[2] = b2 / a0; - coeffs[3] = a1 / a0; - coeffs[4] = a2 / a0; - return ESP_OK; -} - -esp_err_t dsps_biquad_gen_lowShelf_f32(float *coeffs, float f, float gain, float qFactor) -{ - if (qFactor <= 0.0001) { - qFactor = 0.0001; - } - float Fs = 1; - - float A = sqrtf(pow(10, (double)gain / 20.0)); - float w0 = 2 * M_PI * f / Fs; - float c = cosf(w0); - float s = sinf(w0); - float alpha = s / (2 * qFactor); - - float b0 = A * ((A + 1) - (A - 1) * c + 2 * sqrtf(A) * alpha); - float b1 = 2 * A * ((A - 1) - (A + 1) * c); - float b2 = A * ((A + 1) - (A - 1) * c - 2 * sqrtf(A) * alpha); - float a0 = (A + 1) + (A - 1) * c + 2 * sqrtf(A) * alpha; - float a1 = -2 * ((A - 1) + (A + 1) * c); - float a2 = (A + 1) + (A - 1) * c - 2 * sqrtf(A) * alpha; - - coeffs[0] = b0 / a0; - coeffs[1] = b1 / a0; - coeffs[2] = b2 / a0; - coeffs[3] = a1 / a0; - coeffs[4] = a2 / a0; - return ESP_OK; -} - -esp_err_t dsps_biquad_gen_highShelf_f32(float *coeffs, float f, float gain, float qFactor) -{ - if (qFactor <= 0.0001) { - qFactor = 0.0001; - } - float Fs = 1; - - float A = sqrtf(pow(10, (double)gain / 20.0)); - float w0 = 2 * M_PI * f / Fs; - float c = cosf(w0); - float s = sinf(w0); - float alpha = s / (2 * qFactor); - - float b0 = A * ((A + 1) + (A - 1) * c + 2 * sqrtf(A) * alpha); - float b1 = -2 * A * ((A - 1) + (A + 1) * c); - float b2 = A * ((A + 1) + (A - 1) * c - 2 * sqrtf(A) * alpha); - float a0 = (A + 1) - (A - 1) * c + 2 * sqrtf(A) * alpha; - float a1 = 2 * ((A - 1) - (A + 1) * c); - float a2 = (A + 1) - (A - 1) * c - 2 * sqrtf(A) * alpha; - - coeffs[0] = b0 / a0; - coeffs[1] = b1 / a0; - coeffs[2] = b2 / a0; - coeffs[3] = a1 / a0; - coeffs[4] = a2 / a0; - return ESP_OK; -} diff --git a/components/esp-dsp/modules/iir/include/dsps_biquad.h b/components/esp-dsp/modules/iir/include/dsps_biquad.h deleted file mode 100644 index 8e809eef..00000000 --- a/components/esp-dsp/modules/iir/include/dsps_biquad.h +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2018-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. - - -#ifndef _dsps_biquad_H_ -#define _dsps_biquad_H_ - -#include "dsp_err.h" - -#include "dsps_add_platform.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - -/**@{*/ -/** - * @brief IIR filter - * - * IIR filter 2nd order direct form II (bi quad) - * The extension (_ansi) use ANSI C and could be compiled and run on any platform. - * The extension (_ae32) is optimized for ESP32 chip. - * - * @param[in] input: input array - * @param output: output array - * @param len: length of input and output vectors - * @param coef: array of coefficients. b0,b1,b2,a1,a2 - * expected that a0 = 1. b0..b2 - numerator, a0..a2 - denominator - * @param w: delay line w0,w1. Length of 2. - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_biquad_f32_ansi(const float *input, float *output, int len, float *coef, float *w); -esp_err_t dsps_biquad_f32_ae32(const float *input, float *output, int len, float *coef, float *w); -/**@}*/ - - -#ifdef __cplusplus -} -#endif - -#if CONFIG_DSP_OPTIMIZED -#if (dsps_biquad_f32_ae32_enabled == 1) -#define dsps_biquad_f32 dsps_biquad_f32_ae32 -#else -#define dsps_biquad_f32 dsps_biquad_f32_ansi -#endif -#else // CONFIG_DSP_OPTIMIZED -#define dsps_biquad_f32 dsps_biquad_f32_ansi -#endif // CONFIG_DSP_OPTIMIZED - - -#endif // _dsps_biquad_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/iir/include/dsps_biquad_gen.h b/components/esp-dsp/modules/iir/include/dsps_biquad_gen.h deleted file mode 100644 index 750dc4df..00000000 --- a/components/esp-dsp/modules/iir/include/dsps_biquad_gen.h +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright 2018-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. - -#ifndef _dsps_biquad_gen_H_ -#define _dsps_biquad_gen_H_ - -#include "dsp_err.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - -// Common rules for all generated coefficients. -// The coefficients placed to the array as follows: -// coeffs[0] = b0; -// coeffs[1] = b1; -// coeffs[2] = b2; -// coeffs[3] = a1; -// coeffs[4] = a2; -// a0 - are not placed and expected always as == 1 - -/** - * @brief LPF IIR filter coefficients - * Coefficients for low pass 2nd order IIR filter (bi-quad) - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param coeffs: result coefficients. b0,b1,b2,a1,a2, a0 are not placed to the array and expected by IIR as 1 - * @param f: filter cut off frequency in range of 0..0.5 (normalized to sample frequency) - * @param qFactor: Q factor of filter - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_biquad_gen_lpf_f32(float *coeffs, float f, float qFactor); - -/** - * @brief HPF IIR filter coefficients - * - * Coefficients for high pass 2nd order IIR filter (bi-quad) - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param coeffs: result coefficients. b0,b1,b2,a1,a2, a0 are not placed to the array and expected by IIR as 1 - * @param f: filter cut off frequency in range of 0..0.5 (normalized to sample frequency) - * @param qFactor: Q factor of filter - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_biquad_gen_hpf_f32(float *coeffs, float f, float qFactor); - -/** - * @brief BPF IIR filter coefficients - * - * Coefficients for band pass 2nd order IIR filter (bi-quad) - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param coeffs: result coefficients. b0,b1,b2,a1,a2, a0 are not placed to the array and expected by IIR as 1 - * @param f: filter center frequency in range of 0..0.5 (normalized to sample frequency) - * @param qFactor: Q factor of filter - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_biquad_gen_bpf_f32(float *coeffs, float f, float qFactor); - -/** - * @brief 0 dB BPF IIR filter coefficients - * - * Coefficients for band pass 2nd order IIR filter (bi-quad) with 0 dB gain in passband - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param coeffs: result coefficients. b0,b1,b2,a1,a2, a0 are not placed to the array and expected by IIR as 1 - * @param f: filter center frequency in range of 0..0.5 (normalized to sample frequency) - * @param qFactor: Q factor of filter - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_biquad_gen_bpf0db_f32(float *coeffs, float f, float qFactor); - -/** - * @brief Notch IIR filter coefficients - * - * Coefficients for notch 2nd order IIR filter (bi-quad) - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param coeffs: result coefficients. b0,b1,b2,a1,a2, a0 are not placed to the array and expected by IIR as 1 - * @param f: filter notch frequency in range of 0..0.5 (normalized to sample frequency) - * @param gain: gain in stopband in dB - * @param qFactor: Q factor of filter - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_biquad_gen_notch_f32(float *coeffs, float f, float gain, float qFactor); - -/** - * @brief Allpass 360 degree IIR filter coefficients - * - * Coefficients for all pass 2nd order IIR filter (bi-quad) with 360 degree phase shift - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param coeffs: result coefficients. b0,b1,b2,a1,a2, a0 are not placed to the array and expected by IIR as 1 - * @param f: filter notch frequency in range of 0..0.5 (normalized to sample frequency) - * @param qFactor: Q factor of filter - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_biquad_gen_allpass360_f32(float *coeffs, float f, float qFactor); - -/** - * @brief Allpass 180 degree IIR filter coefficients - * - * Coefficients for all pass 2nd order IIR filter (bi-quad) with 180 degree phase shift - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param coeffs: result coefficients. b0,b1,b2,a1,a2, a0 are not placed to the array and expected by IIR as 1 - * @param f: filter notch frequency in range of 0..0.5 (normalized to sample frequency) - * @param qFactor: Q factor of filter - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_biquad_gen_allpass180_f32(float *coeffs, float f, float qFactor); - -/** - * @brief peak IIR filter coefficients - * - * Coefficients for peak 2nd order IIR filter (bi-quad) - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param coeffs: result coefficients. b0,b1,b2,a1,a2, a0 are not placed to the array and expected by IIR as 1 - * @param f: filter notch frequency in range of 0..0.5 (normalized to sample frequency) - * @param qFactor: Q factor of filter - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_biquad_gen_peakingEQ_f32(float *coeffs, float f, float qFactor); - -/** - * @brief low shelf IIR filter coefficients - * - * Coefficients for low pass Shelf 2nd order IIR filter (bi-quad) - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param coeffs: result coefficients. b0,b1,b2,a1,a2, a0 are not placed to the array and expected by IIR as 1 - * @param f: filter notch frequency in range of 0..0.5 (normalized to sample frequency) - * @param gain: gain in stopband in dB - * @param qFactor: Q factor of filter - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_biquad_gen_lowShelf_f32(float *coeffs, float f, float gain, float qFactor); - -/** - * @brief high shelf IIR filter coefficients - * - * Coefficients for high pass Shelf 2nd order IIR filter (bi-quad) - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param coeffs: result coefficients. b0,b1,b2,a1,a2, a0 are not placed to the array and expected by IIR as 1 - * @param f: filter notch frequency in range of 0..0.5 (normalized to sample frequency) - * @param gain: gain in stopband in dB - * @param qFactor: Q factor of filter - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_biquad_gen_highShelf_f32(float *coeffs, float f, float gain, float qFactor); - -#ifdef __cplusplus -} -#endif - -#endif // _dsps_biquad_gen_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/iir/include/dsps_biquad_platform.h b/components/esp-dsp/modules/iir/include/dsps_biquad_platform.h deleted file mode 100644 index 41551735..00000000 --- a/components/esp-dsp/modules/iir/include/dsps_biquad_platform.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _dsps_biquad_platform_H_ -#define _dsps_biquad_platform_H_ - -#include -#include - - -#if ((XCHAL_HAVE_FP == 1) && (XCHAL_HAVE_LOOPS == 1)) - -#define dsps_biquad_f32_ae32_enabled 1 - -#endif - -#endif // _dsps_biquad_platform_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/iir/test/test_bq_f32_ae32.c b/components/esp-dsp/modules/iir/test/test_bq_f32_ae32.c deleted file mode 100644 index 33db3fa3..00000000 --- a/components/esp-dsp/modules/iir/test/test_bq_f32_ae32.c +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_tone_gen.h" -#include "dsps_d_gen.h" -#include "dsps_biquad_gen.h" -#include "dsps_biquad.h" - -static const char *TAG = "dsps_biquad_f32_ae32"; -const int bq_len = 1024; -TEST_CASE("dsps_biquad_f32_ae32 functionality", "[dsps]") -{ - float* x = calloc(bq_len,sizeof(float)); - float* y = calloc(bq_len,sizeof(float)); - float* z = calloc(bq_len,sizeof(float)); - - // In the test we generate filter with cutt off frequency 0.1 - // and then filtering 0.1 and 0.3 frequencis. - // Result must be better then 24 dB - int len = bq_len; - - dsps_d_gen_f32(x, len, 0); - float coeffs[5]; - float w1[2] = {0}; - float w2[2] = {0}; - dsps_biquad_gen_lpf_f32(coeffs, 0.1, 1); - dsps_biquad_f32_ae32(x, y, len, coeffs, w1); - dsps_biquad_f32_ansi(x, z, len, coeffs, w2); - - for (int i = 0 ; i < 32 ; i++) { - ESP_LOGD(TAG, "[%i]calc = %f, expected=%f", i, y[i], z[i]); - if (y[i] != z[i]) { - TEST_ASSERT_EQUAL( y[i], z[i]); - } - } - free(x); - free(y); - free(z); -} - -TEST_CASE("dsps_biquad_f32_ae32 benchmark", "[dsps]") -{ - float* x = calloc(bq_len,sizeof(float)); - float* y = calloc(bq_len,sizeof(float)); - float* z = calloc(bq_len,sizeof(float)); - - float w1[2] = {0}; - int len = bq_len; - int repeat_count = 1024; - dsps_d_gen_f32(x, len, 0); - float coeffs[5]; - dsps_biquad_gen_lpf_f32(coeffs, 0.1, 1); - - - unsigned int start_b = xthal_get_ccount(); - for (int i = 0 ; i < repeat_count ; i++) { - dsps_biquad_f32_ae32(x, y, len, coeffs, w1); - } - unsigned int end_b = xthal_get_ccount(); - - float total_b = end_b - start_b; - float cycles = total_b / (len * repeat_count); - - start_b = xthal_get_ccount(); - for (int i = 0 ; i < repeat_count ; i++) { - dsps_biquad_f32_ansi(x, y, len, coeffs, w1); - } - end_b = xthal_get_ccount(); - float total_b_ansi = end_b - start_b; - float cycles_ansi = total_b_ansi / (len * repeat_count); - - ESP_LOGI(TAG, "dsps_biquad_f32_ae32 - %f per sample\n", cycles); - ESP_LOGI(TAG, "dsps_biquad_f32_ansi - %f per sample\n", cycles_ansi); - // float min_exec = 10; - // float max_exec = 20; - // if (cycles >= max_exec) { - // TEST_ASSERT_MESSAGE (false, "Exec time takes more than expected!"); - // } - // if (cycles < min_exec) { - // TEST_ASSERT_MESSAGE (false, "Exec time takes less then expected!"); - // } - free(x); - free(y); - free(z); - -} \ No newline at end of file diff --git a/components/esp-dsp/modules/iir/test/test_bq_f32_ansi.c b/components/esp-dsp/modules/iir/test/test_bq_f32_ansi.c deleted file mode 100644 index feea3eac..00000000 --- a/components/esp-dsp/modules/iir/test/test_bq_f32_ansi.c +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_tone_gen.h" -#include "dsps_d_gen.h" -#include "dsps_biquad_gen.h" -#include "dsps_biquad.h" - -static const char *TAG = "dsps_biquad_f32_ansi"; - -float x[1024]; -float y[1024]; - -TEST_CASE("dsps_biquad_f32_ansi functionality", "[dsps]") -{ - // In the test we generate filter with cutt off frequency 0.1 - // and then filtering 0.1 and 0.3 frequencis. - // Result must be better then 24 dB - int len = sizeof(x) / sizeof(float); - - dsps_tone_gen_f32(x, len, 1, 0.1, 0); - - float coeffs[5]; - float w1[2] = {0}; - float w2[2] = {0}; - dsps_biquad_gen_lpf_f32(coeffs, 0.1, 1); - dsps_biquad_f32_ansi(x, y, len, coeffs, w1); - float pow_band = 0; - for (int i = len / 2 ; i < len ; i++) { - pow_band += y[i] * y[i]; - } - float pow_out_band = 0; - dsps_tone_gen_f32(x, len, 1, 0.3, 0); - dsps_biquad_f32_ansi(x, y, len, coeffs, w2); - for (int i = len / 2 ; i < len ; i++) { - pow_out_band += y[i] * y[i]; - } - pow_band = 2 * pow_band / (float)len; - pow_out_band = 2 * pow_out_band / (float)len; - float diff_db = -10 * log10f(0.000000001 + pow_out_band / pow_band); - ESP_LOGI(TAG, "Power: pass =%f, stop= %f, diff = %f dB", pow_band, pow_out_band, diff_db); - - if (diff_db < 24) { - ESP_LOGE(TAG, "Attenuation for LPF must be not less then 24! Now it is: %f", diff_db); - TEST_ASSERT_MESSAGE (false, "LPF attenuation is less then expected"); - } -} diff --git a/components/esp-dsp/modules/math/add/fixed/dsps_add_s16_ae32.S b/components/esp-dsp/modules/math/add/fixed/dsps_add_s16_ae32.S deleted file mode 100644 index 6f29a5ad..00000000 --- a/components/esp-dsp/modules/math/add/fixed/dsps_add_s16_ae32.S +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_add_platform.h" -#if (dsps_add_s16_ae32_enabled == 1) - - .text - .align 4 - .global dsps_add_s16_ae32 - .type dsps_add_s16_ae32,@function -// The function implements the following C code: -// esp_err_t dsps_add_s16_ansi(const int16_t *input1, const int16_t *input2, int16_t *output, int len, int step1, int step2, int step_out, int shift) -// { -// for (int i = 0 ; i < len ; i++) { -// int32_t acc = (int32_t)input1[i * step1] + (int32_t)input2[i * step2]; -// output[i * step_out] = acc >> shift; -// } -// return ESP_OK; -// } -dsps_add_s16_ae32: -// input1 - a2 -// input2 - a3 -// output - a4 -// len - a5 -// step_in1 - a6 -// step_in2 - a7 -// step_out - stack (a10) -// shift - stack (a9) - - entry a1, 16 - - - // l32i.n a10, a1, 16 - // s16i a10, a4, 0 - // l32i.n a10, a1, 20 - // s16i a10, a4, 2 - - l32i.n a10, a1, 16 // Load step_out to the a10 register - l32i.n a9, a1, 20 // Load shift to the a9 register - ssr a9 // sar = a9 - - slli a6, a6, 1 // a6 - step_in<<1 - slli a7, a7, 1 // a7 - step_in<<1 - slli a10, a10, 1 // a8 - step_out<<1 - - // s16i a10, a4, 0 - // s16i a6, a4, 2 - // s16i a7, a4, 4 - // s16i a5, a4, 6 - - l16si a11, a2, 0 - l16si a8, a3, 0 - add a8, a11, a8 - srl a9, a8 // a8 = a8>>sar - - loopnez a5, .loop_end_add_s16_ae32 - add.n a2, a2, a6 // input1+=step_in1; - add.n a3, a3, a7 // input2+=step_in2; - - l16si a11, a2, 0 - l16si a8, a3, 0 - s16i a9, a4, 0 // store result to the putput - add a8, a11, a8 - srl a9, a8 // a8 = a8>>sar - - add.n a4, a4, a10 // output+=step_out; -.loop_end_add_s16_ae32: - movi.n a2, 0 // return status ESP_OK - retw.n - -#endif // dsps_add_s16_ae32_enabled \ No newline at end of file diff --git a/components/esp-dsp/modules/math/add/fixed/dsps_add_s16_ansi.c b/components/esp-dsp/modules/math/add/fixed/dsps_add_s16_ansi.c deleted file mode 100644 index 3651ee33..00000000 --- a/components/esp-dsp/modules/math/add/fixed/dsps_add_s16_ansi.c +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_add.h" - -esp_err_t dsps_add_s16_ansi(const int16_t *input1, const int16_t *input2, int16_t *output, int len, int step1, int step2, int step_out, int shift) -{ - if (NULL == input1) return ESP_ERR_DSP_PARAM_OUTOFRANGE; - if (NULL == input2) return ESP_ERR_DSP_PARAM_OUTOFRANGE; - if (NULL == output) return ESP_ERR_DSP_PARAM_OUTOFRANGE; - - for (int i = 0 ; i < len ; i++) { - int32_t acc = (int32_t)input1[i * step1] + (int32_t)input2[i * step2]; - output[i * step_out] = acc >> shift; - } - return ESP_OK; -} diff --git a/components/esp-dsp/modules/math/add/float/dsps_add_f32_ae32.S b/components/esp-dsp/modules/math/add/float/dsps_add_f32_ae32.S deleted file mode 100644 index 8f1c50ac..00000000 --- a/components/esp-dsp/modules/math/add/float/dsps_add_f32_ae32.S +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_add_platform.h" -#if (dsps_add_f32_ae32_enabled == 1) - -// This is bi quad filter form II for ESP32 processor. - .text - .align 4 - .global dsps_add_f32_ae32 - .type dsps_add_f32_ae32,@function -// The function implements the following C code: -// esp_err_t dsps_add_f32_ansi(const float *input1, const float *input2, float *output, int len, int step1, int step2, int step_out) -// { -// for (int i = 0 ; i < len ; i++) { -// output[i * step_out] = input1[i * step1] + input2[i * step2]; -// } -// return ESP_OK; -// } - -dsps_add_f32_ae32: -// input1 - a2 -// input2 - a3 -// output - a4 -// len - a5 -// step1 - a6 -// step2 - a7 -// step_out - stack (a8) - - entry a1, 16 - - l32i.n a8, a1, 16 // Load step_out to the a8 register - slli a6, a6, 2 // a6 - step1<<2 - slli a7, a7, 2 // a7 - step2<<2 - slli a8, a8, 2 // a8 - step_out<<2 - - lsi f0, a2, 0 - add.n a2, a2, a6 // input1_ptr+=step1; - loopnez a5, loop_end_add_f32_ae32 - lsi f1, a3, 0 - add.n a3, a3, a7 // input2_ptr+=step2; - - add.s f2, f1, f0 // f2 = f1 + f0 - lsi f0, a2, 0 - add.n a2, a2, a6 // input1_ptr+=step1; - ssi f2, a4, 0 - add.n a4, a4, a8 // input2_ptr+=step2; -loop_end_add_f32_ae32: - - movi.n a2, 0 // return status ESP_OK - retw.n - -#endif // dsps_add_f32_ae32_enabled diff --git a/components/esp-dsp/modules/math/add/float/dsps_add_f32_ansi.c b/components/esp-dsp/modules/math/add/float/dsps_add_f32_ansi.c deleted file mode 100644 index ae057895..00000000 --- a/components/esp-dsp/modules/math/add/float/dsps_add_f32_ansi.c +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_add.h" - -esp_err_t dsps_add_f32_ansi(const float *input1, const float *input2, float *output, int len, int step1, int step2, int step_out) -{ - if (NULL == input1) return ESP_ERR_DSP_PARAM_OUTOFRANGE; - if (NULL == input2) return ESP_ERR_DSP_PARAM_OUTOFRANGE; - if (NULL == output) return ESP_ERR_DSP_PARAM_OUTOFRANGE; - - for (int i = 0 ; i < len ; i++) { - output[i * step_out] = input1[i * step1] + input2[i * step2]; - } - return ESP_OK; -} diff --git a/components/esp-dsp/modules/math/add/include/dsps_add.h b/components/esp-dsp/modules/math/add/include/dsps_add.h deleted file mode 100644 index 32a15eb2..00000000 --- a/components/esp-dsp/modules/math/add/include/dsps_add.h +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2018-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. - -#ifndef _dsps_add_H_ -#define _dsps_add_H_ -#include "dsp_err.h" - -#include "dsps_add_platform.h" - - -#ifdef __cplusplus -extern "C" -{ -#endif - - -/**@{*/ -/** - * @brief add two arrays - * - * The function add one input array to another - * out[i*step_out] = input1[i*step1] + input2[i*step2]; i=[0..len) - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param[in] input1: input array 1 - * @param[in] input2: input array 2 - * @param output: output array - * @param len: amount of operations for arrays - * @param step1: step over input array 1 (by default should be 1) - * @param step2: step over input array 2 (by default should be 1) - * @param step_out: step over output array (by default should be 1) - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_add_f32_ansi(const float *input1, const float *input2, float *output, int len, int step1, int step2, int step_out); -esp_err_t dsps_add_f32_ae32(const float *input1, const float *input2, float *output, int len, int step1, int step2, int step_out); - -esp_err_t dsps_add_s16_ansi(const int16_t *input1, const int16_t *input2, int16_t *output, int len, int step1, int step2, int step_out, int shift); -esp_err_t dsps_add_s16_ae32(const int16_t *input1, const int16_t *input2, int16_t *output, int len, int step1, int step2, int step_out, int shift); -/**@}*/ - -#ifdef __cplusplus -} -#endif - -#if CONFIG_DSP_OPTIMIZED - -#if (dsps_add_f32_ae32_enabled == 1) -#define dsps_add_f32 dsps_add_f32_ae32 -#else -#define dsps_add_f32 dsps_add_f32_ansi -#endif - -#if (dsps_add_s16_ae32_enabled == 1) -#define dsps_add_s16 dsps_add_s16_ae32 -#else -#define dsps_add_s16 dsps_add_s16_ansi -#endif - -#else // CONFIG_DSP_OPTIMIZED -#define dsps_add_f32 dsps_add_f32_ansi -#define dsps_add_s16 dsps_add_s16_ansi -#endif // CONFIG_DSP_OPTIMIZED - -#endif // _dsps_add_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/math/add/include/dsps_add_platform.h b/components/esp-dsp/modules/math/add/include/dsps_add_platform.h deleted file mode 100644 index 18dab1f2..00000000 --- a/components/esp-dsp/modules/math/add/include/dsps_add_platform.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef _dsps_add_platform_H_ -#define _dsps_add_platform_H_ - -#include -#include - - -#if ((XCHAL_HAVE_FP == 1) && (XCHAL_HAVE_LOOPS == 1)) - -#define dsps_add_f32_ae32_enabled 1 - -#endif - -#if (XCHAL_HAVE_LOOPS == 1) -#define dsps_add_s16_ae32_enabled 1 -#endif - - -#endif // _dsps_add_platform_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/math/add/test/test_dsps_add_f32_ansi.c b/components/esp-dsp/modules/math/add/test/test_dsps_add_f32_ansi.c deleted file mode 100644 index 7af59b99..00000000 --- a/components/esp-dsp/modules/math/add/test/test_dsps_add_f32_ansi.c +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_add.h" -#include "esp_attr.h" - -static const char *TAG = "dsps_add"; - -TEST_CASE("dsps_add_f32_ansi functionality", "[dsps]") -{ - int n = 32; - float x[n]; - float y[n]; - for (int i = 0 ; i < n ; i++) { - x[i] = i; - y[i] = 2*i; - } - dsps_add_f32_ansi(x, x, x, n, 1, 1, 1); - for (int i = 0 ; i < n ; i++) { - if (x[i] != y[i]) { - TEST_ASSERT_EQUAL(x[i], y[i]); - } - } -} - -TEST_CASE("dsps_add_f32_ae32 functionality", "[dsps]") -{ - int n = 32; - float x[n]; - float y[n]; - for (int i = 0 ; i < n ; i++) { - x[i] = i; - y[i] = 2*i; - } - dsps_add_f32_ae32(x, x, x, n, 1, 1, 1); - for (int i = 0 ; i < n ; i++) { - if (x[i] != y[i]) { - TEST_ASSERT_EQUAL(x[i], y[i]); - } - } - - int repeat_count = 1; - - dsps_add_f32_ae32(x, x, x, n, 1, 1, 1); - - unsigned int start_b = xthal_get_ccount(); - dsps_add_f32_ae32(x, x, x, n, 1, 1, 1); - unsigned int end_b = xthal_get_ccount(); - - float total_b = end_b - start_b; - float cycles = total_b / (n * repeat_count); - ESP_LOGI(TAG, "dsps_add_f32_ae32 - %f cycles per sample \n", cycles); - -} diff --git a/components/esp-dsp/modules/math/add/test/test_dsps_add_s16_ae32.c b/components/esp-dsp/modules/math/add/test/test_dsps_add_s16_ae32.c deleted file mode 100644 index bd72ddc9..00000000 --- a/components/esp-dsp/modules/math/add/test/test_dsps_add_s16_ae32.c +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_add.h" -#include "esp_attr.h" - -static const char *TAG = "dsps_add"; - -TEST_CASE("dsps_add_s16_ae32 functionality", "[dsps]") -{ - int n = 64; - int16_t x[n]; - int16_t y[n]; - int32_t temp; - int shift = 0; - for (int i = 0 ; i < n ; i++) { - x[i] = i<<4; - temp = ((int32_t)x[i] + (int32_t)x[i])>>shift; - y[i] = temp; - } - - dsps_add_s16_ae32(x, x, x, n, 1, 1, 1, 0); - for (int i = 0 ; i < n ; i++) { - ESP_LOGD(TAG, "x[%i] = %i %i", i, x[i], y[i]); - if (x[i] != y[i]) { - TEST_ASSERT_EQUAL(x[i], y[i]); - } - } -} - -TEST_CASE("dsps_add_s16_ae32 benchmark", "[dsps]") -{ - const int n = 256; - int16_t x[n]; - int16_t y[n]; - int32_t temp; - int16_t test_const = 0x2000; - for (int i = 0 ; i < n ; i++) { - x[i] = i<<4; - temp = (int32_t)x[i]*(int32_t)test_const; - y[i] = temp >> 15; - } - - int repeat_count = 1; - - unsigned int start_b = xthal_get_ccount(); - dsps_add_s16_ae32(x, x, x, n, 1, 1, 1, 0); - unsigned int end_b = xthal_get_ccount(); - - float cycles = end_b - start_b; - ESP_LOGI(TAG, "dsps_add_s16_ae32 - %f cycles per sample \n", cycles); -} diff --git a/components/esp-dsp/modules/math/add/test/test_dsps_add_s16_ansi.c b/components/esp-dsp/modules/math/add/test/test_dsps_add_s16_ansi.c deleted file mode 100644 index e780551a..00000000 --- a/components/esp-dsp/modules/math/add/test/test_dsps_add_s16_ansi.c +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_add.h" -#include "esp_attr.h" - -static const char *TAG = "dsps_add"; - -TEST_CASE("dsps_add_s16_ansi functionality", "[dsps]") -{ - int n = 64; - int16_t x[n]; - int16_t y[n]; - int32_t temp; - int shift = 0; - for (int i = 0 ; i < n ; i++) { - x[i] = i<<4; - temp = ((int32_t)x[i] + (int32_t)x[i])>>shift; - y[i] = temp; - } - - dsps_add_s16_ansi(x, x, x, n, 1, 1, 1, 0); - for (int i = 0 ; i < n ; i++) { - if (x[i] != y[i]) { - TEST_ASSERT_EQUAL(x[i], y[i]); - } - } -} - -TEST_CASE("dsps_add_s16_ansi benchmark", "[dsps]") -{ - const int n = 256; - int16_t x[n]; - int16_t y[n]; - int32_t temp; - int16_t test_const = 0x2000; - for (int i = 0 ; i < n ; i++) { - x[i] = i<<4; - temp = (int32_t)x[i]*(int32_t)test_const; - y[i] = temp >> 15; - } - - int repeat_count = 1; - - unsigned int start_b = xthal_get_ccount(); - dsps_add_s16_ansi(x, x, x, n, 1, 1, 1, 0); - unsigned int end_b = xthal_get_ccount(); - - float cycles = end_b - start_b; - ESP_LOGI(TAG, "dsps_add_s16_ansi - %f cycles per sample \n", cycles); -} diff --git a/components/esp-dsp/modules/math/addc/float/dsps_addc_f32_ae32.S b/components/esp-dsp/modules/math/addc/float/dsps_addc_f32_ae32.S deleted file mode 100644 index cb4ea6ac..00000000 --- a/components/esp-dsp/modules/math/addc/float/dsps_addc_f32_ae32.S +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_addc_platform.h" -#if (dsps_addc_f32_ae32_enabled == 1) - -// This is bi quad filter form II for ESP32 processor. - .text - .align 4 - .global dsps_addc_f32_ae32 - .type dsps_addc_f32_ae32,@function -// The function implements the following C code: -// esp_err_t dsps_addc_f32_ansi(const float *input, float *output, int len, float C, int step_in, int step_out) -// { -// for (int i = 0 ; i < len ; i++) { -// output[i * step_out] = input[i * step_in] + C; -// } -// return ESP_OK; -// } -dsps_addc_f32_ae32: -// input - a2 -// output - a3 -// len - a4 -// C - a5 -// step_in - a6 -// step_out - a7 - - entry a1, 16 - - slli a6, a6, 2 // a6 - step_in<<2 - slli a7, a7, 2 // a7 - step_out<<2 - wfr f0, a5 // a5 - load to the f0 - - loopnez a4, loop_end_addc_f32_ae32 - lsi f1, a2, 0 - - add.s f2, f1, f0 // f2 = f1 + f0 - add.n a2, a2, a6 // input1_ptr+=step_in; - ssi f2, a3, 0 - add.n a3, a3, a7 // output+=step_out; -loop_end_addc_f32_ae32: - - movi.n a2, 0 // return status ESP_OK - retw.n - -#endif // dsps_addc_f32_ae32_enabled \ No newline at end of file diff --git a/components/esp-dsp/modules/math/addc/float/dsps_addc_f32_ansi.c b/components/esp-dsp/modules/math/addc/float/dsps_addc_f32_ansi.c deleted file mode 100644 index f825592d..00000000 --- a/components/esp-dsp/modules/math/addc/float/dsps_addc_f32_ansi.c +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_addc.h" - -esp_err_t dsps_addc_f32_ansi(const float *input, float *output, int len, float C, int step_in, int step_out) -{ - if (NULL == input) return ESP_ERR_DSP_PARAM_OUTOFRANGE; - if (NULL == output) return ESP_ERR_DSP_PARAM_OUTOFRANGE; - - for (int i = 0 ; i < len ; i++) { - output[i * step_out] = input[i * step_in] + C; - } - return ESP_OK; -} \ No newline at end of file diff --git a/components/esp-dsp/modules/math/addc/include/dsps_addc.h b/components/esp-dsp/modules/math/addc/include/dsps_addc.h deleted file mode 100644 index 595320d5..00000000 --- a/components/esp-dsp/modules/math/addc/include/dsps_addc.h +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2018-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. - -#ifndef _dsps_addc_H_ -#define _dsps_addc_H_ -#include "dsp_err.h" - -#include "dsps_addc_platform.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - - -/**@{*/ -/** - * @brief add constant - * - * The function adds constant to the input array - * x[i*step_out] = y[i*step_in] + C; i=[0..len) - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param[in] input: input array - * @param output: output array - * @param len: amount of operations for arrays - * @param C: constant value - * @param step_in: step over input array (by default should be 1) - * @param step_out: step over output array (by default should be 1) - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_addc_f32_ansi(const float *input, float *output, int len, float C, int step_in, int step_out); -esp_err_t dsps_addc_f32_ae32(const float *input, float *output, int len, float C, int step_in, int step_out); -/**@}*/ - -#ifdef __cplusplus -} -#endif - - -#if CONFIG_DSP_OPTIMIZED -#if (dsps_addc_f32_ae32_enabled == 1) -#define dsps_addc_f32 dsps_addc_f32_ae32 -#else -#define dsps_addc_f32 dsps_addc_f32_ansi -#endif -#else -#define dsps_addc_f32 dsps_addc_f32_ansi -#endif // CONFIG_DSP_OPTIMIZED - -#endif // _dsps_addc_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/math/addc/include/dsps_addc_platform.h b/components/esp-dsp/modules/math/addc/include/dsps_addc_platform.h deleted file mode 100644 index 2880098c..00000000 --- a/components/esp-dsp/modules/math/addc/include/dsps_addc_platform.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef _dsps_addc_platform_H_ -#define _dsps_addc_platform_H_ - -#include -#include - - -#if ((XCHAL_HAVE_FP == 1) && (XCHAL_HAVE_LOOPS == 1)) - -#define dsps_addc_f32_ae32_enabled 1 - -#endif - - -#endif // _dsps_addc_platform_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/math/addc/test/test_dsps_addc_f32_ansi.c b/components/esp-dsp/modules/math/addc/test/test_dsps_addc_f32_ansi.c deleted file mode 100644 index 2f2d9d40..00000000 --- a/components/esp-dsp/modules/math/addc/test/test_dsps_addc_f32_ansi.c +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_addc.h" -#include "esp_attr.h" - -static const char *TAG = "dsps_addc"; - - -TEST_CASE("dsps_addc_f32_ansi functionality", "[dsps]") -{ - int n = 64; - float x[n]; - float y[n]; - for (int i = 0 ; i < n ; i++) { - x[i] = i; - y[i] = i + 10; - } - dsps_addc_f32_ansi(x, x, n, 10, 1, 1); - for (int i = 0 ; i < n ; i++) { - if (x[i] != y[i]) { - TEST_ASSERT_EQUAL(x[i], y[i]); - } - } -} - -TEST_CASE("dsps_addc_f32_ae32 functionality", "[dsps]") -{ - int n = 64; - float x[n]; - float y[n]; - for (int i = 0 ; i < n ; i++) { - x[i] = i; - y[i] = i + 10; - } - dsps_addc_f32_ae32(x, x, n, 10, 1, 1); - for (int i = 0 ; i < n ; i++) { - if (x[i] != y[i]) { - TEST_ASSERT_EQUAL(x[i], y[i]); - } - } - - int repeat_count = 1; - - dsps_addc_f32_ae32(x, x, n, 10, 1, 1); - - unsigned int start_b = xthal_get_ccount(); - dsps_addc_f32_ae32(x, x, n, 10, 1, 1); - unsigned int end_b = xthal_get_ccount(); - - float total_b = end_b - start_b; - float cycles = total_b / (n * repeat_count); - ESP_LOGI(TAG, "dsps_addc_f32_ae32 - %f cycles per sample \n", cycles); -} diff --git a/components/esp-dsp/modules/math/include/dsps_math.h b/components/esp-dsp/modules/math/include/dsps_math.h deleted file mode 100644 index 878f34d6..00000000 --- a/components/esp-dsp/modules/math/include/dsps_math.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2018-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. - -#ifndef _dsps_math_H_ -#define _dsps_math_H_ - -#include "dsps_add.h" -#include "dsps_sub.h" -#include "dsps_mul.h" -#include "dsps_addc.h" -#include "dsps_mulc.h" -#include "dsps_sqrt.h" - -#endif // _dsps_math_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/math/mul/fixed/dsps_mul_s16_ansi.c b/components/esp-dsp/modules/math/mul/fixed/dsps_mul_s16_ansi.c deleted file mode 100644 index 45d48e3b..00000000 --- a/components/esp-dsp/modules/math/mul/fixed/dsps_mul_s16_ansi.c +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_mul.h" - -esp_err_t dsps_mul_s16_ansi(const int16_t *input1, const int16_t *input2, int16_t *output, int len, int step1, int step2, int step_out, int shift) -{ - if (NULL == input1) return ESP_ERR_DSP_PARAM_OUTOFRANGE; - if (NULL == input2) return ESP_ERR_DSP_PARAM_OUTOFRANGE; - if (NULL == output) return ESP_ERR_DSP_PARAM_OUTOFRANGE; - - for (int i = 0 ; i < len ; i++) { - int ttt = (int)input1[i * step1] * (int)input2[i * step2]; - output[i * step_out] = ttt>>shift; - } - return ESP_OK; -} diff --git a/components/esp-dsp/modules/math/mul/float/dsps_mul_f32_ae32.S b/components/esp-dsp/modules/math/mul/float/dsps_mul_f32_ae32.S deleted file mode 100644 index e01e2e53..00000000 --- a/components/esp-dsp/modules/math/mul/float/dsps_mul_f32_ae32.S +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_mul_platform.h" -#if (dsps_mul_f32_ae32_enabled == 1) - -// This is bi quad filter form II for ESP32 processor. - .text - .align 4 - .global dsps_mul_f32_ae32 - .type dsps_mul_f32_ae32,@function -// The function implements the following C code: -// esp_err_t dsps_mul_f32_ansi(const float *input1, const float *input2, float *output, int len, int step1, int step2, int step_out) -// { -// for (int i = 0 ; i < len ; i++) { -// output[i * step_out] = input1[i * step1] * input2[i * step2]; -// } -// return ESP_OK; -// } - -dsps_mul_f32_ae32: -// input1 - a2 -// input2 - a3 -// output - a4 -// len - a5 -// step1 - a6 -// step2 - a7 -// step_out - stack (a8) - - entry a1, 16 - - l32i.n a8, a1, 16 // Load step_out to the a8 register - slli a6, a6, 2 // a6 - step1<<2 - slli a7, a7, 2 // a7 - step2<<2 - slli a8, a8, 2 // a8 - step_out<<2 - - lsi f0, a2, 0 - add.n a2, a2, a6 // input1_ptr+=step1; - loopnez a5, loop_end_mul_f32_ae32 - lsi f1, a3, 0 - add.n a3, a3, a7 // input2_ptr+=step2; - - mul.s f2, f1, f0 // f2 = f1*f0 - lsi f0, a2, 0 - add.n a2, a2, a6 // input1_ptr+=step1; - ssi f2, a4, 0 - add.n a4, a4, a8 // input2_ptr+=step2; -loop_end_mul_f32_ae32: - - movi.n a2, 0 // return status ESP_OK - retw.n - -#endif // dsps_mul_f32_ae32_enabled diff --git a/components/esp-dsp/modules/math/mul/float/dsps_mul_f32_ansi.c b/components/esp-dsp/modules/math/mul/float/dsps_mul_f32_ansi.c deleted file mode 100644 index 109c11e5..00000000 --- a/components/esp-dsp/modules/math/mul/float/dsps_mul_f32_ansi.c +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_mul.h" - -esp_err_t dsps_mul_f32_ansi(const float *input1, const float *input2, float *output, int len, int step1, int step2, int step_out) -{ - if (NULL == input1) return ESP_ERR_DSP_PARAM_OUTOFRANGE; - if (NULL == input2) return ESP_ERR_DSP_PARAM_OUTOFRANGE; - if (NULL == output) return ESP_ERR_DSP_PARAM_OUTOFRANGE; - - for (int i = 0 ; i < len ; i++) { - output[i * step_out] = input1[i * step1] * input2[i * step2]; - } - return ESP_OK; -} diff --git a/components/esp-dsp/modules/math/mul/include/dsps_mul.h b/components/esp-dsp/modules/math/mul/include/dsps_mul.h deleted file mode 100644 index 303da36b..00000000 --- a/components/esp-dsp/modules/math/mul/include/dsps_mul.h +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2018-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. - -#ifndef _dsps_mul_H_ -#define _dsps_mul_H_ -#include "dsp_err.h" - -#include "dsps_mul_platform.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - - -/**@{*/ -/** - * @brief Multiply two arrays - * - * The function multiply one input array to another and store result to other array - * out[i*step_out] = input1[i*step1] * input2[i*step2]; i=[0..len) - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param[in] input1: input array 1 - * @param[in] input2: input array 2 - * @param output: output array - * @param len: amount of operations for arrays - * @param step1: step over input array 1 (by default should be 1) - * @param step2: step over input array 2 (by default should be 1) - * @param step_out: step over output array (by default should be 1) - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_mul_f32_ansi(const float *input1, const float *input2, float *output, int len, int step1, int step2, int step_out); -esp_err_t dsps_mul_f32_ae32(const float *input1, const float *input2, float *output, int len, int step1, int step2, int step_out); -/**@}*/ - - -/**@{*/ -/** - * @brief Multiply two arrays - * - * The function multiply one input array to another and store result to other array - * out[i*step_out] = input1[i*step1] * input2[i*step2]; i=[0..len) - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param[in] input1: input array 1 - * @param[in] input2: input array 2 - * @param output: output array - * @param len: amount of operations for arrays - * @param step1: step over input array 1 (by default should be 1) - * @param step2: step over input array 2 (by default should be 1) - * @param step_out: step over output array (by default should be 1) - * @param shift: output shift after multiplication (by default should be 15) - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_mul_s16_ansi(const int16_t *input1, const int16_t *input2, int16_t *output, int len, int step1, int step2, int step_out, int shift); - -/**@}*/ - -#ifdef __cplusplus -} -#endif - -#if CONFIG_DSP_OPTIMIZED -#if (dsps_mul_f32_ae32_enabled == 1) -#define dsps_mul_f32 dsps_mul_f32_ae32 -#else -#define dsps_mul_f32 dsps_mul_f32_ansi -#endif // -#define dsps_mul_s16 dsps_mul_s16_ansi -#else // CONFIG_DSP_OPTIMIZED -#define dsps_mul_f32 dsps_mul_f32_ansi -#define dsps_mul_s16 dsps_mul_s16_ansi -#endif -#endif // _dsps_mul_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/math/mul/include/dsps_mul_platform.h b/components/esp-dsp/modules/math/mul/include/dsps_mul_platform.h deleted file mode 100644 index 2e195ea1..00000000 --- a/components/esp-dsp/modules/math/mul/include/dsps_mul_platform.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _dsps_mul_platform_H_ -#define _dsps_mul_platform_H_ - -#include -#include - - -#if ((XCHAL_HAVE_FP == 1) && (XCHAL_HAVE_LOOPS == 1)) - -#define dsps_mul_f32_ae32_enabled 1 - -#endif - -#endif // _dsps_mul_platform_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/math/mul/test/test_dsps_mul_f32_ansi.c b/components/esp-dsp/modules/math/mul/test/test_dsps_mul_f32_ansi.c deleted file mode 100644 index 5fa8344f..00000000 --- a/components/esp-dsp/modules/math/mul/test/test_dsps_mul_f32_ansi.c +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_mul.h" -#include "esp_attr.h" - -static const char *TAG = "dsps_mul"; - -TEST_CASE("dsps_mul_f32_ansi functionality", "[dsps]") -{ - int n = 32; - float x[n]; - float y[n]; - for (int i = 0 ; i < n ; i++) { - x[i] = i; - y[i] = i*i; - } - dsps_mul_f32_ansi(x, x, x, n, 1, 1, 1); - for (int i = 0 ; i < n ; i++) { - if (x[i] != y[i]) { - TEST_ASSERT_EQUAL(x[i], y[i]); - } - } -} - -TEST_CASE("dsps_mul_f32_ae32 functionality", "[dsps]") -{ - int n = 32; - float x[n]; - float y[n]; - for (int i = 0 ; i < n ; i++) { - x[i] = i; - y[i] = i*i; - } - dsps_mul_f32_ae32(x, x, x, n, 1, 1, 1); - for (int i = 0 ; i < n ; i++) { - if (x[i] != y[i]) { - TEST_ASSERT_EQUAL(x[i], y[i]); - } - } - - int repeat_count = 1; - - dsps_mul_f32_ae32(x, x, x, n, 1, 1, 1); - - unsigned int start_b = xthal_get_ccount(); - dsps_mul_f32_ae32(x, x, x, n, 1, 1, 1); - unsigned int end_b = xthal_get_ccount(); - - float total_b = end_b - start_b; - float cycles = total_b / (n * repeat_count); - ESP_LOGI(TAG, "dsps_mul_f32_ae32 - %f cycles per sample \n", cycles); - -} diff --git a/components/esp-dsp/modules/math/mulc/fixed/dsps_mulc_s16_ae32.S b/components/esp-dsp/modules/math/mulc/fixed/dsps_mulc_s16_ae32.S deleted file mode 100644 index d86d0817..00000000 --- a/components/esp-dsp/modules/math/mulc/fixed/dsps_mulc_s16_ae32.S +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_mulc_platform.h" -#if (dsps_mulc_s16_ae32_enabled == 1) - - .text - .align 4 - .global dsps_mulc_s16_ae32 - .type dsps_mulc_s16_ae32,@function -// The function implements the following C code: -// esp_err_t dsps_mulc_f32_ansi(const float *input, float *output, int len, float C, int step_in, int step_out) -// { -// for (int i = 0 ; i < len ; i++) { -// int32_t acc = (int32_t)input[i * step_in] * (int32_t)C; -// output[i * step_out] = (int16_t)(acc>>15); -// } -// return ESP_OK; -// } -dsps_mulc_s16_ae32: -// input - a2 -// output - a3 -// len - a4 -// C - a5 -// step_in - a6 -// step_out - a7 - - entry a1, 16 - - movi.n a8, 15 // output shift - ssr a8 - - srli a4, a4, 1 // a4 = a4>>1 - slli a6, a6, 2 // a6 - step_in<<3, because we load two inputs per loop - slli a7, a7, 1 // a7 - step_out<<2 - - addi a6, a6, -4; - addi a2, a2, -4; - - ldinc m0, a2 - - loopnez a4, loop_end_mulc_f32_ae32 - add.n a2, a2, a6 // input+=step_input; - mul.DA.LL m0, a5 - rsr a8, acchi - rsr a9, acclo - src a8, a8, a9 // Here result in a8 - s16i a8, a3, 0 // store result to the putput - // rsr a9, acclo - // s16i a9, a3, 0 // store result to the putput - add.n a3, a3, a7 // output+=step_out; - mul.DA.HL m0, a5 - - rsr a8, acchi - rsr a9, acclo - ldinc m0, a2 // load next data - src a10, a8, a9 // Here result in a8 - s16i a10, a3, 0 // store result to the putput - // // rsr a9, acclo - // // s16i a9, a3, 0 // store result to the putput - add.n a3, a3, a7 // output+=step_out; -loop_end_mulc_f32_ae32: - movi.n a2, 0 // return status ESP_OK - retw.n - -#endif // dsps_mulc_s16_ae32_enabled \ No newline at end of file diff --git a/components/esp-dsp/modules/math/mulc/fixed/dsps_mulc_s16_ansi.c b/components/esp-dsp/modules/math/mulc/fixed/dsps_mulc_s16_ansi.c deleted file mode 100644 index bbe4db9a..00000000 --- a/components/esp-dsp/modules/math/mulc/fixed/dsps_mulc_s16_ansi.c +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_mulc.h" - -esp_err_t dsps_mulc_s16_ansi(const int16_t *input, int16_t *output, int len, int16_t C, int step_in, int step_out) -{ - if (NULL == input) return ESP_ERR_DSP_PARAM_OUTOFRANGE; - if (NULL == output) return ESP_ERR_DSP_PARAM_OUTOFRANGE; - - for (int i = 0 ; i < len ; i++) { - int32_t acc = (int32_t)input[i * step_in] * (int32_t)C; - output[i * step_out] = (int16_t)(acc>>15); - } - return ESP_OK; -} \ No newline at end of file diff --git a/components/esp-dsp/modules/math/mulc/float/dsps_mulc_f32_ae32.S b/components/esp-dsp/modules/math/mulc/float/dsps_mulc_f32_ae32.S deleted file mode 100644 index d1eade04..00000000 --- a/components/esp-dsp/modules/math/mulc/float/dsps_mulc_f32_ae32.S +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_mulc_platform.h" -#if (dsps_mulc_f32_ae32_enabled == 1) - -// This is bi quad filter form II for ESP32 processor. - .text - .align 4 - .global dsps_mulc_f32_ae32 - .type dsps_mulc_f32_ae32,@function -// The function implements the following C code: -// esp_err_t dsps_mulc_f32_ansi(const float *input, float *output, int len, float C, int step_in, int step_out) -// { -// for (int i = 0 ; i < len ; i++) { -// output[i * step_out] = input[i * step_in] * C; -// } -// return ESP_OK; -// } -dsps_mulc_f32_ae32: -// input - a2 -// output - a3 -// len - a4 -// C - a5 -// step_in - a6 -// step_out - a7 - - entry a1, 16 - - slli a6, a6, 2 // a6 - step_in<<2 - slli a7, a7, 2 // a7 - step_out<<2 - wfr f0, a5 // a5 - load to the f0 - - loopnez a4, loop_end_mulc_f32_ae32 - lsi f1, a2, 0 - - mul.s f2, f1, f0 // f2 = f1 * f0 - add.n a2, a2, a6 // input1_ptr+=step_in; - ssi f2, a3, 0 - add.n a3, a3, a7 // output+=step_out; -loop_end_mulc_f32_ae32: - - movi.n a2, 0 // return status ESP_OK - retw.n - -#endif // dsps_mulc_f32_ae32_enabled \ No newline at end of file diff --git a/components/esp-dsp/modules/math/mulc/float/dsps_mulc_f32_ansi.c b/components/esp-dsp/modules/math/mulc/float/dsps_mulc_f32_ansi.c deleted file mode 100644 index c184eff8..00000000 --- a/components/esp-dsp/modules/math/mulc/float/dsps_mulc_f32_ansi.c +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_mulc.h" - -esp_err_t dsps_mulc_f32_ansi(const float *input, float *output, int len, float C, int step_in, int step_out) -{ - if (NULL == input) return ESP_ERR_DSP_PARAM_OUTOFRANGE; - if (NULL == output) return ESP_ERR_DSP_PARAM_OUTOFRANGE; - - for (int i = 0 ; i < len ; i++) { - output[i * step_out] = input[i * step_in] * C; - } - return ESP_OK; -} \ No newline at end of file diff --git a/components/esp-dsp/modules/math/mulc/include/dsps_mulc.h b/components/esp-dsp/modules/math/mulc/include/dsps_mulc.h deleted file mode 100644 index 6b8ff167..00000000 --- a/components/esp-dsp/modules/math/mulc/include/dsps_mulc.h +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2018-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. - -#ifndef _dsps_mulc_H_ -#define _dsps_mulc_H_ -#include "dsp_err.h" - -#include "dsps_mulc_platform.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - -/**@{*/ -/** - * @brief multiply constant - * - * The function multiplies input array to the constant value - * x[i*step_out] = y[i*step_in]*C; i=[0..len) - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param[in] input: input array - * @param output: output array - * @param len: amount of operations for arrays - * @param C: constant value - * @param step_in: step over input array (by default should be 1) - * @param step_out: step over output array (by default should be 1) - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_mulc_f32_ansi(const float *input, float *output, int len, float C, int step_in, int step_out); -esp_err_t dsps_mulc_f32_ae32(const float *input, float *output, int len, float C, int step_in, int step_out); - -esp_err_t dsps_mulc_s16_ae32(const int16_t *input, int16_t *output, int len, int16_t C, int step_in, int step_out); -esp_err_t dsps_mulc_s16_ansi(const int16_t *input, int16_t *output, int len, int16_t C, int step_in, int step_out); - -/**@}*/ - -#ifdef __cplusplus -} -#endif - -#if CONFIG_DSP_OPTIMIZED -#if (dsps_mulc_f32_ae32_enabled == 1) -#define dsps_mulc_f32 dsps_mulc_f32_ae32 -#else // -#define dsps_mulc_f32 dsps_mulc_f32_ansi -#endif -#if (dsps_mulc_s16_ae32_enabled == 1) -#define dsps_mulc_s16 dsps_mulc_s16_ae32 -#else -#define dsps_mulc_s16 dsps_mulc_s16_ansi -#endif // dsps_mulc_s16_ae32_enabled - -#else -#define dsps_mulc_f32 dsps_mulc_f32_ansi -#define dsps_mulc_s16 dsps_mulc_s16_ansi -#endif - - -#endif // _dsps_mulc_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/math/mulc/include/dsps_mulc_platform.h b/components/esp-dsp/modules/math/mulc/include/dsps_mulc_platform.h deleted file mode 100644 index d0d741ca..00000000 --- a/components/esp-dsp/modules/math/mulc/include/dsps_mulc_platform.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef _dsps_mulc_platform_H_ -#define _dsps_mulc_platform_H_ - -#include -#include - - -#if ((XCHAL_HAVE_FP == 1) && (XCHAL_HAVE_LOOPS == 1)) - -#define dsps_mulc_f32_ae32_enabled 1 - -#endif - -#if ((XCHAL_HAVE_LOOPS == 1) && (XCHAL_HAVE_MAC16 == 1)) - -#define dsps_mulc_s16_ae32_enabled 1 - -#endif // - - -#endif // _dsps_mulc_platform_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/math/mulc/test/test_dsps_mulc_f32_ansi.c b/components/esp-dsp/modules/math/mulc/test/test_dsps_mulc_f32_ansi.c deleted file mode 100644 index 74f36d8d..00000000 --- a/components/esp-dsp/modules/math/mulc/test/test_dsps_mulc_f32_ansi.c +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_mulc.h" -#include "esp_attr.h" - -static const char *TAG = "dsps_mulc"; - -TEST_CASE("dsps_mulc_f32_ansi functionality", "[dsps]") -{ - int n = 64; - float x[n]; - float y[n]; - for (int i = 0 ; i < n ; i++) { - x[i] = i; - y[i] = i * 10; - } - dsps_mulc_f32_ansi(x, x, n, 10, 1, 1); - for (int i = 0 ; i < n ; i++) { - if (x[i] != y[i]) { - TEST_ASSERT_EQUAL(x[i], y[i]); - } - } -} - -TEST_CASE("dsps_mulc_f32_ae32 functionality", "[dsps]") -{ - int n = 64; - float x[n]; - float y[n]; - for (int i = 0 ; i < n ; i++) { - x[i] = i; - y[i] = i*10; - } - dsps_mulc_f32_ae32(x, x, n, 10, 1, 1); - for (int i = 0 ; i < n ; i++) { - if (x[i] != y[i]) { - TEST_ASSERT_EQUAL(x[i], y[i]); - } - } - - int repeat_count = 1; - - dsps_mulc_f32_ae32(x, x, n, 10, 1, 1); - - unsigned int start_b = xthal_get_ccount(); - dsps_mulc_f32_ae32(x, x, n, 10, 1, 1); - unsigned int end_b = xthal_get_ccount(); - - float total_b = end_b - start_b; - float cycles = total_b / (n * repeat_count); - ESP_LOGI(TAG, "dsps_mulc_f32_ae32 - %f cycles per sample \n", cycles); -} diff --git a/components/esp-dsp/modules/math/mulc/test/test_dsps_mulc_s16_ae32.c b/components/esp-dsp/modules/math/mulc/test/test_dsps_mulc_s16_ae32.c deleted file mode 100644 index 16cd0eba..00000000 --- a/components/esp-dsp/modules/math/mulc/test/test_dsps_mulc_s16_ae32.c +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_mulc.h" -#include "esp_attr.h" - -static const char *TAG = "dsps_mulc"; - -TEST_CASE("dsps_mulc_s16_ae32 functionality", "[dsps]") -{ - int n = 64; - int16_t x[n]; - int16_t y[n]; - int32_t temp; - int16_t test_const = 0x2000; - for (int i = 0 ; i < n ; i++) { - x[i] = i<<4; - temp = (int32_t)x[i]*(int32_t)test_const; - y[i] = temp >> 15; - } - - dsps_mulc_s16_ae32(x, x, n, test_const, 1, 1); - for (int i = 0 ; i < n ; i++) { - if (x[i] != y[i]) { - TEST_ASSERT_EQUAL(x[i], y[i]); - } - } -} - -TEST_CASE("dsps_mulc_s16_ae32 benchmark", "[dsps]") -{ - const int n = 256; - int16_t x[n]; - int16_t y[n]; - int32_t temp; - int16_t test_const = 0x2000; - for (int i = 0 ; i < n ; i++) { - x[i] = i<<4; - temp = (int32_t)x[i]*(int32_t)test_const; - y[i] = temp >> 15; - } - - int repeat_count = 1; - - unsigned int start_b = xthal_get_ccount(); - dsps_mulc_s16_ae32(x, x, n, 10, 1, 1); - unsigned int end_b = xthal_get_ccount(); - - float cycles = end_b - start_b; - ESP_LOGI(TAG, "dsps_mulc_f32_ae32 - %f cycles per sample \n", cycles); -} diff --git a/components/esp-dsp/modules/math/mulc/test/test_dsps_mulc_s16_ansi.c b/components/esp-dsp/modules/math/mulc/test/test_dsps_mulc_s16_ansi.c deleted file mode 100644 index 7017a2ae..00000000 --- a/components/esp-dsp/modules/math/mulc/test/test_dsps_mulc_s16_ansi.c +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_mulc.h" -#include "esp_attr.h" - -static const char *TAG = "dsps_mulc"; - -TEST_CASE("dsps_mulc_s16_ansi functionality", "[dsps]") -{ - int n = 64; - int16_t x[n]; - int16_t y[n]; - int32_t temp; - int16_t test_const = 0x2000; - for (int i = 0 ; i < n ; i++) { - x[i] = i<<4; - temp = (int32_t)x[i]*(int32_t)test_const; - y[i] = temp >> 15; - } - - dsps_mulc_s16_ansi(x, x, n, test_const, 1, 1); - for (int i = 0 ; i < n ; i++) { - if (x[i] != y[i]) { - TEST_ASSERT_EQUAL(x[i], y[i]); - } - } -} - -TEST_CASE("dsps_mulc_s16_ae32 benchmark", "[dsps]") -{ - const int n = 256; - int16_t x[n]; - int16_t y[n]; - int32_t temp; - int16_t test_const = 0x2000; - for (int i = 0 ; i < n ; i++) { - x[i] = i<<4; - temp = (int32_t)x[i]*(int32_t)test_const; - y[i] = temp >> 15; - } - - int repeat_count = 1; - - unsigned int start_b = xthal_get_ccount(); - dsps_mulc_s16_ansi(x, x, n, 10, 1, 1); - unsigned int end_b = xthal_get_ccount(); - - float cycles = end_b - start_b; - ESP_LOGI(TAG, "dsps_mulc_f32_ae32 - %f cycles per sample \n", cycles); -} diff --git a/components/esp-dsp/modules/math/sqrt/float/dsps_sqrt_f32_ansi.c b/components/esp-dsp/modules/math/sqrt/float/dsps_sqrt_f32_ansi.c deleted file mode 100644 index dc8b1c73..00000000 --- a/components/esp-dsp/modules/math/sqrt/float/dsps_sqrt_f32_ansi.c +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_sqrt.h" -#include "esp_err.h" -#include - -inline float -dsps_sqrtf_f32_ansi (float f) -{ - const int result = 0x1fbb4000 + (*(int *)&f >> 1); - return *(float *)&result; -} - -esp_err_t -dsps_sqrt_f32_ansi (const float *input, float *output, int len) -{ - if (NULL == input) - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - if (NULL == output) - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - - for (int i = 0; i < len; i++) - { - output[i] = dsps_sqrtf_f32_ansi (input[i]); - } - return ESP_OK; -} - -float -dsps_inverted_sqrtf_f32_ansi (float data) -{ - const float x2 = data * 0.5F; - const float threehalfs = 1.5F; - - union - { - float f; - uint32_t i; - } conv = { data }; // member 'f' set to value of 'data'. - conv.i = 0x5f3759df - (conv.i >> 1); - conv.f *= (threehalfs - (x2 * conv.f * conv.f)); - return conv.f; -} diff --git a/components/esp-dsp/modules/math/sqrt/include/dsps_sqrt.h b/components/esp-dsp/modules/math/sqrt/include/dsps_sqrt.h deleted file mode 100644 index 31edc643..00000000 --- a/components/esp-dsp/modules/math/sqrt/include/dsps_sqrt.h +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2018-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. - -#ifndef _dsps_sqrt_H_ -#define _dsps_sqrt_H_ -#include "dsp_err.h" - - -#ifdef __cplusplus -extern "C" -{ -#endif - -/**@{*/ -/** - * @brief square root approximation - * - * The function takes square root approximation - * x[i] ~ sqrt(y[i]); i=[0..len) - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param[in] input: input array - * @param output: output array - * @param len: amount of operations for arrays - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_sqrt_f32_ansi(const float *input, float *output, int len); -//esp_err_t dsps_sqrt_s32_ansi(const int32_t *input, int16_t *output, int len); - -/**@{*/ -/** - * @brief square root approximation - * - * The function takes square root approximation - * x ~ sqrt(y); - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param[in] data: input value - * - * @return - * - square root value - */ -float dsps_sqrtf_f32_ansi(const float data); - - -/**@{*/ -/** - * @brief inverted square root approximation - * - * The function takes inverted square root approximation - * x ~ 1/sqrt(y); - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param[in] data: input value - * - * @return - * - inverted square root value - */ -float dsps_inverted_sqrtf_f32_ansi(float data ); -/**@}*/ - -#ifdef __cplusplus -} -#endif - - -#ifdef CONFIG_DSP_OPTIMIZED -#define dsps_sqrt_f32 dsps_sqrt_f32_ansi -#define dsps_sqrtf_f32 dsps_sqrtf_f32_ansi -#define dsps_inverted_sqrtf_f32 dsps_inverted_sqrtf_f32_ansi -#else -#define dsps_sqrt_f32 dsps_sqrt_f32_ansi -#define dsps_sqrtf_f32 dsps_sqrtf_f32_ansi -#define dsps_inverted_sqrtf_f32 dsps_inverted_sqrtf_f32_ansi -#endif - -#endif // _dsps_sqrt_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/math/sqrt/test/test_dsps_sqrt_f32_ansi.c b/components/esp-dsp/modules/math/sqrt/test/test_dsps_sqrt_f32_ansi.c deleted file mode 100644 index 7fb8b77c..00000000 --- a/components/esp-dsp/modules/math/sqrt/test/test_dsps_sqrt_f32_ansi.c +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_sqrt.h" -#include "esp_attr.h" - -static const char *TAG = "dsps_sqrt"; - -TEST_CASE("dsps_sqrtf_f32_ansi functionality", "[dsps]") -{ - float max_err = -1000; - float max_value = 0; - float min_err = 0; - float min_value = INT32_MAX; - int test_points = 100000; - for (size_t i = 0; i < test_points; i++) - { - float test_value = rand(); - // if (test_value > max_value) max_value = test_value; - // if (test_value < min_value) min_value = test_value; - float x = sqrtf(test_value); - float y = dsps_sqrtf_f32(test_value); - float error = 20*log10f(fabs((x - y)/x) + 0.000001); - if (error > max_err) - { - max_err = error; - max_value = test_value; - } - if (error < min_err) - { - min_err = error; - min_value = test_value; - } - if (error > -25) { - ESP_LOGE(TAG, "dsps_sqrtf_f32_ansi: error = %f dB, value = %f (0x%8.8x)\n", error, test_value, (int)test_value); - TEST_ASSERT_EQUAL(x, y); - } - } - ESP_LOGI(TAG, "dsps_sqrtf_f32_ansi: max error = %f dB, min error = %f dB, max_value = %f (0x%8.8x), min_value = %f (0x%8.8x)\n", max_err, min_err, max_value, (int)max_value, min_value, (int)min_value); -} - -TEST_CASE("dsps_sqrt_f32_ansi functionality", "[dsps]") -{ - int n = 256; - float* x = (float*)malloc(sizeof(float)*n); - float* result = (float*)malloc(sizeof(float)*n); - float* y = (float*)malloc(sizeof(float)*n); - for (int i = 0 ; i < n ; i++) { - y[i] = i * 10; - x[i] = y[i]*y[i]; - } - unsigned int start_b = xthal_get_ccount(); - dsps_sqrt_f32_ansi(x, result, n); - float cycles = xthal_get_ccount() - start_b; - - for (int i = 0 ; i < n ; i++) { - //printf("Result[%i] = %f, expected = %f, diff = %f\n", i, result[i], y[i], 20*logf(fabs((result[i] - y[i])/y[i]) + 0.000001)); - float error = 20*log10f(fabs((result[i] - y[i])/y[i]) + 0.000001); - if (error > -25) { - TEST_ASSERT_EQUAL(result[i], y[i]); - } - } - ESP_LOGI(TAG, "dsps_sqrt_f32_ansi - %f cycles for %i samples \n", cycles, n); - free(x); - free(y); - free(result); -} diff --git a/components/esp-dsp/modules/math/sub/float/dsps_sub_f32_ae32.S b/components/esp-dsp/modules/math/sub/float/dsps_sub_f32_ae32.S deleted file mode 100644 index 90e9e76e..00000000 --- a/components/esp-dsp/modules/math/sub/float/dsps_sub_f32_ae32.S +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_sub_platform.h" -#if (dsps_sub_f32_ae32_enabled == 1) - -// This is bi quad filter form II for ESP32 processor. - .text - .align 4 - .global dsps_sub_f32_ae32 - .type dsps_sub_f32_ae32,@function -// The function implements the following C code: -// esp_err_t dsps_sub_f32_ae32(const float *input1, const float *input2, float *output, int len, int step1, int step2, int step_out) -// { -// for (int i = 0 ; i < len ; i++) { -// output[i * step_out] = input1[i * step1] - input2[i * step2]; -// } -// return ESP_OK; -// } - -dsps_sub_f32_ae32: -// input1 - a2 -// input2 - a3 -// output - a4 -// len - a5 -// step1 - a6 -// step2 - a7 -// step_out - stack (a8) - - entry a1, 16 - - l32i.n a8, a1, 16 // Load step_out to the a8 register - slli a6, a6, 2 // a6 - step1<<2 - slli a7, a7, 2 // a7 - step2<<2 - slli a8, a8, 2 // a8 - step_out<<2 - - lsi f0, a2, 0 - add.n a2, a2, a6 // input1_ptr+=step1; - loopnez a5, loop_end_sub_f32_ae32 - lsi f1, a3, 0 - add.n a3, a3, a7 // input2_ptr+=step2; - - sub.s f2, f1, f0 // f2 = f1 - f0 - lsi f0, a2, 0 - add.n a2, a2, a6 // input1_ptr+=step1; - ssi f2, a4, 0 - add.n a4, a4, a8 // input2_ptr+=step2; -loop_end_sub_f32_ae32: - - movi.n a2, 0 // return status ESP_OK - retw.n - -#endif // dsps_sub_f32_ae32_enabled diff --git a/components/esp-dsp/modules/math/sub/float/dsps_sub_f32_ansi.c b/components/esp-dsp/modules/math/sub/float/dsps_sub_f32_ansi.c deleted file mode 100644 index 0126f1df..00000000 --- a/components/esp-dsp/modules/math/sub/float/dsps_sub_f32_ansi.c +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_sub.h" - -esp_err_t dsps_sub_f32_ansi(const float *input1, const float *input2, float *output, int len, int step1, int step2, int step_out) -{ - if (NULL == input1) return ESP_ERR_DSP_PARAM_OUTOFRANGE; - if (NULL == input2) return ESP_ERR_DSP_PARAM_OUTOFRANGE; - if (NULL == output) return ESP_ERR_DSP_PARAM_OUTOFRANGE; - - for (int i = 0 ; i < len ; i++) { - output[i * step_out] = input1[i * step1] - input2[i * step2]; - } - return ESP_OK; -} diff --git a/components/esp-dsp/modules/math/sub/include/dsps_sub.h b/components/esp-dsp/modules/math/sub/include/dsps_sub.h deleted file mode 100644 index 2dc1adf3..00000000 --- a/components/esp-dsp/modules/math/sub/include/dsps_sub.h +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2018-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. - -#ifndef _dsps_sub_H_ -#define _dsps_sub_H_ -#include "dsp_err.h" - -#include "dsps_sub_platform.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - - -/**@{*/ -/** - * @brief sub arrays - * - * The function subtract one array from another - * out[i*step_out] = input1[i*step1] - input2[i*step2]; i=[0..len) - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param[in] input1: input array 1 - * @param[in] input2: input array 2 - * @param output: output array - * @param len: amount of operations for arrays - * @param step1: step over input array 1 (by default should be 1) - * @param step2: step over input array 2 (by default should be 1) - * @param step_out: step over output array (by default should be 1) - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_sub_f32_ansi(const float *input1, const float *input2, float *output, int len, int step1, int step2, int step_out); -esp_err_t dsps_sub_f32_ae32(const float *input1, const float *input2, float *output, int len, int step1, int step2, int step_out); -/**@}*/ - -#ifdef __cplusplus -} -#endif - -#if CONFIG_DSP_OPTIMIZED - -#if (dsps_sub_f32_ae32_enabled == 1) -#define dsps_sub_f32 dsps_sub_f32_ae32 -#else -#define dsps_sub_f32 dsps_sub_f32_ansi -#endif -#else -#define dsps_sub_f32 dsps_sub_f32_ansi -#endif // CONFIG_DSP_OPTIMIZED - - -#endif // _dsps_sub_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/math/sub/include/dsps_sub_platform.h b/components/esp-dsp/modules/math/sub/include/dsps_sub_platform.h deleted file mode 100644 index d71ed0ff..00000000 --- a/components/esp-dsp/modules/math/sub/include/dsps_sub_platform.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef _dsps_sub_platform_H_ -#define _dsps_sub_platform_H_ - -#include -#include - - -#if ((XCHAL_HAVE_FP == 1) && (XCHAL_HAVE_LOOPS == 1)) - -#define dsps_sub_f32_ae32_enabled 1 - -#endif - -#endif // _dsps_sub_platform_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/math/sub/test/test_dsps_sub_f32_ansi.c b/components/esp-dsp/modules/math/sub/test/test_dsps_sub_f32_ansi.c deleted file mode 100644 index b5427cdb..00000000 --- a/components/esp-dsp/modules/math/sub/test/test_dsps_sub_f32_ansi.c +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_sub.h" -#include "esp_attr.h" - -static const char *TAG = "dsps_sub"; - -TEST_CASE("dsps_sub_f32_ansi functionality", "[dsps]") -{ - int n = 32; - float x[n]; - float y[n]; - for (int i = 0 ; i < n ; i++) { - x[i] = i; - y[i] = 0; - } - dsps_sub_f32_ansi(x, x, x, n, 1, 1, 1); - for (int i = 0 ; i < n ; i++) { - if (x[i] != y[i]) { - TEST_ASSERT_EQUAL(x[i], y[i]); - } - } -} - -TEST_CASE("dsps_sub_f32_ae32 functionality", "[dsps]") -{ - int n = 32; - float x[n]; - float y[n]; - for (int i = 0 ; i < n ; i++) { - x[i] = i; - y[i] = 0; - } - dsps_sub_f32_ae32(x, x, x, n, 1, 1, 1); - for (int i = 0 ; i < n ; i++) { - if (x[i] != y[i]) { - TEST_ASSERT_EQUAL(x[i], y[i]); - } - } - - int repeat_count = 1; - dsps_sub_f32_ae32(x, x, x, n, 1, 1, 1); - - unsigned int start_b = xthal_get_ccount(); - dsps_sub_f32_ae32(x, x, x, n, 1, 1, 1); - unsigned int end_b = xthal_get_ccount(); - - float total_b = end_b - start_b; - float cycles = total_b / (n * repeat_count); - ESP_LOGI(TAG, "dsps_sub_f32_ae32 - %f cycles per sample \n", cycles); -} diff --git a/components/esp-dsp/modules/matrix/fixed/dspm_mult_s16_ae32.S b/components/esp-dsp/modules/matrix/fixed/dspm_mult_s16_ae32.S deleted file mode 100644 index d28ac9ec..00000000 --- a/components/esp-dsp/modules/matrix/fixed/dspm_mult_s16_ae32.S +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright 2018-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. - -#include "dspm_mult_platform.h" -#if (dspm_mult_s16_ae32_enabled == 1) - -#include "dsps_dotprod_s16_m_ae32.S" -#include "dspm_mult_s16_m_ae32_vector.S" -//esp_err_t dspm_mult_s16_ae32(const int16_t* A, const int16_t* B, int16_t* C, int m, int n, int k, int shift); - -// This is matrix multipliction function for ESP32 processor. - .text - .align 4 - .global dspm_mult_s16_ae32 - .type dspm_mult_s16_ae32,@function - -dspm_mult_s16_ae32: -// A - a2 -// B - a3 -// C - a4 -// m - a5 - any > 0 -// n - a6 - 1,2,3, any -// k - a7 - 1, any -// shift - stack (a8) - -// a14 - n*4 - pointer increment -// - entry a1, 48 -// ====== process matrices when k == 1 ============ - l32i.n a8, a1, 48 // Load shift to the a8 register - - - // Prepare and load round value - ssr a8 // store shift to ssa - movi a15, 0x7fff - srl a15, a15 - - neg a8, a8 - addi a8, a8, 15 - ssr a8 // store shift to ssa - movi a8, 0 // Clear a8 - - slli a14, a6, 1 // Pointer increment for n - movi.n a10, 2 // Increment = 2 - movi.n a9, 0 // initial counter loop1 - - movi a12, 1 - beq a7, a12, vector_mult - // We have normal path with k > 1 - // a2, a3, a4 - A,B,C - // a5 - m - // a6 - n - // a7 - k - // a8 - temp - // a9 - temp - // a10- k counter - // a11- m counter - // a12- B - // a13- A - // a14 - pointer increment for n - // a15 - round value - - bbsi a6, 0, even_N_samples -// ---------------- for odd N - srli a6, a6, 1 // counter a6 = a6/2. We have to do it only once - slli a7, a7, 1 // counter a7 = a7*2. We have to do it only once - - // loop for M -m_loop_mmult: - movi a10, 0 // reset k loop counter - mov a13, a3 // set pointer to the first column -// loop for K -k_loop_mmult: - - addi a12, a2, -4 // every loop the same start position - - movi a8, 0 - wsr a8, acchi - wsr a15, acclo // initialize acc with shifted round value - - loopnez a6, .loop_end_mmult // loop for N - .loop_mmult: - ldinc m3, a12 - l16si a8, a13, 0 - add a13, a13, a7 - mula.ad.ll a8, m3 - l16si a8, a13, 0 - add a13, a13, a7 - mula.ad.lh a8, m3 - .loop_end_mmult: - - rsr a8, acchi - rsr a9, acclo - src a8, a8, a9 - s16i a8, a4, 0 - addi a4, a4, 2 - // check and increment for K - - addi a10, a10, 2 - add a13, a3, a10 // we shift collumn - bne a10, a7, k_loop_mmult - - // Check and increment for M - add a2, a2, a14 // move to the next raw - addi a5, a5, -1 - bnez.n a5, m_loop_mmult - - movi.n a2, 0 // return status ESP_OK - retw.n - -even_N_samples: -// ---------------- for odd N - slli a7, a7, 1 // counter a7 = a7*2. We have to do it only once - - // loop for M -m_loop_mmult_even: - movi a10, 0 // reset k loop counter - mov a13, a3 // set pointer to the first column -// loop for K -k_loop_mmult_even: - - mov a12, a2 // every loop the same start position - - movi a8, 0 - wsr a8, acchi - wsr a15, acclo // initialize acc with shifted round value - - loopnez a6, .loop_end_mmult_even // loop for N - .loop_mmult_even: - l16si a9, a12, 0 - l16si a8, a13, 0 - addi a12, a12, 2 - add a13, a13, a7 - mula.aa.ll a8, a9 - .loop_end_mmult_even: - - rsr a8, acchi - rsr a9, acclo - src a8, a8, a9 - s16i a8, a4, 0 - addi a4, a4, 2 - // check and increment for K - - addi a10, a10, 2 - add a13, a3, a10 // we shift collumn - bne a10, a7, k_loop_mmult_even - - // Check and increment for M - add a2, a2, a14 // move to the next raw - addi a5, a5, -1 - bnez.n a5, m_loop_mmult_even - - movi.n a2, 0 // return status ESP_OK - retw.n - -// The path where n > 1 -vector_mult: - dspm_mult_s16_m_ae32_vector; - - -#endif // dspm_mult_s16_ae32_enabled \ No newline at end of file diff --git a/components/esp-dsp/modules/matrix/fixed/dspm_mult_s16_ansi.c b/components/esp-dsp/modules/matrix/fixed/dspm_mult_s16_ansi.c deleted file mode 100644 index 13c244e9..00000000 --- a/components/esp-dsp/modules/matrix/fixed/dspm_mult_s16_ansi.c +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_dotprod.h" -#include "dspm_mult.h" - -// Matrinx A(m,n), m - amount or rows, n - amount of columns -// C(m,k) = A(m,n)*B(n,k) -// c(i,j) = sum(a(i,s)*b(s,j)) , s=1..n -esp_err_t dspm_mult_s16_ansi(const int16_t *A, const int16_t *B, int16_t *C, int m, int n, int k, int shift) -{ - int final_shift = shift - 15; - for (int i = 0 ; i < m ; i++) { - for (int j = 0 ; j < k ; j++) { - // This code also could be used - //dsps_dotprode_f32_ae32(&A[i*n],&B[j],&C[i*k + j],n,1,n); - long long acc = 0x7fff >> shift; - for (int s = 0; s < n ; s++) { - acc += (int32_t)A[i * n + s] * (int32_t)B[s * k + j]; - } - if (final_shift > 0) { - C[i * k + j] = (acc << final_shift); - } else { - C[i * k + j] = (acc >> (-final_shift)); - } - } - } - return ESP_OK; -} diff --git a/components/esp-dsp/modules/matrix/fixed/dspm_mult_s16_m_ae32.S b/components/esp-dsp/modules/matrix/fixed/dspm_mult_s16_m_ae32.S deleted file mode 100644 index 791e0852..00000000 --- a/components/esp-dsp/modules/matrix/fixed/dspm_mult_s16_m_ae32.S +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2018-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. - - -.macro dspm_mult_s16_ae32_MxNxN -// A - a2 -// B - a3 -// C - a4 -// m - a5 -// n - a6 -// k - a7 -// shift - stack (a8) - - movi a10, 4 // load 4 as a constant - // Check if n >=4 then acceleration is possible and - blt a6, a10, do_dotproduct - // Here we make operations one by one... - - - movi.n a2, 0 // return status ESP_OK - retw.n - -do_dotproduct: - - mov a12, a2 - mov a13, a3 - - srli a9, a6, 2 // a9 - count/4 - 1 - addi a9, a9, -1 - - movi.n a10, 0 // load 0 to the a10 to increment second array - dotprod_s16_ae32_full a12, a13, a9, a10, a6 - - /* Get accumulator */ - ssr a6 - rsr a2, acchi - rsr a3, acclo - src a2, a2, a3 - - s16i a2, a4, 0 - movi.n a2, 0 - - - movi.n a2, 0 // return status ESP_OK - retw.n - -.endm // dspm_mult_s16_ae32_MxNxN \ No newline at end of file diff --git a/components/esp-dsp/modules/matrix/fixed/dspm_mult_s16_m_ae32_vector.S b/components/esp-dsp/modules/matrix/fixed/dspm_mult_s16_m_ae32_vector.S deleted file mode 100644 index af9dd62b..00000000 --- a/components/esp-dsp/modules/matrix/fixed/dspm_mult_s16_m_ae32_vector.S +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright 2018-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. - - -.macro dspm_mult_s16_m_ae32_vector -// m - a5 - any > 0 -// n - a6 - 1,2,3, any -// k - a7 - 1, any - - - // Define path for n < 4 - movi a7, 4 - blt a6, a7, small_process_loop // jump for n < 4 - - srli a7, a6, 2 - addi a7, a7, -1 - - -mmultv_loop1: - wsr a8, acchi - wsr a15, acclo // initialize acc with shifted round value - - // Clear initial state of the result register - // a2 - A - // a3 - B - // a4 - C - // a6 - n - // a7 - n/4 - 1 - // a8 - 0 - // a15- 0x7fff>>shift - - mov a12, a2 // load A - mov a13, a3 // Load B - - dotprod_s16_ae32_full a12, a13, a7, a6 - - // check loop 1 - /* Get accumulator */ - rsr a12, acchi - rsr a13, acclo - src a12, a12, a13 - - s16i a12, a4, 0 - addi a4, a4, 2 - - add.n a2, a2, a14 // Increment A, A = A[i*n] - addi a9, a9, 1 // Increment loop1 counter - blt a9, a5, mmultv_loop1 - - - movi.n a2, 0 // return status ESP_OK - retw.n - -small_process_loop: - - wsr a8, acchi - wsr a15, acclo // initialize acc with shifted round value - - mov a12, a2 // load A - mov a13, a3 // Load B - - addi a12, a12, -4 // To arrange fist pointer - addi a13, a13, -4 // To arrange fist pointer - - bbci a6, 1, .mod2chk_short - ldinc m0, a12 - ldinc m2, a13 - mula.dd.hh m0, m2 - mula.dd.ll m0, m2 - .mod2chk_short: - bbci a6, 0, .mod1chk_short - ldinc m0, a12 - ldinc m2, a13 - mula.dd.ll m0, m2 - .mod1chk_short: - - // check loop 1 - /* Get accumulator */ - rsr a12, acchi - rsr a13, acclo - src a12, a12, a13 - - s16i a12, a4, 0 - addi a4, a4, 2 - - add.n a2, a2, a14 // Increment A, A = A[i*n] - addi a9, a9, 1 // Increment loop1 counter - blt a9, a5, small_process_loop - - movi.n a2, 0 // return status ESP_OK - retw.n - - -.endm // dspm_mult_s16_m_ae32_vector \ No newline at end of file diff --git a/components/esp-dsp/modules/matrix/float/dspm_mult_3x3x1_f32_ae32.S b/components/esp-dsp/modules/matrix/float/dspm_mult_3x3x1_f32_ae32.S deleted file mode 100644 index 1932c197..00000000 --- a/components/esp-dsp/modules/matrix/float/dspm_mult_3x3x1_f32_ae32.S +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2018-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. - -#include "dspm_mult_platform.h" -#if (dspm_mult_3x3x1_f32_ae32_enabled == 1) - -// This is matrix multipliction function for ESP32 processor. - .text - .align 4 - .global dspm_mult_3x3x1_f32_ae32 - .type dspm_mult_3x3x1_f32_ae32,@function -// The function implements the following C code: -// esp_err_t dspm_mult_3x3x1_f32_ansi(const float* A, const float* B, float* C, int m, int n, int k) -// { - // for (int i=0 ; i< m ; i++) - // { - // for (int j=0 ; j< k ; j++) - // { - // C[i*k + j] = A[i*n]*B[j]; - // for (int s=1; s< n ; s++) - // { - // C[i*k + j] += A[i*n + s]*B[s*k + j]; - // } - // } - // } -// return ESP_OK; -// } - -dspm_mult_3x3x1_f32_ae32: -// A - a2 -// B - a3 -// C - a4 - -// a5 - 0 -// a6 - 3 - entry a1, 16 - - movi a5, 0 - movi a6, 3 - - lsi f13,a3, 0 // B[0] - lsi f14,a3, 4 // B[1] - lsi f15,a3, 8 // B[2] - -// addi a2, a2, -12 // To compensate first increment - loopnez a6, loop_mac_3x3x1_end_m_ae32 - wfr f0, a5 - lsi f2, a2, 0 - madd.s f0, f2, f13 - lsi f3, a2, 4 - madd.s f0, f3, f14 - lsi f4, a2, 8 - madd.s f0, f4, f15 - - addi a2, a2, 12 - ssi f0, a4, 0 - addi a4, a4, 4 - - loop_mac_3x3x1_end_m_ae32: - - movi.n a2, 0 // return status ESP_OK - retw.n - -#endif // \ No newline at end of file diff --git a/components/esp-dsp/modules/matrix/float/dspm_mult_3x3x3_f32_ae32.S b/components/esp-dsp/modules/matrix/float/dspm_mult_3x3x3_f32_ae32.S deleted file mode 100644 index d549eccc..00000000 --- a/components/esp-dsp/modules/matrix/float/dspm_mult_3x3x3_f32_ae32.S +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2018-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. - -#include "dspm_mult_platform.h" -#if (dspm_mult_3x3x3_f32_ae32_enabled == 1) - -// This is matrix multipliction function for ESP32 processor. - .text - .align 4 - .global dspm_mult_3x3x3_f32_ae32 - .type dspm_mult_3x3x3_f32_ae32,@function -// The function implements the following C code: -// esp_err_t dspm_mult_3x3x1_f32_ansi(const float* A, const float* B, float* C, int m, int n, int k) -// { - // for (int i=0 ; i< m ; i++) - // { - // for (int j=0 ; j< k ; j++) - // { - // C[i*k + j] = A[i*n]*B[j]; - // for (int s=1; s< n ; s++) - // { - // C[i*k + j] += A[i*n + s]*B[s*k + j]; - // } - // } - // } -// return ESP_OK; -// } - -dspm_mult_3x3x3_f32_ae32: -// A - a2 -// B - a3 -// C - a4 - -// a5 - 0 -// a6 - 3 - internal loop for n -// a7 - 3 - external loop for M - entry a1, 16 - - movi a5, 0 - movi a6, 3 - movi a7, 3 // loop ccount - -m_loop_3x3x3: - mov a12, a2 // A - mov a14, a4 // output pointer - - lsi f12, a3, 0 // B[0][0] - lsi f13, a3, 12 // B[1][0] - lsi f14, a3, 24 // B[2][0] - - loopnez a6, loop_mac_3x3x3_end_m_ae32 - wfr f0, a5 - - lsi f2, a12, 0 - madd.s f0, f2, f12 - lsi f3, a12, 4 - madd.s f0, f3, f13 - lsi f4, a12, 8 - madd.s f0, f4, f14 - - addi a12, a12, 12 - ssi f0, a14, 0 - addi a14, a14, 12 - loop_mac_3x3x3_end_m_ae32: - - addi a3, a3, 4 // increment input pointer B - addi a4, a4, 4 - addi a7, a7, -1 - bnez a7, m_loop_3x3x3 - - movi.n a2, 0 // return status ESP_OK - retw.n - -#endif // \ No newline at end of file diff --git a/components/esp-dsp/modules/matrix/float/dspm_mult_4x4x1_f32_ae32.S b/components/esp-dsp/modules/matrix/float/dspm_mult_4x4x1_f32_ae32.S deleted file mode 100644 index cb6c2d43..00000000 --- a/components/esp-dsp/modules/matrix/float/dspm_mult_4x4x1_f32_ae32.S +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2018-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. - -#include "dspm_mult_platform.h" -#if (dspm_mult_4x4x1_f32_ae32_enabled == 1) - -// This is matrix multipliction function for ESP32 processor. - .text - .align 4 - .global dspm_mult_4x4x1_f32_ae32 - .type dspm_mult_4x4x1_f32_ae32,@function -// The function implements the following C code: -// esp_err_t dspm_mult_3x3x1_f32_ansi(const float* A, const float* B, float* C, int m, int n, int k) -// { - // for (int i=0 ; i< m ; i++) - // { - // for (int j=0 ; j< k ; j++) - // { - // C[i*k + j] = A[i*n]*B[j]; - // for (int s=1; s< n ; s++) - // { - // C[i*k + j] += A[i*n + s]*B[s*k + j]; - // } - // } - // } -// return ESP_OK; -// } - -dspm_mult_4x4x1_f32_ae32: -// A - a2 -// B - a3 -// C - a4 - -// a5 - 0 -// a6 - 3 - entry a1, 16 - - movi a5, 0 - movi a6, 4 - - lsi f12,a3, 0 // B[0] - lsi f13,a3, 4 // B[1] - lsi f14,a3, 8 // B[2] - lsi f15,a3, 12 // B[3] - - loopnez a6, loop_mac_4x4x1_end_m_ae32 - wfr f0, a5 - lsi f2, a2, 0 - madd.s f0, f2, f12 - lsi f3, a2, 4 - madd.s f0, f3, f13 - lsi f4, a2, 8 - madd.s f0, f4, f14 - lsi f5, a2, 12 - madd.s f0, f5, f15 - - addi a2, a2, 16 - ssi f0, a4, 0 - addi a4, a4, 4 - - loop_mac_4x4x1_end_m_ae32: - - movi.n a2, 0 // return status ESP_OK - retw.n - -#endif // \ No newline at end of file diff --git a/components/esp-dsp/modules/matrix/float/dspm_mult_4x4x4_f32_ae32.S b/components/esp-dsp/modules/matrix/float/dspm_mult_4x4x4_f32_ae32.S deleted file mode 100644 index 980a6650..00000000 --- a/components/esp-dsp/modules/matrix/float/dspm_mult_4x4x4_f32_ae32.S +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2018-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. - -#include "dspm_mult_platform.h" -#if (dspm_mult_4x4x4_f32_ae32_enabled == 1) - -// This is matrix multipliction function for ESP32 processor. - .text - .align 4 - .global dspm_mult_4x4x4_f32_ae32 - .type dspm_mult_4x4x4_f32_ae32,@function -// The function implements the following C code: -// esp_err_t dspm_mult_3x3x1_f32_ansi(const float* A, const float* B, float* C, int m, int n, int k) -// { - // for (int i=0 ; i< m ; i++) - // { - // for (int j=0 ; j< k ; j++) - // { - // C[i*k + j] = A[i*n]*B[j]; - // for (int s=1; s< n ; s++) - // { - // C[i*k + j] += A[i*n + s]*B[s*k + j]; - // } - // } - // } -// return ESP_OK; -// } - -dspm_mult_4x4x4_f32_ae32: -// A - a2 -// B - a3 -// C - a4 - -// a5 - 0 -// a6 - 4 - internal loop for n -// a7 - 4 - external loop for M - entry a1, 16 - - movi a5, 0 - movi a6, 4 - movi a7, 4 // loop ccount - -m_loop_4x4x4: - mov a12, a2 // A - mov a14, a4 // output pointer - - lsi f12, a3, 0 // B[0][0] - lsi f13, a3, 16 // B[1][0] - lsi f14, a3, 32 // B[2][0] - lsi f15, a3, 48 // B[3][0] - - loopnez a6, loop_mac_4x4x4_end_m_ae32 - wfr f0, a5 - - lsi f2, a12, 0 - madd.s f0, f2, f12 - lsi f3, a12, 4 - madd.s f0, f3, f13 - lsi f4, a12, 8 - madd.s f0, f4, f14 - lsi f5, a12, 12 - madd.s f0, f5, f15 - - addi a12, a12, 16 - ssi f0, a14, 0 - addi a14, a14, 16 - loop_mac_4x4x4_end_m_ae32: - - addi a3, a3, 4 // increment input pointer B - addi a4, a4, 4 - addi a7, a7, -1 - bnez a7, m_loop_4x4x4 - - movi.n a2, 0 // return status ESP_OK - retw.n - -#endif // \ No newline at end of file diff --git a/components/esp-dsp/modules/matrix/float/dspm_mult_f32_ae32.S b/components/esp-dsp/modules/matrix/float/dspm_mult_f32_ae32.S deleted file mode 100644 index f6d5c22f..00000000 --- a/components/esp-dsp/modules/matrix/float/dspm_mult_f32_ae32.S +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2018-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. - -#include "dspm_mult_platform.h" -#if (dspm_mult_f32_ae32_enabled == 1) - -#include "dsps_dotprode_f32_m_ae32.S" - -// This is matrix multipliction function for ESP32 processor. - .text - .align 4 - .global dspm_mult_f32_ae32 - .type dspm_mult_f32_ae32,@function -// The function implements the following C code: -// esp_err_t dspm_mult_f32_ansi(const float* A, const float* B, float* C, int m, int n, int k) -// { - // for (int i=0 ; i< m ; i++) - // { - // for (int j=0 ; j< k ; j++) - // { - // C[i*k + j] = A[i*n]*B[j]; - // for (int s=1; s< n ; s++) - // { - // C[i*k + j] += A[i*n + s]*B[s*k + j]; - // } - // } - // } -// return ESP_OK; -// } - -dspm_mult_f32_ae32: -// A - a2 -// B - a3 -// C - a4 -// m - a5 -// n - a6 -// k - a7 - -// a8 = n*4 -// a10 = 4 -// a9 - counter loop1: 0..m -// a11 - counter loop2: 0..k -// a12 - A -// a13 - B -// a4 - C - - entry a1, 16 - // Array increment for floating point data should be 4 - - slli a8, a6, 2 // Pointer increment for A - slli a15,a7, 2 // Pointer increment for B - - movi.n a14, 0 // Innitial state of accumulator f1 - movi.n a10, 4 // Increment = 4 - movi.n a9, 0 // counter loop1 - -dpf_loop1: - movi.n a11, 0 // reset counter for loop2 -dpf_loop2: - - // Clear initial state of the result register - // a2 - A - // a3 - B - // a6 - n - // a10 - step == 4 bytes - // a8 - step n*4 - mov a12, a2 // load A - - slli a13, a11, 2 // loop count to pointer value - add.n a13, a3, a13 // load A - - wfr f1, a14 // reset f1 - // Calculating dotproduct... - dotprode_f32_ae32 a12, a13, a6, a10, a15; - - ssi f1, a4, 0 // Store result from f1 to memory at a4 - addi a4, a4, 4 // increment a4 for next time - - // check loop 2 - addi a11, a11, 1 // Increment loop2 counter - blt a11, a7, dpf_loop2 - - // check loop 1 - add.n a2, a2, a8 // Increment A, A = A[i*n] - - addi a9, a9, 1 // Increment loop1 counter - blt a9, a5, dpf_loop1 - - movi.n a2, 0 // return status ESP_OK - retw.n - -#endif //dspm_mult_f32_ae32_enabled \ No newline at end of file diff --git a/components/esp-dsp/modules/matrix/float/dspm_mult_f32_ansi.c b/components/esp-dsp/modules/matrix/float/dspm_mult_f32_ansi.c deleted file mode 100644 index 371aa253..00000000 --- a/components/esp-dsp/modules/matrix/float/dspm_mult_f32_ansi.c +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2018-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. - - -#include "dsps_dotprod.h" -#include "dspm_mult.h" - -// Matrinx A(m,n), m - amount or rows, n - amount of columns -// C(m,k) = A(m,n)*B(n,k) -// c(i,j) = sum(a(i,s)*b(s,j)) , s=1..n -esp_err_t dspm_mult_f32_ansi(const float *A, const float *B, float *C, int m, int n, int k) -{ - for (int i = 0 ; i < m ; i++) { - for (int j = 0 ; j < k ; j++) { - C[i * k + j] = A[i * n] * B[j]; - for (int s = 1; s < n ; s++) { - C[i * k + j] += A[i * n + s] * B[s * k + j]; - } - } - } - return ESP_OK; -} diff --git a/components/esp-dsp/modules/matrix/include/dspm_mult.h b/components/esp-dsp/modules/matrix/include/dspm_mult.h deleted file mode 100644 index b43c3f02..00000000 --- a/components/esp-dsp/modules/matrix/include/dspm_mult.h +++ /dev/null @@ -1,182 +0,0 @@ -// Copyright 2018-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. - -#ifndef _dspm_mult_H_ -#define _dspm_mult_H_ - -#include "dsp_err.h" -#include "dspm_mult_platform.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - -/**@{*/ -/** - * @brief Matrix multiplication - * - * Matrix multiplication for two floating point matrices: C[m][k] = A[m][n] * B[n][k] - * The extension (_ansi) use ANSI C and could be compiled and run on any platform. - * The extension (_ae32) is optimized for ESP32 chip. - * - * @param[in] A input matrix A[m][n] - * @param[in] B input matrix B[n][k] - * @param C result matrix C[m][k] - * @param[in] m matrix dimension - * @param[in] n matrix dimension - * @param[in] k matrix dimension - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dspm_mult_f32_ansi(const float *A, const float *B, float *C, int m, int n, int k); -esp_err_t dspm_mult_f32_ae32(const float *A, const float *B, float *C, int m, int n, int k); -/**@}*/ - - -/** - * @brief Matrix multiplication A[3x3]xB[3x1] - * - * Matrix multiplication for two floating point matrices 3x3 and 3x1: C[1][3] = A[3][3] * B[3][1] - * The implementation is optimized for ESP32 chip. - * - * @param[in] A input matrix A[3][3] - * @param[in] B input matrix/vector B[3][1] - * @param C result matrix/vector C[3][3] - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dspm_mult_3x3x1_f32_ae32(const float *A, const float *B, float *C); - -/** - * @brief Matrix multiplication A[3x3]xB[3x3] - * - * Matrix multiplication for two square 3x3 floating point matrices: C[3][3] = A[3][3] * B[3][3] - * The implementation is optimized for ESP32 chip. - * - * @param[in] A input matrix A[3][3] - * @param[in] B input matrix B[3][3] - * @param C result matrix C[3][3] - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dspm_mult_3x3x3_f32_ae32(const float *A, const float *B, float *C); - -/** - * @brief Matrix multiplication A[4x4]xB[4x1] - * - * Matrix multiplication for two floating point matrices 4x4 and 4x1: C[1][4] = A[4][4] * B[4][1] - * The implementation is optimized for ESP32 chip. - * - * @param[in] A input matrix A[4][4] - * @param[in] B input matrix/vector B[4][1] - * @param C result matrix/vector C[4][4] - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ - -esp_err_t dspm_mult_4x4x1_f32_ae32(const float *A, const float *B, float *C); - -/** - * @brief Matrix multiplication A[4x4]xB[4x4] - * - * Matrix multiplication for two square 3x3 floating point matrices: C[4][4] = A[4][4] * B[4][4] - * The implementation is optimized for ESP32 chip. - * - * @param[in] A input matrix A[4][4] - * @param[in] B input matrix B[4][4] - * @param C result matrix C[4][4] - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dspm_mult_4x4x4_f32_ae32(const float *A, const float *B, float *C); - -/**@{*/ -/** - * @brief Matrix multiplication 16 bit signeg int - * - * Matrix multiplication for two signed 16 bit fixed point matrices: C[m][k] = (A[m][n] * B[n][k]) >> (15- shift) - * The extension (_ansi) use ANSI C and could be compiled and run on any platform. - * The extension (_ae32) is optimized for ESP32 chip. - * - * @param[in] A input matrix A[m][n] - * @param[in] B input matrix B[n][k] - * @param C result matrix C[m][k] - * @param[in] m matrix dimension - * @param[in] n matrix dimension - * @param[in] k matrix dimension - * @param[in] shift every result will be shifted and stored as 16 bit signed value. - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dspm_mult_s16_ansi(const int16_t *A, const int16_t *B, int16_t *C, int m, int n, int k, int shift); -esp_err_t dspm_mult_s16_ae32(const int16_t *A, const int16_t *B, int16_t *C, int m, int n, int k, int shift); -/**@}*/ - -#ifdef __cplusplus -} -#endif - -#if CONFIG_DSP_OPTIMIZED - -#if (dspm_mult_s16_ae32_enabled == 1) -#define dspm_mult_s16 dspm_mult_s16_ae32 -#else -#define dspm_mult_s16 dspm_mult_s16_ansi -#endif - -#if (dspm_mult_f32_ae32_enabled == 1) -#define dspm_mult_f32 dspm_mult_f32_ae32 -#else -#define dspm_mult_f32 dspm_mult_f32_ansi -#endif - -#if (dspm_mult_3x3x1_f32_ae32_enabled == 1) -#define dspm_mult_3x3x1_f32 dspm_mult_3x3x1_f32_ae32 -#else -#define dspm_mult_3x3x1_f32(A,B,C) dspm_mult_f32_ansi(A,B,C, 3, 3, 1) -#endif -#if (dspm_mult_3x3x3_f32_ae32_enabled == 1) -#define dspm_mult_3x3x3_f32(A,B,C) dspm_mult_f32_ansi(A,B,C, 3, 3, 3) -#else -#define dsps_sub_f32 dsps_sub_f32_ansi -#endif -#if (dspm_mult_4x4x1_f32_ae32_enabled == 1) -#define dspm_mult_4x4x1_f32(A,B,C) dspm_mult_f32_ansi(A,B,C, 4, 4, 1) -#else -#define dsps_sub_f32 dsps_sub_f32_ansi -#endif -#if (dspm_mult_4x4x4_f32_ae32_enabled == 1) -#define dspm_mult_4x4x4_f32 dspm_mult_4x4x4_f32_ae32 -#else -#define dspm_mult_4x4x4_f32(A,B,C) dspm_mult_f32_ansi(A,B,C, 4, 4, 4) -#endif - -#else -#define dspm_mult_s16 dspm_mult_s16_ansi -#define dspm_mult_f32 dspm_mult_f32_ansi -#define dspm_mult_3x3x1_f32(A,B,C) dspm_mult_f32_ansi(A,B,C, 3, 3, 1) -#define dsps_sub_f32 dsps_sub_f32_ansi -#define dsps_sub_f32 dsps_sub_f32_ansi -#define dspm_mult_4x4x4_f32(A,B,C) dspm_mult_f32_ansi(A,B,C, 4, 4, 4) -#endif // CONFIG_DSP_OPTIMIZED - - -#endif // _dspm_mult_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/matrix/include/dspm_mult_platform.h b/components/esp-dsp/modules/matrix/include/dspm_mult_platform.h deleted file mode 100644 index c3c09c97..00000000 --- a/components/esp-dsp/modules/matrix/include/dspm_mult_platform.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef _dspm_mult_platform_H_ -#define _dspm_mult_platform_H_ - - - -#include -#include - - -#if ((XCHAL_HAVE_FP == 1) && (XCHAL_HAVE_LOOPS == 1)) - -#define dspm_mult_f32_ae32_enabled 1 -#define dspm_mult_3x3x1_f32_ae32_enabled 1 -#define dspm_mult_3x3x3_f32_ae32_enabled 1 -#define dspm_mult_4x4x1_f32_ae32_enabled 1 -#define dspm_mult_4x4x4_f32_ae32_enabled 1 - -#endif - -#if ((XCHAL_HAVE_LOOPS == 1) && (XCHAL_HAVE_MAC16 == 1)) - -#define dspm_mult_s16_ae32_enabled 1 - -#endif - -#endif // _dspm_mult_platform_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/matrix/include/mat.h b/components/esp-dsp/modules/matrix/include/mat.h deleted file mode 100644 index 134ea6a2..00000000 --- a/components/esp-dsp/modules/matrix/include/mat.h +++ /dev/null @@ -1,504 +0,0 @@ -// Copyright 2018-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. - -#ifndef _dspm_mat_h_ -#define _dspm_mat_h_ -#include - -/** - * @brief DSP matrix namespace - * - * DSP library matrix namespace. - */ -namespace dspm { -/** - * @brief Matrix - * - * The Mat class provides basic matrix operations on single-precision floating point values. - */ -class Mat { -public: - /** - * Constructor allocate internal buffer. - * @param[in] rows: amount of matrix rows - * @param[in] cols: amount of matrix columns - */ - Mat(int rows, int cols); - /** - * Constructor use external buffer. - * @param[in] data: external buffer with row-major matrix data - * @param[in] rows: amount of matrix rows - * @param[in] cols: amount of matrix columns - */ - Mat(float *data, int rows, int cols); - /** - * Allocate matrix with undefined size. - */ - Mat(); - virtual ~Mat(); - /** - * Make copy of matrix. - * @param[in] src: source matrix - */ - Mat(const Mat &src); - /** - * Copy operator - * - * @param[in] src: source matrix - * - * @return - * - matrix copy - */ - Mat &operator=(const Mat &src); - - bool ext_buff; /*!< Flag indicates that matrix use external buffer*/ - - /** - * Access to the matrix elements. - * @param[in] row: row position - * @param[in] col: column position - * - * @return - * - element of matrix M[row][col] - */ - inline float &operator()(int row, int col) - { - return data[row * this->cols + col]; - } - /** - * Access to the matrix elements. - * @param[in] row: row position - * @param[in] col: column position - * - * @return - * - element of matrix M[row][col] - */ - inline const float &operator()(int row, int col) const - { - return data[row * this->cols + col]; - } - - /** - * += operator - * The operator use DSP optimized implementation of multiplication. - * - * @param[in] A: source matrix - * - * @return - * - result matrix: result += A - */ - Mat &operator+=(const Mat &A); - - /** - * += operator - * The operator use DSP optimized implementation of multiplication. - * - * @param[in] C: constant - * - * @return - * - result matrix: result += C - */ - Mat &operator+=(float C); - /** - * -= operator - * The operator use DSP optimized implementation of multiplication. - * - * @param[in] A: source matrix - * - * @return - * - result matrix: result -= A - */ - Mat &operator-=(const Mat &A); - - /** - * -= operator - * The operator use DSP optimized implementation of multiplication. - * - * @param[in] C: constant - * - * @return - * - result matrix: result -= C - */ - Mat &operator-=(float C); - - /** - * *= operator - * The operator use DSP optimized implementation of multiplication. - * - * @param[in] A: source matrix - * - * @return - * - result matrix: result -= A - */ - Mat &operator*=(const Mat &A); - /** - * += with constant operator - * The operator use DSP optimized implementation of multiplication. - * - * @param[in] C: constant value - * - * @return - * - result matrix: result *= C - */ - Mat &operator*=(float C); - /** - * /= with constant operator - * The operator use DSP optimized implementation of multiplication. - * - * @param[in] C: constant value - * - * @return - * - result matrix: result /= C - */ - Mat &operator/=(float C); - /** - * /= operator - * - * @param[in] B: source matrix - * - * @return - * - result matrix: result[i,j] = result[i,j]/B[i,j] - */ - Mat &operator/=(const Mat &B); - /** - * ^= xor with constant operator - * The operator use DSP optimized implementation of multiplication. - * @param[in] C: constant value - * - * @return - * - result matrix: result ^= C - */ - Mat operator^(int C); - - /** - * Swap two rows between each other. - * @param[in] row1: position of first row - * @param[in] row2: position of second row - */ - void swapRows(int row1, int row2); - /** - * Matrix transpose. - * Change rows and columns between each other. - * - * @return - * - transposed matrix - */ - Mat t(); - - /** - * Create identity matrix. - * Create a square matrix and fill diagonal with 1. - * - * @param[in] size: matrix size - * - * @return - * - matrix [N]x[N] with 1 in diagonal - */ - static Mat eye(int size); - - /** - * Create matrix with all elements 1. - * Create a square matrix and fill all elements with 1. - * - * @param[in] size: matrix size - * - * @return - * - matrix [N]x[N] with 1 in all elements - */ - static Mat ones(int size); - - /** - * Return part of matrix from defined position (startRow, startCol) as a matrix[blockRows x blockCols]. - * - * @param[in] startRow: start row position - * @param[in] startCol: start column position - * @param[in] blockRows: amount of rows in result matrix - * @param[in] blockCols: amount of columns in the result matrix - * - * @return - * - matrix [blockRows]x[blockCols] - */ - Mat block(int startRow, int startCol, int blockRows, int blockCols); - - /** - * Normalizes the vector, i.e. divides it by its own norm. - * If it's matrix, calculate matrix norm - * - */ - void normalize(void); - - /** - * Return norm of the vector. - * If it's matrix, calculate matrix norm - * - * @return - * - matrix norm - */ - float norm(void); - - /** - * The method fill 0 to the matrix structure. - * - */ - void clear(void); - - /** - * @brief Solve the matrix - * - * Solve matrix. Find roots for the matrix A*x = b - * - * @param[in] A: matrix [N]x[N] with input coefficients - * @param[in] b: vector [N]x[1] with result values - * - * @return - * - matrix [N]x[1] with roots - */ - static Mat solve(Mat A, Mat b); - /** - * @brief Band solve the matrix - * - * Solve band matrix. Find roots for the matrix A*x = b with bandwidth k. - * - * @param[in] A: matrix [N]x[N] with input coefficients - * @param[in] b: vector [N]x[1] with result values - * @param[in] k: upper bandwidth value - * - * @return - * - matrix [N]x[1] with roots - */ - static Mat bandSolve(Mat A, Mat b, int k); - /** - * @brief Solve the matrix - * - * Different way to solve the matrix. Find roots for the matrix A*x = y - * - * @param[in] A: matrix [N]x[N] with input coefficients - * @param[in] y: vector [N]x[1] with result values - * - * @return - * - matrix [N]x[1] with roots - */ - static Mat roots(Mat A, Mat y); - - /** - * @brief Dotproduct of two vectors - * - * The method returns dotproduct of two vectors - * - * @param[in] A: Input vector A Nx1 - * @param[in] B: Input vector B Nx1 - * - * @return - * - dotproduct value - */ - static float dotProduct(Mat A, Mat B); - - /** - * @brief Augmented matrices - * - * Augmented matrices - * - * @param[in] A: Input vector A MxN - * @param[in] B: Input vector B MxK - * - * @return - * - Augmented matrix Mx(N+K) - */ - static Mat augment(Mat A, Mat B); - /** - * @brief Gaussian Elimination - * - * Gaussian Elimination of matrix - * - * @return - * - result matrix - */ - Mat gaussianEliminate(); - - /** - * Row reduction for Gaussian elimination - * - * @return - * - result matrix - */ - Mat rowReduceFromGaussian(); - - /** - * Find the inverse matrix - * - * @return - * - inverse matrix - */ - Mat inverse(); - - /** - * Find pseudo inverse matrix - * - * @return - * - inverse matrix - */ - Mat pinv(); - - int rows; /*!< Amount of rows*/ - int cols; /*!< Amount of columns*/ - float *data; /*!< Buffer with matrix data*/ - int length; /*!< Total amount of data in data array*/ - - static float abs_tol; /*!< Max acceptable absolute tolerance*/ -private: - Mat cofactor(int row, int col, int n); - float det(int n); - Mat adjoint(); - - void allocate(); // Allocate buffer - Mat expHelper(const Mat &m, int num); -}; -/** - * Print matrix to the standard iostream. - * @param[in] os: output stream - * @param[in] m: matrix to print - * - * @return - * - output stream - */ -std::ostream &operator<<(std::ostream &os, const Mat &m); -/** - * Fill the matrix from iostream. - * @param[in] is: input stream - * @param[in] m: matrix to fill - * - * @return - * - input stream - */ -std::istream &operator>>(std::istream &is, Mat &m); - -/** - * + operator, sum of two matrices - * The operator use DSP optimized implementation of multiplication. - * - * @param[in] A: Input matrix A - * @param[in] B: Input matrix B - * - * @return - * - result matrix A+B -*/ -Mat operator+(const Mat &A, const Mat &B); -/** - * + operator, sum of matrix with constant - * The operator use DSP optimized implementation of multiplication. - * - * @param[in] A: Input matrix A - * @param[in] C: Input constant - * - * @return - * - result matrix A+C -*/ -Mat operator+(const Mat &A, float C); - -/** - * - operator, subtraction of two matrices - * The operator use DSP optimized implementation of multiplication. - * - * @param[in] A: Input matrix A - * @param[in] B: Input matrix B - * - * @return - * - result matrix A-B -*/ -Mat operator-(const Mat &A, const Mat &B); -/** - * - operator, sum of matrix with constant - * The operator use DSP optimized implementation of multiplication. - * - * @param[in] A: Input matrix A - * @param[in] C: Input constant - * - * @return - * - result matrix A+C -*/ -Mat operator-(const Mat &A, float C); - -/** - * * operator, multiplication of two matrices. - * The operator use DSP optimized implementation of multiplication. - * - * @param[in] A: Input matrix A - * @param[in] B: Input matrix B - * - * @return - * - result matrix A*B -*/ -Mat operator*(const Mat &A, const Mat &B); - -/** - * * operator, multiplication of matrix with constant - * The operator use DSP optimized implementation of multiplication. - * - * @param[in] A: Input matrix A - * @param[in] C: floating point value - * - * @return - * - result matrix A*B -*/ -Mat operator*(const Mat &A, float C); - -/** - * * operator, multiplication of matrix with constant - * The operator use DSP optimized implementation of multiplication. - * - * @param[in] C: floating point value - * @param[in] A: Input matrix A - * - * @return - * - result matrix A*B -*/ -Mat operator*(float C, const Mat &A); - -/** - * / operator, divide of matrix by constant - * The operator use DSP optimized implementation of multiplication. - * - * @param[in] A: Input matrix A - * @param[in] C: floating point value - * - * @return - * - result matrix A*B -*/ -Mat operator/(const Mat &A, float C); - -/** - * / operator, divide matrix A by matrix B - * - * @param[in] A: Input matrix A - * @param[in] B: Input matrix B - * - * @return - * - result matrix C, where C[i,j] = A[i,j]/B[i,j] -*/ -Mat operator/(const Mat &A, const Mat &B); - -/** - * == operator, compare two matrices - * - * @param[in] A: Input matrix A - * @param[in] B: Input matrix B - * - * @return - * - true if matrices are the same - * - false if matrices are different -*/ -bool operator==(const Mat &A, const Mat &B); - -} -#endif //_dspm_mat_h_ diff --git a/components/esp-dsp/modules/matrix/mat/mat.cpp b/components/esp-dsp/modules/matrix/mat/mat.cpp deleted file mode 100644 index 60ef17ab..00000000 --- a/components/esp-dsp/modules/matrix/mat/mat.cpp +++ /dev/null @@ -1,713 +0,0 @@ -// Copyright 2018-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. - -#include -#include -#include "mat.h" -#include "esp_log.h" - -#include "dsps_math.h" -#include "dspm_mult.h" -#include - - -using std::ostream; -using std::istream; -using std::endl; - -namespace dspm { - -float Mat::abs_tol = 1e-10; - -Mat::Mat(int rows, int cols) -{ - ESP_LOGD("Mat", "Mat(%i, %i)", rows, cols); - this->rows = rows; - this->cols = cols; - allocate(); - memset(this->data, 0, this->length * sizeof(float)); -} - -Mat::Mat(float *data, int rows, int cols) -{ - ESP_LOGD("Mat", "Mat(data, %i, %i)", rows, cols); - this->ext_buff = true; - this->rows = rows; - this->cols = cols; - this->data = data; - this->length = this->rows * this->cols; - memcpy(this->data, data, this->length * sizeof(float)); -} - - -Mat::Mat() -{ - this->rows = 1; - this->cols = 1; - ESP_LOGD("Mat", "Mat()"); - - allocate(); - this->data[0] = 0; -} - -Mat::~Mat() -{ - ESP_LOGD("Mat", "~Mat(%i, %i), ext_buff=%i, data=0x%8.8x", this->rows, this->cols, this->ext_buff, (uint32_t)this->data); - if (false == this->ext_buff) { - delete data; - } -} - -Mat::Mat(const Mat &m) -{ - this->rows = m.rows; - this->cols = m.cols; - - allocate(); - memcpy(this->data, m.data, this->length * sizeof(float)); -} - -Mat &Mat::operator=(const Mat &m) -{ - if (this == &m) { - return *this; - } - - if (this->rows != m.rows || this->cols != m.cols) { - if (!this->ext_buff) { - delete this->data; - } - this->ext_buff = false; - this->rows = m.rows; - this->cols = m.cols; - allocate(); - } - memcpy(this->data, m.data, this->length * sizeof(float)); - return *this; -} - -Mat &Mat::operator+=(const Mat &m) -{ - dsps_add_f32(this->data, m.data, this->data, this->length, 1, 1, 1); - return *this; -} - -Mat &Mat::operator+=(float C) -{ - dsps_addc_f32_ansi(this->data, this->data, this->length, C, 1, 1); - return *this; -} - -Mat &Mat::operator-=(const Mat &m) -{ - dsps_sub_f32(this->data, m.data, this->data, this->length, 1, 1, 1); - return *this; -} - -Mat &Mat::operator-=(float C) -{ - dsps_addc_f32_ansi(this->data, this->data, this->length, -C, 1, 1); - return *this; -} - -Mat &Mat::operator*=(const Mat &m) -{ - Mat temp = *this; - dspm_mult_f32(temp.data, m.data, this->data, temp.rows, temp.cols, m.cols); - return (*this); -} - -Mat &Mat::operator*=(float num) -{ - dsps_mulc_f32_ansi(this->data, this->data, this->length, num, 1, 1); - return *this; -} - -Mat &Mat::operator/=(float num) -{ - dsps_mulc_f32_ansi(this->data, this->data, this->length, 1 / num, 1, 1); - return *this; -} - -Mat &Mat::operator/=(const Mat &B) -{ - Mat temp = *this; - *this = temp / B; - return (*this); -} - -Mat Mat::operator^(int num) -{ - Mat temp(*this); - return expHelper(temp, num); -} - -void Mat::swapRows(int r1, int r2) -{ - for (int i = 0; i < this->cols; i++) { - float temp = this->data[r1 * this->cols + i]; - this->data[r1 * this->cols + i] = this->data[r2 * this->cols + i]; - this->data[r2 * this->cols + i] = temp; - } -} - -Mat Mat::t() -{ - Mat ret(this->cols, this->rows); - for (int i = 0; i < this->rows; ++i) { - for (int j = 0; j < this->cols; ++j) { - ret(j, i) = this->data[i * this->cols + j]; - } - } - return ret; -} - -Mat Mat::eye(int size) -{ - Mat temp(size, size); - for (int i = 0; i < temp.rows; ++i) { - for (int j = 0; j < temp.cols; ++j) { - if (i == j) { - temp(i, j) = 1; - } else { - temp(i, j) = 0; - } - } - } - return temp; -} - -Mat Mat::ones(int size) -{ - Mat temp(size, size); - for (int i = 0; i < temp.rows; ++i) { - for (int j = 0; j < temp.cols; ++j) { - temp(i, j) = 1; - } - } - return temp; -} - -void Mat::clear() -{ - memset(this->data, 0, this->length * sizeof(float)); -} - -Mat Mat::block(int startRow, int startCol, int blockRows, int blockCols) -{ - Mat result(blockRows, blockCols); - for (int i = 0; i < blockRows; ++i) { - for (int j = 0; j < blockCols; ++j) { - result(i, j) = (*this)(startRow + i, startCol + j); - } - } - return result; -} - -void Mat::normalize(void) -{ - float sqr_norm = 0; - for (int i = 0; i < this->rows; ++i) { - for (int j = 0; j < this->cols; ++j) { - sqr_norm += (*this)(i, j) * (*this)(i, j); - } - } - sqr_norm = 1 / sqrtf(sqr_norm); - *this *= sqr_norm; -} - -float Mat::norm(void) -{ - float sqr_norm = 0; - for (int i = 0; i < this->rows; ++i) { - for (int j = 0; j < this->cols; ++j) { - sqr_norm += (*this)(i, j) * (*this)(i, j); - } - } - sqr_norm = sqrtf(sqr_norm); - return sqr_norm; -} - -Mat Mat::solve(Mat A, Mat b) -{ - // Gaussian elimination - for (int i = 0; i < A.rows; ++i) { - if (A(i, i) == 0) { - // pivot 0 - error - ESP_LOGW("Mat", "Error: the coefficient matrix has 0 as a pivot. Please fix the input and try again."); - Mat err_result(0, 0); - return err_result; - } - float a_ii = 1 / A(i, i); - for (int j = i + 1; j < A.rows; ++j) { - float a_ji = A(j, i) * a_ii; - for (int k = i + 1; k < A.cols; ++k) { - A(j, k) -= A(i, k) * a_ji; - if ((A(j, k) < abs_tol) && (A(j, k) > -1 * abs_tol)) { - A(j, k) = 0; - } - } - b(j, 0) -= b(i, 0) * a_ji; - if (A(j, 0) < abs_tol && A(j, 0) > -1 * abs_tol) { - A(j, 0) = 0; - } - A(j, i) = 0; - } - } - - // Back substitution - Mat x(b.rows, 1); - x((x.rows - 1), 0) = b((x.rows - 1), 0) / A((x.rows - 1), (x.rows - 1)); - if (x((x.rows - 1), 0) < abs_tol && x((x.rows - 1), 0) > -1 * abs_tol) { - x((x.rows - 1), 0) = 0; - } - for (int i = x.rows - 2; i >= 0; --i) { - float sum = 0; - for (int j = i + 1; j < x.rows; ++j) { - sum += A(i, j) * x(j, 0); - } - x(i, 0) = (b(i, 0) - sum) / A(i, i); - if (x(i, 0) < abs_tol && x(i, 0) > -1 * abs_tol) { - x(i, 0) = 0; - } - } - return x; -} - -Mat Mat::bandSolve(Mat A, Mat b, int k) -{ - // optimized Gaussian elimination - int bandsBelow = (k - 1) / 2; - for (int i = 0; i < A.rows; ++i) { - if (A(i, i) == 0) { - // pivot 0 - error - ESP_LOGW("Mat", "Error: the coefficient matrix has 0 as a pivot. Please fix the input and try again."); - Mat err_result(b.rows, 1); - memset(err_result.data, 0, b.rows * sizeof(float)); - return err_result; - } - float a_ii = 1 / A(i, i); - for (int j = i + 1; j < A.rows && j <= i + bandsBelow; ++j) { - int k = i + 1; - while ((k < A.cols) && (fabs(A(j, k)) > abs_tol)) { - A(j, k) -= A(i, k) * (A(j, i) * a_ii); - k++; - } - b(j, 0) -= b(i, 0) * (A(j, i) * a_ii); - A(j, i) = 0; - } - } - - // Back substitution - Mat x(b.rows, 1); - x((x.rows - 1), 0) = b((x.rows - 1), 0) / A((x.rows - 1), (x.rows - 1)); - for (int i = x.rows - 2; i >= 0; --i) { - float sum = 0; - for (int j = i + 1; j < x.rows; ++j) { - sum += A(i, j) * x(j, 0); - } - x(i, 0) = (b(i, 0) - sum) / A(i, i); - } - - return x; -} - -Mat Mat::roots(Mat A, Mat y) -{ - int n = A.cols + 1; - - Mat result(y.rows, 1); - - Mat g_m = Mat::augment(A, y); - for (int j = 0; j < A.cols; j++) { - float g_jj = 1 / g_m(j, j); - for (int i = 0; i < A.cols; i++) { - if (i != j) { - float c = g_m(i, j) * g_jj; - for (int k = 0; k < n; k++) { - g_m(i, k) = g_m(i, k) - c * g_m(j, k); - } - } - } - } - for (int i = 0; i < A.rows; i++) { - result(i, 0) = g_m(i, A.cols) / g_m(i, i); - } - return result; -} - -float Mat::dotProduct(Mat a, Mat b) -{ - float sum = 0; - for (int i = 0; i < a.rows; ++i) { - sum += (a(i, 0) * b(i, 0)); - } - return sum; -} - -Mat Mat::augment(Mat A, Mat B) -{ - Mat AB(A.rows, A.cols + B.cols); - for (int i = 0; i < AB.rows; ++i) { - for (int j = 0; j < AB.cols; ++j) { - if (j < A.cols) { - AB(i, j) = A(i, j); - } else { - AB(i, j) = B(i, j - A.cols); - } - } - } - return AB; -} - -Mat Mat::gaussianEliminate() -{ - Mat Ab(*this); - int rows = Ab.rows; - int cols = Ab.cols; - int Acols = cols - 1; - - int i = 0; // row tracker - int j = 0; // column tracker - - // iterate through the rows - while (i < rows) { - // find a pivot for the row - bool pivot_found = false; - while (j < Acols && !pivot_found) { - if (Ab(i, j) != 0) { // pivot not equal to 0 - pivot_found = true; - } else { // check for a possible swap - int max_row = i; - float max_val = 0; - for (int k = i + 1; k < rows; ++k) { - float cur_abs = Ab(k, j) >= 0 ? Ab(k, j) : -1 * Ab(k, j); - if (cur_abs > max_val) { - max_row = k; - max_val = cur_abs; - } - } - if (max_row != i) { - Ab.swapRows(max_row, i); - pivot_found = true; - } else { - j++; - } - } - } - - // perform elimination as normal if pivot was found - if (pivot_found) { - for (int t = i + 1; t < rows; ++t) { - for (int s = j + 1; s < cols; ++s) { - Ab(t, s) = Ab(t, s) - Ab(i, s) * (Ab(t, j) / Ab(i, j)); - if (Ab(t, s) < abs_tol && Ab(t, s) > -1 * abs_tol) { - Ab(t, s) = 0; - } - } - Ab(t, j) = 0; - } - } - - i++; - j++; - } - - return Ab; -} - -Mat Mat::rowReduceFromGaussian() -{ - Mat R(*this); - int rows = R.rows; - int cols = R.cols; - - int i = rows - 1; // row tracker - int j = cols - 2; // column tracker - - // iterate through every row - while (i >= 0) { - // find the pivot column - int k = j - 1; - while (k >= 0) { - if (R(i, k) != 0) { - j = k; - } - k--; - } - - // zero out elements above pivots if pivot not 0 - if (R(i, j) != 0) { - for (int t = i - 1; t >= 0; --t) { - for (int s = 0; s < cols; ++s) { - if (s != j) { - R(t, s) = R(t, s) - R(i, s) * (R(t, j) / R(i, j)); - if (R(t, s) < abs_tol && R(t, s) > -1 * abs_tol) { - R(t, s) = 0; - } - } - } - R(t, j) = 0; - } - - // divide row by pivot - for (int k = j + 1; k < cols; ++k) { - R(i, k) = R(i, k) / R(i, j); - if (R(i, k) < abs_tol && R(i, k) > -1 * abs_tol) { - R(i, k) = 0; - } - } - R(i, j) = 1; - } - - i--; - j--; - } - - return R; -} - -Mat Mat::pinv() -{ - Mat I = Mat::eye(this->rows); - Mat AI = Mat::augment(*this, I); - Mat U = AI.gaussianEliminate(); - Mat IAInverse = U.rowReduceFromGaussian(); - Mat AInverse(this->rows, this->cols); - for (int i = 0; i < this->rows; ++i) { - for (int j = 0; j < this->cols; ++j) { - AInverse(i, j) = IAInverse(i, j + this->cols); - } - } - return AInverse; -} - -Mat Mat::cofactor(int row, int col, int n) -{ - int i = 0, j = 0; - Mat result(n, n); - // Looping for each element of the matrix - for (int r = 0; r < n; r++) { - for (int c = 0; c < n; c++) { - // Copying into temporary matrix only those element - // which are not in given row and column - if (r != row && c != col) { - result(i, j++) = (*this)(r, c); - - // Row is filled, so increase row index and - // reset col index - if (j == this->rows - 1) { - j = 0; - i++; - } - } - } - } - return result; -} - -float Mat::det(int n) -{ - float D = 0; // Initialize result - - // Base case : if matrix contains single element - if (n == 1) { - return (*this)(0, 0); - } - - Mat temp(this->rows, this->rows); // To store cofactors - - int sign = 1; // To store sign multiplier - - // Iterate for each element of first row - for (int f = 0; f < n; f++) { - // Getting Cofactor of A[0][f] - Mat temp = this->cofactor(0, f, n); - D += (*this)(0, f) * temp.det(n - 1) * sign; - - // terms are to be added with alternate sign - sign = -sign; - } - - return D; -} - -Mat Mat::adjoint() -{ - Mat adj(this->rows, this->cols); - if (this->rows == 1) { - adj(0, 0) = 1; - return adj; - } - - // temp is used to store cofactors of A(,) - int sign = 1; - Mat temp(this->rows, this->cols); - - for (int i = 0; i < this->rows; i++) { - for (int j = 0; j < this->cols; j++) { - // Get cofactor of A(i,j) - temp = this->cofactor( i, j, this->rows); - - // sign of adj(j,i) positive if sum of row - // and column indexes is even. - sign = ((i + j) % 2 == 0) ? 1 : -1; - - // Interchanging rows and columns to get the - // transpose of the cofactor matrix - adj(j, i) = (sign) * (temp.det(this->rows - 1)); - } - } - return adj; -} - -Mat Mat::inverse() -{ - Mat result(this->rows, this->cols); - // Find determinant of matrix - float det = this->det(this->rows); - if (det == 0) { - //std::cout << "Singular matrix, can't find its inverse"; - return result; - } - - // Find adjoint - Mat adj = this->adjoint(); - - // Find Inverse using formula "inverse(A) = adj(A)/det(A)" - for (int i = 0; i < this->rows; i++) - for (int j = 0; j < this->cols; j++) { - result(i, j) = adj(i, j) / float(det); - } - - return result; -} - -void Mat::allocate() -{ - this->ext_buff = false; - this->length = this->rows * this->cols; - data = new float[this->length]; - ESP_LOGD("Mat", "allocate(%i) = 0x%8.8x", this->length, (uint32_t)this->data); -} - -Mat Mat::expHelper(const Mat &m, int num) -{ - if (num == 0) { - return Mat::eye(m.rows); - } else if (num == 1) { - return m; - } else if (num % 2 == 0) { // num is even - return expHelper(m * m, num / 2); - } else { // num is odd - return m * expHelper(m * m, (num - 1) / 2); - } -} - -Mat operator+(const Mat &m1, const Mat &m2) -{ - Mat temp(m1); - return (temp += m2); -} - -Mat operator+(const Mat &m1, float C) -{ - Mat temp(m1); - return (temp += C); -} - -bool operator==(const Mat &m1, const Mat &m2) -{ - if ((m1.cols != m2.cols) || (m1.rows != m2.rows)) { - return false; - } - for (int i = 0 ; i < (m1.cols * m1.rows) ; i++) { - if (m1.data[i] != m2.data[i]) { - printf("Error: %i, m1.data=%f, m2.data=%f \n", i, m1.data[i], m2.data[i]); - return false; - } - } - return true; -} - -Mat operator-(const Mat &m1, const Mat &m2) -{ - Mat temp(m1); - return (temp -= m2); -} - -Mat operator-(const Mat &m1, float C) -{ - Mat temp(m1); - return (temp -= C); -} - -Mat operator*(const Mat &m1, const Mat &m2) -{ - Mat temp(m1.rows, m2.cols); - dspm_mult_f32(m1.data, m2.data, temp.data, m1.rows, m1.cols, m2.cols); - return temp; -} - -Mat operator*(const Mat &m, float num) -{ - Mat temp(m); - return (temp *= num); -} - -Mat operator*(float num, const Mat &m) -{ - return (m * num); -} - -Mat operator/(const Mat &m, float num) -{ - Mat temp(m); - return (temp /= num); -} - -Mat operator/(const Mat &A, const Mat &B) -{ - Mat temp(A); - for (int i = 0; i < A.rows; ++i) { - for (int j = 1; j < A.cols; ++j) { - temp(i, j) = A(i, j) / B(i, j); - } - } - return (temp); -} - -ostream &operator<<(ostream &os, const Mat &m) -{ - for (int i = 0; i < m.rows; ++i) { - os << m(i, 0); - for (int j = 1; j < m.cols; ++j) { - os << " " << m(i, j); - } - os << endl; - } - return os; -} - -istream &operator>>(istream &is, Mat &m) -{ - for (int i = 0; i < m.rows; ++i) { - for (int j = 0; j < m.cols; ++j) { - is >> m(i, j); - } - } - return is; -} - -} \ No newline at end of file diff --git a/components/esp-dsp/modules/matrix/test/test_mat_f32.cpp b/components/esp-dsp/modules/matrix/test/test_mat_f32.cpp deleted file mode 100644 index 3b755fd4..00000000 --- a/components/esp-dsp/modules/matrix/test/test_mat_f32.cpp +++ /dev/null @@ -1,280 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dspm_mult.h" -#include "esp_attr.h" -#include "dsp_tests.h" -#include "mat.h" - -static const char *TAG = "dspm_Mat"; - -TEST_CASE("Mat class ", "[dspm]") -{ - int m = 3; - int n = 3; - dspm::Mat mat(m, n); - std::cout << "Test matrix: rows: " << mat.rows << ", columns: " << mat.cols << std::endl; - std::cout << mat; -} - -TEST_CASE("Mat class check solve ", "[dspm]") -{ - int m = 3; - int n = 3; - float data_a[9] ={3, 2, 1, 2, 3, 1, 2, 1, 3}; - float data_b[9] ={5, -1, 4}; - dspm::Mat A(data_a, m, n); - dspm::Mat b(data_b, m, 1); - dspm::Mat x1 = dspm::Mat::solve(A, b); - std::cout << "Solve result matrix: rows: " << x1.rows << ", columns: " << x1.cols << std::endl; - std::cout << (x1*12).t(); - dspm::Mat x2 = dspm::Mat::roots(A, b); - std::cout << "Roots result matrix: rows: " << x2.rows << ", columns: " << x2.cols << std::endl; - std::cout << (x2*12).t(); - dspm::Mat diff_b = x1 - x2; - std::cout << "Difference between solve() abd roots(): " << diff_b.t(); - for (int m=0 ; m < diff_b.rows; m++) - { - for (int n=0 ; n < diff_b.cols ; n++) - { - if (fabs(diff_b(m, n)) > 0.000001) - { - TEST_ASSERT_MESSAGE (false, "Calculation is incorrect! Error more then expected!"); - } - } - } -} - -TEST_CASE("Mat class basic operations", "[dspm]") -{ - int M = 4; - int N = 4; - - dspm::Mat A(M, N); - dspm::Mat x(N, 1); - for (int m=0 ; m < M ; m++) - { - for (int n=0 ; n < N ; n++) - { - A(m,n) = N*(m + 1) + (n + 1); - } - x(m, 0) = m + 2; - } - - A(0,0) = 10; - A(0,1) = 11; - - - dspm::Mat b = A*x; - dspm::Mat x1_ = dspm::Mat::solve(A, b); - dspm::Mat x2_ = dspm::Mat::roots(A, b); - - ESP_LOGI(TAG, "Matrix A:"); - std::cout << A; - ESP_LOGI(TAG, "Matrix x.t():"); - std::cout << x.t(); - ESP_LOGI(TAG, "Matrix b.t():"); - std::cout << b.t(); - ESP_LOGI(TAG, "Solve result:"); - std::cout << x1_.t(); - ESP_LOGI(TAG, "Roots result:"); - std::cout << x2_.t(); - dspm::Mat check_b = A*x1_; - ESP_LOGI(TAG, "Result b.t():"); - std::cout << check_b.t(); - dspm::Mat diff_b = check_b - b; - ESP_LOGI(TAG, "Difference:"); - std::cout << diff_b.t(); - - for (int m=0 ; m < diff_b.rows; m++) - { - for (int n=0 ; n < diff_b.cols ; n++) - { - float error = fabs(diff_b(m, n)); - if (fabs(diff_b(m, n)) > 0.0001) - { - ESP_LOGE(TAG,"Solve calculation error: %f", error); - TEST_ASSERT_MESSAGE (false, "Calculation is incorrect! Error more then expected!"); - } - } - } -} - -TEST_CASE("Mat class operators", "[dspm]") -{ - int M = 4; - int N = 4; - - dspm::Mat test1(M, N); - dspm::Mat test2(M, N); - dspm::Mat result(M, N); - float* check_array = new float[M*N]; - for (int m=0 ; m < M ; m++) - { - for (int n=0 ; n< N ; n++) - { - test1(m,n) = m*N + n; - test2(m,n) = m*N + n; - result(m,n) = 0; - } - } - - result = test1 + test2; - for (int m=0 ; m < M ; m++) - { - for (int n=0 ; n < N ; n++) - { - if ((result(m,n) != 2*test1(m,n)) || - (result(m,n) != 2*(m*N + n)) || - (result.data[m*N + n] != 2*(m*N + n))) - { - TEST_ASSERT_MESSAGE (false, "Error in + operator!"); - } - } - } - result = test1 - test2; - for (int m=0 ; m < M ; m++) - { - for (int n=0 ; n < N ; n++) - { - if ((result(m,n) != (test1(m,n) - test2(m,n))) || - (result(m,n) != 0) || - (result.data[m*N + n] != 0)) - { - TEST_ASSERT_MESSAGE (false, "Error in - operator!"); - } - } - } - // Check * operator (result = A*B;) - // result = I*test2 - // result == test2 - test1 = test1.eye(test1.rows); - result = test1 * test2; - dspm::Mat result2 = test1; - result2 *= test2; - - for (int m=0 ; m < M ; m++) - { - for (int n=0 ; n < N ; n++) - { - if ((result(m,n) != test2(m,n)) || - (result(m,n) != (m*N + n)) || - (result.data[m*N + n] != (m*N + n))) - { - TEST_ASSERT_MESSAGE (false, "Error in * operator!"); - } - } - } - if (!(result == result2)) - { - std::cout << "result matrix: " << std::endl << result << std::endl; - std::cout << "result2 matrix: " << std::endl << result2 << std::endl; - TEST_ASSERT_MESSAGE (false, "Error in *= or in == operator!"); - } - // Check * and + operator (result = A*const1 + const2;) - - test1 = test2; - float const1 = 2; - float const2 = 10; - result = test1*const1 + const2; - result = (result - const2)/const1; - for (int m=0 ; m < M ; m++) - { - for (int n=0 ; n < N ; n++) - { - if ((result(m,n) != test2(m,n)) || - (result(m,n) != (m*N + n)) || - (result.data[m*N + n] != (m*N + n)) - ) - { - TEST_ASSERT_MESSAGE (false, "Error in + * const operator!"); - } - } - } - // Test block(...): - int count = 0; - for (int m=0 ; m < M ; m++) - { - for (int n=0 ; n < N ; n++) - { - result(m,n) = count++; - } - } - std::cout << "Original matrix: " << std::endl; - std::cout << result << std::endl; - std::cout << "block: " << std::endl; - std::cout << result.block(1,1,M-1, N-1) << std::endl; - // Test normalize() - result = dspm::Mat(2,2); - for (int m=0 ; m < result.rows ; m++) - { - for (int n=0 ; n < result.cols ; n++) - { - result(m,n) = 1; - } - } - result.normalize(); - std::cout << "normalize: " << std::endl; - std::cout << result << std::endl; - - for (int m=0 ; m < result.rows ; m++) - { - for (int n=0 ; n < result.cols ; n++) - { - if (std::abs(result(m,n) - 0.5) > dspm::Mat::abs_tol) - { - TEST_ASSERT_MESSAGE (false, "Error in normalize() operation!"); - } - } - } - // Test inverse() - float m_data[] = {2,5,7, - 6,3,4, - 5,-2,-3}; - float m_result[] = { 1.0000, -1.0000, 1.0000, - -38.0000, 41.0000, -34.0000, - 27.0000, -29.0000, 24.0000}; - result = dspm::Mat(m_data, 3,3); - result = result.inverse(); - std::cout << "inverse: " << std::endl; - std::cout << result << std::endl; - for (int i=0 ; i< 3*3 ; i++) - { - if (std::abs(result.data[i] - m_result[i]) > 1e-8) - { - printf("Error at[%i] = %f, expected= %f, calculated = %f \n", i, std::abs(result.data[i] - m_result[i]), m_result[i], result.data[i]); - TEST_ASSERT_MESSAGE (false, "Error in inverse() operation!\n"); - } - } - - result = dspm::Mat(m_data, 3,3); - result = result.pinv(); - std::cout << "pinv: " << std::endl; - std::cout << result << std::endl; - for (int i=0 ; i< 3*3 ; i++) - { - if (std::abs(result.data[i] - m_result[i]) > 1e-2) - { - printf("Error at[%i] = %f, expected= %f, calculated = %f \n", i, std::abs(result.data[i] - m_result[i]), m_result[i], result.data[i]); - TEST_ASSERT_MESSAGE (false, "Error in pinv() operation!\n"); - } - } - - delete check_array; -} \ No newline at end of file diff --git a/components/esp-dsp/modules/matrix/test/test_mmult_3x3xx_f32_ae32.c b/components/esp-dsp/modules/matrix/test/test_mmult_3x3xx_f32_ae32.c deleted file mode 100644 index 047311ae..00000000 --- a/components/esp-dsp/modules/matrix/test/test_mmult_3x3xx_f32_ae32.c +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dspm_mult.h" -#include "esp_attr.h" -#include "dsp_tests.h" - -static const char *TAG = "dspm_mult_3x3x1_f32_ae32"; - -// Test dsps_dotprod_s16_ansi function -TEST_CASE("dspm_mult_3x3x1_f32_ae32 functionality", "[dspm]") -{ - int m = 3; - int n = 3; - int k = 1; - - - float A[m][n]; - float *A_ptr = (float *)A; - - float B[n][k]; - float *B_ptr = (float *)B; - - float C[m][k]; - float *C_ptr = (float *)C; - float C_compare[m][k]; - float *Cc_ptr = (float *)C_compare; - - for (int i = 0; i < m; i++) { - for (int j = 0; j < n; j++) { - A[i][j] = i; - } - } - for (int i = 0; i < n; i++) { - for (int j = 0; j < k; j++) { - B[i][j] = i; - } - } - - dspm_mult_3x3x1_f32_ae32(A_ptr, B_ptr, C_ptr); - dspm_mult_f32_ansi(A_ptr, B_ptr, Cc_ptr, m, n, k); - - for (int i=0 ; i< m ; i++) - { - for (int j=0 ; j< k ; j++) - { - ESP_LOGD(TAG, "[%i][%i] calc=%f, expected =%f",i,j, C[i][j], C_compare[i][j]); - } - } - //Compare and check results - for (int i = 0; i < m * k; i++) { - if (Cc_ptr[i] != C_ptr[i]) { - TEST_ASSERT_EQUAL(C_ptr[i], Cc_ptr[i]); - } - } -} - -TEST_CASE("dspm_mult_3x3x3_f32_ae32 functionality", "[dspm]") -{ - int m = 3; - int n = 3; - int k = 3; - - - float A[m][n]; - float *A_ptr = (float *)A; - - float B[n][k]; - float *B_ptr = (float *)B; - - float C[m][k]; - float *C_ptr = (float *)C; - float C_compare[m][k]; - float *Cc_ptr = (float *)C_compare; - - for (int i = 0; i < m; i++) { - for (int j = 0; j < n; j++) { - A[i][j] = i; - C[i][j] = 0; - } - } - for (int i = 0; i < n; i++) { - for (int j = 0; j < k; j++) { - B[i][j] = i; - } - } - - dspm_mult_3x3x3_f32_ae32(A_ptr, B_ptr, C_ptr); - dspm_mult_f32_ansi(A_ptr, B_ptr, Cc_ptr, m, n, k); - - for (int i=0 ; i< m ; i++) - { - for (int j=0 ; j< k ; j++) - { - ESP_LOGD(TAG, "[%i][%i] calc=%f, expected =%f",i,j, C[i][j], C_compare[i][j]); - } - } - // Compare and check results - for (int i = 0 ; i < m * k ; i++) { - if (Cc_ptr[i] != C_ptr[i]) { - TEST_ASSERT_EQUAL( C_ptr[i], Cc_ptr[i]); - } - } -} - -static portMUX_TYPE testnlock = portMUX_INITIALIZER_UNLOCKED; - -TEST_CASE("dspm_mult_3x3x1_f32_ae32 benchmark", "[dspm]") -{ - int m = 3; - int n = 3; - int k = 1; - - float A[m][n]; - float *A_ptr = (float *)A; - - float B[n][k]; - float *B_ptr = (float *)B; - - float C[m][k]; - float *C_ptr = (float *)C; - - - portENTER_CRITICAL(&testnlock); - - unsigned int start_b = xthal_get_ccount(); - int repeat_count = 1024; - for (int i = 0 ; i < repeat_count ; i++) { - dspm_mult_3x3x1_f32_ae32(A_ptr, B_ptr, C_ptr); - } - unsigned int end_b = xthal_get_ccount(); - portEXIT_CRITICAL(&testnlock); - - float total_b = end_b - start_b; - float cycles = total_b / (repeat_count); - ESP_LOGI("dspm_mult_3x3x1_f32_ae32", "dspm_mult_3x3x1_f32_ae32 - %f per multiplication (ae32 - 134, ansi - 285)", cycles); - float min_exec = 60; - float max_exec = 90; - TEST_ASSERT_EXEC_IN_RANGE(min_exec, max_exec, cycles); -} - -TEST_CASE("dspm_mult_3x3x3_f32_ae32 benchmark", "[dspm]") -{ - int m = 4; - int n = 4; - int k = 4; - - float A[m][n]; - float *A_ptr = (float *)A; - - float B[n][k]; - float *B_ptr = (float *)B; - - float C[m][k]; - float *C_ptr = (float *)C; - - - portENTER_CRITICAL(&testnlock); - - unsigned int start_b = xthal_get_ccount(); - int repeat_count = 1024; - for (int i = 0 ; i < repeat_count ; i++) { - dspm_mult_3x3x3_f32_ae32(A_ptr, B_ptr, C_ptr); - } - unsigned int end_b = xthal_get_ccount(); - portEXIT_CRITICAL(&testnlock); - - float total_b = end_b - start_b; - float cycles = total_b / (repeat_count); - ESP_LOGI("dspm_mult_3x3x3_f32_ae32", "dspm_mult_3x3x3_f32_ae32 - %f per multiplication", cycles); - float min_exec = 100; - float max_exec = 250; - TEST_ASSERT_EXEC_IN_RANGE(min_exec, max_exec, cycles); -} \ No newline at end of file diff --git a/components/esp-dsp/modules/matrix/test/test_mmult_4x4xx_f32_ae32.c b/components/esp-dsp/modules/matrix/test/test_mmult_4x4xx_f32_ae32.c deleted file mode 100644 index 840c7b45..00000000 --- a/components/esp-dsp/modules/matrix/test/test_mmult_4x4xx_f32_ae32.c +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dspm_mult.h" -#include "esp_attr.h" -#include "dsp_tests.h" - -static const char *TAG = "dspm_mult_4x4x1_f32_ae32"; - -TEST_CASE("dspm_mult_4x4x1_f32_ae32 functionality", "[dspm]") -{ - int m = 4; - int n = 4; - int k = 1; - - float A[m][n]; - float *A_ptr = (float *)A; - - float B[n][k]; - float *B_ptr = (float *)B; - - float C[m][k]; - float *C_ptr = (float *)C; - float C_compare[m][k]; - float *Cc_ptr = (float *)C_compare; - - for (int i = 0; i < m; i++) { - for (int j = 0; j < n; j++) { - A[i][j] = i; - } - } - for (int i = 0; i < n; i++) { - for (int j = 0; j < k; j++) { - B[i][j] = i; - } - } - - dspm_mult_4x4x1_f32_ae32(A_ptr, B_ptr, C_ptr); - dspm_mult_f32_ansi(A_ptr, B_ptr, Cc_ptr, m, n, k); - - for (int i=0 ; i< m ; i++) - { - for (int j=0 ; j< k ; j++) - { - ESP_LOGD(TAG, "[%i][%i] calc=%f, expected =%f",i,j, C[i][j], C_compare[i][j]); - } - } - //Compare and check results - for (int i = 0; i < m * k; i++) { - if (Cc_ptr[i] != C_ptr[i]) { - TEST_ASSERT_EQUAL(C_ptr[i], Cc_ptr[i]); - } - } -} - -TEST_CASE("dspm_mult_4x4x4_f32_ae32 functionality", "[dspm]") -{ - int m = 4; - int n = 4; - int k = 4; - - - float A[m][n]; - float *A_ptr = (float *)A; - - float B[n][k]; - float *B_ptr = (float *)B; - - float C[m][k]; - float *C_ptr = (float *)C; - float C_compare[m][k]; - float *Cc_ptr = (float *)C_compare; - - for (int i = 0; i < m; i++) { - for (int j = 0; j < n; j++) { - A[i][j] = i; - C[i][j] = 0; - } - } - for (int i = 0; i < n; i++) { - for (int j = 0; j < k; j++) { - B[i][j] = i; - } - } - - dspm_mult_4x4x4_f32_ae32(A_ptr, B_ptr, C_ptr); - dspm_mult_f32_ansi(A_ptr, B_ptr, Cc_ptr, m, n, k); - - for (int i=0 ; i< m ; i++) - { - for (int j=0 ; j< k ; j++) - { - ESP_LOGD(TAG, "[%i][%i] calc=%f, expected =%f",i,j, C[i][j], C_compare[i][j]); - } - } - // Compare and check results - for (int i = 0 ; i < m * k ; i++) { - if (Cc_ptr[i] != C_ptr[i]) { - TEST_ASSERT_EQUAL( C_ptr[i], Cc_ptr[i]); - } - } -} - -static portMUX_TYPE testnlock = portMUX_INITIALIZER_UNLOCKED; - -TEST_CASE("dspm_mult_4x4x1_f32_ae32 benchmark", "[dspm]") -{ - int m = 4; - int n = 4; - int k = 1; - - float A[m][n]; - float *A_ptr = (float *)A; - - float B[n][k]; - float *B_ptr = (float *)B; - - float C[m][k]; - float *C_ptr = (float *)C; - - - portENTER_CRITICAL(&testnlock); - - unsigned int start_b = xthal_get_ccount(); - int repeat_count = 1024; - for (int i = 0 ; i < repeat_count ; i++) { - dspm_mult_4x4x1_f32_ae32(A_ptr, B_ptr, C_ptr); - } - unsigned int end_b = xthal_get_ccount(); - portEXIT_CRITICAL(&testnlock); - - float total_b = end_b - start_b; - float cycles = total_b / (repeat_count); - ESP_LOGI("dspm_mult_4x4x1_f32_ae32", "dspm_mult_4x4x1_f32_ae32 - %f per multiplication", cycles); - float min_exec = 60; - float max_exec = 110; - TEST_ASSERT_EXEC_IN_RANGE(min_exec, max_exec, cycles); -} - -TEST_CASE("dspm_mult_4x4x4_f32_ae32 benchmark", "[dspm]") -{ - int m = 4; - int n = 4; - int k = 4; - - float A[m][n]; - float *A_ptr = (float *)A; - - float B[n][k]; - float *B_ptr = (float *)B; - - float C[m][k]; - float *C_ptr = (float *)C; - - - portENTER_CRITICAL(&testnlock); - - unsigned int start_b = xthal_get_ccount(); - int repeat_count = 1024; - for (int i = 0 ; i < repeat_count ; i++) { - dspm_mult_4x4x4_f32_ae32(A_ptr, B_ptr, C_ptr); - } - unsigned int end_b = xthal_get_ccount(); - portEXIT_CRITICAL(&testnlock); - - float total_b = end_b - start_b; - float cycles = total_b / (repeat_count); - ESP_LOGI("dspm_mult_4x4x4_f32_ae32", "dspm_mult_4x4x4_f32_ae32 - %f per multiplication", cycles); - float min_exec = 300; - float max_exec = 450; - TEST_ASSERT_EXEC_IN_RANGE(min_exec, max_exec, cycles); -} \ No newline at end of file diff --git a/components/esp-dsp/modules/matrix/test/test_mmult_f32_ae32.c b/components/esp-dsp/modules/matrix/test/test_mmult_f32_ae32.c deleted file mode 100644 index e694c49c..00000000 --- a/components/esp-dsp/modules/matrix/test/test_mmult_f32_ae32.c +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dspm_mult.h" -#include "esp_attr.h" -#include "dsp_tests.h" - -static const char *TAG = "dspm_mult_f32_ae32"; - -// Test dsps_dotprod_s16_ansi function -TEST_CASE("dspm_mult_f32_ae32 functionality", "[dspm]") -{ - int m = 4; - int n = 3; - int k = 4; - - - float A[m][n]; - float *A_ptr = (float *)A; - - float B[n][k]; - float *B_ptr = (float *)B; - - float C[m][k]; - float *C_ptr = (float *)C; - float C_compare[m][k]; - float *Cc_ptr = (float *)C_compare; - - for (int i = 0 ; i < m * n; i++) { - A_ptr[i] = i; - B_ptr[i] = i; - } - for (int i = 0 ; i < m ; i++) { - for (int j = 0 ; j < k ; j++) { - C_compare[i][j] = 0; - for (int s = 0 ; s < n ; s++) { - C_compare[i][j] += A[i][s] * B[s][j]; - } - } - } - dspm_mult_f32_ae32(A_ptr, B_ptr, C_ptr, m, n, k); - - for (int i=0 ; i< m ; i++) - { - for (int j=0 ; j< k ; j++) - { - ESP_LOGD(TAG, "[%i][%i] calc=%f, expected =%f",i,j, C[i][j], C_compare[i][j]); - } - } - // Compare and check results - for (int i = 0 ; i < m * k ; i++) { - if (Cc_ptr[i] != C_ptr[i]) { - TEST_ASSERT_EQUAL( C_ptr[i], Cc_ptr[i]); - } - } -} - -static portMUX_TYPE testnlock = portMUX_INITIALIZER_UNLOCKED; - -TEST_CASE("dspm_mult_f32_ae32 benchmark", "[dspm]") -{ - int m = 4; - int n = 4; - int k = 4; - - float A[m][n]; - float *A_ptr = (float *)A; - - float B[n][k]; - float *B_ptr = (float *)B; - - float C[m][k]; - float *C_ptr = (float *)C; - - - portENTER_CRITICAL(&testnlock); - - unsigned int start_b = xthal_get_ccount(); - int repeat_count = 1024; - for (int i = 0 ; i < repeat_count ; i++) { - dspm_mult_f32_ae32(A_ptr, B_ptr, C_ptr, m, n, k); - } - unsigned int end_b = xthal_get_ccount(); - portEXIT_CRITICAL(&testnlock); - - float total_b = end_b - start_b; - float cycles = total_b / (repeat_count); - printf("Benchmark dspm_mult_f32_ae32 - %f per multiplication 4x4 + overhead.\n", cycles); - float min_exec = 100; - float max_exec = 700; - TEST_ASSERT_EXEC_IN_RANGE(min_exec, max_exec, cycles); -} \ No newline at end of file diff --git a/components/esp-dsp/modules/matrix/test/test_mmult_f32_ansi.c b/components/esp-dsp/modules/matrix/test/test_mmult_f32_ansi.c deleted file mode 100644 index 05dc3692..00000000 --- a/components/esp-dsp/modules/matrix/test/test_mmult_f32_ansi.c +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dspm_mult.h" -#include "esp_attr.h" -#include "dsp_tests.h" - -static const char *TAG = "dspm_mult_f32_ansi"; - -// Test dsps_dotprod_s16_ansi function -TEST_CASE("dspm_mult_f32_ansi functionality", "[dspm]") -{ - for (int m = 1 ; m < 8 ; m++) { - for (int n = 1; n < 8 ; n++) { - for (int k = 1; k < 8 ; k++) { - float A[m][n]; - float *A_ptr = (float *)A; - - float B[n][k]; - float *B_ptr = (float *)B; - - float C[m][k]; - float *C_ptr = (float *)C; - float C_compare[m][k]; - float *Cc_ptr = (float *)C_compare; - - for (int i = 0 ; i < m * n; i++) { - A_ptr[i] = i; - B_ptr[i] = i; - } - for (int i = 0 ; i < m ; i++) { - for (int j = 0 ; j < n ; j++) { - A[i][j] = i * n + j; - } - } - for (int i = 0 ; i < n ; i++) { - for (int j = 0 ; j < k ; j++) { - B[i][j] = i * k + j; - } - } - for (int i = 0 ; i < m ; i++) { - for (int j = 0 ; j < k ; j++) { - C_compare[i][j] = 0; - for (int s = 0 ; s < n ; s++) { - C_compare[i][j] += A[i][s] * B[s][j]; - } - } - } - dspm_mult_f32_ansi(A_ptr, B_ptr, C_ptr, m, n, k); - - for (int i=0 ; i< m ; i++) - { - for (int j=0 ; j< k ; j++) - { - ESP_LOGD(TAG, "[%i][%i] calc=%f, expected =%f",i,j, C[i][j], C_compare[i][j]); - } - } - // Compare and check results - for (int i = 0 ; i < m * k ; i++) { - if (Cc_ptr[i] != C_ptr[i]) { - TEST_ASSERT_EQUAL(Cc_ptr[i], C_ptr[i]); - } - } - } - } - } -} - -static portMUX_TYPE testnlock = portMUX_INITIALIZER_UNLOCKED; - -TEST_CASE("dspm_mult_f32_ansi benchmark", "[dspm]") -{ - int m = 4; - int n = 4; - int k = 4; - - float A[m][n]; - float *A_ptr = (float *)A; - - float B[n][k]; - float *B_ptr = (float *)B; - - float C[m][k]; - float *C_ptr = (float *)C; - - - portENTER_CRITICAL(&testnlock); - - unsigned int start_b = xthal_get_ccount(); - int repeat_count = 1024; - for (int i = 0 ; i < repeat_count ; i++) { - dspm_mult_f32_ansi(A_ptr, B_ptr, C_ptr, m, n, k); - } - unsigned int end_b = xthal_get_ccount(); - portEXIT_CRITICAL(&testnlock); - - float total_b = end_b - start_b; - float cycles = total_b / (repeat_count); - printf("Benchmark dspm_mult_f32_ansi - %f per multiplication 4x4 + overhead.\n", cycles); - float min_exec = 100; - float max_exec = 2000; - TEST_ASSERT_EXEC_IN_RANGE(min_exec, max_exec, cycles); -} \ No newline at end of file diff --git a/components/esp-dsp/modules/matrix/test/test_mmult_s16_ae32.c b/components/esp-dsp/modules/matrix/test/test_mmult_s16_ae32.c deleted file mode 100644 index 98b96140..00000000 --- a/components/esp-dsp/modules/matrix/test/test_mmult_s16_ae32.c +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dspm_mult.h" -#include "esp_attr.h" -#include "esp_log.h" - -// Test dsps_dotprod_s16_ansi function -TEST_CASE("dspm_mult_s16_ae32 functionality", "[dspm]") -{ - for (int m = 1 ; m < 8 ; m++) { - for (int n = 1 ; n < 8 ; n++) { - for (int k = 1 ; k < 8 ; k++) { - - int16_t A[m][n]; - int16_t *A_ptr = (int16_t *)A; - - int16_t B[n][k]; - int16_t *B_ptr = (int16_t *)B; - - int16_t C[m][k]; - int16_t *C_ptr = (int16_t *)C; - int16_t C_compare[m][k]; - int16_t *Cc_ptr = (int16_t *)C_compare; - for (int shift = -4 ; shift < 4 ; shift++) { - for (int i = 0 ; i < m ; i++) { - for (int j = 0 ; j < n; j++) { - A[i][j] = 0x1234; - } - } - for (int i = 0 ; i < n ; i++) { - for (int j = 0 ; j < k; j++) { - B[i][j] = 0x1234; - } - } - - dspm_mult_s16_ansi(A_ptr, B_ptr, Cc_ptr, m, n, k, shift); - dspm_mult_s16_ae32(A_ptr, B_ptr, C_ptr, m, n, k, shift); - - // Compare and check results - for (int i = 0 ; i < m * k ; i++) { - if (Cc_ptr[i] != C_ptr[i]) { - ESP_LOGE("dspm_mult_s16_ae32", "Process path m=%i, n=%i, k=%i, shift=%i\n", m, n, k, shift); - TEST_ASSERT_EQUAL(Cc_ptr[i], C_ptr[i]); - } - } - } - } - } - } -} - -static portMUX_TYPE testnlock = portMUX_INITIALIZER_UNLOCKED; - -TEST_CASE("dspm_mult_s16_ae32 benchmark", "[dspm]") -{ - unsigned int start_b = xthal_get_ccount(); - unsigned int end_b = xthal_get_ccount(); - for (int m = 2 ; m <= 8 ; m++) { - for (int n = 2 ; n <= 8 ; n++) { - for (int k = 1 ; k <= 6 ; k++) { - - int16_t A[m][n]; - int16_t *A_ptr = (int16_t *)A; - - int16_t B[m][n]; - int16_t *B_ptr = (int16_t *)B; - - int16_t C[m][k]; - int16_t *C_ptr = (int16_t *)C; - - memset(A, 0, sizeof(A)); - memset(B, 0, sizeof(A)); - memset(C, 0, sizeof(A)); - portENTER_CRITICAL(&testnlock); - - start_b = xthal_get_ccount(); - dspm_mult_s16_ae32(A_ptr, B_ptr, C_ptr, m, n, k, 0); - end_b = xthal_get_ccount(); - portEXIT_CRITICAL(&testnlock); - - float total_b = end_b - start_b; - float cycles = total_b; - ESP_LOGD("dspm_mult_s16_ae32", "dspm_mult_s16_ae32[%i][%i][%i] - %f", m, n, k, cycles); - } - } - } -} \ No newline at end of file diff --git a/components/esp-dsp/modules/matrix/test/test_mmult_s16_ansi.c b/components/esp-dsp/modules/matrix/test/test_mmult_s16_ansi.c deleted file mode 100644 index faf5f905..00000000 --- a/components/esp-dsp/modules/matrix/test/test_mmult_s16_ansi.c +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dspm_mult.h" -#include "esp_attr.h" -#include "dsp_tests.h" - -static const char *TAG = "dspm_mult_s16_ansi"; - -// Test dsps_dotprod_s16_ansi function -TEST_CASE("dspm_mult_s16_ansi functionality", "[dspm]") -{ - int m = 4; - int n = 3; - int k = 4; - - - int16_t A[m][n]; - int16_t *A_ptr = (int16_t *)A; - - int16_t B[n][k]; - int16_t *B_ptr = (int16_t *)B; - - int16_t C[m][k]; - int16_t *C_ptr = (int16_t *)C; - int16_t C_compare[m][k]; - int16_t *Cc_ptr = (int16_t *)C_compare; - - int shift = 0; - for (int i = 0 ; i < m * n; i++) { - A_ptr[i] = 0x1000; - B_ptr[i] = 0x200; - } - long long store_reg = 0; - for (int i = 0 ; i < m ; i++) { - for (int j = 0 ; j < k ; j++) { - store_reg = (0x7fff >> shift); - for (int s = 0 ; s < n ; s++) { - store_reg += ((int32_t)A[i][s] * (int32_t)B[s][j]); - } - C_compare[i][j] = store_reg >> (15 - shift); - } - } - dspm_mult_s16_ansi(A_ptr, B_ptr, C_ptr, m, n, k, shift); - - for (int i=0 ; i< m ; i++) - { - for (int j=0 ; j< k ; j++) - { - ESP_LOGD(TAG, "[%i][%i] calc=%i, expected =%i",i,j, C[i][j], C_compare[i][j]); - } - } - // Compare and check results - for (int i = 0 ; i < m * k ; i++) { - if (Cc_ptr[i] != C_ptr[i]) { - TEST_ASSERT_EQUAL(Cc_ptr[i], C_ptr[i]); - } - } -} - -static portMUX_TYPE testnlock = portMUX_INITIALIZER_UNLOCKED; - -TEST_CASE("dspm_mult_s16_ansi benchmark", "[dspm]") -{ - int m = 4; - int n = 4; - int k = 4; - - int16_t A[m][n]; - int16_t *A_ptr = (int16_t *)A; - - int16_t B[n][k]; - int16_t *B_ptr = (int16_t *)B; - - int16_t C[m][k]; - int16_t *C_ptr = (int16_t *)C; - - - portENTER_CRITICAL(&testnlock); - - unsigned int start_b = xthal_get_ccount(); - int repeat_count = 1024; - for (int i = 0 ; i < repeat_count ; i++) { - dspm_mult_s16_ansi(A_ptr, B_ptr, C_ptr, m, n, k, 0); - } - unsigned int end_b = xthal_get_ccount(); - portEXIT_CRITICAL(&testnlock); - - float total_b = end_b - start_b; - float cycles = total_b / (repeat_count); - ESP_LOGI("dspm_mult_s16_ansi", "Benchmark dspm_mult_s16_ansi - %f per multiplication %ix%ix%i.\n", cycles, m, n, k); - float min_exec = 1000; - float max_exec = 3000; - TEST_ASSERT_EXEC_IN_RANGE(min_exec, max_exec, cycles); -} \ No newline at end of file diff --git a/components/esp-dsp/modules/support/include/dsps_d_gen.h b/components/esp-dsp/modules/support/include/dsps_d_gen.h deleted file mode 100644 index 8eacae86..00000000 --- a/components/esp-dsp/modules/support/include/dsps_d_gen.h +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2018-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. - -#ifndef _dsps_d_gen_H_ -#define _dsps_d_gen_H_ -#include "dsp_err.h" - - -#ifdef __cplusplus -extern "C" -{ -#endif - -/** - * @brief delta function - * - * The function generate delta function. - * output[i]=0, if i=[0..N) - * output[i]=1, if i=pos, pos: [0..N-1) - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param output: output array. - * @param len: length of the input signal - * @param pos: delta function position - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_d_gen_f32(float *output, int len, int pos); - -#ifdef __cplusplus -} -#endif - -#endif // _dsps_d_gen_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/support/include/dsps_h_gen.h b/components/esp-dsp/modules/support/include/dsps_h_gen.h deleted file mode 100644 index a19bef1b..00000000 --- a/components/esp-dsp/modules/support/include/dsps_h_gen.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2018-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. - -#ifndef _dsps_h_gen_H_ -#define _dsps_h_gen_H_ -#include "dsp_err.h" - - -#ifdef __cplusplus -extern "C" -{ -#endif - -/** - * @brief Heviside function - * - * The Heviside function. - * output[i]=0, if i=[0..pos) - * output[i]=1, if i=[pos..N) - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param output: output array. - * @param len: length of the input signal - * @param pos: heviside function position - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ - -esp_err_t dsps_h_gen_f32(float *output, int len, int pos); - -#ifdef __cplusplus -} -#endif - -#endif // _dsps_h_gen_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/support/include/dsps_sfdr.h b/components/esp-dsp/modules/support/include/dsps_sfdr.h deleted file mode 100644 index 1b7decc0..00000000 --- a/components/esp-dsp/modules/support/include/dsps_sfdr.h +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2018-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. - -#ifndef _dsps_sfdr_H_ -#define _dsps_sfdr_H_ - - -#include "dsp_err.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - -/** - * @brief SFDR - * - * The function calculates Spurious-Free Dynamic Range. - * The function makes FFT of the input, then search a spectrum maximum, and then compare - * maximum value with all others. Result calculated as minimum value. - * This function have to be used for debug and unit tests only. It's not optimized for real-time processing. - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param[in] input: input array. - * @param len: length of the input signal - * @param use_dc: this parameter define will be DC value used for calculation or not. - * 0 - SNR will not include DC power - * 1 - SNR will include DC power - * - * @return - * - SFDR in DB - */ -float dsps_sfdr_f32(const float *input, int32_t len, int8_t use_dc); -float dsps_sfdr_fc32(const float *input, int32_t len); - -#ifdef __cplusplus -} -#endif - -#endif // _dsps_sfdr_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/support/include/dsps_snr.h b/components/esp-dsp/modules/support/include/dsps_snr.h deleted file mode 100644 index 163df4de..00000000 --- a/components/esp-dsp/modules/support/include/dsps_snr.h +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2018-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. - -#ifndef _DSP_SNR_H_ -#define _DSP_SNR_H_ - -#include "dsp_err.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - -/** - * @brief SNR - * - * The function calculates signal to noise ration in case if signal is sine tone. - * The function makes FFT of the input, then search a spectrum maximum, and then calculated - * SNR as sum of all harmonics to the maximum value. - * This function have to be used for debug and unit tests only. It's not optimized for real-time processing. - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param input: input array. - * @param len: length of the input signal - * @param use_dc: this parameter define will be DC value used for calculation or not. - * 0 - SNR will not include DC power - * 1 - SNR will include DC power - * - * @return - * - SNR in dB - */ -float dsps_snr_f32(const float *input, int32_t len, uint8_t use_dc); -float dsps_snr_fc32(const float *input, int32_t len); - - -#ifdef __cplusplus -} -#endif - -#endif // _DSP_SNR_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/support/include/dsps_tone_gen.h b/components/esp-dsp/modules/support/include/dsps_tone_gen.h deleted file mode 100644 index 281e3b6b..00000000 --- a/components/esp-dsp/modules/support/include/dsps_tone_gen.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2018-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. - -#ifndef _dsps_tone_gen_H_ -#define _dsps_tone_gen_H_ -#include "dsp_err.h" - - -#ifdef __cplusplus -extern "C" -{ -#endif - -/** - * @brief tone - * - * The function generate a tone signal. - * x[i]=A*sin(2*PI*i + ph/180*PI) - * The implementation use ANSI C and could be compiled and run on any platform - * - * @param output: output array. - * @param len: length of the input signal - * @param Ampl: amplitude - * @param freq: Naiquist frequency -1..1 - * @param phase: phase in degree - * - * @return - * - ESP_OK on success - * - One of the error codes from DSP library - */ -esp_err_t dsps_tone_gen_f32(float *output, int len, float Ampl, float freq, float phase); - -#ifdef __cplusplus -} -#endif - -#endif // _dsps_tone_gen_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/support/include/dsps_view.h b/components/esp-dsp/modules/support/include/dsps_view.h deleted file mode 100644 index 49c3022c..00000000 --- a/components/esp-dsp/modules/support/include/dsps_view.h +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2018-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. - -#ifndef _dsps_view_H_ -#define _dsps_view_H_ - -#include "dsp_err.h" - -#ifdef __cplusplus -extern "C" -{ -#endif - -/**@{*/ -/** - * @brief plot view - * - * Generic view function. - * This function takes input samples and show then in console view as a plot. - * The main purpose to give and draft debug information to the DSP developer. - * - * @param[in] data: array with input samples. - * @param len: length of the input array - * @param width: plot width in symbols - * @param height: plot height in lines - * @param min: minimum value that will be limited by Axis Y. - * @param max: maximum value that will be limited by Axis Y. - * @param view_char: character to draw the plot calues ('.' or '|' etc) - * - */ -void dsps_view(const float *data, int32_t len, int width, int height, float min, float max, char view_char); -void dsps_view_s16(const int16_t *data, int32_t len, int width, int height, float min, float max, char view_char); -/**@}*/ - -/** - * @brief spectrum view - * - * The view function to show spectrum values in 64x10 screen. - * The function based on dsps_view. - * - * @param[in] data: array with input samples. - * @param len: length of the input array - * @param min: minimum value that will be limited by Axis Y. - * @param max: maximum value that will be limited by Axis Y. - * - */ -void dsps_view_spectrum(const float *data, int32_t len, float min, float max); - -#ifdef __cplusplus -} -#endif - -#endif // _dsps_view_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/support/misc/dsps_d_gen.c b/components/esp-dsp/modules/support/misc/dsps_d_gen.c deleted file mode 100644 index 7011e73b..00000000 --- a/components/esp-dsp/modules/support/misc/dsps_d_gen.c +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_d_gen.h" - -esp_err_t dsps_d_gen_f32(float *output, int len, int pos) -{ - if (pos >= len) { - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - } - if (pos < 0) { - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - } - for (int i = 0 ; i < len ; i++) { - output[i] = 0; - } - output[pos] = 1; - return ESP_OK; -} \ No newline at end of file diff --git a/components/esp-dsp/modules/support/misc/dsps_h_gen.c b/components/esp-dsp/modules/support/misc/dsps_h_gen.c deleted file mode 100644 index 061c1fe1..00000000 --- a/components/esp-dsp/modules/support/misc/dsps_h_gen.c +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_h_gen.h" - -esp_err_t dsps_h_gen_f32(float *output, int len, int pos) -{ - if (pos >= len) { - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - } - if (pos < 0) { - return ESP_ERR_DSP_PARAM_OUTOFRANGE; - } - for (int i = 0 ; i < pos ; i++) { - output[i] = 0; - } - for (int i = pos ; i < len ; i++) { - output[i] = 1; - } - return ESP_OK; -} diff --git a/components/esp-dsp/modules/support/misc/dsps_tone_gen.c b/components/esp-dsp/modules/support/misc/dsps_tone_gen.c deleted file mode 100644 index 39e6a089..00000000 --- a/components/esp-dsp/modules/support/misc/dsps_tone_gen.c +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_tone_gen.h" -#include - -esp_err_t dsps_tone_gen_f32(float *output, int len, float Ampl, float freq, float phase) -{ - if (freq >= 1) { - return ESP_ERR_DSP_INVALID_PARAM; - } - if (freq <= -1) { - return ESP_ERR_DSP_INVALID_PARAM; - } - float ph = phase / 180 * M_PI; - float fr = 2 * M_PI * freq; - for (int i = 0 ; i < len ; i++) { - output[i] = Ampl * sin(ph); - ph += fr; - if (ph > 2 * M_PI) { - ph -= 2 * M_PI; - } - if (ph < -2 * M_PI) { - ph += 2 * M_PI; - } - } - return ESP_OK; -} diff --git a/components/esp-dsp/modules/support/sfdr/float/dsps_sfdr_f32.cpp b/components/esp-dsp/modules/support/sfdr/float/dsps_sfdr_f32.cpp deleted file mode 100644 index 29ee3266..00000000 --- a/components/esp-dsp/modules/support/sfdr/float/dsps_sfdr_f32.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_sfdr.h" -#include "dsps_fft2r.h" -#include "dsp_common.h" -#include -#include -#include "esp_log.h" - -static const char *TAG = "sfdr"; - -float dsps_sfdr_f32(const float *input, int32_t len, int8_t use_dc) -{ - if (!dsp_is_power_of_two(len)) { - return 0; - } - - float *temp_array = new float[len * 2]; - for (int i = 0 ; i < len ; i++) { - float wind = 0.5 * (1 - cosf(i * 2 * M_PI / (float)len)); - temp_array[i * 2 + 0] = input[i] * wind; - temp_array[i * 2 + 1] = 0; - } - dsps_fft2r_init_fc32(NULL, CONFIG_DSP_MAX_FFT_SIZE); - - dsps_fft2r_fc32_ansi(temp_array, len); - dsps_bit_rev_fc32_ansi(temp_array, len); - - float min = std::numeric_limits::max(); - float max = std::numeric_limits::min(); - int max_pos = 0; - for (int i = 0 ; i < len / 2 ; i++) { - temp_array[i] = 10 * log10f(temp_array[i * 2 + 0] * temp_array[i * 2 + 0] + temp_array[i * 2 + 1] * temp_array[i * 2 + 1]); - if (temp_array[i] < min) { - min = temp_array[i]; - } - if (temp_array[i] > max) { - max = temp_array[i]; - max_pos = i; - } - ESP_LOGD(TAG, "FFT Data[%i] =%8.4f dB", i, temp_array[i]); - } - int start_pos = 0; - int wind_width = 5; - float min_diff = std::numeric_limits::max(); - - if (use_dc == 0) { - start_pos = wind_width; - } - for (int i = start_pos ; i < len / 2 ; i++) { - if ((i < (max_pos - wind_width)) || (i > (max_pos + wind_width))) { - float diff = max - temp_array[i]; - if (diff < min_diff) { - ESP_LOGD(TAG, "FFT Data[%i] =%8.4f dB, maX=%f, max_pos=%i", i, temp_array[i], max, max_pos); - min_diff = diff; - } - } - } - - delete temp_array; - return min_diff; -} diff --git a/components/esp-dsp/modules/support/sfdr/test/test_dsps_sfdr_f32.c b/components/esp-dsp/modules/support/sfdr/test/test_dsps_sfdr_f32.c deleted file mode 100644 index 66fa69da..00000000 --- a/components/esp-dsp/modules/support/sfdr/test/test_dsps_sfdr_f32.c +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_view.h" -#include "dsps_sfdr.h" -#include "dsps_fft2r.h" - - -static const char *TAG = "dsps_sfdr_f32"; - -static float data[1024]; - -TEST_CASE("dsps_sfdr_f32 functionality", "[dsps]") -{ - int N = sizeof(data) / sizeof(float) / 2; - int check_bin = 32; - float sfdr_exp = 4; - for (int i = 0 ; i < N ; i++) { - data[i] = 4 * sinf(M_PI / N * check_bin * i) / (N / 2); - data[i] += sinf(M_PI / N * check_bin * i * 2) / (N / 2); - } - - float sfdr = dsps_sfdr_f32(data, N, 1); - TEST_ASSERT_EQUAL( (int)20 * log10(sfdr_exp), (int)sfdr); - ESP_LOGI(TAG, "dsps_sfdr_f32 = %f dB", sfdr); - dsps_fft2r_deinit_fc32(); -} diff --git a/components/esp-dsp/modules/support/snr/float/dsps_snr_f32.cpp b/components/esp-dsp/modules/support/snr/float/dsps_snr_f32.cpp deleted file mode 100644 index 50e1dca5..00000000 --- a/components/esp-dsp/modules/support/snr/float/dsps_snr_f32.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2018-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. - -#include "dsps_snr.h" -#include "dsps_fft2r.h" -#include "dsp_common.h" -#include -#include -#include "esp_log.h" - -static const char *TAG = "snr"; - -float dsps_snr_f32(const float *input, int32_t len, uint8_t use_dc) -{ - if (!dsp_is_power_of_two(len)) { - return 0; - } - - float *temp_array = new float[len * 2]; - for (int i = 0 ; i < len ; i++) { - float wind = 0.5 * (1 - cosf(i * 2 * M_PI / (float)len)); - temp_array[i * 2 + 0] = input[i] * wind; - temp_array[i * 2 + 1] = 0; - } - dsps_fft2r_init_fc32(NULL, CONFIG_DSP_MAX_FFT_SIZE); - - dsps_fft2r_fc32_ansi(temp_array, len); - dsps_bit_rev_fc32_ansi(temp_array, len); - - float min = std::numeric_limits::max(); - float max = std::numeric_limits::min(); - int max_pos = 0; - for (int i = 0 ; i < len / 2 ; i++) { - temp_array[i] = temp_array[i * 2 + 0] * temp_array[i * 2 + 0] + temp_array[i * 2 + 1] * temp_array[i * 2 + 1]; - if (temp_array[i] < min) { - min = temp_array[i]; - } - if (temp_array[i] > max) { - max = temp_array[i]; - max_pos = i; - } - ESP_LOGD(TAG, "FFT Data[%i] =%8.4f dB", i, temp_array[i]); - } - int start_pos = 0; - int wind_width = 7; - - if (use_dc == 0) { - start_pos = wind_width; - } - float noise_power = 0; - for (int i = start_pos ; i < len / 2 ; i++) { - if ((i < (max_pos - wind_width)) || (i > (max_pos + wind_width))) { - noise_power += temp_array[i]; - ESP_LOGD(TAG, "FFT Data[%i] =%8.4f dB, maX=%f, max_pos=%i, noise_power=%f", i, temp_array[i], max, max_pos, noise_power); - } - } - - noise_power += std::numeric_limits::min(); - if (noise_power < max * 0.00000000001) { - return 192; - } - delete temp_array; - float snr = max / noise_power; - float result = 10 * log10(max / noise_power) - 2; // 2 - window correction - ESP_LOGI(TAG, "SNR = %f, result=%f dB", snr, result); - return result; -} diff --git a/components/esp-dsp/modules/support/snr/test/test_dsps_snr_f32.c b/components/esp-dsp/modules/support/snr/test/test_dsps_snr_f32.c deleted file mode 100644 index e58e3ec5..00000000 --- a/components/esp-dsp/modules/support/snr/test/test_dsps_snr_f32.c +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_view.h" -#include "dsps_snr.h" -#include "dsps_fft2r.h" - - -static const char *TAG = "dsps_snr_f32"; - -static float data[1024]; - -TEST_CASE("dsps_snr_f32 functionality", "[dsps]") -{ - int N = sizeof(data) / sizeof(float) / 2; - int check_bin = 32; - float snr_exp = 0.001; - for (int i = 0 ; i < N ; i++) { - data[i] = 1 * sinf(M_PI / N * check_bin * i) / (N / 2); - data[i] += 0.001 / N; //0.1*sinf(M_PI/N*check_bin*i*2)/(N/2); - } - - float snr = dsps_snr_f32(data, N, 1); - TEST_ASSERT_EQUAL(-round(20 * log10(snr_exp) + 3), (int)round(snr)); - ESP_LOGI(TAG, "dsps_snr_f32 = %f dB", snr); - dsps_fft2r_deinit_fc32(); -} diff --git a/components/esp-dsp/modules/support/view/dsps_view.cpp b/components/esp-dsp/modules/support/view/dsps_view.cpp deleted file mode 100644 index 2cfa2ca2..00000000 --- a/components/esp-dsp/modules/support/view/dsps_view.cpp +++ /dev/null @@ -1,119 +0,0 @@ -#include "dsps_view.h" -#include -#include "esp_log.h" -#include - -void dsps_view(const float *data, int32_t len, int width, int height, float min, float max, char view_char) -{ - uint8_t *view_data = new uint8_t[width * height]; - float *view_data_min = new float[width]; - float *view_data_max = new float[width]; - // - - for (int y = 0; y < height ; y++) { - for (int x = 0 ; x < width ; x++) { - view_data[y * width + x] = ' '; - } - } - for (int i = 0 ; i < width ; i++) { - view_data_min[i] = max; - view_data_max[i] = min; - } - float x_step = (float)(width) / (float)len; - float y_step = (float)(height - 1) / (max - min); - float data_min = std::numeric_limits::max(); - float data_max = std::numeric_limits::min(); - int min_pos = 0; - int max_pos = 0; - - for (int i = 0 ; i < len ; i++) { - int x_pos = i * x_step; - if (data[i] < view_data_min[x_pos]) { - view_data_min[x_pos] = data[i]; - } - if (data[i] > view_data_max[x_pos]) { - view_data_max[x_pos] = data[i]; - } - - if (view_data_min[x_pos] < min) { - view_data_min[x_pos] = min; - } - if (view_data_max[x_pos] > max) { - view_data_max[x_pos] = max; - } - ESP_LOGD("view", "for i=%i, x_pos=%i, max=%f, min=%f, data=%f", i, x_pos, view_data_min[x_pos], view_data_max[x_pos], data[i]); - if (data[i] > data_max) { - data_max = data[i]; - max_pos = i; - } - if (data[i] < data_min) { - data_min = data[i]; - min_pos = i; - } - } - ESP_LOGI("view", "Data min[%i] = %f, Data max[%i] = %f", min_pos, data_min, max_pos, data_max); - ESP_LOGD("view", "y_step = %f", y_step); - for (int x = 0 ; x < width ; x++) { - int y_count = (view_data_max[x] - view_data_min[x]) * y_step + 1; - ESP_LOGD("view", "For x= %i y_count=%i ,min =%f, max=%f, ... ", x, y_count, view_data_min[x], view_data_max[x]); - for (int y = 0 ; y < y_count ; y++) { - int y_pos = (max - view_data_max[x]) * y_step + y; - ESP_LOGD("view", " %i, ", y_pos); - view_data[y_pos * width + x] = view_char; - } - ESP_LOGD("view", " "); - } - - // Simple output - // for (int i=0 ; i< len ; i++) - // { - // float x_step = (float)(width-1)/(float)len; - // float y_step = (float)(height-1)/(max - min); - // int x_pos = i*x_step; - // int y_pos = data[i]*y_step; - // if (data[i] >= max) y_pos = 0; - // if (data[i] <= min) y_pos = height-1; - // view_data[y_pos*width + x_pos] = view_char; - // printf("For data[%i]=%f, x_pos%i, y_pos=%i\n", i, data[i], x_pos, y_pos); - // } - // printf("\n"); - printf(" "); - for (int x = 0 ; x < width ; x++) { - printf("_"); - } - printf("\n"); - for (int y = 0; y < height ; y++) { - printf("%i", y % 10); - for (int x = 0 ; x < width ; x++) { - printf("%c", view_data[y * width + x]); - } - printf("|\n"); - } - printf(" "); - for (int x = 0 ; x < width ; x++) { - printf("%i", x % 10); - } - printf("\n"); - ESP_LOGI("view", "Plot: Length=%i, min=%f, max=%f", len, min, max); - delete view_data; - delete view_data_min; - delete view_data_max; -} - -void dsps_view_s16(const int16_t *data, int32_t len, int width, int height, float min, float max, char view_char) -{ - float *view_data = new float[len]; - for (size_t i = 0; i < len; i++) - { -// view_data[i] = ((float)data[i])/32768.0f; - view_data[i] = data[i]; - view_data[i] /=32768; - } - dsps_view(view_data, len, width, height, min, max, view_char); - delete view_data; -} - -void dsps_view_spectrum(const float *data, int32_t len, float min, float max) -{ - dsps_view(data, len, 64, 10, min, max, '|'); -} diff --git a/components/esp-dsp/modules/support/view/test/test_dsps_view.c b/components/esp-dsp/modules/support/view/test/test_dsps_view.c deleted file mode 100644 index 87ffb520..00000000 --- a/components/esp-dsp/modules/support/view/test/test_dsps_view.c +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "dsps_view.h" - - -static const char *TAG = "dsps_view"; - -static float data[1024]; - -TEST_CASE("dsps_view functionality", "[dsps]") -{ - for (int i = 0 ; i < 1024 ; i++) { - data[i] = -100; - } - data[256] = 0; - dsps_view_spectrum(data, 1024, -100, 0); - - ESP_LOGI(TAG, "Just a check\n"); -} diff --git a/components/esp-dsp/modules/windows/blackman/float/dsps_wind_blackman_f32.c b/components/esp-dsp/modules/windows/blackman/float/dsps_wind_blackman_f32.c deleted file mode 100644 index 264302a8..00000000 --- a/components/esp-dsp/modules/windows/blackman/float/dsps_wind_blackman_f32.c +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018-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. - -#define _USE_MATH_DEFINES -#include "dsps_wind_blackman.h" -#include - -void dsps_wind_blackman_f32(float *window, int len) -{ - const float a0 = 0.42; - const float a1 = 0.5; - const float a2 = 0.08; - - float len_mult = 1/(float)(len-1); - for (int i = 0; i < len; i++) { - window[i] = a0 - a1 * cosf(i * 2 * M_PI * len_mult) + a2 * cosf(i * 4 * M_PI * len_mult); - } -} diff --git a/components/esp-dsp/modules/windows/blackman/include/dsps_wind_blackman.h b/components/esp-dsp/modules/windows/blackman/include/dsps_wind_blackman.h deleted file mode 100644 index 4c7475a5..00000000 --- a/components/esp-dsp/modules/windows/blackman/include/dsps_wind_blackman.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2018-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. - - -#ifndef _dsps_wind_blackman_H_ -#define _dsps_wind_blackman_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -/** - * @brief Blackman window - * - * The function generates Blackman window for plpha = 0.16. - * - * @param window: buffer to store window array. - * @param len: length of the window array - * - */ -void dsps_wind_blackman_f32(float *window, int len); - -#ifdef __cplusplus -} -#endif -#endif // _dsps_wind_blackman_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/windows/blackman_harris/float/dsps_wind_blackman_harris_f32.c b/components/esp-dsp/modules/windows/blackman_harris/float/dsps_wind_blackman_harris_f32.c deleted file mode 100644 index 25a7bc4c..00000000 --- a/components/esp-dsp/modules/windows/blackman_harris/float/dsps_wind_blackman_harris_f32.c +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2018-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. - -#define _USE_MATH_DEFINES -#include "dsps_wind_blackman_harris.h" -#include - -void dsps_wind_blackman_harris_f32(float *window, int len) -{ - const float a0=0.35875; - const float a1=0.48829; - const float a2=0.14128; - const float a3=0.01168; - - float len_mult = 1/(float)(len-1); - for (int i = 0; i < len; i++) { - window[i] = a0 - - a1 * cosf(i * 2 * M_PI * len_mult) - + a2 * cosf(i * 4 * M_PI * len_mult) - - a3 * cosf(i * 6 * M_PI * len_mult); - } -} diff --git a/components/esp-dsp/modules/windows/blackman_harris/include/dsps_wind_blackman_harris.h b/components/esp-dsp/modules/windows/blackman_harris/include/dsps_wind_blackman_harris.h deleted file mode 100644 index 5f93a7b6..00000000 --- a/components/esp-dsp/modules/windows/blackman_harris/include/dsps_wind_blackman_harris.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2018-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. - - -#ifndef _dsps_wind_blackman_harris_H_ -#define _dsps_wind_blackman_harris_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -/** - * @brief Blackman-Harris window - * - * The function generates Blackman-Harris window. - * - * @param window: buffer to store window array. - * @param len: length of the window array - * - */ -void dsps_wind_blackman_harris_f32(float *window, int len); - -#ifdef __cplusplus -} -#endif -#endif // _dsps_wind_blackman_harris_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/windows/blackman_nuttall/float/dsps_wind_blackman_nuttall_f32.c b/components/esp-dsp/modules/windows/blackman_nuttall/float/dsps_wind_blackman_nuttall_f32.c deleted file mode 100644 index 0871af90..00000000 --- a/components/esp-dsp/modules/windows/blackman_nuttall/float/dsps_wind_blackman_nuttall_f32.c +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2018-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. - -#define _USE_MATH_DEFINES -#include "dsps_wind_blackman_nuttall.h" -#include - -void dsps_wind_blackman_nuttall_f32(float *window, int len) -{ - const float a0=0.3635819; - const float a1=0.4891775; - const float a2=0.1365995; - const float a3=0.0106411; - - float len_mult = 1/(float)(len-1); - for (int i = 0; i < len; i++) { - window[i] = a0 - - a1 * cosf(i * 2 * M_PI * len_mult) - + a2 * cosf(i * 4 * M_PI * len_mult) - - a3 * cosf(i * 6 * M_PI * len_mult); - } -} diff --git a/components/esp-dsp/modules/windows/blackman_nuttall/include/dsps_wind_blackman_nuttall.h b/components/esp-dsp/modules/windows/blackman_nuttall/include/dsps_wind_blackman_nuttall.h deleted file mode 100644 index 10b52578..00000000 --- a/components/esp-dsp/modules/windows/blackman_nuttall/include/dsps_wind_blackman_nuttall.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2018-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. - - -#ifndef _dsps_wind_blackman_nuttall_H_ -#define _dsps_wind_blackman_nuttall_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -/** - * @brief Blackman-Nuttall window - * - * The function generates Blackman-Nuttall window. - * - * @param window: buffer to store window array. - * @param len: length of the window array - * - */ -void dsps_wind_blackman_nuttall_f32(float *window, int len); - -#ifdef __cplusplus -} -#endif -#endif // _dsps_wind_blackman_nuttall_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/windows/flat_top/float/dsps_wind_flat_top_f32.c b/components/esp-dsp/modules/windows/flat_top/float/dsps_wind_flat_top_f32.c deleted file mode 100644 index a153963a..00000000 --- a/components/esp-dsp/modules/windows/flat_top/float/dsps_wind_flat_top_f32.c +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2018-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. - -#define _USE_MATH_DEFINES -#include "dsps_wind_flat_top.h" -#include - -void dsps_wind_flat_top_f32(float *window, int len) -{ - const float a0=0.21557895; - const float a1=0.41663158; - const float a2=0.277263158; - const float a3=0.083578947; - const float a4=0.006947368; - - float len_mult = 1/(float)(len-1); - for (int i = 0; i < len; i++) { - window[i] = a0 - - a1 * cosf(i * 2 * M_PI * len_mult) - + a2 * cosf(i * 4 * M_PI * len_mult) - - a3 * cosf(i * 6 * M_PI * len_mult) - + a4 * cosf(i * 8 * M_PI * len_mult); - } -} diff --git a/components/esp-dsp/modules/windows/flat_top/include/dsps_wind_flat_top.h b/components/esp-dsp/modules/windows/flat_top/include/dsps_wind_flat_top.h deleted file mode 100644 index 85d83e50..00000000 --- a/components/esp-dsp/modules/windows/flat_top/include/dsps_wind_flat_top.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2018-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. - - -#ifndef _dsps_wind_flat_top_H_ -#define _dsps_wind_flat_top_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -/** - * @brief Flat-Top window - * - * The function generates Flat-Top window. - * - * @param window: buffer to store window array. - * @param len: length of the window array - * - */ -void dsps_wind_flat_top_f32(float *window, int len); - -#ifdef __cplusplus -} -#endif -#endif // _dsps_wind_flat_top_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/windows/hann/float/dsps_wind_hann_f32.c b/components/esp-dsp/modules/windows/hann/float/dsps_wind_hann_f32.c deleted file mode 100644 index 7148d42b..00000000 --- a/components/esp-dsp/modules/windows/hann/float/dsps_wind_hann_f32.c +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2018-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. - -#define _USE_MATH_DEFINES -#include "dsps_wind_hann.h" -#include - -void dsps_wind_hann_f32(float *window, int len) -{ - float len_mult = 1/(float)(len-1); - for (int i = 0; i < len; i++) { - window[i] = 0.5 * (1 - cosf(i * 2 * M_PI * len_mult)); - } -} diff --git a/components/esp-dsp/modules/windows/hann/include/dsps_wind_hann.h b/components/esp-dsp/modules/windows/hann/include/dsps_wind_hann.h deleted file mode 100644 index 2c682570..00000000 --- a/components/esp-dsp/modules/windows/hann/include/dsps_wind_hann.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2018-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. - - -#ifndef _dsps_wind_hann_H_ -#define _dsps_wind_hann_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -/** - * @brief Hann window - * - * The function generates Hann window. - * - * @param window: buffer to store window array. - * @param len: length of the window array - * - */ -void dsps_wind_hann_f32(float *window, int len); - -#ifdef __cplusplus -} -#endif -#endif // _dsps_wind_hann_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/windows/include/dsps_wind.h b/components/esp-dsp/modules/windows/include/dsps_wind.h deleted file mode 100644 index c8e3404a..00000000 --- a/components/esp-dsp/modules/windows/include/dsps_wind.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2018-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. - - -#ifndef _dsps_wind_H_ -#define _dsps_wind_H_ - -#include "dsps_wind_hann.h" -#include "dsps_wind_blackman.h" -#include "dsps_wind_blackman_harris.h" -#include "dsps_wind_blackman_nuttall.h" -#include "dsps_wind_nuttall.h" -#include "dsps_wind_flat_top.h" - -#endif // _dsps_wind_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/windows/nuttall/float/dsps_wind_nuttall_f32.c b/components/esp-dsp/modules/windows/nuttall/float/dsps_wind_nuttall_f32.c deleted file mode 100644 index 9c1a7c71..00000000 --- a/components/esp-dsp/modules/windows/nuttall/float/dsps_wind_nuttall_f32.c +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2018-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. - -#define _USE_MATH_DEFINES -#include "dsps_wind_nuttall.h" -#include - -void dsps_wind_nuttall_f32(float *window, int len) -{ - const float a0=0.355768; - const float a1=0.487396; - const float a2=0.144232; - const float a3=0.012604; - - float len_mult = 1/(float)(len-1); - for (int i = 0; i < len; i++) { - window[i] = a0 - - a1 * cosf(i * 2 * M_PI * len_mult) - + a2 * cosf(i * 4 * M_PI * len_mult) - - a3 * cosf(i * 6 * M_PI * len_mult); - } -} diff --git a/components/esp-dsp/modules/windows/nuttall/include/dsps_wind_nuttall.h b/components/esp-dsp/modules/windows/nuttall/include/dsps_wind_nuttall.h deleted file mode 100644 index 180cb923..00000000 --- a/components/esp-dsp/modules/windows/nuttall/include/dsps_wind_nuttall.h +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2018-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. - - -#ifndef _dsps_wind_nuttall_H_ -#define _dsps_wind_nuttall_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif - -/** - * @brief Nuttall window - * - * The function generates Nuttall window. - * - * @param window: buffer to store window array. - * @param len: length of the window array - * - */ -void dsps_wind_nuttall_f32(float *window, int len); - -#ifdef __cplusplus -} -#endif -#endif // _dsps_wind_nuttall_H_ \ No newline at end of file diff --git a/components/esp-dsp/modules/windows/test/test_wind_f32.c b/components/esp-dsp/modules/windows/test/test_wind_f32.c deleted file mode 100644 index f686dde3..00000000 --- a/components/esp-dsp/modules/windows/test/test_wind_f32.c +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" -#include "esp_log.h" - -#include "esp_dsp.h" -#include "dsps_wind.h" - -static const int length = 1024; -static float data[1024]; - -// This test check if the window is symmetric -TEST_CASE("dsps_wind_hann_f32: test Hann window for symmetry", "[dsps]") -{ - dsps_wind_hann_f32(data, length); - float hann_diff = 0; - for (int i=0 ; i< length/2 ; i++) - { - hann_diff += fabs(data[i] - data[length - 1 -i]); - } - - if (hann_diff > 0) TEST_ASSERT_EQUAL(0, hann_diff); - dsps_view(data, length, 64, 10, 0, 1, '.'); -} - -TEST_CASE("dsps_wind_blackman_f32: test Blackman window for symmetry", "[dsps]") -{ - dsps_wind_blackman_f32(data, length); - float hann_diff = 0; - for (int i=0 ; i< length/2 ; i++) - { - hann_diff += fabs(data[i] - data[length - 1 -i]); - } - if (hann_diff > 0) TEST_ASSERT_EQUAL(0, hann_diff); - dsps_view(data, length, 64, 10, 0, 1, '.'); -} - -TEST_CASE("dsps_wind_blackman_harris_f32: test Blackman-Hariss window for symmetry", "[dsps]") -{ - dsps_wind_blackman_harris_f32(data, length); - float hann_diff = 0; - for (int i=0 ; i< length/2 ; i++) - { - hann_diff += fabs(data[i] - data[length - 1 -i]); - } - - if (hann_diff > 0) TEST_ASSERT_EQUAL(0, hann_diff); - dsps_view(data, length, 64, 10, 0, 1, '.'); -} - -TEST_CASE("dsps_wind_blackman_nuttall_f32: test Blackman-Nuttall window for symmetry", "[dsps]") -{ - dsps_wind_blackman_nuttall_f32(data, length); - float hann_diff = 0; - for (int i=0 ; i< length/2 ; i++) - { - hann_diff += fabs(data[i] - data[length - 1 -i]); - } - - if (hann_diff > 0) TEST_ASSERT_EQUAL(0, hann_diff); - dsps_view(data, length, 64, 10, 0, 1, '.'); -} - -TEST_CASE("dsps_wind_nuttall_f32: test Nuttall window for symmetry", "[dsps]") -{ - dsps_wind_nuttall_f32(data, length); - float hann_diff = 0; - for (int i=0 ; i< length/2 ; i++) - { - hann_diff += fabs(data[i] - data[length - 1 -i]); - } - - if (hann_diff > 0) TEST_ASSERT_EQUAL(0, hann_diff); - dsps_view(data, length, 64, 10, 0, 1, '.'); -} - -TEST_CASE("dsps_wind_flat_top_f32: test Flat-Top window for symmetry", "[dsps]") -{ - dsps_wind_flat_top_f32(data, length); - float hann_diff = 0; - for (int i=0 ; i< length/2 ; i++) - { - hann_diff += fabs(data[i] - data[length - 1 -i]); - } - - if (hann_diff > 0) TEST_ASSERT_EQUAL(0, hann_diff); - dsps_view(data, length, 64, 10, 0, 1, '.'); -} diff --git a/components/esp-dsp/test/CMakeLists.txt b/components/esp-dsp/test/CMakeLists.txt deleted file mode 100644 index 41f56228..00000000 --- a/components/esp-dsp/test/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -set(COMPONENT_SRCDIRS - "." - "../modules/dotprod/test" - "../modules/matrix/test" - "../modules/iir/test" - "../modules/fir/test" - "../modules/math/mulc/test" - "../modules/math/addc/test" - "../modules/math/add/test" - "../modules/math/sub/test" - "../modules/math/mul/test" - "../modules/math/sqrt/test" - "../modules/support/view/test" - "../modules/support/snr/test" - "../modules/support/sfdr/test" - "../modules/fft/test" - "../modules/dct/test" - "../modules/conv/test" -) -set(COMPONENT_REQUIRES unity esp-dsp) - -set(COMPONENT_ADD_LDFRAGMENTS linker.lf) - -register_component() - \ No newline at end of file diff --git a/components/esp-dsp/test/component.mk b/components/esp-dsp/test/component.mk deleted file mode 100644 index e65a307d..00000000 --- a/components/esp-dsp/test/component.mk +++ /dev/null @@ -1,23 +0,0 @@ -COMPONENT_SRCDIRS := \ - . \ - ../modules/dotprod/test \ - ../modules/matrix/test \ - ../modules/iir/test \ - ../modules/fir/test \ - ../modules/math/mulc/test \ - ../modules/math/addc/test \ - ../modules/math/add/test \ - ../modules/math/sub/test \ - ../modules/math/mul/test \ - ../modules/math/sqrt/test \ - ../modules/support/view/test \ - ../modules/support/snr/test \ - ../modules/support/sfdr/test \ - ../modules/windows/test \ - ../modules/conv/test \ - ../modules/fft/test \ - ../modules/dct/test - -COMPONENT_ADD_LDFLAGS = -Wl,--whole-archive -l$(COMPONENT_NAME) -Wl,--no-whole-archive - -COMPONENT_ADD_LDFRAGMENTS += linker.lf diff --git a/components/esp-dsp/test/linker.lf b/components/esp-dsp/test/linker.lf deleted file mode 100644 index 66c46b05..00000000 --- a/components/esp-dsp/test/linker.lf +++ /dev/null @@ -1,20 +0,0 @@ -[mapping:dsp] -archive: libesp-dsp.a -entries: - * (noflash) - * (noflash_data) - * (noflash_text) - -[mapping:dsp2] -archive: libdsp.a -entries: - * (noflash) - * (noflash_data) - * (noflash_text) - -[mapping:dsp_test] -archive: libesp-dsp_test.a -entries: - * (noflash) - * (noflash_data) - * (noflash_text) diff --git a/components/esp-dsp/test/report.inc b/components/esp-dsp/test/report.inc deleted file mode 100644 index b5e169b0..00000000 --- a/components/esp-dsp/test/report.inc +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2018-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. - -#pragma once - -#include -#include - -/** - * This file contains helper functions and macros used to generate - * the benchmarks table in test_dsp.c. - */ - -static char report_space_str[] = " "; -static char report_line_str[] = "------------------------------------------------------------"; -static char report_double_line_str[] = "============================================================"; - -#define REPORT_COL1_WIDTH 58 -#define REPORT_COL2_WIDTH 10 -#define REPORT_COL3_WIDTH 10 - -static void report_text_line_2col(const char* col1, const char* col2) -{ - printf("| %-*.*s| %-*.*s|\n", - REPORT_COL1_WIDTH - 1, REPORT_COL1_WIDTH - 1, col1, - REPORT_COL2_WIDTH + REPORT_COL3_WIDTH, REPORT_COL2_WIDTH + REPORT_COL3_WIDTH, col2); -} -static void report_text_line(const char* col1, const char* col2, const char* col3) -{ - printf("| %-*.*s| %-*.*s| %-*.*s|\n", - REPORT_COL1_WIDTH - 1, REPORT_COL1_WIDTH - 1, col1, - REPORT_COL2_WIDTH - 1, REPORT_COL2_WIDTH - 1, col2, - REPORT_COL3_WIDTH - 1, REPORT_COL3_WIDTH - 1, col3); -} - -static void report_value_line(const char* col1, uint32_t col2, uint32_t col3) -{ - printf("| %-*.*s|%*u |%*u |\n", - REPORT_COL1_WIDTH - 1, REPORT_COL1_WIDTH - 1, col1, - REPORT_COL2_WIDTH - 1, col2, - REPORT_COL3_WIDTH - 1, col3); -} - -static void report_separator(const char* fill) -{ - printf("+%.*s+%.*s+%.*s+\n", - REPORT_COL1_WIDTH, fill, - REPORT_COL2_WIDTH, fill, - REPORT_COL3_WIDTH, fill); -} - -#define REPORT_BENCHMARK(title, func1, func2, ...) \ - do { \ - func1(__VA_ARGS__); /* warm up the cache */ \ - unsigned intlevel = portENTER_CRITICAL_NESTED(); \ - uint32_t func1_start = xthal_get_ccount(); \ - func1(__VA_ARGS__); \ - uint32_t func1_end = xthal_get_ccount(); \ - portEXIT_CRITICAL_NESTED(intlevel); \ - func2(__VA_ARGS__); /* warm up the cache */ \ - intlevel = portENTER_CRITICAL_NESTED(); \ - uint32_t func2_start = xthal_get_ccount(); \ - func2(__VA_ARGS__); \ - uint32_t func2_end = xthal_get_ccount(); \ - portEXIT_CRITICAL_NESTED(intlevel); \ - report_value_line(title, func1_end - func1_start, func2_end - func2_start); \ - report_separator(report_line_str); \ - } while(0); - -#define REPORT_SECTION(title) \ - do { \ - report_text_line(report_space_str, report_space_str, report_space_str); \ - report_separator(report_line_str); \ - report_text_line(title, report_space_str, report_space_str); \ - report_separator(report_line_str); \ - } while(0); - - -#define REPORT_HEADER() \ - do { \ - report_separator(report_line_str); \ - report_text_line_2col("Function name and arguments", "CPU cycles"); \ - report_separator(report_line_str); \ - report_text_line(report_space_str, "ESP32", "ANSI C"); \ - report_separator(report_double_line_str); \ - } while(0); diff --git a/components/esp-dsp/test/test_dsp.c b/components/esp-dsp/test/test_dsp.c deleted file mode 100644 index d97ec0c4..00000000 --- a/components/esp-dsp/test/test_dsp.c +++ /dev/null @@ -1,228 +0,0 @@ -// Copyright 2018-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. - -#include -#include "unity.h" -#include "dsp_platform.h" - -#include "esp_dsp.h" -#include "report.inc" - -static const char *TAG = "common"; - -// This is template test for future extensions -// Test on this level should test complex functionality -// for many modules -TEST_CASE("test template", "[dsp][ignore]") -{ - size_t size_before = xPortGetFreeHeapSize(); - size_t size_after = xPortGetFreeHeapSize(); - - ptrdiff_t heap_diff = size_before - size_after; - heap_diff = abs(heap_diff); - if (heap_diff > 8) TEST_ASSERT_EQUAL(0, heap_diff); -} - - -#define dspm_mult_3x3x1_f32_ansi(data1, data2, data3) dspm_mult_f32_ansi(data1, data2, data3, 3, 3, 1) -#define dspm_mult_3x3x3_f32_ansi(data1, data2, data3) dspm_mult_f32_ansi(data1, data2, data3, 3, 3, 3) -#define dspm_mult_4x4x1_f32_ansi(data1, data2, data3) dspm_mult_f32_ansi(data1, data2, data3, 4, 4, 1) -#define dspm_mult_4x4x4_f32_ansi(data1, data2, data3) dspm_mult_f32_ansi(data1, data2, data3, 4, 4, 4) - -TEST_CASE("DSP Libary benchmark table", "[dsp]") -{ - // This test generates benchmark rst table for all available functions - const size_t test_size = 1024; - - esp_err_t ret = dsps_fft2r_init_fc32(NULL, CONFIG_DSP_MAX_FFT_SIZE); - if (ret != ESP_OK) { - ESP_LOGE(TAG, "Not possible to initialize floating point FFT-R2. Error = 0x%x", ret); - abort(); - } - ret = dsps_fft2r_init_sc16(NULL, CONFIG_DSP_MAX_FFT_SIZE); - if (ret != ESP_OK) { - ESP_LOGE(TAG, "Not possible to initialize fixed point FFT-R2. Error = 0x%x", ret); - abort(); - } - - ret = dsps_fft4r_init_fc32(NULL, CONFIG_DSP_MAX_FFT_SIZE); - if (ret != ESP_OK) { - ESP_LOGE(TAG, "Not possible to initialize fixed point FFT-R4. Error = 0x%x", ret); - abort(); - } - - float* data1 = (float*) malloc(test_size * 2 * sizeof(float)); - float* data2 = (float*) malloc(test_size * 2 * sizeof(float)); - float* data3 = (float*) malloc(test_size * 2 * sizeof(float)); - if (!data1 || !data2 || !data3) { - ESP_LOGE(TAG, "Failed to allocate buffers"); - abort(); - } - - fir_f32_t fir1; - dsps_fir_init_f32(&fir1, data1, data2, 256); - - fir_f32_t fir2; - dsps_fird_init_f32(&fir2, data1, data2, 256, 4, 0); - - float coeffs[5]; - dsps_biquad_gen_lpf_f32(coeffs, 0.1, 1); - - REPORT_HEADER(); - REPORT_SECTION("**Dot Product**"); - REPORT_BENCHMARK("dsps_dotprod_f32 for N=256 points", - dsps_dotprod_f32_ae32, - dsps_dotprod_f32_ansi, - data1, data2, data3, 256); - - REPORT_BENCHMARK("dsps_dotprode_f32 for N=256 points, with step 1", - dsps_dotprode_f32_ae32, - dsps_dotprode_f32_ansi, - data1, data2, data3, 256, 1, 1); - - REPORT_BENCHMARK("dsps_dotprod_s16 for N=256 points", - dsps_dotprod_s16_ae32, - dsps_dotprod_s16_ansi, - (int16_t *)data1, (int16_t *)data2, (int16_t *)data3, 256, 0); - - - REPORT_SECTION("**FIR Filters**"); - - REPORT_BENCHMARK("dsps_fir_f32 1024 input samples and 256 coefficients", - dsps_fir_f32_ae32, - dsps_fir_f32_ansi, - &fir1, data1, data2, 1024); - - REPORT_BENCHMARK("dsps_fird_f32 1024 samples, 256 coeffs and decimation 4", - dsps_fird_f32_ae32, - dsps_fird_f32_ansi, - &fir1, data1, data2, 1024); - - REPORT_SECTION("**FFTs Radix-2 32 bit Floating Point**"); - - REPORT_BENCHMARK("dsps_fft2r_fc32 for 64 complex points", - dsps_fft2r_fc32_ae32, - dsps_fft2r_fc32_ansi, - data1, 64); - - REPORT_BENCHMARK("dsps_fft2r_fc32 for 128 complex points", - dsps_fft2r_fc32_ae32, - dsps_fft2r_fc32_ansi, - data1, 128); - - REPORT_BENCHMARK("dsps_fft2r_fc32 for 256 complex points", - dsps_fft2r_fc32_ae32, - dsps_fft2r_fc32_ansi, - data1, 256); - - REPORT_BENCHMARK("dsps_fft2r_fc32 for 512 complex points", - dsps_fft2r_fc32_ae32, - dsps_fft2r_fc32_ansi, - data1, 512); - - REPORT_BENCHMARK("dsps_fft2r_fc32 for 1024 complex points", - dsps_fft2r_fc32_ae32, - dsps_fft2r_fc32_ansi, - data1, 1024); - - REPORT_SECTION("**FFTs Radix-4 32 bit Floating Point**"); - - REPORT_BENCHMARK("dsps_fft4r_fc32 for 64 complex points", - dsps_fft4r_fc32_ae32, - dsps_fft4r_fc32_ansi, - data1, 64); - - REPORT_BENCHMARK("dsps_fft4r_fc32 for 256 complex points", - dsps_fft4r_fc32_ae32, - dsps_fft4r_fc32_ansi, - data1, 256); - - REPORT_BENCHMARK("dsps_fft4r_fc32 for 1024 complex points", - dsps_fft4r_fc32_ae32, - dsps_fft4r_fc32_ansi, - data1, 1024); - - REPORT_SECTION("**FFTs 16 bit Fixed Point**"); - - REPORT_BENCHMARK("dsps_fft2r_sc16 for 64 complex points", - dsps_fft2r_sc16_ae32, - dsps_fft2r_sc16_ansi, - (int16_t*)data1, 64); - - REPORT_BENCHMARK("dsps_fft2r_sc16 for 128 complex points", - dsps_fft2r_sc16_ae32, - dsps_fft2r_sc16_ansi, - (int16_t*)data1, 128); - - REPORT_BENCHMARK("dsps_fft2r_sc16 for 256 complex points", - dsps_fft2r_sc16_ae32, - dsps_fft2r_sc16_ansi, - (int16_t*)data1, 256); - - REPORT_BENCHMARK("dsps_fft2r_sc16 for 512 complex points", - dsps_fft2r_sc16_ae32, - dsps_fft2r_sc16_ansi, - (int16_t*)data1, 512); - - REPORT_BENCHMARK("dsps_fft2r_sc16 for 1024 complex points", - dsps_fft2r_sc16_ae32, - dsps_fft2r_sc16_ansi, - (int16_t*)data1, 1024); - - REPORT_SECTION("**IIR Filters**"); - - REPORT_BENCHMARK("dsps_biquad_f32 - biquad filter for 1024 input samples", - dsps_biquad_f32_ae32, - dsps_biquad_f32_ansi, - data1, data2, 1024, coeffs, data3); - - REPORT_SECTION("**Matrix Multiplication**"); - - REPORT_BENCHMARK("dspm_mult_f32 - C[16,16] = A[16,16]*B[16,16];", - dspm_mult_f32_ae32, - dspm_mult_f32_ansi, - data1, data2, data3, 16, 16, 16); - - REPORT_BENCHMARK("dspm_mult_s16 - C[16,16] = A[16,16]*B[16,16];", - dspm_mult_s16_ae32, - dspm_mult_s16_ansi, - (int16_t *)data1, (int16_t *)data2, (int16_t *)data3, 16, 16, 16, 0); - - REPORT_BENCHMARK("dspm_mult_3x3x1_f32 - C[3,1] = A[3,3]*B[3,1];", - dspm_mult_3x3x1_f32_ae32, - dspm_mult_3x3x1_f32_ansi, - data1, data2, data3); - - REPORT_BENCHMARK("dspm_mult_3x3x3_f32 - C[3,3] = A[3,3]*B[3,3];", - dspm_mult_3x3x3_f32_ae32, - dspm_mult_3x3x3_f32_ansi, - data1, data2, data3); - - REPORT_BENCHMARK("dspm_mult_4x4x1_f32 - C[4,1] = A[4,4]*B[4,1];", - dspm_mult_4x4x1_f32_ae32, - dspm_mult_4x4x1_f32_ansi, - data1, data2, data3); - - REPORT_BENCHMARK("dspm_mult_4x4x4_f32 - C[4,4] = A[4,4]*B[4,4];", - dspm_mult_4x4x4_f32_ae32, - dspm_mult_4x4x4_f32_ansi, - data1, data2, data3); - - dsps_fft2r_deinit_fc32(); - dsps_fft4r_deinit_fc32(); - dsps_fft2r_deinit_sc16(); - free(data1); - free(data2); - free(data3); -} diff --git a/components/esp-dsp/test_app/CMakeLists.txt b/components/esp-dsp/test_app/CMakeLists.txt deleted file mode 100644 index 3cc05d5e..00000000 --- a/components/esp-dsp/test_app/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -# This is the project CMakeLists.txt file for the test subproject -cmake_minimum_required(VERSION 3.5) - -# Include the components directory of the main application: -# -set(EXTRA_COMPONENT_DIRS "../") -set(IDF_EXCLUDE_COMPONENTS "test" "test_app") - -set(TEST_COMPONENTS "esp-dsp" CACHE STRING "List of components to test") - -include($ENV{IDF_PATH}/tools/cmake/project.cmake) -project(test_app) diff --git a/components/esp-dsp/test_app/Makefile b/components/esp-dsp/test_app/Makefile deleted file mode 100644 index e4d59160..00000000 --- a/components/esp-dsp/test_app/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# -# This is a project Makefile for the test subproject. -# - -PROJECT_NAME := test_app - -# Include the components directory of the main application: -# -EXTRA_COMPONENT_DIRS := $(realpath ..) -EXCLUDE_COMPONENTS := test_app -TEST_COMPONENTS ?= esp-dsp - -include $(IDF_PATH)/make/project.mk diff --git a/components/esp-dsp/test_app/main/CMakeLists.txt b/components/esp-dsp/test_app/main/CMakeLists.txt deleted file mode 100644 index 46bea557..00000000 --- a/components/esp-dsp/test_app/main/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -set(COMPONENT_SRCS "test_app_main.c") -set(COMPONENT_ADD_INCLUDEDIRS ".") - -register_component() diff --git a/components/esp-dsp/test_app/main/component.mk b/components/esp-dsp/test_app/main/component.mk deleted file mode 100644 index e69de29b..00000000 diff --git a/components/esp-dsp/test_app/main/test_app_main.c b/components/esp-dsp/test_app/main/test_app_main.c deleted file mode 100644 index a0372b10..00000000 --- a/components/esp-dsp/test_app/main/test_app_main.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "unity.h" - -void app_main() -{ - unity_run_menu(); -} diff --git a/components/esp-dsp/test_app/sdkconfig.defaults b/components/esp-dsp/test_app/sdkconfig.defaults deleted file mode 100644 index dd233326..00000000 --- a/components/esp-dsp/test_app/sdkconfig.defaults +++ /dev/null @@ -1,2 +0,0 @@ -CONFIG_ESP_TASK_WDT=n -CONFIG_OPTIMIZATION_LEVEL_RELEASE=y diff --git a/components/esp_peripherals/driver/i2c_bus/i2c_bus.c b/components/esp_peripherals/driver/i2c_bus/i2c_bus.c index db476b76..7ce1bcae 100644 --- a/components/esp_peripherals/driver/i2c_bus/i2c_bus.c +++ b/components/esp_peripherals/driver/i2c_bus/i2c_bus.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on ESPRESSIF SYSTEMS products only, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,189 +18,208 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "i2c_bus.h" + +#include +#include + #include "audio_mem.h" #include "audio_mutex.h" #include "driver/i2c.h" #include "esp_log.h" -#include #define ESP_INTR_FLG_DEFAULT (0) #define ESP_I2C_MASTER_BUF_LEN (0) #define I2C_ACK_CHECK_EN 1 -#define I2C_BUS_CHECK(a, str, ret) \ - if (!(a)) \ - { \ - ESP_LOGE (TAG, "%s:%d (%s):%s", __FILE__, __LINE__, __FUNCTION__, str); \ - return (ret); \ - } - -typedef struct -{ - i2c_config_t i2c_conf; /*!i2c_conf, sizeof(i2c_config_t)) == 0) { + i2c_bus[port]->ref_count++; + ESP_LOGW(TAG, "I2C bus has been already created, [port:%d]", port); return i2c_bus[port]; + } else { + ESP_LOGE(TAG, "Have not enough slot(%d) to create I2C bus", port); + return NULL; } - i2c_bus[port] = (i2c_bus_t *)audio_calloc (1, sizeof (i2c_bus_t)); + } + + i2c_bus[port] = (i2c_bus_t *)audio_calloc(1, sizeof(i2c_bus_t)); i2c_bus[port]->i2c_conf = *conf; i2c_bus[port]->i2c_port = port; - esp_err_t ret - = i2c_param_config (i2c_bus[port]->i2c_port, &i2c_bus[port]->i2c_conf); - if (ret != ESP_OK) - { - goto error; - } - ret = i2c_driver_install ( - i2c_bus[port]->i2c_port, i2c_bus[port]->i2c_conf.mode, - ESP_I2C_MASTER_BUF_LEN, ESP_I2C_MASTER_BUF_LEN, ESP_INTR_FLG_DEFAULT); - if (ret != ESP_OK) - { - goto error; - } - if (_busLock) - { - mutex_destroy (_busLock); - } - _busLock = mutex_create (); + i2c_bus[port]->ref_count++; + esp_err_t ret = + i2c_param_config(i2c_bus[port]->i2c_port, &i2c_bus[port]->i2c_conf); + if (ret != ESP_OK) { + goto error; + } + ret = i2c_driver_install(i2c_bus[port]->i2c_port, + i2c_bus[port]->i2c_conf.mode, ESP_I2C_MASTER_BUF_LEN, + ESP_I2C_MASTER_BUF_LEN, ESP_INTR_FLG_DEFAULT); + if (ret != ESP_OK) { + goto error; + } + i2c_bus[port]->bus_lock = mutex_create(); + if (i2c_bus[port]->bus_lock == NULL) { + goto error; + } return (i2c_bus_handle_t)i2c_bus[port]; error: - if (i2c_bus[port]) - { - audio_free (i2c_bus[port]); + if (i2c_bus[port]) { + if (i2c_bus[port]->bus_lock == NULL) { + mutex_destroy(i2c_bus[port]->bus_lock); } + audio_free(i2c_bus[port]); + } return NULL; } -esp_err_t -i2c_bus_write_bytes (i2c_bus_handle_t bus, int addr, uint8_t *reg, int regLen, - uint8_t *data, int datalen) -{ - I2C_BUS_CHECK (bus != NULL, "Handle error", ESP_FAIL); +esp_err_t i2c_bus_write_bytes(i2c_bus_handle_t bus, int addr, uint8_t *reg, + int regLen, uint8_t *data, int datalen) { + I2C_BUS_CHECK(bus != NULL, "Handle error", ESP_FAIL); i2c_bus_t *p_bus = (i2c_bus_t *)bus; - I2C_BUS_CHECK (p_bus->i2c_port < I2C_NUM_MAX, "I2C port error", ESP_FAIL); - I2C_BUS_CHECK (data != NULL, "Not initialized input data pointer", ESP_FAIL); + I2C_BUS_CHECK(p_bus->i2c_port < I2C_NUM_MAX, "I2C port error", ESP_FAIL); + I2C_BUS_CHECK(data != NULL, "Not initialized input data pointer", ESP_FAIL); esp_err_t ret = ESP_OK; - mutex_lock (_busLock); - i2c_cmd_handle_t cmd = i2c_cmd_link_create (); - ret |= i2c_master_start (cmd); - ret |= i2c_master_write_byte (cmd, addr, 1); - ret |= i2c_master_write (cmd, reg, regLen, I2C_ACK_CHECK_EN); - ret |= i2c_master_write (cmd, data, datalen, I2C_ACK_CHECK_EN); - ret |= i2c_master_stop (cmd); - ret |= i2c_master_cmd_begin (p_bus->i2c_port, cmd, 1000 / portTICK_RATE_MS); - i2c_cmd_link_delete (cmd); - mutex_unlock (_busLock); - I2C_BUS_CHECK (ret == 0, "I2C Bus WriteReg Error", ESP_FAIL); + mutex_lock(p_bus->bus_lock); + i2c_cmd_handle_t cmd = i2c_cmd_link_create(); + ret |= i2c_master_start(cmd); + ret |= i2c_master_write_byte(cmd, addr, 1); + ret |= i2c_master_write(cmd, reg, regLen, I2C_ACK_CHECK_EN); + ret |= i2c_master_write(cmd, data, datalen, I2C_ACK_CHECK_EN); + ret |= i2c_master_stop(cmd); + ret |= i2c_master_cmd_begin(p_bus->i2c_port, cmd, 1000 / portTICK_RATE_MS); + i2c_cmd_link_delete(cmd); + mutex_unlock(p_bus->bus_lock); + I2C_BUS_CHECK(ret == 0, "I2C Bus WriteReg Error", ESP_FAIL); return ret; } -esp_err_t -i2c_bus_write_data (i2c_bus_handle_t bus, int addr, uint8_t *data, int datalen) -{ - I2C_BUS_CHECK (bus != NULL, "Handle error", ESP_FAIL); +esp_err_t i2c_bus_write_data(i2c_bus_handle_t bus, int addr, uint8_t *data, + int datalen) { + I2C_BUS_CHECK(bus != NULL, "Handle error", ESP_FAIL); i2c_bus_t *p_bus = (i2c_bus_t *)bus; - I2C_BUS_CHECK (p_bus->i2c_port < I2C_NUM_MAX, "I2C port error", ESP_FAIL); - I2C_BUS_CHECK (data != NULL, "Not initialized input data pointer", ESP_FAIL); + I2C_BUS_CHECK(p_bus->i2c_port < I2C_NUM_MAX, "I2C port error", ESP_FAIL); + I2C_BUS_CHECK(data != NULL, "Not initialized input data pointer", ESP_FAIL); esp_err_t ret = ESP_OK; - mutex_lock (_busLock); - i2c_cmd_handle_t cmd = i2c_cmd_link_create (); - ret |= i2c_master_start (cmd); - ret |= i2c_master_write_byte (cmd, addr, 1); - ret |= i2c_master_write (cmd, data, datalen, I2C_ACK_CHECK_EN); - ret |= i2c_master_stop (cmd); - ret |= i2c_master_cmd_begin (p_bus->i2c_port, cmd, 1000 / portTICK_RATE_MS); - i2c_cmd_link_delete (cmd); - mutex_unlock (_busLock); - I2C_BUS_CHECK (ret == 0, "I2C Bus WriteReg Error", ESP_FAIL); + mutex_lock(p_bus->bus_lock); + i2c_cmd_handle_t cmd = i2c_cmd_link_create(); + ret |= i2c_master_start(cmd); + ret |= i2c_master_write_byte(cmd, addr, 1); + ret |= i2c_master_write(cmd, data, datalen, I2C_ACK_CHECK_EN); + ret |= i2c_master_stop(cmd); + ret |= i2c_master_cmd_begin(p_bus->i2c_port, cmd, 1000 / portTICK_RATE_MS); + i2c_cmd_link_delete(cmd); + mutex_unlock(p_bus->bus_lock); + I2C_BUS_CHECK(ret == 0, "I2C Bus WriteReg Error", ESP_FAIL); return ret; } -esp_err_t -i2c_bus_read_bytes (i2c_bus_handle_t bus, int addr, uint8_t *reg, int reglen, - uint8_t *outdata, int datalen) -{ - I2C_BUS_CHECK (bus != NULL, "Handle error", ESP_FAIL); +esp_err_t i2c_bus_read_bytes(i2c_bus_handle_t bus, int addr, uint8_t *reg, + int reglen, uint8_t *outdata, int datalen) { + I2C_BUS_CHECK(bus != NULL, "Handle error", ESP_FAIL); i2c_bus_t *p_bus = (i2c_bus_t *)bus; - I2C_BUS_CHECK (p_bus->i2c_port < I2C_NUM_MAX, "I2C port error", ESP_FAIL); - I2C_BUS_CHECK (outdata != NULL, "Not initialized output data buffer pointer", - ESP_FAIL); + I2C_BUS_CHECK(p_bus->i2c_port < I2C_NUM_MAX, "I2C port error", ESP_FAIL); + I2C_BUS_CHECK(outdata != NULL, "Not initialized output data buffer pointer", + ESP_FAIL); esp_err_t ret = ESP_OK; - mutex_lock (_busLock); + mutex_lock(p_bus->bus_lock); i2c_cmd_handle_t cmd; - cmd = i2c_cmd_link_create (); - ret |= i2c_master_start (cmd); - ret |= i2c_master_write_byte (cmd, addr, I2C_ACK_CHECK_EN); - ret |= i2c_master_write (cmd, reg, reglen, I2C_ACK_CHECK_EN); - ret |= i2c_master_stop (cmd); - ret |= i2c_master_cmd_begin (p_bus->i2c_port, cmd, 1000 / portTICK_RATE_MS); - i2c_cmd_link_delete (cmd); - - cmd = i2c_cmd_link_create (); - ret |= i2c_master_start (cmd); - ret |= i2c_master_write_byte (cmd, addr | 0x01, I2C_ACK_CHECK_EN); - - for (int i = 0; i < datalen - 1; i++) - { - ret |= i2c_master_read_byte (cmd, &outdata[i], 0); - } - ret |= i2c_master_read_byte (cmd, &outdata[datalen - 1], 1); - - ret = i2c_master_stop (cmd); - ret = i2c_master_cmd_begin (p_bus->i2c_port, cmd, 1000 / portTICK_RATE_MS); - i2c_cmd_link_delete (cmd); - - mutex_unlock (_busLock); - I2C_BUS_CHECK (ret == 0, "I2C Bus ReadReg Error", ESP_FAIL); + cmd = i2c_cmd_link_create(); + ret |= i2c_master_start(cmd); + ret |= i2c_master_write_byte(cmd, addr, I2C_ACK_CHECK_EN); + ret |= i2c_master_write(cmd, reg, reglen, I2C_ACK_CHECK_EN); + ret |= i2c_master_stop(cmd); + ret |= i2c_master_cmd_begin(p_bus->i2c_port, cmd, 1000 / portTICK_RATE_MS); + i2c_cmd_link_delete(cmd); + + cmd = i2c_cmd_link_create(); + ret |= i2c_master_start(cmd); + ret |= i2c_master_write_byte(cmd, addr | 0x01, I2C_ACK_CHECK_EN); + + for (int i = 0; i < datalen - 1; i++) { + ret |= i2c_master_read_byte(cmd, &outdata[i], 0); + } + ret |= i2c_master_read_byte(cmd, &outdata[datalen - 1], 1); + + ret |= i2c_master_stop(cmd); + ret |= i2c_master_cmd_begin(p_bus->i2c_port, cmd, 1000 / portTICK_RATE_MS); + i2c_cmd_link_delete(cmd); + + mutex_unlock(p_bus->bus_lock); + I2C_BUS_CHECK(ret == 0, "I2C Bus ReadReg Error", ESP_FAIL); return ret; } -esp_err_t -i2c_bus_delete (i2c_bus_handle_t bus) -{ - I2C_BUS_CHECK (bus != NULL, "Handle error", ESP_FAIL); +esp_err_t i2c_bus_delete(i2c_bus_handle_t bus) { + I2C_BUS_CHECK(bus != NULL, "Handle error", ESP_FAIL); i2c_bus_t *p_bus = (i2c_bus_t *)bus; - i2c_driver_delete (p_bus->i2c_port); - i2c_bus[p_bus->i2c_port] = NULL; - audio_free (p_bus); - mutex_destroy (_busLock); - - _busLock = NULL; + if (--p_bus->ref_count == 0) { + i2c_driver_delete(p_bus->i2c_port); + i2c_bus[p_bus->i2c_port] = NULL; + mutex_destroy(p_bus->bus_lock); + audio_free(p_bus); + } return ESP_OK; } -esp_err_t -i2c_bus_cmd_begin (i2c_bus_handle_t bus, i2c_cmd_handle_t cmd, - portBASE_TYPE ticks_to_wait) -{ - I2C_BUS_CHECK (bus != NULL, "Handle error", ESP_FAIL); - I2C_BUS_CHECK (cmd != NULL, "I2C cmd error", ESP_FAIL); +esp_err_t i2c_bus_cmd_begin(i2c_bus_handle_t bus, i2c_cmd_handle_t cmd, + portBASE_TYPE ticks_to_wait) { + I2C_BUS_CHECK(bus != NULL, "Handle error", ESP_FAIL); + I2C_BUS_CHECK(cmd != NULL, "I2C cmd error", ESP_FAIL); i2c_bus_t *p_bus = (i2c_bus_t *)bus; - esp_err_t ret = i2c_master_cmd_begin (p_bus->i2c_port, cmd, ticks_to_wait); + esp_err_t ret = i2c_master_cmd_begin(p_bus->i2c_port, cmd, ticks_to_wait); return ret; } + +esp_err_t i2c_bus_probe_addr(i2c_bus_handle_t bus, uint8_t addr) { + I2C_BUS_CHECK(bus != NULL, "Handle error", ESP_FAIL); + /* Use 7 bit address here */ + if (addr >= 0x80) { + ESP_LOGE(TAG, "I2C addr out of range"); + return ESP_ERR_INVALID_ARG; + } + + i2c_bus_t *i2c_bus = (i2c_bus_t *)bus; + mutex_lock(i2c_bus->bus_lock); + i2c_cmd_handle_t cmd = i2c_cmd_link_create(); + i2c_master_start(cmd); + i2c_master_write_byte(cmd, addr, I2C_ACK_CHECK_EN); + i2c_master_stop(cmd); + esp_err_t ret_val = + i2c_master_cmd_begin(i2c_bus->i2c_port, cmd, pdMS_TO_TICKS(500)); + i2c_cmd_link_delete(cmd); + mutex_unlock(i2c_bus->bus_lock); + + /* Get probe result if ESP_OK equals to ret_val */ + return ret_val; +} diff --git a/components/esp_peripherals/driver/i2c_bus/i2c_bus.h b/components/esp_peripherals/driver/i2c_bus/i2c_bus.h index 6c429efb..ee2bdbec 100644 --- a/components/esp_peripherals/driver/i2c_bus/i2c_bus.h +++ b/components/esp_peripherals/driver/i2c_bus/i2c_bus.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on ESPRESSIF SYSTEMS products only, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #ifndef _IOT_I2C_BUS_H_ @@ -29,96 +29,107 @@ #include "driver/i2c.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - typedef void *i2c_bus_handle_t; +typedef void *i2c_bus_handle_t; - /** - * @brief Create and init I2C bus and return a I2C bus handle - * - * @param port I2C port number - * @param conf Pointer to I2C parameters - * - * @return - * - I2C bus handle - */ - i2c_bus_handle_t i2c_bus_create (i2c_port_t port, i2c_config_t *conf); +/** + * @brief Create and init I2C bus and return a I2C bus handle + * + * @param port I2C port number + * @param conf Pointer to I2C parameters + * + * @return + * - I2C bus handle + */ +i2c_bus_handle_t i2c_bus_create(i2c_port_t port, i2c_config_t *conf); - /** - * @brief Write bytes to I2C bus - * - * @param bus I2C bus handle - * @param addr The address of the device - * @param reg The register of the device - * @param regLen The length of register - * @param data The data pointer - * @param datalen The length of data - * - * @return - * - NULL Fail - * - Others Success - */ - esp_err_t i2c_bus_write_bytes (i2c_bus_handle_t bus, int addr, uint8_t *reg, - int regLen, uint8_t *data, int datalen); +/** + * @brief Write bytes to I2C bus + * + * @param bus I2C bus handle + * @param addr The address of the device + * @param reg The register of the device + * @param regLen The length of register + * @param data The data pointer + * @param datalen The length of data + * + * @return + * - NULL Fail + * - Others Success + */ +esp_err_t i2c_bus_write_bytes(i2c_bus_handle_t bus, int addr, uint8_t *reg, + int regLen, uint8_t *data, int datalen); - /** - * @brief Write data to I2C bus - * - * @param bus I2C bus handle - * @param addr The address of the device - * @param data The data pointer - * @param datalen The length of data - * - * @return - * - NULL Fail - * - Others Success - */ - esp_err_t i2c_bus_write_data (i2c_bus_handle_t bus, int addr, uint8_t *data, - int datalen); +/** + * @brief Write data to I2C bus + * + * @param bus I2C bus handle + * @param addr The address of the device + * @param data The data pointer + * @param datalen The length of data + * + * @return + * - NULL Fail + * - Others Success + */ +esp_err_t i2c_bus_write_data(i2c_bus_handle_t bus, int addr, uint8_t *data, + int datalen); + +/** + * @brief Read bytes to I2C bus + * + * @param bus I2C bus handle + * @param addr The address of the device + * @param reg The register of the device + * @param regLen The length of register + * @param outdata The outdata pointer + * @param datalen The length of outdata + * + * @return + * - NULL Fail + * - Others Success + */ +esp_err_t i2c_bus_read_bytes(i2c_bus_handle_t bus, int addr, uint8_t *reg, + int reglen, uint8_t *outdata, int datalen); - /** - * @brief Read bytes to I2C bus - * - * @param bus I2C bus handle - * @param addr The address of the device - * @param reg The register of the device - * @param regLen The length of register - * @param outdata The outdata pointer - * @param datalen The length of outdata - * - * @return - * - NULL Fail - * - Others Success - */ - esp_err_t i2c_bus_read_bytes (i2c_bus_handle_t bus, int addr, uint8_t *reg, - int reglen, uint8_t *outdata, int datalen); +/** + * @brief Delete and release the I2C bus object + * + * @param bus I2C bus handle + * + * @return + * - ESP_OK Success + * - ESP_FAIL Fail + */ +esp_err_t i2c_bus_delete(i2c_bus_handle_t bus); - /** - * @brief Delete and release the I2C bus object - * - * @param bus I2C bus handle - * - * @return - * - ESP_OK Success - * - ESP_FAIL Fail - */ - esp_err_t i2c_bus_delete (i2c_bus_handle_t bus); +/** + * @brief I2C start sending buffered commands + * + * @param bus I2C bus handle + * @param cmd I2C cmd handle + * @param ticks_to_wait Maximum blocking time + * + * @return + * - ESP_OK Success + * - ESP_FAIL Fail + */ +esp_err_t i2c_bus_cmd_begin(i2c_bus_handle_t bus, i2c_cmd_handle_t cmd, + portBASE_TYPE ticks_to_wait); - /** - * @brief I2C start sending buffered commands - * - * @param bus I2C bus handle - * @param cmd I2C cmd handle - * @param ticks_to_wait Maximum blocking time - * - * @return - * - ESP_OK Success - * - ESP_FAIL Fail - */ - esp_err_t i2c_bus_cmd_begin (i2c_bus_handle_t bus, i2c_cmd_handle_t cmd, - portBASE_TYPE ticks_to_wait); +/** + * @brief Auto probe the I2C device + * + * @param bus I2C bus handle + * @param addr I2C adress + * + * @return + * - ESP_OK Found a I2C device + * - ESP_FAIL Fail + */ +esp_err_t i2c_bus_probe_addr(i2c_bus_handle_t bus, uint8_t addr); #ifdef __cplusplus } diff --git a/components/esp_peripherals/esp_peripherals.c b/components/esp_peripherals/esp_peripherals.c index 7c077cfb..643fcd55 100644 --- a/components/esp_peripherals/esp_peripherals.c +++ b/components/esp_peripherals/esp_peripherals.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,13 +18,16 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "esp_peripherals.h" + +#include + #include "audio_event_iface.h" #include "audio_mem.h" #include "audio_mutex.h" @@ -32,14 +35,12 @@ #include "driver/gpio.h" #include "esp_log.h" #include "sys/queue.h" -#include static const char *TAG = "ESP_PERIPH"; #define DEFAULT_ESP_PERIPH_WAIT_TICK (10 / portTICK_RATE_MS) -struct esp_periph -{ +struct esp_periph { char *tag; bool disabled; esp_periph_id_t periph_id; @@ -51,11 +52,10 @@ struct esp_periph void *periph_data; esp_periph_event_t *on_evt; TimerHandle_t timer; - STAILQ_ENTRY (esp_periph) entries; + STAILQ_ENTRY(esp_periph) entries; }; -typedef struct esp_periph_sets -{ +typedef struct esp_periph_sets { EventGroupHandle_t state_event_bits; xSemaphoreHandle lock; int task_stack; @@ -65,311 +65,265 @@ typedef struct esp_periph_sets bool ext_stack; bool run; esp_periph_event_t event_handle; - STAILQ_HEAD (esp_periph_list_item, esp_periph) periph_list; + STAILQ_HEAD(esp_periph_list_item, esp_periph) periph_list; } esp_periph_set_t; static const int STARTED_BIT = BIT0; static const int STOPPED_BIT = BIT1; -static esp_err_t -esp_periph_wait_for_stop (esp_periph_set_handle_t periph_set_handle, - TickType_t ticks_to_wait); +static esp_err_t esp_periph_wait_for_stop( + esp_periph_set_handle_t periph_set_handle, TickType_t ticks_to_wait); -static esp_err_t -process_peripheral_event (audio_event_iface_msg_t *msg, void *context) -{ +static esp_err_t process_peripheral_event(audio_event_iface_msg_t *msg, + void *context) { esp_periph_handle_t periph_evt = (esp_periph_handle_t)msg->source; esp_periph_handle_t periph; esp_periph_set_t *sets = context; - STAILQ_FOREACH (periph, &sets->periph_list, entries) - { - if (periph->periph_id == periph_evt->periph_id - && periph_evt->state == PERIPH_STATE_RUNNING && periph_evt->run - && !periph_evt->disabled) - { - return periph_evt->run (periph_evt, msg); - } + STAILQ_FOREACH(periph, &sets->periph_list, entries) { + if (periph->periph_id == periph_evt->periph_id && + periph_evt->state == PERIPH_STATE_RUNNING && periph_evt->run && + !periph_evt->disabled) { + return periph_evt->run(periph_evt, msg); + } } return ESP_OK; } -static void -esp_periph_task (void *pv) -{ +esp_err_t esp_periph_set_change_waiting_time( + esp_periph_set_handle_t periph_set_handle, int time_ms) { + audio_event_iface_set_cmd_waiting_timeout( + esp_periph_set_get_event_iface(periph_set_handle), + time_ms / portTICK_RATE_MS); + return ESP_OK; +} + +static void esp_periph_task(void *pv) { esp_periph_handle_t periph; esp_periph_set_handle_t periph_set_handle = (esp_periph_set_handle_t)pv; - ESP_LOGD (TAG, "esp_periph_task is running, handle:%p", periph_set_handle); - xEventGroupSetBits (periph_set_handle->state_event_bits, STARTED_BIT); - xEventGroupClearBits (periph_set_handle->state_event_bits, STOPPED_BIT); - - while (periph_set_handle->run) - { - mutex_lock (periph_set_handle->lock); - STAILQ_FOREACH (periph, &periph_set_handle->periph_list, entries) - { - if (periph->disabled) - { - continue; - } - if (periph->state == PERIPH_STATE_INIT && periph->init) - { - ESP_LOGD (TAG, "PERIPH[%s]->init", periph->tag); - if (periph->init (periph) == ESP_OK) - { - periph->state = PERIPH_STATE_RUNNING; - } - else - { - periph->state = PERIPH_STATE_ERROR; - } - } + ESP_LOGD(TAG, "esp_periph_task is running, handle:%p", periph_set_handle); + xEventGroupSetBits(periph_set_handle->state_event_bits, STARTED_BIT); + xEventGroupClearBits(periph_set_handle->state_event_bits, STOPPED_BIT); + + while (periph_set_handle->run) { + mutex_lock(periph_set_handle->lock); + STAILQ_FOREACH(periph, &periph_set_handle->periph_list, entries) { + if (periph->disabled) { + continue; } - mutex_unlock (periph_set_handle->lock); - audio_event_iface_waiting_cmd_msg ( - esp_periph_set_get_event_iface (periph_set_handle)); - } - STAILQ_FOREACH (periph, &periph_set_handle->periph_list, entries) - { - esp_periph_stop_timer (periph); - if (periph->destroy) - { - periph->destroy (periph); + if (periph->state == PERIPH_STATE_INIT && periph->init) { + ESP_LOGD(TAG, "PERIPH[%s]->init", periph->tag); + if (periph->init(periph) == ESP_OK) { + periph->state = PERIPH_STATE_RUNNING; + } else { + periph->state = PERIPH_STATE_ERROR; + } } + } + mutex_unlock(periph_set_handle->lock); + audio_event_iface_waiting_cmd_msg( + esp_periph_set_get_event_iface(periph_set_handle)); + } + STAILQ_FOREACH(periph, &periph_set_handle->periph_list, entries) { + esp_periph_stop_timer(periph); + if (periph->destroy) { + periph->destroy(periph); + } } - xEventGroupClearBits (periph_set_handle->state_event_bits, STARTED_BIT); - xEventGroupSetBits (periph_set_handle->state_event_bits, STOPPED_BIT); + xEventGroupClearBits(periph_set_handle->state_event_bits, STARTED_BIT); + xEventGroupSetBits(periph_set_handle->state_event_bits, STOPPED_BIT); - vTaskDelete (NULL); + vTaskDelete(NULL); } -esp_periph_set_handle_t -esp_periph_set_init (esp_periph_config_t *config) -{ +esp_periph_set_handle_t esp_periph_set_init(esp_periph_config_t *config) { esp_periph_set_t *periph_sets = NULL; int _err_step = 1; - bool _success = ((periph_sets = audio_calloc (1, sizeof (esp_periph_set_t))) - && _err_step++ - && (periph_sets->state_event_bits = xEventGroupCreate ()) - && _err_step++ && (periph_sets->lock = mutex_create ()) - && _err_step++); + bool _success = + ((periph_sets = audio_calloc(1, sizeof(esp_periph_set_t))) && + _err_step++ && (periph_sets->state_event_bits = xEventGroupCreate()) && + _err_step++ && (periph_sets->lock = mutex_create()) && _err_step++); - AUDIO_MEM_CHECK (TAG, _success, { goto _periph_init_failed; }); + AUDIO_MEM_CHECK(TAG, _success, { goto _periph_init_failed; }); - STAILQ_INIT (&periph_sets->periph_list); + STAILQ_INIT(&periph_sets->periph_list); // TODO: Should we uninstall gpio isr service?? // TODO: Because gpio need for sdcard and gpio, then install isr here - gpio_install_isr_service (ESP_INTR_FLAG_LEVEL1); + gpio_install_isr_service(ESP_INTR_FLAG_LEVEL1); periph_sets->run = false; - xEventGroupClearBits (periph_sets->state_event_bits, STARTED_BIT); - xEventGroupSetBits (periph_sets->state_event_bits, STOPPED_BIT); + xEventGroupClearBits(periph_sets->state_event_bits, STARTED_BIT); + xEventGroupSetBits(periph_sets->state_event_bits, STOPPED_BIT); periph_sets->task_stack = config->task_stack; periph_sets->task_prio = config->task_prio; periph_sets->task_core = config->task_core; periph_sets->ext_stack = config->extern_stack; - audio_event_iface_cfg_t event_cfg = AUDIO_EVENT_IFACE_DEFAULT_CFG (); + audio_event_iface_cfg_t event_cfg = AUDIO_EVENT_IFACE_DEFAULT_CFG(); event_cfg.queue_set_size = 0; event_cfg.context = periph_sets; event_cfg.on_cmd = process_peripheral_event; - periph_sets->event_handle.iface = audio_event_iface_init (&event_cfg); + periph_sets->event_handle.iface = audio_event_iface_init(&event_cfg); - AUDIO_MEM_CHECK (TAG, periph_sets->event_handle.iface, - goto _periph_init_failed); - audio_event_iface_set_cmd_waiting_timeout (periph_sets->event_handle.iface, - DEFAULT_ESP_PERIPH_WAIT_TICK); + AUDIO_MEM_CHECK(TAG, periph_sets->event_handle.iface, + goto _periph_init_failed); + audio_event_iface_set_cmd_waiting_timeout(periph_sets->event_handle.iface, + DEFAULT_ESP_PERIPH_WAIT_TICK); return periph_sets; _periph_init_failed: - if (periph_sets) - { - mutex_destroy (periph_sets->lock); - vEventGroupDelete (periph_sets->state_event_bits); - - if (periph_sets->event_handle.iface) - { - audio_event_iface_destroy (periph_sets->event_handle.iface); - } + if (periph_sets) { + mutex_destroy(periph_sets->lock); + vEventGroupDelete(periph_sets->state_event_bits); - audio_free (periph_sets); - periph_sets = NULL; + if (periph_sets->event_handle.iface) { + audio_event_iface_destroy(periph_sets->event_handle.iface); } + + audio_free(periph_sets); + periph_sets = NULL; + } return NULL; } -esp_err_t -esp_periph_set_destroy (esp_periph_set_handle_t periph_set_handle) -{ - if (periph_set_handle == NULL) - { - AUDIO_ERROR (TAG, "Peripherals have not been initialized"); - return ESP_FAIL; - } +esp_err_t esp_periph_remove_from_set(esp_periph_set_handle_t periph_set_handle, + esp_periph_handle_t periph) { + STAILQ_REMOVE(&periph_set_handle->periph_list, periph, esp_periph, entries); + return ESP_OK; +} + +esp_err_t esp_periph_set_destroy(esp_periph_set_handle_t periph_set_handle) { + if (periph_set_handle == NULL) { + AUDIO_ERROR(TAG, "Peripherals have not been initialized"); + return ESP_FAIL; + } periph_set_handle->run = false; - esp_periph_wait_for_stop (periph_set_handle, portMAX_DELAY); + esp_periph_wait_for_stop(periph_set_handle, portMAX_DELAY); esp_periph_handle_t item, tmp; - STAILQ_FOREACH_SAFE (item, &periph_set_handle->periph_list, entries, tmp) - { - STAILQ_REMOVE (&periph_set_handle->periph_list, item, esp_periph, entries); - audio_free (item->tag); - audio_free (item); + STAILQ_FOREACH_SAFE(item, &periph_set_handle->periph_list, entries, tmp) { + STAILQ_REMOVE(&periph_set_handle->periph_list, item, esp_periph, entries); + audio_free(item->tag); + audio_free(item); } - mutex_destroy (periph_set_handle->lock); - vEventGroupDelete (periph_set_handle->state_event_bits); + mutex_destroy(periph_set_handle->lock); + vEventGroupDelete(periph_set_handle->state_event_bits); - gpio_uninstall_isr_service (); - audio_event_iface_destroy (periph_set_handle->event_handle.iface); - audio_free (periph_set_handle); + gpio_uninstall_isr_service(); + audio_event_iface_destroy(periph_set_handle->event_handle.iface); + audio_free(periph_set_handle); periph_set_handle = NULL; return ESP_OK; } -esp_err_t -esp_periph_set_stop_all (esp_periph_set_handle_t periph_set_handle) -{ - if (periph_set_handle == NULL) - { - AUDIO_ERROR (TAG, "Peripherals have not been initialized"); - return ESP_FAIL; - } +esp_err_t esp_periph_set_stop_all(esp_periph_set_handle_t periph_set_handle) { + if (periph_set_handle == NULL) { + AUDIO_ERROR(TAG, "Peripherals have not been initialized"); + return ESP_FAIL; + } esp_periph_handle_t periph; - STAILQ_FOREACH (periph, &periph_set_handle->periph_list, entries) - { + STAILQ_FOREACH(periph, &periph_set_handle->periph_list, entries) { periph->disabled = true; } return ESP_OK; } -esp_periph_handle_t -esp_periph_set_get_by_id (esp_periph_set_handle_t periph_set_handle, - int periph_id) -{ +esp_periph_handle_t esp_periph_set_get_by_id( + esp_periph_set_handle_t periph_set_handle, int periph_id) { esp_periph_handle_t periph; - if (periph_set_handle == NULL) - { - AUDIO_ERROR (TAG, "Peripherals have not been initialized"); - return NULL; + if (periph_set_handle == NULL) { + AUDIO_ERROR(TAG, "Peripherals have not been initialized"); + return NULL; + } + mutex_lock(periph_set_handle->lock); + STAILQ_FOREACH(periph, &periph_set_handle->periph_list, entries) { + if (periph->periph_id == periph_id) { + mutex_unlock(periph_set_handle->lock); + return periph; } - mutex_lock (periph_set_handle->lock); - STAILQ_FOREACH (periph, &periph_set_handle->periph_list, entries) - { - if (periph->periph_id == periph_id) - { - mutex_unlock (periph_set_handle->lock); - return periph; - } } - ESP_LOGD (TAG, "Periph id %d not found", periph_id); - mutex_unlock (periph_set_handle->lock); + ESP_LOGD(TAG, "Periph id %d not found", periph_id); + mutex_unlock(periph_set_handle->lock); return NULL; } -audio_event_iface_handle_t -esp_periph_set_get_event_iface (esp_periph_set_handle_t periph_set_handle) -{ +audio_event_iface_handle_t esp_periph_set_get_event_iface( + esp_periph_set_handle_t periph_set_handle) { return periph_set_handle->event_handle.iface; } -esp_err_t -esp_periph_set_register_callback (esp_periph_set_handle_t periph_set_handle, - esp_periph_event_handle_t cb, - void *user_context) -{ - if (periph_set_handle == NULL) - { - return ESP_FAIL; - } - else - { - periph_set_handle->event_handle.cb = cb; - periph_set_handle->event_handle.user_ctx = user_context; - return ESP_OK; - } +esp_err_t esp_periph_set_register_callback( + esp_periph_set_handle_t periph_set_handle, esp_periph_event_handle_t cb, + void *user_context) { + if (periph_set_handle == NULL) { + return ESP_FAIL; + } else { + periph_set_handle->event_handle.cb = cb; + periph_set_handle->event_handle.user_ctx = user_context; + return ESP_OK; + } } -QueueHandle_t -esp_periph_set_get_queue (esp_periph_set_handle_t periph_set_handle) -{ - return audio_event_iface_get_queue_handle ( +QueueHandle_t esp_periph_set_get_queue( + esp_periph_set_handle_t periph_set_handle) { + return audio_event_iface_get_queue_handle( periph_set_handle->event_handle.iface); } -esp_err_t -esp_periph_wait_for_stop (esp_periph_set_handle_t periph_set_handle, - TickType_t ticks_to_wait) -{ +esp_err_t esp_periph_wait_for_stop(esp_periph_set_handle_t periph_set_handle, + TickType_t ticks_to_wait) { EventGroupHandle_t ev_bits = periph_set_handle->state_event_bits; - EventBits_t uxBits - = xEventGroupWaitBits (ev_bits, STOPPED_BIT, false, true, ticks_to_wait); - if (uxBits & STOPPED_BIT) - { - return ESP_OK; - } + EventBits_t uxBits = + xEventGroupWaitBits(ev_bits, STOPPED_BIT, false, true, ticks_to_wait); + if (uxBits & STOPPED_BIT) { + return ESP_OK; + } return ESP_FAIL; } -esp_err_t -esp_periph_set_list_init (esp_periph_set_handle_t periph_set) -{ +esp_err_t esp_periph_set_list_init(esp_periph_set_handle_t periph_set) { esp_periph_handle_t periph; - STAILQ_FOREACH (periph, &periph_set->periph_list, entries) - { - if (periph->init) - { - periph->init (periph); - } + STAILQ_FOREACH(periph, &periph_set->periph_list, entries) { + if (periph->init) { + periph->init(periph); + } } return ESP_OK; } -esp_err_t -esp_periph_set_list_run (esp_periph_set_handle_t periph_set, - audio_event_iface_msg_t msg) -{ +esp_err_t esp_periph_set_list_run(esp_periph_set_handle_t periph_set, + audio_event_iface_msg_t msg) { esp_periph_handle_t periph; - STAILQ_FOREACH (periph, &periph_set->periph_list, entries) - { - if (periph->run) - { - periph->run (periph, &msg); - } + STAILQ_FOREACH(periph, &periph_set->periph_list, entries) { + if (periph->run) { + periph->run(periph, &msg); + } } return ESP_OK; } -esp_err_t -esp_periph_set_list_destroy (esp_periph_set_handle_t periph_set) -{ +esp_err_t esp_periph_set_list_destroy(esp_periph_set_handle_t periph_set) { esp_periph_handle_t periph; - STAILQ_FOREACH (periph, &periph_set->periph_list, entries) - { - if (periph->destroy) - { - periph->destroy (periph); - } + STAILQ_FOREACH(periph, &periph_set->periph_list, entries) { + if (periph->destroy) { + periph->destroy(periph); + } } return ESP_OK; } -esp_periph_handle_t -esp_periph_create (int periph_id, const char *tag) -{ - esp_periph_handle_t new_entry = audio_calloc (1, sizeof (struct esp_periph)); +esp_periph_handle_t esp_periph_create(int periph_id, const char *tag) { + esp_periph_handle_t new_entry = audio_calloc(1, sizeof(struct esp_periph)); - AUDIO_MEM_CHECK (TAG, new_entry, return NULL); - if (tag) - { - new_entry->tag = audio_strdup (tag); - } - else - { - new_entry->tag = audio_strdup ("periph"); - } - AUDIO_MEM_CHECK (TAG, new_entry->tag, { - audio_free (new_entry); + AUDIO_MEM_CHECK(TAG, new_entry, return NULL); + if (tag) { + new_entry->tag = audio_strdup(tag); + } else { + new_entry->tag = audio_strdup("periph"); + } + AUDIO_MEM_CHECK(TAG, new_entry->tag, { + audio_free(new_entry); return NULL; }) new_entry->state = PERIPH_STATE_INIT; @@ -377,105 +331,83 @@ esp_periph_create (int periph_id, const char *tag) return new_entry; } -esp_err_t -esp_periph_set_function (esp_periph_handle_t periph, esp_periph_func init, - esp_periph_run_func run, esp_periph_func destroy) -{ +esp_err_t esp_periph_set_function(esp_periph_handle_t periph, + esp_periph_func init, esp_periph_run_func run, + esp_periph_func destroy) { periph->init = init; periph->run = run; periph->destroy = destroy; return ESP_OK; } -esp_err_t -esp_periph_start (esp_periph_set_handle_t periph_set_handle, - esp_periph_handle_t periph) -{ - if (periph_set_handle == NULL) - { - AUDIO_ERROR (TAG, "Peripherals have not been initialized"); +esp_err_t esp_periph_start(esp_periph_set_handle_t periph_set_handle, + esp_periph_handle_t periph) { + if (periph_set_handle == NULL) { + AUDIO_ERROR(TAG, "Peripherals have not been initialized"); + return ESP_FAIL; + } + if (esp_periph_set_get_by_id(periph_set_handle, periph->periph_id) != NULL) { + ESP_LOGI(TAG, "This peripheral has been added"); + periph->disabled = false; + } else { + esp_periph_register_on_events(periph, &periph_set_handle->event_handle); + STAILQ_INSERT_TAIL(&periph_set_handle->periph_list, periph, entries); + } + if (periph_set_handle->run == false && periph_set_handle->task_stack > 0) { + periph_set_handle->run = true; + if (audio_thread_create( + &periph_set_handle->audio_thread, "esp_periph", esp_periph_task, + periph_set_handle, periph_set_handle->task_stack, + periph_set_handle->task_prio, periph_set_handle->ext_stack, + periph_set_handle->task_core) != ESP_OK) { + ESP_LOGE(TAG, "Create [%s] task failed", periph->tag); return ESP_FAIL; } - if (esp_periph_set_get_by_id (periph_set_handle, periph->periph_id) != NULL) - { - ESP_LOGI (TAG, "This peripheral has been added"); - periph->disabled = false; - } - else - { - esp_periph_register_on_events (periph, &periph_set_handle->event_handle); - STAILQ_INSERT_TAIL (&periph_set_handle->periph_list, periph, entries); - } - if (periph_set_handle->run == false && periph_set_handle->task_stack > 0) - { - periph_set_handle->run = true; - if (audio_thread_create ( - &periph_set_handle->audio_thread, "esp_periph", esp_periph_task, - periph_set_handle, periph_set_handle->task_stack, - periph_set_handle->task_prio, periph_set_handle->ext_stack, - periph_set_handle->task_core) - != ESP_OK) - { - ESP_LOGE (TAG, "Create [%s] task failed", periph->tag); - return ESP_FAIL; - } - } + } return ESP_OK; } -esp_err_t -esp_periph_stop (esp_periph_handle_t periph) -{ - if (periph) - { - periph->disabled = true; - return ESP_OK; - } +esp_err_t esp_periph_stop(esp_periph_handle_t periph) { + if (periph) { + periph->disabled = true; + return ESP_OK; + } return ESP_OK; } -esp_err_t -esp_periph_send_cmd (esp_periph_handle_t periph, int cmd, void *data, - int data_len) -{ - if (periph->on_evt == NULL) - { - return ESP_FAIL; - } +esp_err_t esp_periph_send_cmd(esp_periph_handle_t periph, int cmd, void *data, + int data_len) { + if (periph->on_evt == NULL) { + return ESP_FAIL; + } audio_event_iface_msg_t msg; msg.cmd = cmd; msg.source = periph; msg.source_type = periph->periph_id; msg.data = (void *)data; msg.data_len = data_len; - return audio_event_iface_cmd (periph->on_evt->iface, &msg); + return audio_event_iface_cmd(periph->on_evt->iface, &msg); } -esp_err_t -esp_periph_send_cmd_from_isr (esp_periph_handle_t periph, int cmd, void *data, - int data_len) -{ - if (periph->on_evt == NULL) - { - return ESP_FAIL; - } +esp_err_t esp_periph_send_cmd_from_isr(esp_periph_handle_t periph, int cmd, + void *data, int data_len) { + if (periph->on_evt == NULL) { + return ESP_FAIL; + } audio_event_iface_msg_t msg; msg.cmd = cmd; msg.source = periph; msg.source_type = periph->periph_id; msg.data = (void *)data; msg.data_len = data_len; - return audio_event_iface_cmd_from_isr (periph->on_evt->iface, &msg); + return audio_event_iface_cmd_from_isr(periph->on_evt->iface, &msg); } -esp_err_t -esp_periph_send_event (esp_periph_handle_t periph, int event_id, void *data, - int data_len) -{ - if (periph->on_evt == NULL) - { - return ESP_FAIL; - } +esp_err_t esp_periph_send_event(esp_periph_handle_t periph, int event_id, + void *data, int data_len) { + if (periph->on_evt == NULL) { + return ESP_FAIL; + } audio_event_iface_msg_t msg; msg.source_type = periph->periph_id; msg.cmd = event_id; @@ -484,96 +416,72 @@ esp_periph_send_event (esp_periph_handle_t periph, int event_id, void *data, msg.need_free_data = false; msg.source = periph; - if (periph->on_evt->cb) - { - periph->on_evt->cb (&msg, periph->on_evt->user_ctx); - } - return audio_event_iface_sendout (periph->on_evt->iface, &msg); -} - -esp_err_t -esp_periph_start_timer (esp_periph_handle_t periph, TickType_t interval_tick, - timer_callback callback) -{ - if (periph->timer == NULL) - { - periph->timer = xTimerCreate ("periph_itmer", interval_tick, pdTRUE, - periph, callback); - if (xTimerStart (periph->timer, 0) != pdTRUE) - { - AUDIO_ERROR (TAG, "Error to starting timer"); - return ESP_FAIL; - } + if (periph->on_evt->cb) { + periph->on_evt->cb(&msg, periph->on_evt->user_ctx); + } + return audio_event_iface_sendout(periph->on_evt->iface, &msg); +} + +esp_err_t esp_periph_start_timer(esp_periph_handle_t periph, + TickType_t interval_tick, + timer_callback callback) { + if (periph->timer == NULL) { + periph->timer = + xTimerCreate("periph_itmer", interval_tick, pdTRUE, periph, callback); + if (xTimerStart(periph->timer, 0) != pdTRUE) { + AUDIO_ERROR(TAG, "Error to starting timer"); + return ESP_FAIL; } + } return ESP_OK; } -esp_err_t -esp_periph_stop_timer (esp_periph_handle_t periph) -{ - if (periph->timer) - { - xTimerStop (periph->timer, portMAX_DELAY); - xTimerDelete (periph->timer, portMAX_DELAY); - periph->timer = NULL; - } +esp_err_t esp_periph_stop_timer(esp_periph_handle_t periph) { + if (periph->timer) { + xTimerStop(periph->timer, portMAX_DELAY); + xTimerDelete(periph->timer, portMAX_DELAY); + periph->timer = NULL; + } return ESP_OK; } -esp_err_t -esp_periph_set_data (esp_periph_handle_t periph, void *data) -{ +esp_err_t esp_periph_set_data(esp_periph_handle_t periph, void *data) { periph->periph_data = data; return ESP_OK; } -void * -esp_periph_get_data (esp_periph_handle_t periph) -{ +void *esp_periph_get_data(esp_periph_handle_t periph) { return periph->periph_data; } -esp_periph_state_t -esp_periph_get_state (esp_periph_handle_t periph) -{ +esp_periph_state_t esp_periph_get_state(esp_periph_handle_t periph) { return periph->state; } -esp_periph_id_t -esp_periph_get_id (esp_periph_handle_t periph) -{ +esp_periph_id_t esp_periph_get_id(esp_periph_handle_t periph) { return periph->periph_id; } -esp_err_t -esp_periph_set_id (esp_periph_handle_t periph, esp_periph_id_t periph_id) -{ +esp_err_t esp_periph_set_id(esp_periph_handle_t periph, + esp_periph_id_t periph_id) { periph->periph_id = periph_id; return ESP_OK; } -esp_err_t -esp_periph_init (esp_periph_handle_t periph) -{ - return periph->init (periph); +esp_err_t esp_periph_init(esp_periph_handle_t periph) { + return periph->init(periph); } -esp_err_t -esp_periph_run (esp_periph_handle_t periph) -{ - return periph->run (periph, NULL); +esp_err_t esp_periph_run(esp_periph_handle_t periph) { + return periph->run(periph, NULL); } -esp_err_t -esp_periph_destroy (esp_periph_handle_t periph) -{ - return periph->destroy (periph); +esp_err_t esp_periph_destroy(esp_periph_handle_t periph) { + return periph->destroy(periph); } -esp_err_t -esp_periph_register_on_events (esp_periph_handle_t periph, - esp_periph_event_t *evts) -{ +esp_err_t esp_periph_register_on_events(esp_periph_handle_t periph, + esp_periph_event_t *evts) { periph->on_evt = evts; return ESP_OK; } diff --git a/components/esp_peripherals/include/esp_peripherals.h b/components/esp_peripherals/include/esp_peripherals.h index 186a4e5d..bd64a2a3 100644 --- a/components/esp_peripherals/include/esp_peripherals.h +++ b/components/esp_peripherals/include/esp_peripherals.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -33,473 +33,486 @@ #include "freertos/event_groups.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - /** - * @brief Peripheral Identify, this must be unique for each peripheral added - * to the peripherals list - */ - typedef enum - { - PERIPH_ID_BUTTON = AUDIO_ELEMENT_TYPE_PERIPH + 1, - PERIPH_ID_TOUCH = AUDIO_ELEMENT_TYPE_PERIPH + 2, - PERIPH_ID_SDCARD = AUDIO_ELEMENT_TYPE_PERIPH + 3, - PERIPH_ID_WIFI = AUDIO_ELEMENT_TYPE_PERIPH + 4, - PERIPH_ID_FLASH = AUDIO_ELEMENT_TYPE_PERIPH + 5, - PERIPH_ID_AUXIN = AUDIO_ELEMENT_TYPE_PERIPH + 6, - PERIPH_ID_ADC = AUDIO_ELEMENT_TYPE_PERIPH + 7, - PERIPH_ID_CONSOLE = AUDIO_ELEMENT_TYPE_PERIPH + 8, - PERIPH_ID_BLUETOOTH = AUDIO_ELEMENT_TYPE_PERIPH + 9, - PERIPH_ID_LED = AUDIO_ELEMENT_TYPE_PERIPH + 10, - PERIPH_ID_SPIFFS = AUDIO_ELEMENT_TYPE_PERIPH + 11, - PERIPH_ID_ADC_BTN = AUDIO_ELEMENT_TYPE_PERIPH + 12, - PERIPH_ID_IS31FL3216 = AUDIO_ELEMENT_TYPE_PERIPH + 13, - PERIPH_ID_GPIO_ISR = AUDIO_ELEMENT_TYPE_PERIPH + 14, - PERIPH_ID_WS2812 = AUDIO_ELEMENT_TYPE_PERIPH + 15, - PERIPH_ID_AW2013 = AUDIO_ELEMENT_TYPE_PERIPH + 16 - } esp_periph_id_t; - - /** - * @brief Peripheral working state - */ - typedef enum - { - PERIPH_STATE_NULL, - PERIPH_STATE_INIT, - PERIPH_STATE_RUNNING, - PERIPH_STATE_PAUSE, - PERIPH_STATE_STOPPING, - PERIPH_STATE_ERROR, - PERIPH_STATE_STATUS_MAX, - } esp_periph_state_t; - - typedef struct esp_periph_sets *esp_periph_set_handle_t; - typedef struct esp_periph *esp_periph_handle_t; - typedef esp_err_t (*esp_periph_func) (esp_periph_handle_t periph); - typedef esp_err_t (*esp_periph_run_func) (esp_periph_handle_t periph, - audio_event_iface_msg_t *msg); - typedef esp_err_t (*esp_periph_event_handle_t) ( - audio_event_iface_msg_t *event, void *context); - typedef void (*timer_callback) (xTimerHandle tmr); - - /** - * @brief Common peripherals configurations - */ - typedef struct - { - int task_stack; /*!< >0 Service task stack size; =0 without task created */ - int task_prio; /*!< Service task priority (based on freeRTOS priority) */ - int task_core; /*!< Service task running in core (0 or 1) */ - bool extern_stack; /*!< Service task stack allocate on extern ram */ - } esp_periph_config_t; - - /** - * @brief peripheral events - */ - typedef struct esp_periph_event - { - void *user_ctx; /*!< peripheral context data */ - esp_periph_event_handle_t cb; /*!< peripheral callback function */ - audio_event_iface_handle_t iface; /*!< peripheral event */ - } esp_periph_event_t; +/** + * @brief Peripheral Identify, this must be unique for each peripheral added to + * the peripherals list + */ +typedef enum { + PERIPH_ID_BUTTON = AUDIO_ELEMENT_TYPE_PERIPH + 1, + PERIPH_ID_TOUCH = AUDIO_ELEMENT_TYPE_PERIPH + 2, + PERIPH_ID_SDCARD = AUDIO_ELEMENT_TYPE_PERIPH + 3, + PERIPH_ID_WIFI = AUDIO_ELEMENT_TYPE_PERIPH + 4, + PERIPH_ID_FLASH = AUDIO_ELEMENT_TYPE_PERIPH + 5, + PERIPH_ID_AUXIN = AUDIO_ELEMENT_TYPE_PERIPH + 6, + PERIPH_ID_ADC = AUDIO_ELEMENT_TYPE_PERIPH + 7, + PERIPH_ID_CONSOLE = AUDIO_ELEMENT_TYPE_PERIPH + 8, + PERIPH_ID_BLUETOOTH = AUDIO_ELEMENT_TYPE_PERIPH + 9, + PERIPH_ID_LED = AUDIO_ELEMENT_TYPE_PERIPH + 10, + PERIPH_ID_SPIFFS = AUDIO_ELEMENT_TYPE_PERIPH + 11, + PERIPH_ID_ADC_BTN = AUDIO_ELEMENT_TYPE_PERIPH + 12, + PERIPH_ID_IS31FL3216 = AUDIO_ELEMENT_TYPE_PERIPH + 13, + PERIPH_ID_GPIO_ISR = AUDIO_ELEMENT_TYPE_PERIPH + 14, + PERIPH_ID_WS2812 = AUDIO_ELEMENT_TYPE_PERIPH + 15, + PERIPH_ID_AW2013 = AUDIO_ELEMENT_TYPE_PERIPH + 16, + PERIPH_ID_LCD = AUDIO_ELEMENT_TYPE_PERIPH + 17 +} esp_periph_id_t; + +/** + * @brief Peripheral working state + */ +typedef enum { + PERIPH_STATE_NULL, + PERIPH_STATE_INIT, + PERIPH_STATE_RUNNING, + PERIPH_STATE_PAUSE, + PERIPH_STATE_STOPPING, + PERIPH_STATE_ERROR, + PERIPH_STATE_STATUS_MAX, +} esp_periph_state_t; + +typedef struct esp_periph_sets *esp_periph_set_handle_t; +typedef struct esp_periph *esp_periph_handle_t; +typedef esp_err_t (*esp_periph_func)(esp_periph_handle_t periph); +typedef esp_err_t (*esp_periph_run_func)(esp_periph_handle_t periph, + audio_event_iface_msg_t *msg); +typedef esp_err_t (*esp_periph_event_handle_t)(audio_event_iface_msg_t *event, + void *context); +typedef void (*timer_callback)(xTimerHandle tmr); + +/** + * @brief Common peripherals configurations + */ +typedef struct { + int task_stack; /*!< >0 Service task stack size; =0 without task created */ + int task_prio; /*!< Service task priority (based on freeRTOS priority) */ + int task_core; /*!< Service task running in core (0 or 1) */ + bool extern_stack; /*!< Service task stack allocate on extern ram */ +} esp_periph_config_t; + +/** + * @brief peripheral events + */ +typedef struct esp_periph_event { + void *user_ctx; /*!< peripheral context data */ + esp_periph_event_handle_t cb; /*!< peripheral callback function */ + audio_event_iface_handle_t iface; /*!< peripheral event */ +} esp_periph_event_t; #define DEFAULT_ESP_PERIPH_STACK_SIZE (4 * 1024) #define DEFAULT_ESP_PERIPH_TASK_PRIO (5) #define DEFAULT_ESP_PERIPH_TASK_CORE (0) -#define DEFAULT_ESP_PERIPH_SET_CONFIG() \ - { \ - .task_stack = DEFAULT_ESP_PERIPH_STACK_SIZE, \ - .task_prio = DEFAULT_ESP_PERIPH_TASK_PRIO, \ - .task_core = DEFAULT_ESP_PERIPH_TASK_CORE, .extern_stack = false, \ +#define DEFAULT_ESP_PERIPH_SET_CONFIG() \ + { \ + .task_stack = DEFAULT_ESP_PERIPH_STACK_SIZE, \ + .task_prio = DEFAULT_ESP_PERIPH_TASK_PRIO, \ + .task_core = DEFAULT_ESP_PERIPH_TASK_CORE, .extern_stack = false, \ } - /** - * @brief Initialize esp_peripheral sets, create empty peripherals list. - * Call this function before starting any peripherals (with - * `esp_periph_start`). This call will initialize the data needed for - * esp_peripherals to work, but does not actually create the task. The - * `event_handle` is optional if you want to receive events from this - * callback function. The esp_peripherals task will send all events out to - * event_iface, can be listen by event_iface by `esp_periph_get_event_iface`. - * The `user_context` will sent `esp_periph_event_handle_t` as *context - * parameter. - * - * @param[in] config The configurations - * - * @return The peripheral sets instance - */ - esp_periph_set_handle_t esp_periph_set_init (esp_periph_config_t *config); - - /** - * @brief This function will stop and kill the monitor task, calling all - * destroy callback functions of the peripheral (so you do not need to - * destroy the peripheral object manually). It will also remove all memory - * allocated to the peripherals list, so you need to call the - * `esp_periph_set_init` function again if you want to use it. - * - * @param periph_set_handle The esp_periph_set_handle_t instance - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t esp_periph_set_destroy (esp_periph_set_handle_t periph_set_handle); - - /** - * @brief Stop monitoring all peripherals, the peripheral state is still - * kept. This funciton only temporary disables the peripheral. - * - * @param periph_set_handle The esp_periph_set_handle_t instance - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t - esp_periph_set_stop_all (esp_periph_set_handle_t periph_set_handle); - - /** - * @brief Get the peripheral handle by Peripheral ID - * - * @param periph_set_handle The esp_periph_set_handle_t instance - * - * @param[in] periph_id as esp_periph_id_t, or any ID you use when calling - * `esp_periph_create` - * - * - * @return The esp_periph_handle_t - */ - esp_periph_handle_t - esp_periph_set_get_by_id (esp_periph_set_handle_t periph_set_handle, - int periph_id); - - /** - * @brief Return the event_iface used by this esp_peripherals - * - * @param periph_set_handle The esp_periph_set_handle_t instance - * - * @return The audio event iface handle - */ - audio_event_iface_handle_t - esp_periph_set_get_event_iface (esp_periph_set_handle_t periph_set_handle); - - /** - * @brief Register peripheral sets event callback function. - * - * @param periph_set_handle The esp_periph_set_handle_t instance - * @param cb The event handle callback function - * @param user_context The user context pointer - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t - esp_periph_set_register_callback (esp_periph_set_handle_t periph_set_handle, - esp_periph_event_handle_t cb, - void *user_context); - - /** - * @brief Peripheral is using event_iface to control the event, all - * events are send out to event_iface queue. This function will be useful in - * case we want to read events directly from the event_iface queue. - * - * @param periph_set_handle The esp_periph_set_handle_t instance - * - * @return The queue handle - */ - QueueHandle_t - esp_periph_set_get_queue (esp_periph_set_handle_t periph_set_handle); - - /** - * @brief Call this function to initialize all the listed peripherals. - * @note Work with no task peripheral set only - * - * @param periph_set_handle The esp_periph_set_handle_t instance - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t - esp_periph_set_list_init (esp_periph_set_handle_t periph_set_handle); - - /** - * @brief Call this function to run all the listed peripherals. - * @note Work with no task peripheral set only - * - * @param periph_set_handle The esp_periph_set_handle_t instance - * @param msg The audio_event_iface_msg_t handle - * message - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t esp_periph_set_list_run (esp_periph_set_handle_t periph_set_handle, - audio_event_iface_msg_t msg); - - /** - * @brief Call this function to destroy all the listed peripherals. - * @note Work with no task peripheral set only - * - * @param periph_set_handle The esp_periph_set_handle_t instance - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t - esp_periph_set_list_destroy (esp_periph_set_handle_t periph_set_handle); - - /** - * @brief Call this function to initialize a new peripheral - * - * @param[in] periph_id The periph identifier - * @param[in] tag The tag name, we named it easy to get in debug logs - * - * @return The peripheral handle - */ - esp_periph_handle_t esp_periph_create (int periph_id, const char *tag); - - /** - * @brief Each peripheral has a cycle of sequential operations from - * initialization, execution of commands to destroying the peripheral. These - * operations are represented by functions passed as call parameters to this - * function. - * - * @param[in] periph The periph - * @param[in] init The initialize - * @param[in] run The run - * @param[in] destroy The destroy - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t esp_periph_set_function (esp_periph_handle_t periph, - esp_periph_func init, - esp_periph_run_func run, - esp_periph_func destroy); - - /** - * @brief Add the peripheral to peripherals list, enable and start - * monitor task (if task stack size > 0) - * - * @param[in] periph_set_handle The esp_periph_set_handle_t instance - * @param[in] periph The peripheral instance - * - * @note - * This peripheral must be first created by calling - * `esp_periph_create` - * - * @return - * - ESP_OK on success - * - ESP_FAIL when any errors - */ - esp_err_t esp_periph_start (esp_periph_set_handle_t periph_set_handle, - esp_periph_handle_t periph); - - /** - * @brief Stop monitoring the peripheral, the peripheral state is still - * kept. This funciton only temporary disables the peripheral. - * - * @param[in] periph The periph - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t esp_periph_stop (esp_periph_handle_t periph); - - /** - * @brief When this function is called, the command is passed to the - * event_iface command queue, and the `esp_periph_run_func` of this - * peripheral will be executed in the main peripheral task. This function can - * be called from any task, basically it only sends a queue to the main - * peripheral task - * - * @param[in] periph The periph - * @param[in] cmd The command - * @param data The data - * @param[in] data_len The data length - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t esp_periph_send_cmd (esp_periph_handle_t periph, int cmd, - void *data, int data_len); - - /** - * @brief Similar to `esp_periph_send_cmd`, but it can be called in the - * hardware interrupt handle - * - * @param[in] periph The periph - * @param[in] cmd The command - * @param data The data - * @param[in] data_len The data length - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t esp_periph_send_cmd_from_isr (esp_periph_handle_t periph, int cmd, - void *data, int data_len); - - /** - * @brief In addition to sending an event via event_iface, this function - * will dispatch the `event_handle` callback if the event_handle callback is - * provided at `esp_periph_init` - * - * @param[in] periph The peripheral - * @param[in] event_id The event identifier - * @param data The data - * @param[in] data_len The data length - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t esp_periph_send_event (esp_periph_handle_t periph, int event_id, - void *data, int data_len); - - /** - * @brief Each peripheral can initialize a timer, which is by default - * NULL. When this function is called, the timer for the peripheral is - * created and it invokes the callback function every interval tick. - * - * @note - * - You do not need to stop or destroy the timer, when the - * `esp_periph_destroy` function is called, it will stop and destroy all - * - This timer using FreeRTOS Timer, with autoreload = true - * - * @param[in] periph The peripheral - * @param[in] interval_tick The interval tick - * @param[in] callback The callback - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t esp_periph_start_timer (esp_periph_handle_t periph, - TickType_t interval_tick, - timer_callback callback); - - /** - * @brief Stop peripheral timer - * - * @param[in] periph The peripheral - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t esp_periph_stop_timer (esp_periph_handle_t periph); - - /** - * @brief Set the user data - * - * @note Make sure the `data` lifetime is sufficient, this function - * does not copy all data, it only stores the data pointer - * - * @param[in] periph The peripheral - * @param data The data - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t esp_periph_set_data (esp_periph_handle_t periph, void *data); - - /** - * @brief Get the user data stored in the peripheral - * - * @param[in] periph The peripheral - * - * @return Peripheral data pointer - */ - void *esp_periph_get_data (esp_periph_handle_t periph); - - /** - * @brief Get the current state of peripheral. - * - * @param[in] periph The handle of peripheral - * - * @return The peripharal working state - */ - esp_periph_state_t esp_periph_get_state (esp_periph_handle_t periph); - - /** - * @brief Get Peripheral identifier - * - * @param[in] periph The peripheral - * - * @return The peripheral identifier - */ - esp_periph_id_t esp_periph_get_id (esp_periph_handle_t periph); - - /** - * @brief Set Peripheral identifier - * - * @param[in] periph The peripheral - * @param[in] periph_id The peripheral identifier - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t esp_periph_set_id (esp_periph_handle_t periph, - esp_periph_id_t periph_id); - - /** - * @brief Call this to execute `init` function of peripheral instance - * - * @param periph The peripheral handle - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t esp_periph_init (esp_periph_handle_t periph); - - /** - * @brief Call this to execute `run` function of peripheral instance - * - * @param periph The peripheral handle - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t esp_periph_run (esp_periph_handle_t periph); - - /** - * @brief Call this to execute `destroy` function of peripheral instance - * - * @param periph The peripheral handle - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t esp_periph_destroy (esp_periph_handle_t periph); - - /** - * @brief Rigster peripheral on event handle - * - * @param periph The peripheral handle - * @param evts The esp_periph_event_t handle - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t esp_periph_register_on_events (esp_periph_handle_t periph, - esp_periph_event_t *evts); +/** + * @brief Initialize esp_peripheral sets, create empty peripherals list. + * Call this function before starting any peripherals (with + * `esp_periph_start`). This call will initialize the data needed for + * esp_peripherals to work, but does not actually create the task. The + * `event_handle` is optional if you want to receive events from this callback + * function. The esp_peripherals task will send all events out to event_iface, + * can be listen by event_iface by `esp_periph_get_event_iface`. The + * `user_context` will sent `esp_periph_event_handle_t` as *context parameter. + * + * @param[in] config The configurations + * + * @return The peripheral sets instance + */ +esp_periph_set_handle_t esp_periph_set_init(esp_periph_config_t *config); + +/** + * @brief This function will stop and kill the monitor task, calling all + * destroy callback functions of the peripheral (so you do not need to destroy + * the peripheral object manually). It will also remove all memory allocated to + * the peripherals list, so you need to call the `esp_periph_set_init` function + * again if you want to use it. + * + * @param periph_set_handle The esp_periph_set_handle_t instance + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t esp_periph_set_destroy(esp_periph_set_handle_t periph_set_handle); + +/** + * @brief Stop monitoring all peripherals, the peripheral state is still + * kept. This funciton only temporary disables the peripheral. + * + * @param periph_set_handle The esp_periph_set_handle_t instance + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t esp_periph_set_stop_all(esp_periph_set_handle_t periph_set_handle); + +/** + * @brief Get the peripheral handle by Peripheral ID + * + * @param periph_set_handle The esp_periph_set_handle_t instance + * + * @param[in] periph_id as esp_periph_id_t, or any ID you use when calling + * `esp_periph_create` + * + * + * @return The esp_periph_handle_t + */ +esp_periph_handle_t esp_periph_set_get_by_id( + esp_periph_set_handle_t periph_set_handle, int periph_id); + +/** + * @brief Return the event_iface used by this esp_peripherals + * + * @param periph_set_handle The esp_periph_set_handle_t instance + * + * @return The audio event iface handle + */ +audio_event_iface_handle_t esp_periph_set_get_event_iface( + esp_periph_set_handle_t periph_set_handle); + +/** + * @brief Register peripheral sets event callback function. + * + * @param periph_set_handle The esp_periph_set_handle_t instance + * @param cb The event handle callback function + * @param user_context The user context pointer + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t esp_periph_set_register_callback( + esp_periph_set_handle_t periph_set_handle, esp_periph_event_handle_t cb, + void *user_context); + +/** + * @brief Peripheral is using event_iface to control the event, all events + * are send out to event_iface queue. This function will be useful in case we + * want to read events directly from the event_iface queue. + * + * @param periph_set_handle The esp_periph_set_handle_t instance + * + * @return The queue handle + */ +QueueHandle_t esp_periph_set_get_queue( + esp_periph_set_handle_t periph_set_handle); + +/** + * @brief Call this function to initialize all the listed peripherals. + * @note Work with no task peripheral set only + * + * @param periph_set_handle The esp_periph_set_handle_t instance + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t esp_periph_set_list_init(esp_periph_set_handle_t periph_set_handle); + +/** + * @brief Call this function to run all the listed peripherals. + * @note Work with no task peripheral set only + * + * @param periph_set_handle The esp_periph_set_handle_t instance + * @param msg The audio_event_iface_msg_t handle message + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t esp_periph_set_list_run(esp_periph_set_handle_t periph_set_handle, + audio_event_iface_msg_t msg); + +/** + * @brief Call this function to destroy all the listed peripherals. + * @note Work with no task peripheral set only + * + * @param periph_set_handle The esp_periph_set_handle_t instance + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t esp_periph_set_list_destroy( + esp_periph_set_handle_t periph_set_handle); + +/** + * @brief Call this function to remove periph from periph_set. + * + * @param periph_set_handle The esp_periph_set_handle_t instance + * @param periph The esp_periph_handle_t instance + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t esp_periph_remove_from_set(esp_periph_set_handle_t periph_set_handle, + esp_periph_handle_t periph); + +/** + * @brief Call this function to change periph_set waiting time. + * + * @param periph_set_handle The esp_periph_set_handle_t instance + * @param time_ms The waiting time + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t esp_periph_set_change_waiting_time( + esp_periph_set_handle_t periph_set_handle, int time_ms); + +/** + * @brief Call this function to initialize a new peripheral + * + * @param[in] periph_id The periph identifier + * @param[in] tag The tag name, we named it easy to get in debug logs + * + * @return The peripheral handle + */ +esp_periph_handle_t esp_periph_create(int periph_id, const char *tag); + +/** + * @brief Each peripheral has a cycle of sequential operations from + * initialization, execution of commands to destroying the peripheral. These + * operations are represented by functions passed as call parameters to this + * function. + * + * @param[in] periph The periph + * @param[in] init The initialize + * @param[in] run The run + * @param[in] destroy The destroy + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t esp_periph_set_function(esp_periph_handle_t periph, + esp_periph_func init, esp_periph_run_func run, + esp_periph_func destroy); + +/** + * @brief Add the peripheral to peripherals list, enable and start monitor + * task (if task stack size > 0) + * + * @param[in] periph_set_handle The esp_periph_set_handle_t instance + * @param[in] periph The peripheral instance + * + * @note + * This peripheral must be first created by calling `esp_periph_create` + * + * @return + * - ESP_OK on success + * - ESP_FAIL when any errors + */ +esp_err_t esp_periph_start(esp_periph_set_handle_t periph_set_handle, + esp_periph_handle_t periph); + +/** + * @brief Stop monitoring the peripheral, the peripheral state is still + * kept. This funciton only temporary disables the peripheral. + * + * @param[in] periph The periph + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t esp_periph_stop(esp_periph_handle_t periph); + +/** + * @brief When this function is called, the command is passed to the + * event_iface command queue, and the `esp_periph_run_func` of this peripheral + * will be executed in the main peripheral task. This function can be called + * from any task, basically it only sends a queue to the main peripheral task + * + * @param[in] periph The periph + * @param[in] cmd The command + * @param data The data + * @param[in] data_len The data length + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t esp_periph_send_cmd(esp_periph_handle_t periph, int cmd, void *data, + int data_len); + +/** + * @brief Similar to `esp_periph_send_cmd`, but it can be called in the + * hardware interrupt handle + * + * @param[in] periph The periph + * @param[in] cmd The command + * @param data The data + * @param[in] data_len The data length + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t esp_periph_send_cmd_from_isr(esp_periph_handle_t periph, int cmd, + void *data, int data_len); + +/** + * @brief In addition to sending an event via event_iface, this function + * will dispatch the `event_handle` callback if the event_handle callback is + * provided at `esp_periph_init` + * + * @param[in] periph The peripheral + * @param[in] event_id The event identifier + * @param data The data + * @param[in] data_len The data length + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t esp_periph_send_event(esp_periph_handle_t periph, int event_id, + void *data, int data_len); + +/** + * @brief Each peripheral can initialize a timer, which is by default NULL. + * When this function is called, the timer for the peripheral is + * created and it invokes the callback function every interval tick. + * + * @note + * - You do not need to stop or destroy the timer, when the + * `esp_periph_destroy` function is called, it will stop and destroy all + * - This timer using FreeRTOS Timer, with autoreload = true + * + * @param[in] periph The peripheral + * @param[in] interval_tick The interval tick + * @param[in] callback The callback + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t esp_periph_start_timer(esp_periph_handle_t periph, + TickType_t interval_tick, + timer_callback callback); + +/** + * @brief Stop peripheral timer + * + * @param[in] periph The peripheral + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t esp_periph_stop_timer(esp_periph_handle_t periph); + +/** + * @brief Set the user data + * + * @note Make sure the `data` lifetime is sufficient, this function does + * not copy all data, it only stores the data pointer + * + * @param[in] periph The peripheral + * @param data The data + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t esp_periph_set_data(esp_periph_handle_t periph, void *data); + +/** + * @brief Get the user data stored in the peripheral + * + * @param[in] periph The peripheral + * + * @return Peripheral data pointer + */ +void *esp_periph_get_data(esp_periph_handle_t periph); + +/** + * @brief Get the current state of peripheral. + * + * @param[in] periph The handle of peripheral + * + * @return The peripharal working state + */ +esp_periph_state_t esp_periph_get_state(esp_periph_handle_t periph); + +/** + * @brief Get Peripheral identifier + * + * @param[in] periph The peripheral + * + * @return The peripheral identifier + */ +esp_periph_id_t esp_periph_get_id(esp_periph_handle_t periph); + +/** + * @brief Set Peripheral identifier + * + * @param[in] periph The peripheral + * @param[in] periph_id The peripheral identifier + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t esp_periph_set_id(esp_periph_handle_t periph, + esp_periph_id_t periph_id); + +/** + * @brief Call this to execute `init` function of peripheral instance + * + * @param periph The peripheral handle + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t esp_periph_init(esp_periph_handle_t periph); + +/** + * @brief Call this to execute `run` function of peripheral instance + * + * @param periph The peripheral handle + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t esp_periph_run(esp_periph_handle_t periph); + +/** + * @brief Call this to execute `destroy` function of peripheral instance + * + * @param periph The peripheral handle + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t esp_periph_destroy(esp_periph_handle_t periph); + +/** + * @brief Rigster peripheral on event handle + * + * @param periph The peripheral handle + * @param evts The esp_periph_event_t handle + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t esp_periph_register_on_events(esp_periph_handle_t periph, + esp_periph_event_t *evts); #define periph_tick_get esp_periph_tick_get diff --git a/components/esp_peripherals/include/periph_adc_button.h b/components/esp_peripherals/include/periph_adc_button.h index cd136aed..5ee6b8be 100644 --- a/components/esp_peripherals/include/periph_adc_button.h +++ b/components/esp_peripherals/include/periph_adc_button.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -32,73 +32,70 @@ #include "esp_peripherals.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif #define ADC_BUTTON_STACK_SIZE 2500 #define ADC_BUTTON_TASK_PRIORITY 10 #define ADC_BUTTON_TASK_CORE_ID 0 - /** - * @brief The configuration of ADC Button - */ - typedef struct - { - adc_arr_t *arr; /*!< An array with configuration of buttons */ - int arr_size; /*!< The array size */ - adc_btn_task_cfg_t task_cfg; /*!< Adc button task configuration */ - } periph_adc_button_cfg_t; +/** + * @brief The configuration of ADC Button + */ +typedef struct { + adc_arr_t *arr; /*!< An array with configuration of buttons */ + int arr_size; /*!< The array size */ + adc_btn_task_cfg_t task_cfg; /*!< Adc button task configuration */ +} periph_adc_button_cfg_t; -#define PERIPH_ADC_BUTTON_DEFAULT_CONFIG() \ - { \ - .task_cfg \ - = {.task_stack = ADC_BUTTON_STACK_SIZE, \ - .task_core = ADC_BUTTON_TASK_CORE_ID, \ - .task_prio = ADC_BUTTON_TASK_PRIORITY, \ - .ext_stack = false } \ +#define PERIPH_ADC_BUTTON_DEFAULT_CONFIG() \ + { \ + .task_cfg = { \ + .task_stack = ADC_BUTTON_STACK_SIZE, \ + .task_core = ADC_BUTTON_TASK_CORE_ID, \ + .task_prio = ADC_BUTTON_TASK_PRIORITY, \ + .ext_stack = false \ + } \ } - typedef enum - { - PERIPH_ADC_BUTTON_IDLE = 0, - PERIPH_ADC_BUTTON_PRESSED, - PERIPH_ADC_BUTTON_RELEASE, - PERIPH_ADC_BUTTON_LONG_PRESSED, - PERIPH_ADC_BUTTON_LONG_RELEASE, - } periph_adc_button_event_id_t; +typedef enum { + PERIPH_ADC_BUTTON_IDLE = 0, + PERIPH_ADC_BUTTON_PRESSED, + PERIPH_ADC_BUTTON_RELEASE, + PERIPH_ADC_BUTTON_LONG_PRESSED, + PERIPH_ADC_BUTTON_LONG_RELEASE, +} periph_adc_button_event_id_t; - /** - * ESP32 ADC1 channels and GPIO table - * ADC1_CHANNEL_0 - GPIO36 - * ADC1_CHANNEL_1 - GPIO37 - * ADC1_CHANNEL_2 - GPIO38 - * ADC1_CHANNEL_3 - GPIO39 - * ADC1_CHANNEL_4 - GPIO32 - * ADC1_CHANNEL_5 - GPIO33 - * ADC1_CHANNEL_6 - GPIO34 - * ADC1_CHANNEL_7 - GPIO35 - * - **/ +/** + * ESP32 ADC1 channels and GPIO table + * ADC1_CHANNEL_0 - GPIO36 + * ADC1_CHANNEL_1 - GPIO37 + * ADC1_CHANNEL_2 - GPIO38 + * ADC1_CHANNEL_3 - GPIO39 + * ADC1_CHANNEL_4 - GPIO32 + * ADC1_CHANNEL_5 - GPIO33 + * ADC1_CHANNEL_6 - GPIO34 + * ADC1_CHANNEL_7 - GPIO35 + * + **/ -#define ADC_DEFAULT_ARR() \ - { \ - .adc_ch = ADC1_CHANNEL_3, .adc_level_step = NULL, .total_steps = 6, \ - .press_judge_time = 3000, \ +#define ADC_DEFAULT_ARR() \ + { \ + .adc_ch = ADC1_CHANNEL_3, .adc_level_step = NULL, .total_steps = 6, \ + .press_judge_time = 3000, \ } - /** - * @brief Create the button peripheral handle for esp_peripherals. - * - * @note The handle created by this function is automatically destroyed - * when esp_periph_destroy is called. - * - * @param btn_cfg The button configuration. - * - * @return The esp peripheral handle. - */ - esp_periph_handle_t - periph_adc_button_init (periph_adc_button_cfg_t *btn_cfg); +/** + * @brief Create the button peripheral handle for esp_peripherals. + * + * @note The handle created by this function is automatically destroyed + * when esp_periph_destroy is called. + * + * @param btn_cfg The button configuration. + * + * @return The esp peripheral handle. + */ +esp_periph_handle_t periph_adc_button_init(periph_adc_button_cfg_t *btn_cfg); #ifdef __cplusplus } diff --git a/components/esp_peripherals/include/periph_aw2013.h b/components/esp_peripherals/include/periph_aw2013.h index ade13c74..b2bb7bca 100644 --- a/components/esp_peripherals/include/periph_aw2013.h +++ b/components/esp_peripherals/include/periph_aw2013.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -31,104 +31,100 @@ #include "esp_peripherals.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - typedef enum - { - AW2013_MODE_LED, - AW2013_MODE_FADE, - AW2013_MODE_AUTO - } periph_aw2013_mode_t; +typedef enum { + AW2013_MODE_LED, + AW2013_MODE_FADE, + AW2013_MODE_AUTO +} periph_aw2013_mode_t; - /** - * @brief Configuration of aw2013 - */ - typedef struct - { - periph_aw2013_mode_t mode; /*!< Work mode of aw2013 */ - aw2013_brightness_t bright; /*!< The brightness of aw2013 */ - uint32_t rgb_value; /*!< rgb value to be set */ - } periph_aw2013_cfg_t; +/** + * @brief Configuration of aw2013 + */ +typedef struct { + periph_aw2013_mode_t mode; /*!< Work mode of aw2013 */ + aw2013_brightness_t bright; /*!< The brightness of aw2013 */ + uint32_t rgb_value; /*!< rgb value to be set */ +} periph_aw2013_cfg_t; - /** - * @brief Initializate aw2013 - * - * @param aw2013_cfg Parameters of aw2013 - * - * @return - * - NULL Error - * - others Success - */ - esp_periph_handle_t periph_aw2013_init (periph_aw2013_cfg_t *aw2013_cfg); +/** + * @brief Initializate aw2013 + * + * @param aw2013_cfg Parameters of aw2013 + * + * @return + * - NULL Error + * - others Success + */ +esp_periph_handle_t periph_aw2013_init(periph_aw2013_cfg_t *aw2013_cfg); - /** - * @brief Set the brightness of aw2013 - * - * @param periph The aw2013's handle - * @param bright The brightness to be set - * - * @return - * - ESP_OK Success - * - ESP_FAIL Error - */ - esp_err_t periph_aw2013_set_brightless (esp_periph_handle_t periph, - aw2013_brightness_t bright); +/** + * @brief Set the brightness of aw2013 + * + * @param periph The aw2013's handle + * @param bright The brightness to be set + * + * @return + * - ESP_OK Success + * - ESP_FAIL Error + */ +esp_err_t periph_aw2013_set_brightless(esp_periph_handle_t periph, + aw2013_brightness_t bright); - /** - * @brief Set the time periods of aw2013 - * - * @param periph The aw2013's handle - * @param time The time period to be set - * @param level The time value to be set - * - * @return - * - ESP_OK Success - * - ESP_FAIL Error - */ - esp_err_t periph_aw2013_set_time (esp_periph_handle_t periph, - aw2013_time_t time, - aw2013_time_level_t level); +/** + * @brief Set the time periods of aw2013 + * + * @param periph The aw2013's handle + * @param time The time period to be set + * @param level The time value to be set + * + * @return + * - ESP_OK Success + * - ESP_FAIL Error + */ +esp_err_t periph_aw2013_set_time(esp_periph_handle_t periph, aw2013_time_t time, + aw2013_time_level_t level); - /** - * @brief Set the work mode of aw2013 - * - * @param periph The aw2013's handle - * @param mode The work mode to be set - * - * @return - * - ESP_OK Success - * - ESP_FAIL Error - */ - esp_err_t periph_aw2013_set_mode (esp_periph_handle_t periph, - periph_aw2013_mode_t mode); +/** + * @brief Set the work mode of aw2013 + * + * @param periph The aw2013's handle + * @param mode The work mode to be set + * + * @return + * - ESP_OK Success + * - ESP_FAIL Error + */ +esp_err_t periph_aw2013_set_mode(esp_periph_handle_t periph, + periph_aw2013_mode_t mode); - /** - * @brief Set the rgb value of aw2013 - * - * @param periph The aw2013's handle - * @param value The value for rgb to be set - * - * @return - * - ESP_OK Success - * - ESP_FAIL Error - */ - esp_err_t periph_aw2013_set_rgb_value (esp_periph_handle_t periph, - uint32_t value); +/** + * @brief Set the rgb value of aw2013 + * + * @param periph The aw2013's handle + * @param value The value for rgb to be set + * + * @return + * - ESP_OK Success + * - ESP_FAIL Error + */ +esp_err_t periph_aw2013_set_rgb_value(esp_periph_handle_t periph, + uint32_t value); - /** - * @brief Set the repeat time in auto flash mode - * - * @param periph The aw2013's handle - * @param cnt Cycle times to be set - * - * @return - * - ESP_OK Success - * - ESP_FAIL Error - */ - esp_err_t periph_aw2013_set_repeat_time (esp_periph_handle_t periph, - uint8_t cnt); +/** + * @brief Set the repeat time in auto flash mode + * + * @param periph The aw2013's handle + * @param cnt Cycle times to be set + * + * @return + * - ESP_OK Success + * - ESP_FAIL Error + */ +esp_err_t periph_aw2013_set_repeat_time(esp_periph_handle_t periph, + uint8_t cnt); #ifdef __cplusplus } diff --git a/components/esp_peripherals/include/periph_button.h b/components/esp_peripherals/include/periph_button.h index 3690b8da..4ab6ae41 100644 --- a/components/esp_peripherals/include/periph_button.h +++ b/components/esp_peripherals/include/periph_button.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,61 +18,55 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #ifndef _BUTTON_DEV_H_ #define _BUTTON_DEV_H_ -#include "audio_common.h" -#include "audio_error.h" #include "esp_peripherals.h" -#include "sys/queue.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - /** - * @brief The Button peripheral configuration - */ - typedef struct - { - uint64_t gpio_mask; /*!< GPIO Mask using for this Button peripheral, it is - BIT(GPIO_NUM), ex: GPIO_SEL_36 | GPIO_SEL_36 */ - int long_press_time_ms; /*!< Long press duration in milliseconds, default - is 2000ms */ - } periph_button_cfg_t; +/** + * @brief The Button peripheral configuration + */ +typedef struct { + uint64_t gpio_mask; /*!< GPIO Mask using for this Button peripheral, it is + BIT(GPIO_NUM), ex: GPIO_SEL_36 | GPIO_SEL_36 */ + int long_press_time_ms; /*!< Long press duration in milliseconds, default is + 2000ms */ +} periph_button_cfg_t; - /** - * @brief Peripheral button event id - */ - typedef enum - { - PERIPH_BUTTON_UNCHANGE = 0, /*!< No event */ - PERIPH_BUTTON_PRESSED, /*!< When button is pressed */ - PERIPH_BUTTON_RELEASE, /*!< When button is released */ - PERIPH_BUTTON_LONG_PRESSED, /*!< When button is pressed and kept for more - than `long_press_time_ms` */ - PERIPH_BUTTON_LONG_RELEASE, /*!< When button is released and event - PERIPH_BUTTON_LONG_PRESSED happened */ - } periph_button_event_id_t; +/** + * @brief Peripheral button event id + */ +typedef enum { + PERIPH_BUTTON_UNCHANGE = 0, /*!< No event */ + PERIPH_BUTTON_PRESSED, /*!< When button is pressed */ + PERIPH_BUTTON_RELEASE, /*!< When button is released */ + PERIPH_BUTTON_LONG_PRESSED, /*!< When button is pressed and kept for more than + `long_press_time_ms` */ + PERIPH_BUTTON_LONG_RELEASE, /*!< When button is released and event + PERIPH_BUTTON_LONG_PRESSED happened */ +} periph_button_event_id_t; - /** - * @brief Create the button peripheral handle for esp_peripherals. - * - * @note The handle was created by this function automatically destroy - * when `esp_periph_destroy` is called - * - * @param but_cfg The but configuration - * - * @return The esp peripheral handle - */ - esp_periph_handle_t periph_button_init (periph_button_cfg_t *but_cfg); +/** + * @brief Create the button peripheral handle for esp_peripherals. + * + * @note The handle was created by this function automatically destroy + * when `esp_periph_destroy` is called + * + * @param but_cfg The but configuration + * + * @return The esp peripheral handle + */ +esp_periph_handle_t periph_button_init(periph_button_cfg_t* but_cfg); #ifdef __cplusplus } diff --git a/components/esp_peripherals/include/periph_console.h b/components/esp_peripherals/include/periph_console.h index 009e83ab..b925e7d6 100644 --- a/components/esp_peripherals/include/periph_console.h +++ b/components/esp_peripherals/include/periph_console.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,69 +18,61 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #ifndef _PERIPH_CONSOLE_H_ #define _PERIPH_CONSOLE_H_ -#include "audio_error.h" #include "esp_peripherals.h" -#include "sys/queue.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - typedef esp_err_t (*console_cmd_callback_t) (esp_periph_handle_t periph, - int argc, char *argv[]); +typedef esp_err_t (*console_cmd_callback_t)(esp_periph_handle_t periph, + int argc, char *argv[]); #define CONSOLE_DEFAULT_TASK_PRIO (5) #define CONSOLE_DEFAULT_TASK_STACK (1024 * 5) #define CONSOLE_DEFAULT_BUFFER_SIZE (256) #define CONSOLE_DEFAULT_PROMPT_STRING "esp32>" - /** - * @brief Command structure - */ - typedef struct - { - const char *cmd; /*!< Name of command, must be unique */ - int id; /*!< Command ID will be sent together when the command is matched - */ - const char *help; /*!< Explanation of the command */ - console_cmd_callback_t func; /*!< Function callback for the command */ - } periph_console_cmd_t; +/** + * @brief Command structure + */ +typedef struct { + const char *cmd; /*!< Name of command, must be unique */ + int id; /*!< Command ID will be sent together when the command is matched */ + const char *help; /*!< Explanation of the command */ + console_cmd_callback_t func; /*!< Function callback for the command */ +} periph_console_cmd_t; - /** - * @brief Console Peripheral configuration - */ - typedef struct - { - int command_num; /*!< Total number of commands */ - const periph_console_cmd_t *commands; /*!< Pointer to array of commands */ - int task_stack; /*!< Console task stack, using default if the value is zero - */ - int task_prio; /*!< Console task priority (based on freeRTOS priority), - using default if the value is zero */ - int buffer_size; /*!< Size of console input buffer */ - const char - *prompt_string; /*!< Console prompt string, using default - CONSOLE_PROMPT_STRING if the pointer is NULL */ - } periph_console_cfg_t; +/** + * @brief Console Peripheral configuration + */ +typedef struct { + int command_num; /*!< Total number of commands */ + const periph_console_cmd_t *commands; /*!< Pointer to array of commands */ + int task_stack; /*!< Console task stack, using default if the value is zero */ + int task_prio; /*!< Console task priority (based on freeRTOS priority), using + default if the value is zero */ + int buffer_size; /*!< Size of console input buffer */ + const char *prompt_string; /*!< Console prompt string, using default + CONSOLE_PROMPT_STRING if the pointer is NULL */ +} periph_console_cfg_t; - /** - * @brief Initialize Console Peripheral - * - * @param config The configuration - * - * @return The esp peripheral handle - */ - esp_periph_handle_t periph_console_init (periph_console_cfg_t *config); +/** + * @brief Initialize Console Peripheral + * + * @param config The configuration + * + * @return The esp peripheral handle + */ +esp_periph_handle_t periph_console_init(periph_console_cfg_t *config); #ifdef __cplusplus } diff --git a/components/esp_peripherals/include/periph_gpio_isr.h b/components/esp_peripherals/include/periph_gpio_isr.h index 2f1521e3..35e34ad4 100644 --- a/components/esp_peripherals/include/periph_gpio_isr.h +++ b/components/esp_peripherals/include/periph_gpio_isr.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -32,59 +32,56 @@ #include "gpio_isr.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - /** - * @breif Set the gpio number and gpio interruption type - */ - typedef struct - { - int gpio_num; /*!< gpio number */ - gpio_int_type_t type; /*!< interruption type */ - } gpio_isr_info_t; +/** + * @breif Set the gpio number and gpio interruption type + */ +typedef struct { + int gpio_num; /*!< gpio number */ + gpio_int_type_t type; /*!< interruption type */ +} gpio_isr_info_t; - /** - * @brief The configuration of gpio isr - */ - typedef struct - { - int info_size; /*!< number of gpio to be register */ - gpio_isr_info_t *gpio_isr_info; /*!< an array of gpio's infomation */ - } periph_gpio_isr_cfg_t; +/** + * @brief The configuration of gpio isr + */ +typedef struct { + int info_size; /*!< number of gpio to be register */ + gpio_isr_info_t *gpio_isr_info; /*!< an array of gpio's infomation */ +} periph_gpio_isr_cfg_t; - /** - * @brief Create the gpio's interrupt service routines handle for - * esp_peripherals - * - * @param isr_config The gpio isr configuration - * - * @return The esp peripheral handle - */ - esp_periph_handle_t periph_gpio_isr_init (periph_gpio_isr_cfg_t *isr_config); +/** + * @brief Create the gpio's interrupt service routines handle for + * esp_peripherals + * + * @param isr_config The gpio isr configuration + * + * @return The esp peripheral handle + */ +esp_periph_handle_t periph_gpio_isr_init(periph_gpio_isr_cfg_t *isr_config); - /** - * @breif Add a gpio to isr - * - * @param gpio_info The gpio interruption type and gpio number - * - * @return - * - ESP_OK success - * - ESP_FAIL fail - */ - esp_err_t periph_gpio_isr_add (gpio_isr_info_t *gpio_info); +/** + * @breif Add a gpio to isr + * + * @param gpio_info The gpio interruption type and gpio number + * + * @return + * - ESP_OK success + * - ESP_FAIL fail + */ +esp_err_t periph_gpio_isr_add(gpio_isr_info_t *gpio_info); - /** - * @brief Unregister a gpio from isr - * - * @param The number of gpio to be unregistered - * - *@return - * - ESP_OK success - * - ESP_FAIL failed - */ - esp_err_t periph_gpio_isr_delete (int gpio_num); +/** + * @brief Unregister a gpio from isr + * + * @param The number of gpio to be unregistered + * + *@return + * - ESP_OK success + * - ESP_FAIL failed + */ +esp_err_t periph_gpio_isr_delete(int gpio_num); #ifdef __cplusplus } diff --git a/components/esp_peripherals/include/periph_is31fl3216.h b/components/esp_peripherals/include/periph_is31fl3216.h index da26c0da..060b98a7 100644 --- a/components/esp_peripherals/include/periph_is31fl3216.h +++ b/components/esp_peripherals/include/periph_is31fl3216.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #ifndef __PERIPH_IS31FL3216_H__ @@ -29,160 +29,155 @@ #include "esp_peripherals.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif -#define IS31FL3216_CH_NUM 16 // Should be less than or equal to 16 +#define IS31FL3216_CH_NUM 16 // Should be less than or equal to 16 #define BLUE_LED_MAX_NUM 12 - typedef enum - { - IS31FL3216_STATE_UNKNOWN, - IS31FL3216_STATE_OFF, - IS31FL3216_STATE_ON, - IS31FL3216_STATE_FLASH, - IS31FL3216_STATE_BY_AUDIO, - IS31FL3216_STATE_SHIFT, - } periph_is31fl3216_state_t; - - typedef enum - { - PERIPH_IS31_SHIFT_MODE_UNKNOWN, - PERIPH_IS31_SHIFT_MODE_ACC, /*!< accumulation mode */ - PERIPH_IS31_SHIFT_MODE_SINGLE, - } periph_is31_shift_mode_t; - - /** - * @brief The configuration of is31fl3216 - */ - typedef struct - { - uint32_t duty[IS31FL3216_CH_NUM]; /*! + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _PERIPH_LCD_H_ +#define _PERIPH_LCD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0)) +#include "driver/spi_master.h" +#include "esp_lcd_panel_io.h" +#include "esp_lcd_panel_vendor.h" +#include "esp_peripherals.h" + +typedef esp_err_t (*perph_lcd_rest)(esp_periph_handle_t self, void *ctx); + +typedef esp_err_t (*get_lcd_io_bus)(void *bus, + esp_lcd_panel_io_spi_config_t *io_config, + esp_lcd_panel_io_handle_t *out_panel_io); + +typedef esp_err_t (*get_lcd_panel)( + const esp_lcd_panel_io_handle_t panel_io, + const esp_lcd_panel_dev_config_t *panel_dev_config, + esp_lcd_panel_handle_t *ret_panel); + +/** + * @brief The LCD peripheral configurations + */ +typedef struct { + void *io_bus; + get_lcd_io_bus new_panel_io; + esp_lcd_panel_io_spi_config_t *lcd_io_cfg; + + get_lcd_panel new_lcd_panel; + esp_lcd_panel_dev_config_t *lcd_dev_cfg; + perph_lcd_rest rest_cb; + void *rest_cb_ctx; + + bool lcd_swap_xy; + bool lcd_mirror_x; + bool lcd_mirror_y; + bool lcd_color_invert; +} periph_lcd_cfg_t; + +/** + * @brief Create the LCD peripheral handle for esp_peripherals + * + * @note The handle was created by this function automatically destroy + * when `esp_periph_destroy` is called + * + * @param config The configuration + * + * @return The esp peripheral handle + */ +esp_periph_handle_t periph_lcd_init(periph_lcd_cfg_t *config); + +/** + * @brief Get the `esp_lcd_panel_handle_t` with given LCD peripheral handle + * + * @param handle The LCD peripheral handle + * + * @return The `esp_lcd_panel_handle_t` handle + */ +esp_lcd_panel_handle_t periph_lcd_get_panel_handle(esp_periph_handle_t handle); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/components/esp_peripherals/include/periph_led.h b/components/esp_peripherals/include/periph_led.h index 52aec810..7897b16c 100644 --- a/components/esp_peripherals/include/periph_led.h +++ b/components/esp_peripherals/include/periph_led.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,108 +18,99 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #ifndef _PERIPH_LED_H_ #define _PERIPH_LED_H_ -#include "audio_common.h" #include "driver/ledc.h" -#include "esp_err.h" #include "esp_peripherals.h" -#include "sys/queue.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - /** - * @brief Peripheral LED event id - */ - typedef enum - { - PERIPH_LED_UNCHANGE = 0, /*!< No event */ - PERIPH_LED_BLINK_FINISH, /*!< When LED blink is finished */ - } periph_led_event_id_t; +/** + * @brief Peripheral LED event id + */ +typedef enum { + PERIPH_LED_UNCHANGE = 0, /*!< No event */ + PERIPH_LED_BLINK_FINISH, /*!< When LED blink is finished */ +} periph_led_event_id_t; - /** - * @brief Peripheral LED idle output level - */ - typedef enum - { - PERIPH_LED_IDLE_LEVEL_LOW, /*!< Low level output */ - PERIPH_LED_IDLE_LEVEL_HIGH /*!< High level output */ - } periph_led_idle_level_t; +/** + * @brief Peripheral LED idle output level + */ +typedef enum { + PERIPH_LED_IDLE_LEVEL_LOW, /*!< Low level output */ + PERIPH_LED_IDLE_LEVEL_HIGH /*!< High level output */ +} periph_led_idle_level_t; - /** - * @brief The LED peripheral configuration - */ - typedef struct - { - ledc_mode_t led_speed_mode; /*!< LEDC speed speed_mode, high-speed mode or - low-speed mode */ - ledc_timer_bit_t led_duty_resolution; /*!< LEDC channel duty resolution */ - ledc_timer_t - led_timer_num; /*!< Select the timer source of channel (0 - 3) */ - uint32_t led_freq_hz; /*!< LEDC timer frequency (Hz) */ - int gpio_num; /*!< Optional, < 0 invalid gpio number */ - } periph_led_cfg_t; +/** + * @brief The LED peripheral configuration + */ +typedef struct { + ledc_mode_t led_speed_mode; /*!< LEDC speed speed_mode, high-speed mode or + low-speed mode */ + ledc_timer_bit_t led_duty_resolution; /*!< LEDC channel duty resolution */ + ledc_timer_t led_timer_num; /*!< Select the timer source of channel (0 - 3) */ + uint32_t led_freq_hz; /*!< LEDC timer frequency (Hz) */ + int gpio_num; /*!< Optional, < 0 invalid gpio number */ +} periph_led_cfg_t; - /** - * @brief Create the LED peripheral handle for esp_peripherals - * - * @note The handle was created by this function automatically destroy - * when `esp_periph_destroy` is called - * - * @param config The configuration - * - * @return The esp peripheral handle - */ - esp_periph_handle_t periph_led_init (periph_led_cfg_t *config); +/** + * @brief Create the LED peripheral handle for esp_peripherals + * + * @note The handle was created by this function automatically destroy + * when `esp_periph_destroy` is called + * + * @param config The configuration + * + * @return The esp peripheral handle + */ +esp_periph_handle_t periph_led_init(periph_led_cfg_t* config); - /** - * @brief Bink LED Peripheral, this function will automatically - * configure the gpio_num to control the LED, with `time_on_ms` as the time - * (in milliseconds) switch from OFF to ON (or ON if fade is disabled), and - * `time_off_ms` as the time (in milliseconds) switch from ON to OFF (or OFF - * if fade is disabled). When switching from ON -> OFF and vice versa, the - * loop decreases once, and will turn off the effect when the loop is 0. With - * a loop value less than 0, the LED effect will loop endlessly. - * PERIPH_LED_BLINK_FINISH events will be sent at each end of - * loop - * - * @param[in] periph The LED periph - * @param[in] gpio_num The gpio number - * @param[in] time_on_ms The time on milliseconds - * @param[in] time_off_ms The time off milliseconds - * @param[in] fade Fading enabled - * @param[in] loop Loop - * @param[in] level idle level - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t periph_led_blink (esp_periph_handle_t periph, int gpio_num, - int time_on_ms, int time_off_ms, bool fade, - int loop, periph_led_idle_level_t level); +/** + * @brief Bink LED Peripheral, this function will automatically configure + * the gpio_num to control the LED, with `time_on_ms` as the time (in + * milliseconds) switch from OFF to ON (or ON if fade is disabled), and + * `time_off_ms` as the time (in milliseconds) switch from ON to OFF (or OFF if + * fade is disabled). When switching from ON -> OFF and vice versa, the loop + * decreases once, and will turn off the effect when the loop is 0. With a loop + * value less than 0, the LED effect will loop endlessly. + * PERIPH_LED_BLINK_FINISH events will be sent at each end of loop + * + * @param[in] periph The LED periph + * @param[in] gpio_num The gpio number + * @param[in] time_on_ms The time on milliseconds + * @param[in] time_off_ms The time off milliseconds + * @param[in] fade Fading enabled + * @param[in] loop Loop + * @param[in] level idle level + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t periph_led_blink(esp_periph_handle_t periph, int gpio_num, + int time_on_ms, int time_off_ms, bool fade, int loop, + periph_led_idle_level_t level); - /** - * @brief Stop Blink the LED - * - * @param[in] periph The periph - * @param[in] gpio_num The gpio number - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t periph_led_stop (esp_periph_handle_t periph, int gpio_num); +/** + * @brief Stop Blink the LED + * + * @param[in] periph The periph + * @param[in] gpio_num The gpio number + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t periph_led_stop(esp_periph_handle_t periph, int gpio_num); #ifdef __cplusplus } diff --git a/components/esp_peripherals/include/periph_sdcard.h b/components/esp_peripherals/include/periph_sdcard.h index 2d25c486..954f8460 100644 --- a/components/esp_peripherals/include/periph_sdcard.h +++ b/components/esp_peripherals/include/periph_sdcard.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,81 +18,75 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #ifndef _SDCARD_DEV_H_ #define _SDCARD_DEV_H_ -#include "audio_common.h" -#include "audio_error.h" #include "esp_peripherals.h" -#include "sys/queue.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - /** - * @brief Peripheral sdcard event id - */ - typedef enum - { - SDCARD_STATUS_UNKNOWN, /*!< No event */ - SDCARD_STATUS_CARD_DETECT_CHANGE, /*!< Detect changes in the card_detect - pin */ - SDCARD_STATUS_MOUNTED, /*!< SDCARD mounted successfully */ - SDCARD_STATUS_UNMOUNTED, /*!< SDCARD unmounted successfully */ - SDCARD_STATUS_MOUNT_ERROR, /*!< SDCARD mount error */ - SDCARD_STATUS_UNMOUNT_ERROR, /*!< SDCARD unmount error */ - } periph_sdcard_event_id_t; +/** + * @brief Peripheral sdcard event id + */ +typedef enum { + SDCARD_STATUS_UNKNOWN, /*!< No event */ + SDCARD_STATUS_CARD_DETECT_CHANGE, /*!< Detect changes in the card_detect pin + */ + SDCARD_STATUS_MOUNTED, /*!< SDCARD mounted successfully */ + SDCARD_STATUS_UNMOUNTED, /*!< SDCARD unmounted successfully */ + SDCARD_STATUS_MOUNT_ERROR, /*!< SDCARD mount error */ + SDCARD_STATUS_UNMOUNT_ERROR, /*!< SDCARD unmount error */ +} periph_sdcard_event_id_t; - /** - * @brief SD card mode, SPI, 1-line SD mode, 4-line SD mode - * - */ - typedef enum - { - SD_MODE_SPI = 0x0, /*!< sd_card SPI*/ - SD_MODE_1_LINE = 0x1, /*!< sd_card 1-line SD mode*/ - SD_MODE_4_LINE = 0x2, /*!< sd_card 4-line SD mode*/ - SD_MODE_MAX, - } periph_sdcard_mode_t; +/** + * @brief SD card mode, SPI, 1-line SD mode, 4-line SD mode + * + */ +typedef enum { + SD_MODE_SPI = 0x0, /*!< sd_card SPI*/ + SD_MODE_1_LINE = 0x1, /*!< sd_card 1-line SD mode*/ + SD_MODE_4_LINE = 0x4, /*!< sd_card 4-line SD mode*/ + SD_MODE_8_LINE = 0x8, /*!< sd_card 8-line SD mode*/ + SD_MODE_MAX, +} periph_sdcard_mode_t; - /** - * @brief The SD Card Peripheral configuration - */ - typedef struct - { - int card_detect_pin; /*!< Card detect gpio number */ - const char *root; /*!< Base path for vfs */ - periph_sdcard_mode_t mode; /*!< card mode*/ - } periph_sdcard_cfg_t; +/** + * @brief The SD Card Peripheral configuration + */ +typedef struct { + int card_detect_pin; /*!< Card detect gpio number */ + const char* root; /*!< Base path for vfs */ + periph_sdcard_mode_t mode; /*!< card mode*/ +} periph_sdcard_cfg_t; - /** - * @brief Create the sdcard peripheral handle for esp_peripherals - * - * @note The handle was created by this function automatically destroy - * when `esp_periph_destroy` is called - * - * @param sdcard_config The sdcard configuration - * - * @return The esp peripheral handle - */ - esp_periph_handle_t periph_sdcard_init (periph_sdcard_cfg_t *sdcard_config); +/** + * @brief Create the sdcard peripheral handle for esp_peripherals + * + * @note The handle was created by this function automatically destroy + * when `esp_periph_destroy` is called + * + * @param sdcard_config The sdcard configuration + * + * @return The esp peripheral handle + */ +esp_periph_handle_t periph_sdcard_init(periph_sdcard_cfg_t* sdcard_config); - /** - * @brief Check the sdcard is mounted or not. - * - * @param[in] periph The periph - * - * @return SDCARD mounted state - */ - bool periph_sdcard_is_mounted (esp_periph_handle_t periph); +/** + * @brief Check the sdcard is mounted or not. + * + * @param[in] periph The periph + * + * @return SDCARD mounted state + */ +bool periph_sdcard_is_mounted(esp_periph_handle_t periph); #ifdef __cplusplus } diff --git a/components/esp_peripherals/include/periph_spiffs.h b/components/esp_peripherals/include/periph_spiffs.h index f8f8aca1..d7ad4a39 100644 --- a/components/esp_peripherals/include/periph_spiffs.h +++ b/components/esp_peripherals/include/periph_spiffs.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,72 +18,66 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #ifndef _SPIFFS_DEV_H_ #define _SPIFFS_DEV_H_ -#include "audio_common.h" -#include "audio_error.h" #include "esp_peripherals.h" -#include "sys/queue.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - /** - * @brief Peripheral spiffs event id - */ - typedef enum - { - SPIFFS_STATUS_UNKNOWN, /*!< No event */ - SPIFFS_STATUS_MOUNTED, /*!< SPIFFS mounted successfully */ - SPIFFS_STATUS_UNMOUNTED, /*!< SPIFFS unmounted successfully */ - SPIFFS_STATUS_MOUNT_ERROR, /*!< SPIFFS mount error */ - SPIFFS_STATUS_UNMOUNT_ERROR, /*!< SPIFFS unmount error */ - } periph_spiffs_event_id_t; +/** + * @brief Peripheral spiffs event id + */ +typedef enum { + SPIFFS_STATUS_UNKNOWN, /*!< No event */ + SPIFFS_STATUS_MOUNTED, /*!< SPIFFS mounted successfully */ + SPIFFS_STATUS_UNMOUNTED, /*!< SPIFFS unmounted successfully */ + SPIFFS_STATUS_MOUNT_ERROR, /*!< SPIFFS mount error */ + SPIFFS_STATUS_UNMOUNT_ERROR, /*!< SPIFFS unmount error */ +} periph_spiffs_event_id_t; - /** - * @brief The SPIFFS Peripheral configuration - */ - typedef struct - { - const char *root; /*!< Base path for vfs */ - const char *partition_label; /*!< Optional, label of SPIFFS partition to - use. If set to NULL, first partition with - subtype=spiffs will be used. */ - size_t max_files; /*!< Maximum number of files that could be open at the - same time. */ - bool format_if_mount_failed; /*!< If true, it will format the file system - if it fails to mount. */ - } periph_spiffs_cfg_t; +/** + * @brief The SPIFFS Peripheral configuration + */ +typedef struct { + const char* root; /*!< Base path for vfs */ + const char* partition_label; /*!< Optional, label of SPIFFS partition to use. + If set to NULL, first partition with + subtype=spiffs will be used. */ + size_t max_files; /*!< Maximum number of files that could be open at the same + time. */ + bool format_if_mount_failed; /*!< If true, it will format the file system if + it fails to mount. */ +} periph_spiffs_cfg_t; - /** - * @brief Create the spiffs peripheral handle for esp_peripherals - * - * @note The handle created by this function will be automatically - * destroyed when `esp_periph_destroy` is called - * - * @param spiffs_config The spiffs configuration - * - * @return The esp peripheral handle - */ - esp_periph_handle_t periph_spiffs_init (periph_spiffs_cfg_t *spiffs_config); +/** + * @brief Create the spiffs peripheral handle for esp_peripherals + * + * @note The handle created by this function will be automatically + * destroyed when `esp_periph_destroy` is called + * + * @param spiffs_config The spiffs configuration + * + * @return The esp peripheral handle + */ +esp_periph_handle_t periph_spiffs_init(periph_spiffs_cfg_t* spiffs_config); - /** - * @brief Check if the SPIFFS is mounted or not. - * - * @param[in] periph The periph - * - * @return SPIFFS mounted state - */ - bool periph_spiffs_is_mounted (esp_periph_handle_t periph); +/** + * @brief Check if the SPIFFS is mounted or not. + * + * @param[in] periph The periph + * + * @return SPIFFS mounted state + */ +bool periph_spiffs_is_mounted(esp_periph_handle_t periph); #ifdef __cplusplus } diff --git a/components/esp_peripherals/include/periph_touch.h b/components/esp_peripherals/include/periph_touch.h index de43e65e..42b320ae 100644 --- a/components/esp_peripherals/include/periph_touch.h +++ b/components/esp_peripherals/include/periph_touch.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,82 +18,74 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #ifndef _TOUCH_DEV_H_ #define _TOUCH_DEV_H_ -#include "audio_common.h" -#include "audio_error.h" #include "esp_peripherals.h" -#include "sys/queue.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - /** - * @brief Touch pad selection - */ - typedef enum - { - TOUCH_PAD_SEL0 = BIT (0), - TOUCH_PAD_SEL1 = BIT (1), - TOUCH_PAD_SEL2 = BIT (2), - TOUCH_PAD_SEL3 = BIT (3), - TOUCH_PAD_SEL4 = BIT (4), - TOUCH_PAD_SEL5 = BIT (5), - TOUCH_PAD_SEL6 = BIT (6), - TOUCH_PAD_SEL7 = BIT (7), - TOUCH_PAD_SEL8 = BIT (8), - TOUCH_PAD_SEL9 = BIT (9), - } esp_touch_pad_sel_t; +/** + * @brief Touch pad selection + */ +typedef enum { + TOUCH_PAD_SEL0 = BIT(0), + TOUCH_PAD_SEL1 = BIT(1), + TOUCH_PAD_SEL2 = BIT(2), + TOUCH_PAD_SEL3 = BIT(3), + TOUCH_PAD_SEL4 = BIT(4), + TOUCH_PAD_SEL5 = BIT(5), + TOUCH_PAD_SEL6 = BIT(6), + TOUCH_PAD_SEL7 = BIT(7), + TOUCH_PAD_SEL8 = BIT(8), + TOUCH_PAD_SEL9 = BIT(9), +} esp_touch_pad_sel_t; - /** - * @brief The Touch peripheral configuration - */ - typedef struct - { - int touch_mask; /*!< Touch pad mask using for this Touch peripheral, ex: - TOUCH_PAD_SEL0 | TOUCH_PAD_SEL1 */ - int tap_threshold_percent; /*!< Tap threshold percent, Tap event will be - determined if the percentage value is less - than the non-touch value */ - int long_tap_time_ms; /*!< Long tap duration in milliseconds, default is - 2000ms, PERIPH_TOUCH_LONG_TAP will be occurred if - TAP and time hold longer than this value */ - } periph_touch_cfg_t; +/** + * @brief The Touch peripheral configuration + */ +typedef struct { + int touch_mask; /*!< Touch pad mask using for this Touch peripheral, ex: + TOUCH_PAD_SEL0 | TOUCH_PAD_SEL1 */ + int tap_threshold_percent; /*!< Tap threshold percent, Tap event will be + determined if the percentage value is less than + the non-touch value */ + int long_tap_time_ms; /*!< Long tap duration in milliseconds, default is + 2000ms, PERIPH_TOUCH_LONG_TAP will be occurred if TAP + and time hold longer than this value */ +} periph_touch_cfg_t; - /** - * @brief Peripheral touch event id - */ - typedef enum - { - PERIPH_TOUCH_UNCHANGE = 0, /*!< No event */ - PERIPH_TOUCH_TAP, /*!< When touch pad is tapped */ - PERIPH_TOUCH_RELEASE, /*!< When touch pad is released after tap */ - PERIPH_TOUCH_LONG_TAP, /*!< When touch pad is tapped and held after - `long_tap_time_ms` time */ - PERIPH_TOUCH_LONG_RELEASE, /*!< When touch pad is released after long tap - */ - } periph_touch_event_id_t; +/** + * @brief Peripheral touch event id + */ +typedef enum { + PERIPH_TOUCH_UNCHANGE = 0, /*!< No event */ + PERIPH_TOUCH_TAP, /*!< When touch pad is tapped */ + PERIPH_TOUCH_RELEASE, /*!< When touch pad is released after tap */ + PERIPH_TOUCH_LONG_TAP, /*!< When touch pad is tapped and held after + `long_tap_time_ms` time */ + PERIPH_TOUCH_LONG_RELEASE, /*!< When touch pad is released after long tap */ +} periph_touch_event_id_t; - /** - * @brief Create the touch peripheral handle for esp_peripherals - * - * @note The handle was created by this function automatically destroy - * when `esp_periph_destroy` is called - * - * @param config The configuration - * - * @return The esp peripheral handle - */ - esp_periph_handle_t periph_touch_init (periph_touch_cfg_t *config); +/** + * @brief Create the touch peripheral handle for esp_peripherals + * + * @note The handle was created by this function automatically destroy + * when `esp_periph_destroy` is called + * + * @param config The configuration + * + * @return The esp peripheral handle + */ +esp_periph_handle_t periph_touch_init(periph_touch_cfg_t* config); #ifdef __cplusplus } diff --git a/components/esp_peripherals/include/periph_wifi.h b/components/esp_peripherals/include/periph_wifi.h index a39942cd..e3e120fd 100644 --- a/components/esp_peripherals/include/periph_wifi.h +++ b/components/esp_peripherals/include/periph_wifi.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,144 +18,150 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #ifndef _DEV_WIFI_H_ #define _DEV_WIFI_H_ -#include "audio_common.h" -#include "audio_error.h" #include "esp_peripherals.h" -#include "sys/queue.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - /** - * @brief Peripheral Wi-Fi event id - */ - typedef enum - { - PERIPH_WIFI_UNCHANGE = 0, - PERIPH_WIFI_CONNECTING, - PERIPH_WIFI_CONNECTED, - PERIPH_WIFI_DISCONNECTED, - PERIPH_WIFI_SETTING, - PERIPH_WIFI_CONFIG_DONE, - PERIPH_WIFI_CONFIG_ERROR, - PERIPH_WIFI_ERROR, - } periph_wifi_state_t; +/** + * @brief Peripheral Wi-Fi event id + */ +typedef enum { + PERIPH_WIFI_UNCHANGE = 0, + PERIPH_WIFI_CONNECTING, + PERIPH_WIFI_CONNECTED, + PERIPH_WIFI_DISCONNECTED, + PERIPH_WIFI_SETTING, + PERIPH_WIFI_CONFIG_DONE, + PERIPH_WIFI_CONFIG_ERROR, + PERIPH_WIFI_ERROR, +} periph_wifi_state_t; - /** - * @brief Wi-Fi setup mode type - */ - typedef enum - { - WIFI_CONFIG_ESPTOUCH, /*!< Using smartconfig with ESPTOUCH protocol */ - WIFI_CONFIG_AIRKISS, /*!< Using smartconfig with AIRKISS protocol */ - WIFI_CONFIG_ESPTOUCH_AIRKISS, /*!< Using smartconfig with ESPTOUCH_AIRKISS - protocol */ - WIFI_CONFIG_WPS, /*!< Using WPS (not support) */ - WIFI_CONFIG_BLUEFI, /*!< Using BLUEFI*/ - WIFI_CONFIG_WEB, /*!< Using HTTP Server (not support) */ - } periph_wifi_config_mode_t; +/** + * @brief Wi-Fi setup mode type + */ +typedef enum { + WIFI_CONFIG_ESPTOUCH, /*!< Using smartconfig with ESPTOUCH protocol */ + WIFI_CONFIG_AIRKISS, /*!< Using smartconfig with AIRKISS protocol */ + WIFI_CONFIG_ESPTOUCH_AIRKISS, /*!< Using smartconfig with ESPTOUCH_AIRKISS + protocol */ + WIFI_CONFIG_WPS, /*!< Using WPS (not support) */ + WIFI_CONFIG_BLUEFI, /*!< Using BLUEFI*/ + WIFI_CONFIG_WEB, /*!< Using HTTP Server (not support) */ +} periph_wifi_config_mode_t; - /** - * @brief The WPA2 enterprise peripheral configuration - */ - typedef struct - { - bool diasble_wpa2_e; /*!< Disable wpa2 enterprise */ - int eap_method; /*!< TLS: 0, PEAP: 1, TTLS: 2 */ - char *ca_pem_start; /*!< binary wpa2 ca pem start */ - char *ca_pem_end; /*!< binary wpa2 ca pem end */ - char *wpa2_e_cert_start; /*!< binary wpa2 cert start */ - char *wpa2_e_cert_end; /*!< binary wpa2 cert end */ - char *wpa2_e_key_start; /*!< binary wpa2 key start */ - char *wpa2_e_key_end; /*!< binary wpa2 key end */ - const char *eap_id; /*!< Identity in phase 1 of EAP procedure */ - const char *eap_username; /*!< Username for EAP method (PEAP and TTLS) */ - const char *eap_password; /*!< Password for EAP method (PEAP and TTLS) */ - } periph_wpa2_enterprise_cfg_t; +/** + * @brief The WPA2 enterprise peripheral configuration + */ +typedef struct { + bool diasble_wpa2_e; /*!< Disable wpa2 enterprise */ + int eap_method; /*!< TLS: 0, PEAP: 1, TTLS: 2 */ + char *ca_pem_start; /*!< binary wpa2 ca pem start */ + char *ca_pem_end; /*!< binary wpa2 ca pem end */ + char *wpa2_e_cert_start; /*!< binary wpa2 cert start */ + char *wpa2_e_cert_end; /*!< binary wpa2 cert end */ + char *wpa2_e_key_start; /*!< binary wpa2 key start */ + char *wpa2_e_key_end; /*!< binary wpa2 key end */ + const char *eap_id; /*!< Identity in phase 1 of EAP procedure */ + const char *eap_username; /*!< Username for EAP method (PEAP and TTLS) */ + const char *eap_password; /*!< Password for EAP method (PEAP and TTLS) */ +} periph_wpa2_enterprise_cfg_t; - /** - * @brief The Wi-Fi peripheral configuration - */ - typedef struct - { - bool disable_auto_reconnect; /*!< Disable Wi-Fi auto reconnect */ - int reconnect_timeout_ms; /*!< The reconnect timeout after disconnected - from Wi-Fi network */ - const char *ssid; /*!< SSID of target AP */ - const char *password; /*!< password of target AP */ - periph_wpa2_enterprise_cfg_t wpa2_e_cfg; /*!< wpa2 enterprise config */ - } periph_wifi_cfg_t; +/** + * @brief The Wi-Fi peripheral configuration + */ +typedef struct { + bool disable_auto_reconnect; /*!< Disable Wi-Fi auto reconnect */ + int reconnect_timeout_ms; /*!< The reconnect timeout after disconnected from + Wi-Fi network */ + const char *ssid; /*!< SSID of target AP */ + const char *password; /*!< password of target AP */ + periph_wpa2_enterprise_cfg_t wpa2_e_cfg; /*!< wpa2 enterprise config */ +} periph_wifi_cfg_t; - /** - * @brief Create the wifi peripheral handle for esp_peripherals - * - * @note The handle was created by this function automatically destroy - * when `esp_periph_destroy` is called - * - * @param config The configuration - * - * @return The esp peripheral handle - */ - esp_periph_handle_t periph_wifi_init (periph_wifi_cfg_t *config); +/** + * @brief Create the wifi peripheral handle for esp_peripherals + * + * @note The handle was created by this function automatically destroy + * when `esp_periph_destroy` is called + * + * @param config The configuration + * + * @return The esp peripheral handle + */ +esp_periph_handle_t periph_wifi_init(periph_wifi_cfg_t *config); - /** - * @brief This function will block current thread (in `tick_to_wait` - * tick) and wait until ESP32 connected to the Wi-Fi network, and got ip - * - * @param[in] periph The periph - * @param[in] tick_to_wait The tick to wait - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t periph_wifi_wait_for_connected (esp_periph_handle_t periph, - TickType_t tick_to_wait); +/** + * @brief This function will block current thread (in `tick_to_wait` tick) + * and wait until ESP32 connected to the Wi-Fi network, and got ip + * + * @param[in] periph The periph + * @param[in] tick_to_wait The tick to wait + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t periph_wifi_wait_for_connected(esp_periph_handle_t periph, + TickType_t tick_to_wait); - /** - * @brief Check the Wi-Fi connection status - * - * @param[in] periph The periph - * - * @return Wi-Fi network status - */ - periph_wifi_state_t periph_wifi_is_connected (esp_periph_handle_t periph); +/** + * @brief Check the Wi-Fi connection status + * + * @param[in] periph The periph + * + * @return Wi-Fi network status + */ +periph_wifi_state_t periph_wifi_is_connected(esp_periph_handle_t periph); - /** - * @brief Start Wi-Fi network setup in `mode` - * - * @param[in] periph The periph - * @param[in] mode The mode - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t periph_wifi_config_start (esp_periph_handle_t periph, - periph_wifi_config_mode_t mode); +/** + * @brief Set Wi-Fi listen interval for ESP32 station to receive beacon + * + * @param[in] periph The wifi periph + * @param[in] interval listen interval. units: AP beacon intervals(see BcnInt, + * default: 100ms) + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t esp_wifi_set_listen_interval(esp_periph_handle_t periph, + int interval); - /** - * @brief Wait for Wi-Fi setup done - * @param[in] periph The periph - * @param[in] tick_to_wait The tick to wait - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t periph_wifi_config_wait_done (esp_periph_handle_t periph, - TickType_t tick_to_wait); +/** + * @brief Start Wi-Fi network setup in `mode` + * + * @param[in] periph The periph + * @param[in] mode The mode + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t periph_wifi_config_start(esp_periph_handle_t periph, + periph_wifi_config_mode_t mode); + +/** + * @brief Wait for Wi-Fi setup done + * @param[in] periph The periph + * @param[in] tick_to_wait The tick to wait + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t periph_wifi_config_wait_done(esp_periph_handle_t periph, + TickType_t tick_to_wait); #ifdef __cplusplus } diff --git a/components/esp_peripherals/include/periph_ws2812.h b/components/esp_peripherals/include/periph_ws2812.h index 0a39f8cf..c96f026b 100644 --- a/components/esp_peripherals/include/periph_ws2812.h +++ b/components/esp_peripherals/include/periph_ws2812.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #ifndef _PERIPH_WS2812_DRIVER_H @@ -29,98 +29,91 @@ #include "esp_peripherals.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - /** - * @brief The RGB peripheral value - */ - typedef uint32_t periph_rgb_value; +/** + * @brief The RGB peripheral value + */ +typedef uint32_t periph_rgb_value; #define make_rgb_value(x, y, z) (((int)(z) << 16) + ((int)(y) << 8) + (x)) -#define LED2812_COLOR_BLACK make_rgb_value (0, 0, 0) -#define LED2812_COLOR_BLUE make_rgb_value (0, 0, 255) -#define LED2812_COLOR_GREEN make_rgb_value (0, 255, 0) -#define LED2812_COLOR_CYAN make_rgb_value (0, 255, 255) -#define LED2812_COLOR_RED make_rgb_value (255, 0, 0) -#define LED2812_COLOR_PURPLE make_rgb_value (255, 0, 255) -#define LED2812_COLOR_YELLOW make_rgb_value (255, 255, 0) -#define LED2812_COLOR_WHITE make_rgb_value (255, 255, 255) -#define LED2812_COLOR_ORANGE make_rgb_value (255, 165, 0) +#define LED2812_COLOR_BLACK make_rgb_value(0, 0, 0) +#define LED2812_COLOR_BLUE make_rgb_value(0, 0, 255) +#define LED2812_COLOR_GREEN make_rgb_value(0, 255, 0) +#define LED2812_COLOR_CYAN make_rgb_value(0, 255, 255) +#define LED2812_COLOR_RED make_rgb_value(255, 0, 0) +#define LED2812_COLOR_PURPLE make_rgb_value(255, 0, 255) +#define LED2812_COLOR_YELLOW make_rgb_value(255, 255, 0) +#define LED2812_COLOR_WHITE make_rgb_value(255, 255, 255) +#define LED2812_COLOR_ORANGE make_rgb_value(255, 165, 0) - /** - * @brief The ws2812 peripheral configuration - */ - typedef struct - { - int gpio_num; /*!< The GPIO number of ws2812*/ - int led_num; /*!< The number of ws2812 */ - } periph_ws2812_cfg_t; +/** + * @brief The ws2812 peripheral configuration + */ +typedef struct { + int gpio_num; /*!< The GPIO number of ws2812*/ + int led_num; /*!< The number of ws2812 */ +} periph_ws2812_cfg_t; - /** - * @brief The periph ws2812 mode - */ - typedef enum - { - PERIPH_WS2812_BLINK, - PERIPH_WS2812_FADE, - PERIPH_WS2812_ONE, - } periph_ws2812_mode_t; +/** + * @brief The periph ws2812 mode + */ +typedef enum { + PERIPH_WS2812_BLINK, + PERIPH_WS2812_FADE, + PERIPH_WS2812_ONE, +} periph_ws2812_mode_t; - /** - * @brief The periph ws2812 control config - */ - typedef struct periph_ws2812_ctrl_cfg - { - periph_rgb_value color; /*!< The RGB value */ - uint32_t - time_on_ms; /*!< The time on milliseconds, suggest min is 100 ms */ - uint32_t - time_off_ms; /*!< The time off milliseconds, suggest min is 100 ms */ - uint32_t loop; /*!< The times offloop */ - periph_ws2812_mode_t - mode; /*!< ws2812 mode (setting color, blink or fade) */ - } periph_ws2812_ctrl_cfg_t; +/** + * @brief The periph ws2812 control config + */ +typedef struct periph_ws2812_ctrl_cfg { + periph_rgb_value color; /*!< The RGB value */ + uint32_t time_on_ms; /*!< The time on milliseconds, suggest min is 100 ms */ + uint32_t time_off_ms; /*!< The time off milliseconds, suggest min is 100 ms */ + uint32_t loop; /*!< The times offloop */ + periph_ws2812_mode_t mode; /*!< ws2812 mode (setting color, blink or fade) */ +} periph_ws2812_ctrl_cfg_t; - /** - * @brief Create the ws2812 peripheral handle for esp_peripherals - * - * @note The handle was created by this function automatically destroy - * when `esp_periph_destroy` is called - * - * @param config The configuration - * - * @return The esp peripheral handle - */ - esp_periph_handle_t periph_ws2812_init (periph_ws2812_cfg_t *config); +/** + * @brief Create the ws2812 peripheral handle for esp_peripherals + * + * @note The handle was created by this function automatically destroy + * when `esp_periph_destroy` is called + * + * @param config The configuration + * + * @return The esp peripheral handle + */ +esp_periph_handle_t periph_ws2812_init(periph_ws2812_cfg_t *config); - /** - * @brief Control ws2812 Peripheral - * - * @param[in] periph The ws2812 periph - * @param[in] control_cfg The ws2812 color config - * @param[in] ctx The ctx - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t periph_ws2812_control (esp_periph_handle_t periph, - periph_ws2812_ctrl_cfg_t *control_cfg, - void *ctx); +/** + * @brief Control ws2812 Peripheral + * + * @param[in] periph The ws2812 periph + * @param[in] control_cfg The ws2812 color config + * @param[in] ctx The ctx + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t periph_ws2812_control(esp_periph_handle_t periph, + periph_ws2812_ctrl_cfg_t *control_cfg, + void *ctx); - /** - * @brief Stop ws2812 - * - * @param[in] periph The periph - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t periph_ws2812_stop (esp_periph_handle_t periph); +/** + * @brief Stop ws2812 + * + * @param[in] periph The periph + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t periph_ws2812_stop(esp_periph_handle_t periph); #ifdef __cplusplus } diff --git a/components/esp_peripherals/lib/IS31FL3216/IS31FL3216.c b/components/esp_peripherals/lib/IS31FL3216/IS31FL3216.c index 1572ecdc..b32a7627 100644 --- a/components/esp_peripherals/lib/IS31FL3216/IS31FL3216.c +++ b/components/esp_peripherals/lib/IS31FL3216/IS31FL3216.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on ESPRESSIF SYSTEMS products only, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,19 +18,21 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "IS31FL3216.h" + +#include +#include + #include "audio_mem.h" #include "driver/i2c.h" #include "esp_log.h" #include "i2c_bus.h" -#include -#include #define IS31FL3216_WRITE_BIT 0x00 @@ -41,367 +43,298 @@ #define IS31FL3216_ADDRESS 0xE8 /*!< I2C Addr*/ -#define IS31_ERROR_CHECK(con) \ - if (!(con)) \ - { \ - ESP_LOGE (TAG, "err line: %d", __LINE__); \ - } -#define IS31_PARAM_CHECK(con) \ - if (!(con)) \ - { \ - ESP_LOGE (TAG, "Parameter error: %d", __LINE__); \ - } -#define IS31_CHECK_I2C_RES(res) \ - if (ret == ESP_FAIL) \ - { \ - ESP_LOGE (TAG, "Is31fl3216[%s]: FAIL\n", __FUNCTION__); \ - } \ - else if (ret == ESP_ERR_TIMEOUT) \ - { \ - ESP_LOGE (TAG, "Is31fl3216[%s]: TIMEOUT\n", __FUNCTION__); \ - } -typedef struct -{ +#define IS31_ERROR_CHECK(con) \ + if (!(con)) { \ + ESP_LOGE(TAG, "err line: %d", __LINE__); \ + } +#define IS31_PARAM_CHECK(con) \ + if (!(con)) { \ + ESP_LOGE(TAG, "Parameter error: %d", __LINE__); \ + } +#define IS31_CHECK_I2C_RES(res) \ + if (ret == ESP_FAIL) { \ + ESP_LOGE(TAG, "Is31fl3216[%s]: FAIL\n", __FUNCTION__); \ + } else if (ret == ESP_ERR_TIMEOUT) { \ + ESP_LOGE(TAG, "Is31fl3216[%s]: TIMEOUT\n", __FUNCTION__); \ + } +typedef struct { i2c_bus_handle_t bus; uint16_t addr; } is31fl3216_dev_t; -uint8_t Is31Value[10] - = { 0x80, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +uint8_t Is31Value[10] = {0x80, 0x00, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00}; static char *TAG = "IS31"; /** * @brief set software shutdown mode */ -static esp_err_t -is31fl3216_write_reg (is31fl3216_handle_t handle, is31fl3216_reg_t regAddr, - uint8_t *data, uint8_t data_num) -{ - IS31_PARAM_CHECK (NULL != data); +static esp_err_t is31fl3216_write_reg(is31fl3216_handle_t handle, + is31fl3216_reg_t regAddr, uint8_t *data, + uint8_t data_num) { + IS31_PARAM_CHECK(NULL != data); is31fl3216_dev_t *dev = (is31fl3216_dev_t *)handle; - esp_err_t ret = i2c_bus_write_bytes ( - dev->bus, IS31FL3216_ADDRESS | IS31FL3216_WRITE_BIT, (uint8_t *)®Addr, - 1, data, data_num); + esp_err_t ret = + i2c_bus_write_bytes(dev->bus, IS31FL3216_ADDRESS | IS31FL3216_WRITE_BIT, + (uint8_t *)®Addr, 1, data, data_num); return ret; } /** * @brief change channels PWM duty cycle data register */ -static esp_err_t -is31fl3218S_channel_duty_by_bits (is31fl3216_handle_t handle, uint32_t by_bits, - uint8_t duty) -{ - for (int i = 0; i < IS31FL3216_CH_NUM_MAX; i++) - { - if ((by_bits >> i) & 0x1) - { - esp_err_t ret = is31fl3216_write_reg ( - handle, IS31FL3216_REG_PWM_16 + (IS31FL3216_CH_NUM_MAX - i - 1), - &duty, 1); - if (ret == ESP_OK) - { - // PASS - } - else - { - IS31_CHECK_I2C_RES (ret); - return ret; - } - } +static esp_err_t is31fl3218S_channel_duty_by_bits(is31fl3216_handle_t handle, + uint32_t by_bits, + uint8_t duty) { + for (int i = 0; i < IS31FL3216_CH_NUM_MAX; i++) { + if ((by_bits >> i) & 0x1) { + esp_err_t ret = is31fl3216_write_reg( + handle, IS31FL3216_REG_PWM_16 + (IS31FL3216_CH_NUM_MAX - i - 1), + &duty, 1); + if (ret == ESP_OK) { + // PASS + } else { + IS31_CHECK_I2C_RES(ret); + return ret; + } } + } return ESP_OK; } /** * @brief Load PWM Register and LED Control Registers data */ -esp_err_t -is31fl3216_update_reg (is31fl3216_handle_t handle) -{ - IS31_PARAM_CHECK (NULL != handle); +esp_err_t is31fl3216_update_reg(is31fl3216_handle_t handle) { + IS31_PARAM_CHECK(NULL != handle); uint8_t m = 0; - return is31fl3216_write_reg (handle, IS31FL3216_REG_UPDATE, &m, 1); + return is31fl3216_write_reg(handle, IS31FL3216_REG_UPDATE, &m, 1); } /** * @brief set software shutdown mode */ -esp_err_t -is31fl3216_power (is31fl3216_handle_t handle, is31fl3216_pwr_t mode) -{ - IS31_PARAM_CHECK (NULL != handle); - if (IS31FL3216_PWR_SHUTDOWN == mode) - { - Is31Value[IS31FL3216_REG_CONFIG] - = (Is31Value[IS31FL3216_REG_CONFIG] & (~(1 << 7))) | (1 << 7); - } - else if (IS31FL3216_PWR_NORMAL == mode) - { - Is31Value[IS31FL3216_REG_CONFIG] - = (Is31Value[IS31FL3216_REG_CONFIG] & (~(1 << 7))); - } - else - { - return ESP_FAIL; - } - esp_err_t ret - = is31fl3216_write_reg (handle, IS31FL3216_REG_CONFIG, - (uint8_t *)&Is31Value[IS31FL3216_REG_CONFIG], 1); +esp_err_t is31fl3216_power(is31fl3216_handle_t handle, is31fl3216_pwr_t mode) { + IS31_PARAM_CHECK(NULL != handle); + if (IS31FL3216_PWR_SHUTDOWN == mode) { + Is31Value[IS31FL3216_REG_CONFIG] = + (Is31Value[IS31FL3216_REG_CONFIG] & (~(1 << 7))) | (1 << 7); + } else if (IS31FL3216_PWR_NORMAL == mode) { + Is31Value[IS31FL3216_REG_CONFIG] = + (Is31Value[IS31FL3216_REG_CONFIG] & (~(1 << 7))); + } else { + return ESP_FAIL; + } + esp_err_t ret = + is31fl3216_write_reg(handle, IS31FL3216_REG_CONFIG, + (uint8_t *)&Is31Value[IS31FL3216_REG_CONFIG], 1); return ret; } -esp_err_t -is31fl3216_work_mode_set (is31fl3216_handle_t handle, - is31fl3216_work_mode_t mode) -{ - IS31_PARAM_CHECK (NULL != handle); - if (IS31FL3216_MODE_PWM == mode) - { - Is31Value[IS31FL3216_REG_CONFIG] - = (Is31Value[IS31FL3216_REG_CONFIG] & (~(3 << 5))); - } - else if (IS31FL3216_MODE_AUTO_FRAME == mode) - { - Is31Value[IS31FL3216_REG_CONFIG] - = (Is31Value[IS31FL3216_REG_CONFIG] & (~(3 << 5))) | (1 << 5); - } - else if (IS31FL3216_MODE_FRAME == mode) - { - Is31Value[IS31FL3216_REG_CONFIG] - = (Is31Value[IS31FL3216_REG_CONFIG] & (~(3 << 5))) | (2 << 5); - } - else - { - return ESP_FAIL; - } - esp_err_t ret - = is31fl3216_write_reg (handle, IS31FL3216_REG_CONFIG, - (uint8_t *)&Is31Value[IS31FL3216_REG_CONFIG], 1); +esp_err_t is31fl3216_work_mode_set(is31fl3216_handle_t handle, + is31fl3216_work_mode_t mode) { + IS31_PARAM_CHECK(NULL != handle); + if (IS31FL3216_MODE_PWM == mode) { + Is31Value[IS31FL3216_REG_CONFIG] = + (Is31Value[IS31FL3216_REG_CONFIG] & (~(3 << 5))); + } else if (IS31FL3216_MODE_AUTO_FRAME == mode) { + Is31Value[IS31FL3216_REG_CONFIG] = + (Is31Value[IS31FL3216_REG_CONFIG] & (~(3 << 5))) | (1 << 5); + } else if (IS31FL3216_MODE_FRAME == mode) { + Is31Value[IS31FL3216_REG_CONFIG] = + (Is31Value[IS31FL3216_REG_CONFIG] & (~(3 << 5))) | (2 << 5); + } else { + return ESP_FAIL; + } + esp_err_t ret = + is31fl3216_write_reg(handle, IS31FL3216_REG_CONFIG, + (uint8_t *)&Is31Value[IS31FL3216_REG_CONFIG], 1); return ret; } /** * @brief change channels PWM duty cycle data register */ -esp_err_t -is31fl3216_ch_duty_set (is31fl3216_handle_t handle, is31_pwm_channel_t ch_bits, - uint8_t duty) -{ +esp_err_t is31fl3216_ch_duty_set(is31fl3216_handle_t handle, + is31_pwm_channel_t ch_bits, uint8_t duty) { esp_err_t ret = ESP_OK; - IS31_PARAM_CHECK (NULL != handle); - ret = is31fl3218S_channel_duty_by_bits (handle, ch_bits, duty); - if (ret != ESP_OK) - { - IS31_CHECK_I2C_RES (ret); - return ret; - } - ret = is31fl3216_update_reg (handle); - if (ret != ESP_OK) - { - IS31_CHECK_I2C_RES (ret); - return ret; - } + IS31_PARAM_CHECK(NULL != handle); + ret = is31fl3218S_channel_duty_by_bits(handle, ch_bits, duty); + if (ret != ESP_OK) { + IS31_CHECK_I2C_RES(ret); + return ret; + } + ret = is31fl3216_update_reg(handle); + if (ret != ESP_OK) { + IS31_CHECK_I2C_RES(ret); + return ret; + } return ESP_OK; } /** * @brief change channels PWM duty cycle data register */ -esp_err_t -is31fl3216_ch_enable (is31fl3216_handle_t handle, is31_pwm_channel_t ch_bits) -{ +esp_err_t is31fl3216_ch_enable(is31fl3216_handle_t handle, + is31_pwm_channel_t ch_bits) { esp_err_t ret = ESP_OK; - IS31_PARAM_CHECK (NULL != handle); + IS31_PARAM_CHECK(NULL != handle); uint16_t value = 0; - for (int i = 0; i < IS31FL3216_CH_NUM_MAX; ++i) - { - if ((ch_bits >> i) & 0x01) - { - value |= (1 << i); - } + for (int i = 0; i < IS31FL3216_CH_NUM_MAX; ++i) { + if ((ch_bits >> i) & 0x01) { + value |= (1 << i); } + } Is31Value[IS31FL3216_REG_LED_CTRL_H] |= value >> 8; Is31Value[IS31FL3216_REG_LED_CTRL_L] |= value; - ret = is31fl3216_write_reg (handle, IS31FL3216_REG_LED_CTRL_H, - &Is31Value[IS31FL3216_REG_LED_CTRL_H], 2); + ret = is31fl3216_write_reg(handle, IS31FL3216_REG_LED_CTRL_H, + &Is31Value[IS31FL3216_REG_LED_CTRL_H], 2); return ret; } /** * @brief change channels PWM duty cycle data register */ -esp_err_t -is31fl3216_ch_disable (is31fl3216_handle_t handle, is31_pwm_channel_t ch_bits) -{ +esp_err_t is31fl3216_ch_disable(is31fl3216_handle_t handle, + is31_pwm_channel_t ch_bits) { esp_err_t ret = ESP_OK; - IS31_PARAM_CHECK (NULL != handle); + IS31_PARAM_CHECK(NULL != handle); uint16_t value = ((uint16_t)Is31Value[IS31FL3216_REG_LED_CTRL_H]) << 8; value |= Is31Value[IS31FL3216_REG_LED_CTRL_L]; - for (int i = 0; i < IS31FL3216_CH_NUM_MAX; ++i) - { - if ((ch_bits >> i) & 0x01) - { - value = value & (~(1 << i)); - } + for (int i = 0; i < IS31FL3216_CH_NUM_MAX; ++i) { + if ((ch_bits >> i) & 0x01) { + value = value & (~(1 << i)); } + } Is31Value[IS31FL3216_REG_LED_CTRL_H] = value >> 8; Is31Value[IS31FL3216_REG_LED_CTRL_L] = value; - ret = is31fl3216_write_reg (handle, IS31FL3216_REG_LED_CTRL_H, - &Is31Value[IS31FL3216_REG_LED_CTRL_H], 2); + ret = is31fl3216_write_reg(handle, IS31FL3216_REG_LED_CTRL_H, + &Is31Value[IS31FL3216_REG_LED_CTRL_H], 2); return ret; } -esp_err_t -is31fl3216_cur_mode_set (is31fl3216_handle_t handle, - is31fl3216_cur_mode_t mode) -{ - IS31_PARAM_CHECK (NULL != handle); - if (IS31FL3216_CUR_MODE_REXT == mode) - { - Is31Value[IS31FL3216_REG_CONFIG] - = (Is31Value[IS31FL3216_REG_CONFIG] & (~(1 << 4))); - } - else if (IS31FL3216_CUR_MODE_AUDIO == mode) - { - Is31Value[IS31FL3216_REG_CONFIG] - = (Is31Value[IS31FL3216_REG_CONFIG] & (~(1 << 4))) | (1 << 4); - } - else - { - return ESP_FAIL; - } - esp_err_t ret - = is31fl3216_write_reg (handle, IS31FL3216_REG_CONFIG, - (uint8_t *)&Is31Value[IS31FL3216_REG_CONFIG], 1); +esp_err_t is31fl3216_cur_mode_set(is31fl3216_handle_t handle, + is31fl3216_cur_mode_t mode) { + IS31_PARAM_CHECK(NULL != handle); + if (IS31FL3216_CUR_MODE_REXT == mode) { + Is31Value[IS31FL3216_REG_CONFIG] = + (Is31Value[IS31FL3216_REG_CONFIG] & (~(1 << 4))); + } else if (IS31FL3216_CUR_MODE_AUDIO == mode) { + Is31Value[IS31FL3216_REG_CONFIG] = + (Is31Value[IS31FL3216_REG_CONFIG] & (~(1 << 4))) | (1 << 4); + } else { + return ESP_FAIL; + } + esp_err_t ret = + is31fl3216_write_reg(handle, IS31FL3216_REG_CONFIG, + (uint8_t *)&Is31Value[IS31FL3216_REG_CONFIG], 1); return ret; } -esp_err_t -is31fl3216_cur_value_set (is31fl3216_handle_t handle, - is31fl3216_cur_value_t value) -{ - IS31_PARAM_CHECK (NULL != handle); - Is31Value[IS31FL3216_REG_LED_EFFECT] - = (Is31Value[IS31FL3216_REG_LED_EFFECT] & (~(7 << 4))) | value << 4; - esp_err_t ret - = is31fl3216_write_reg (handle, IS31FL3216_REG_LED_EFFECT, - &Is31Value[IS31FL3216_REG_LED_EFFECT], 1); +esp_err_t is31fl3216_cur_value_set(is31fl3216_handle_t handle, + is31fl3216_cur_value_t value) { + IS31_PARAM_CHECK(NULL != handle); + Is31Value[IS31FL3216_REG_LED_EFFECT] = + (Is31Value[IS31FL3216_REG_LED_EFFECT] & (~(7 << 4))) | value << 4; + esp_err_t ret = + is31fl3216_write_reg(handle, IS31FL3216_REG_LED_EFFECT, + &Is31Value[IS31FL3216_REG_LED_EFFECT], 1); return ret; } -esp_err_t -is31fl3216_ags_value_set (is31fl3216_handle_t handle, - is31fl3216_ags_value_t value) -{ - IS31_PARAM_CHECK (NULL != handle); - Is31Value[IS31FL3216_REG_LED_EFFECT] - = (Is31Value[IS31FL3216_REG_LED_EFFECT] & (~(7 << 0))) | value << 0; - esp_err_t ret - = is31fl3216_write_reg (handle, IS31FL3216_REG_LED_EFFECT, - &Is31Value[IS31FL3216_REG_LED_EFFECT], 1); +esp_err_t is31fl3216_ags_value_set(is31fl3216_handle_t handle, + is31fl3216_ags_value_t value) { + IS31_PARAM_CHECK(NULL != handle); + Is31Value[IS31FL3216_REG_LED_EFFECT] = + (Is31Value[IS31FL3216_REG_LED_EFFECT] & (~(7 << 0))) | value << 0; + esp_err_t ret = + is31fl3216_write_reg(handle, IS31FL3216_REG_LED_EFFECT, + &Is31Value[IS31FL3216_REG_LED_EFFECT], 1); return ret; } -esp_err_t -is31fl3216_agc_cfg (is31fl3216_handle_t handle, uint32_t en) -{ - IS31_PARAM_CHECK (NULL != handle); - Is31Value[IS31FL3216_REG_LED_EFFECT] - = (Is31Value[IS31FL3216_REG_LED_EFFECT] & (~(1 << 3))) | en << 3; - esp_err_t ret - = is31fl3216_write_reg (handle, IS31FL3216_REG_LED_EFFECT, - &Is31Value[IS31FL3216_REG_LED_EFFECT], 1); +esp_err_t is31fl3216_agc_cfg(is31fl3216_handle_t handle, uint32_t en) { + IS31_PARAM_CHECK(NULL != handle); + Is31Value[IS31FL3216_REG_LED_EFFECT] = + (Is31Value[IS31FL3216_REG_LED_EFFECT] & (~(1 << 3))) | en << 3; + esp_err_t ret = + is31fl3216_write_reg(handle, IS31FL3216_REG_LED_EFFECT, + &Is31Value[IS31FL3216_REG_LED_EFFECT], 1); return ret; } -esp_err_t -is31fl3216_cascade_mode_set (is31fl3216_handle_t handle, - is31fl3216_cascade_mode_t mode) -{ - IS31_PARAM_CHECK (NULL != handle); - Is31Value[IS31FL3216_REG_LED_EFFECT] - = (Is31Value[IS31FL3216_REG_LED_EFFECT] & (~(1 << 7))) | mode << 7; - esp_err_t ret - = is31fl3216_write_reg (handle, IS31FL3216_REG_LED_EFFECT, - &Is31Value[IS31FL3216_REG_LED_EFFECT], 1); +esp_err_t is31fl3216_cascade_mode_set(is31fl3216_handle_t handle, + is31fl3216_cascade_mode_t mode) { + IS31_PARAM_CHECK(NULL != handle); + Is31Value[IS31FL3216_REG_LED_EFFECT] = + (Is31Value[IS31FL3216_REG_LED_EFFECT] & (~(1 << 7))) | mode << 7; + esp_err_t ret = + is31fl3216_write_reg(handle, IS31FL3216_REG_LED_EFFECT, + &Is31Value[IS31FL3216_REG_LED_EFFECT], 1); return ret; } -esp_err_t -is31fl3216_sample_rate_set (is31fl3216_handle_t handle, uint32_t value) -{ - IS31_PARAM_CHECK (NULL != handle); +esp_err_t is31fl3216_sample_rate_set(is31fl3216_handle_t handle, + uint32_t value) { + IS31_PARAM_CHECK(NULL != handle); uint8_t dat = value; - esp_err_t ret - = is31fl3216_write_reg (handle, IS31FL3216_REG_ADC_RATE, &dat, 1); + esp_err_t ret = + is31fl3216_write_reg(handle, IS31FL3216_REG_ADC_RATE, &dat, 1); return ret; } -esp_err_t -is31fl3216_frame_time_set (is31fl3216_handle_t handle, - is31fl3216_delay_time_t time) -{ - IS31_PARAM_CHECK (NULL != handle); +esp_err_t is31fl3216_frame_time_set(is31fl3216_handle_t handle, + is31fl3216_delay_time_t time) { + IS31_PARAM_CHECK(NULL != handle); uint8_t dat = time << 5; - esp_err_t ret - = is31fl3216_write_reg (handle, IS31FL3216_REG_FRAME_DELAY, &dat, 1); + esp_err_t ret = + is31fl3216_write_reg(handle, IS31FL3216_REG_FRAME_DELAY, &dat, 1); return ret; } -esp_err_t -is31fl3216_first_frame_set (is31fl3216_handle_t handle, uint32_t frame) -{ - IS31_PARAM_CHECK (NULL != handle); +esp_err_t is31fl3216_first_frame_set(is31fl3216_handle_t handle, + uint32_t frame) { + IS31_PARAM_CHECK(NULL != handle); uint8_t dat = frame << 5; - esp_err_t ret - = is31fl3216_write_reg (handle, IS31FL3216_REG_FRAME_START, &dat, 1); + esp_err_t ret = + is31fl3216_write_reg(handle, IS31FL3216_REG_FRAME_START, &dat, 1); return ret; } -esp_err_t -is31fl3216_frame_value_set (is31fl3216_handle_t handle, uint32_t num, - uint8_t *data, uint32_t len) -{ - IS31_PARAM_CHECK (NULL != handle); - IS31_PARAM_CHECK (NULL != data); +esp_err_t is31fl3216_frame_value_set(is31fl3216_handle_t handle, uint32_t num, + uint8_t *data, uint32_t len) { + IS31_PARAM_CHECK(NULL != handle); + IS31_PARAM_CHECK(NULL != data); uint8_t startAddr = IS31FL3216_REG_FRAME1_CTRL + (num - 1) * 18; - esp_err_t ret = is31fl3216_write_reg (handle, startAddr, data, len); + esp_err_t ret = is31fl3216_write_reg(handle, startAddr, data, len); return ret; } -esp_err_t -is31fl3216_reset (is31fl3216_handle_t handle) -{ +esp_err_t is31fl3216_reset(is31fl3216_handle_t handle) { esp_err_t ret = ESP_OK; uint8_t dat = 0x00; - IS31_PARAM_CHECK (NULL != handle); - ret = is31fl3216_power (handle, IS31FL3216_PWR_NORMAL); - if (ret) - { - return ret; - } - for (int i = 0; i < IS31FL3216_CH_NUM_MAX; ++i) - { - ret = is31fl3216_ch_duty_set (handle, 1 << i, 0); - if (ret) - { - return ret; - } - } - ret = is31fl3216_ch_enable (handle, IS31FL3216_CH_ALL); - if (ret) - { + IS31_PARAM_CHECK(NULL != handle); + ret = is31fl3216_power(handle, IS31FL3216_PWR_NORMAL); + if (ret) { + return ret; + } + for (int i = 0; i < IS31FL3216_CH_NUM_MAX; ++i) { + ret = is31fl3216_ch_duty_set(handle, 1 << i, 0); + if (ret) { return ret; } + } + ret = is31fl3216_ch_enable(handle, IS31FL3216_CH_ALL); + if (ret) { + return ret; + } - ret = is31fl3216_write_reg (handle, IS31FL3216_REG_LED_EFFECT, &dat, 1); - if (ret) - { - return ret; - } - ret = is31fl3216_write_reg (handle, IS31FL3216_REG_CH_CONFIG, &dat, 1); + ret = is31fl3216_write_reg(handle, IS31FL3216_REG_LED_EFFECT, &dat, 1); + if (ret) { + return ret; + } + ret = is31fl3216_write_reg(handle, IS31FL3216_REG_CH_CONFIG, &dat, 1); return ret; } @@ -409,37 +342,32 @@ is31fl3216_reset (is31fl3216_handle_t handle) * @brief i2c master initialization */ -is31fl3216_handle_t -is31fl3216_init (void) -{ - i2c_config_t conf = { 0 }; +is31fl3216_handle_t is31fl3216_init(void) { + i2c_config_t conf = {0}; conf.mode = I2C_MODE_MASTER; conf.sda_io_num = I2C_MASTER_SDA_IO; conf.sda_pullup_en = GPIO_PULLUP_ENABLE; conf.scl_io_num = I2C_MASTER_SCL_IO; conf.scl_pullup_en = GPIO_PULLUP_ENABLE; conf.master.clk_speed = I2C_MASTER_FREQ_HZ; - is31fl3216_dev_t *led - = (is31fl3216_dev_t *)audio_calloc (1, sizeof (is31fl3216_dev_t)); - led->bus = i2c_bus_create (I2C_MASTER_NUM, &conf); + is31fl3216_dev_t *led = + (is31fl3216_dev_t *)audio_calloc(1, sizeof(is31fl3216_dev_t)); + led->bus = i2c_bus_create(I2C_MASTER_NUM, &conf); led->addr = IS31FL3216_ADDRESS; - IS31_ERROR_CHECK (ESP_OK == is31fl3216_power (led, IS31FL3216_PWR_NORMAL)); - IS31_ERROR_CHECK ( - ESP_OK == is31fl3216_cur_mode_set (led, IS31FL3216_CUR_MODE_REXT)); - IS31_ERROR_CHECK (ESP_OK - == is31fl3216_cur_value_set (led, IS31FL3216_CUR_0_75)); + IS31_ERROR_CHECK(ESP_OK == is31fl3216_power(led, IS31FL3216_PWR_NORMAL)); + IS31_ERROR_CHECK(ESP_OK == + is31fl3216_cur_mode_set(led, IS31FL3216_CUR_MODE_REXT)); + IS31_ERROR_CHECK(ESP_OK == + is31fl3216_cur_value_set(led, IS31FL3216_CUR_0_75)); return (is31fl3216_handle_t)led; } -esp_err_t -is31fl3216_deinit (is31fl3216_handle_t handle) -{ +esp_err_t is31fl3216_deinit(is31fl3216_handle_t handle) { is31fl3216_dev_t *dev = (is31fl3216_dev_t *)handle; - if (dev->bus) - { - i2c_bus_delete (dev->bus); - dev->bus = NULL; - } - audio_free (dev); + if (dev->bus) { + i2c_bus_delete(dev->bus); + dev->bus = NULL; + } + audio_free(dev); return ESP_OK; } diff --git a/components/esp_peripherals/lib/IS31FL3216/IS31FL3216.h b/components/esp_peripherals/lib/IS31FL3216/IS31FL3216.h index 0a9af0c4..c5d19562 100644 --- a/components/esp_peripherals/lib/IS31FL3216/IS31FL3216.h +++ b/components/esp_peripherals/lib/IS31FL3216/IS31FL3216.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on ESPRESSIF SYSTEMS products only, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -30,401 +30,387 @@ #include "driver/i2c.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif #define IS31FL3216_CH_NUM_MAX 16 #define IS31FL3216_DUTY_MAX 255 - typedef enum - { - IS31FL3216_PWR_NORMAL = 0, /**< Normal operation */ - IS31FL3216_PWR_SHUTDOWN, /**< Software shutdown mode */ - IS31FL3216_PWR_MAX, - } is31fl3216_pwr_t; - - typedef enum - { - IS31FL3216_MODE_PWM = 0, /**< PWM control mode operation*/ - IS31FL3216_MODE_AUTO_FRAME, /**< Auto frame play mode operation */ - IS31FL3216_MODE_FRAME, /**< Audio frame mode operation */ - IS31FL3216_MODE_MAX, - } is31fl3216_work_mode_t; - - typedef enum - { - IS31FL3216_CUR_MODE_REXT = 0, /**< Output current is set by register */ - IS31FL3216_CUR_MODE_AUDIO, /**< Output current is modulated by audio signal - */ - IS31FL3216_CUR_MODE_MAX, - } is31fl3216_cur_mode_t; - - typedef enum - { - IS31FL3216_CUR_1_00 = 0, /**< Output Current Selection */ - IS31FL3216_CUR_0_75, - IS31FL3216_CUR_0_50, - IS31FL3216_CUR_0_25, - IS31FL3216_CUR_2_00, - IS31FL3216_CUR_1_75, - IS31FL3216_CUR_1_50, - IS31FL3216_CUR_1_25, - IS31FL3216_CUR_MAX, - } is31fl3216_cur_value_t; - - typedef enum - { - IS31FL3216_CASCADE_MASTER = 0, /**< Chip Cascade Mode */ - IS31FL3216_CASCADE_SLAVE, - } is31fl3216_cascade_mode_t; - - typedef enum - { - IS31FL3216_AGS_0DB = 0, /**< Audio Gain Selection */ - IS31FL3216_AGS_3DB, - IS31FL3216_AGS_6DB, - IS31FL3216_AGS_9DB, - IS31FL3216_AGS_12DB, - IS31FL3216_AGS_15DB, - IS31FL3216_AGS_18DB, - IS31FL3216_AGS_21DB, - IS31FL3216_AGS_MAX, - } is31fl3216_ags_value_t; - - typedef enum - { - IS31FL3216_TIME_32MS = 0, /**< Frame Delay Time */ - IS31FL3216_TIME_64MS, - IS31FL3216_TIME_128MS, - IS31FL3216_TIME_256MS, - IS31FL3216_TIME_512MS, - IS31FL3216_TIME_1024MS, - IS31FL3216_TIME_2048MS, - IS31FL3216_TIME_4096MS, - IS31FL3216_TIME_MAX, - } is31fl3216_delay_time_t; - - typedef enum - { - IS31FL3216_REG_CONFIG = 0x00, /* Configuration register */ - IS31FL3216_REG_LED_CTRL_H - = 0x01, /* LED control register OUT9-OUT16 enable bit */ - IS31FL3216_REG_LED_CTRL_L - = 0x02, /* LED control register OUT1-OUT8 enable bit */ - IS31FL3216_REG_LED_EFFECT - = 0x03, /* Set the output current and the audio gain */ - IS31FL3216_REG_CH_CONFIG = 0x04, /* Set the operating mode of OUT9~OUT16 */ - IS31FL3216_REG_GPIO_CONFIG - = 0x05, /* Set the operating mode of OUT9~OUT16 as the GPIO port */ - IS31FL3216_REG_OUTPUT - = 0x06, /* Set the logic level of OUT9~OUT16 as the output port */ - IS31FL3216_REG_INPUT_CTRL - = 0x07, /* Set the interrupt function of OUT9~OUT16 */ - IS31FL3216_REG_STATE - = 0x08, /* Store the state of OUT9~OUT16 as the input port */ - IS31FL3216_REG_ADC_RATE - = 0x09, /* Set the ADC sample rate of the input signal */ - - IS31FL3216_REG_PWM_16 = 0x10, /* Set the PWM duty cycle data */ - IS31FL3216_REG_PWM_15, - IS31FL3216_REG_PWM_14, - IS31FL3216_REG_PWM_13, - IS31FL3216_REG_PWM_12, - IS31FL3216_REG_PWM_11, - IS31FL3216_REG_PWM_10, - IS31FL3216_REG_PWM_09, - IS31FL3216_REG_PWM_08, - IS31FL3216_REG_PWM_07, - IS31FL3216_REG_PWM_06, - IS31FL3216_REG_PWM_05, - IS31FL3216_REG_PWM_04, - IS31FL3216_REG_PWM_03, - IS31FL3216_REG_PWM_02, - IS31FL3216_REG_PWM_01, - - IS31FL3216_REG_FRAME1_CTRL = 0x20, /* Store the data of 8 frames */ - IS31FL3216_REG_FRAME1_PWM = 0x22, - IS31FL3216_REG_FRAME2_CTRL = 0x32, - IS31FL3216_REG_FRAME2_PWM = 0x34, - IS31FL3216_REG_FRAME3_CTRL = 0x44, - IS31FL3216_REG_FRAME3_PWM = 0x46, - IS31FL3216_REG_FRAME4_CTRL = 0x56, - IS31FL3216_REG_FRAME4_PWM = 0x58, - IS31FL3216_REG_FRAME5_CTRL = 0x68, - IS31FL3216_REG_FRAME5_PWM = 0x6A, - IS31FL3216_REG_FRAME6_CTRL = 0x7A, - IS31FL3216_REG_FRAME6_PWM = 0x7C, - IS31FL3216_REG_FRAME7_CTRL = 0x8C, - IS31FL3216_REG_FRAME7_PWM = 0x8E, - IS31FL3216_REG_FRAME8_CTRL = 0x9E, - IS31FL3216_REG_FRAME8_PWM = 0xA0, - - IS31FL3216_REG_UPDATE = 0xB0, /* Load PWM Register data */ - IS31FL3216_REG_FRAME_DELAY - = 0xB6, /* Set the delay time between each frame */ - IS31FL3216_REG_FRAME_START - = 0xB7, /* Set the start frame in Auto Frame Play Mode */ - IS31FL3216_REG_MAX, - } is31fl3216_reg_t; - - typedef enum - { - IS31FL3216_CH_1 = 0x0001, /**< channel by bit shit */ - IS31FL3216_CH_2 = 0x0002, - IS31FL3216_CH_3 = 0x0004, - IS31FL3216_CH_4 = 0x0008, - IS31FL3216_CH_5 = 0x0010, - IS31FL3216_CH_6 = 0x0020, - IS31FL3216_CH_7 = 0x0040, - IS31FL3216_CH_8 = 0x0080, - IS31FL3216_CH_9 = 0x0100, - IS31FL3216_CH_10 = 0x0200, - IS31FL3216_CH_11 = 0x0400, - IS31FL3216_CH_12 = 0x0800, - IS31FL3216_CH_13 = 0x1000, - IS31FL3216_CH_14 = 0x2000, - IS31FL3216_CH_15 = 0x4000, - IS31FL3216_CH_16 = 0x8000, - IS31FL3216_CH_ALL = 0xFFFF, - } is31_pwm_channel_t; - - typedef void *is31fl3216_handle_t; - - /** - * @brief The Shutdown Register sets software shutdown mode of IS31FL3216. - * - * @param handle led dev handle - * @param mode shutdown mode or Normal - * - * @return - * - ESP_OK Success - * - ESP_FAIL error - * - ESP_ERR_TIMEOUT timeout - */ - esp_err_t is31fl3216_power (is31fl3216_handle_t handle, - is31fl3216_pwr_t mode); - - /** - * @brief set the duty for the channels - * - * @param handle led dev handle - * @param ch_bits the sequence num of channels //e.g.: 1UL << the number of - * channel - * @param duty set the duty between 0-255 - * - * @return - * - ESP_OK Success - * - ESP_FAIL error - */ - esp_err_t is31fl3216_ch_duty_set (is31fl3216_handle_t handle, - is31_pwm_channel_t ch_bits, uint8_t duty); - - /** - * @brief set the work mode of channels - * - * @param handle led dev handle - * @param mode led work mode - * - * @return - * - ESP_OK Success - * - ESP_FAIL error - */ - esp_err_t is31fl3216_work_mode_set (is31fl3216_handle_t handle, - is31fl3216_work_mode_t mode); - - /** - * @brief enable the channels - * - * @param handle led dev handle - * @param ch_bits the sequence num of channels //e.g.: ch_bits = 1UL << the - * number of channel - * - * @return - * - ESP_OK Success - * - ESP_FAIL error - */ - esp_err_t is31fl3216_ch_enable (is31fl3216_handle_t handle, - is31_pwm_channel_t ch_bits); - - /** - * @brief disable the channels - * - * @param handle led dev handle - * @param ch_bits the sequence num of channels //e.g.: chbits = 1UL << the - * number of channel - * - * @return - * - ESP_OK Success - * - ESP_FAIL error - */ - esp_err_t is31fl3216_ch_disable (is31fl3216_handle_t handle, - is31_pwm_channel_t ch_bits); - - /** - * @brief set the mode of output current - * - * @param handle led dev handle - * @param mode output current mode - * - * @return - * - ESP_OK Success - * - ESP_FAIL error - */ - esp_err_t is31fl3216_cur_mode_set (is31fl3216_handle_t handle, - is31fl3216_cur_mode_t mode); - - /** - * @brief set the value of output current - * - * @param handle led dev handle - * @param value output current value - * - * @return - * - ESP_OK Success - * - ESP_FAIL error - */ - esp_err_t is31fl3216_cur_value_set (is31fl3216_handle_t handle, - is31fl3216_cur_value_t value); - - /** - * @brief choose the audio gain - * - * @param handle led dev handle - * @param value selection of audio gain - * - * @return - * - ESP_OK Success - * - ESP_FAIL error - */ - esp_err_t is31fl3216_ags_value_set (is31fl3216_handle_t handle, - is31fl3216_ags_value_t value); - - /** - * @brief enable or disable audio gain - * - * @param handle led dev handle - * @param en 0 or 1 to switch the audio gain - * - * @return - * - ESP_OK Success - * - ESP_FAIL error - */ - esp_err_t is31fl3216_agc_cfg (is31fl3216_handle_t handle, uint32_t en); - - /** - * @brief set the mode of chip cascade - * - * @param handle led dev handle - * @param mode chip cascade mode - * - * @return - * - ESP_OK Success - * - ESP_FAIL error - */ - esp_err_t is31fl3216_cascade_mode_set (is31fl3216_handle_t handle, - is31fl3216_cascade_mode_t mode); - - /** - * @brief update the register - * - * @param handle led dev handle - * - * @return - * - ESP_OK Success - * - ESP_FAIL error - */ - esp_err_t is31fl3216_update_reg (is31fl3216_handle_t handle); - - /** - * @brief set the sample rate - * - * @param handle led dev handle - * @param value set value - * - * @return - * - ESP_OK Success - * - ESP_FAIL error - */ - esp_err_t is31fl3216_sample_rate_set (is31fl3216_handle_t handle, - uint32_t value); - - /** - * @brief set the frame time - * - * @param handle led dev handle - * @param time time to set - * - * @return - * - ESP_OK Success - * - ESP_FAIL error - */ - esp_err_t is31fl3216_frame_time_set (is31fl3216_handle_t handle, - is31fl3216_delay_time_t time); - - /** - * @brief choose the first frame to play - * - * @param handle led dev handle - * @param frame the seqence num of frame - * - * @return - * - ESP_OK Success - * - ESP_FAIL error - */ - esp_err_t is31fl3216_first_frame_set (is31fl3216_handle_t handle, - uint32_t frame); - - /** - * @brief write frame data - * - * @param handle led dev handle - * @param num the seqence num of frame - * @param data data to write - * @param len the length of data - * - * @return - * - ESP_OK Success - * - ESP_FAIL error - */ - esp_err_t is31fl3216_frame_value_set (is31fl3216_handle_t handle, - uint32_t num, uint8_t *data, - uint32_t len); - - /** - * @brief IS31FL3216 will reset all registers to default value. - * - * @param handle led dev handle - * - * @return - * - ESP_OK Success - * - ESP_FAIL error - * - ESP_ERR_TIMEOUT timeout - */ - esp_err_t is31fl3216_reset (is31fl3216_handle_t handle); - - /** - * @brief Create and init sensor object and return a led handle - * - * @param bus I2C bus object handle - * - * @return - * - NULL Fail - * - Others Success - */ - is31fl3216_handle_t is31fl3216_init (void); - - /** - * @brief Delete and release a LED object - * - * @param sensor object handle of Is31fl3216 - * @param del_bus Whether to delete the I2C bus - * - * @return - * - ESP_OK Success - * - ESP_FAIL Fail - */ - esp_err_t is31fl3216_deinit (is31fl3216_handle_t handle); +typedef enum { + IS31FL3216_PWR_NORMAL = 0, /**< Normal operation */ + IS31FL3216_PWR_SHUTDOWN, /**< Software shutdown mode */ + IS31FL3216_PWR_MAX, +} is31fl3216_pwr_t; + +typedef enum { + IS31FL3216_MODE_PWM = 0, /**< PWM control mode operation*/ + IS31FL3216_MODE_AUTO_FRAME, /**< Auto frame play mode operation */ + IS31FL3216_MODE_FRAME, /**< Audio frame mode operation */ + IS31FL3216_MODE_MAX, +} is31fl3216_work_mode_t; + +typedef enum { + IS31FL3216_CUR_MODE_REXT = 0, /**< Output current is set by register */ + IS31FL3216_CUR_MODE_AUDIO, /**< Output current is modulated by audio signal */ + IS31FL3216_CUR_MODE_MAX, +} is31fl3216_cur_mode_t; + +typedef enum { + IS31FL3216_CUR_1_00 = 0, /**< Output Current Selection */ + IS31FL3216_CUR_0_75, + IS31FL3216_CUR_0_50, + IS31FL3216_CUR_0_25, + IS31FL3216_CUR_2_00, + IS31FL3216_CUR_1_75, + IS31FL3216_CUR_1_50, + IS31FL3216_CUR_1_25, + IS31FL3216_CUR_MAX, +} is31fl3216_cur_value_t; + +typedef enum { + IS31FL3216_CASCADE_MASTER = 0, /**< Chip Cascade Mode */ + IS31FL3216_CASCADE_SLAVE, +} is31fl3216_cascade_mode_t; + +typedef enum { + IS31FL3216_AGS_0DB = 0, /**< Audio Gain Selection */ + IS31FL3216_AGS_3DB, + IS31FL3216_AGS_6DB, + IS31FL3216_AGS_9DB, + IS31FL3216_AGS_12DB, + IS31FL3216_AGS_15DB, + IS31FL3216_AGS_18DB, + IS31FL3216_AGS_21DB, + IS31FL3216_AGS_MAX, +} is31fl3216_ags_value_t; + +typedef enum { + IS31FL3216_TIME_32MS = 0, /**< Frame Delay Time */ + IS31FL3216_TIME_64MS, + IS31FL3216_TIME_128MS, + IS31FL3216_TIME_256MS, + IS31FL3216_TIME_512MS, + IS31FL3216_TIME_1024MS, + IS31FL3216_TIME_2048MS, + IS31FL3216_TIME_4096MS, + IS31FL3216_TIME_MAX, +} is31fl3216_delay_time_t; + +typedef enum { + IS31FL3216_REG_CONFIG = 0x00, /* Configuration register */ + IS31FL3216_REG_LED_CTRL_H = + 0x01, /* LED control register OUT9-OUT16 enable bit */ + IS31FL3216_REG_LED_CTRL_L = + 0x02, /* LED control register OUT1-OUT8 enable bit */ + IS31FL3216_REG_LED_EFFECT = + 0x03, /* Set the output current and the audio gain */ + IS31FL3216_REG_CH_CONFIG = 0x04, /* Set the operating mode of OUT9~OUT16 */ + IS31FL3216_REG_GPIO_CONFIG = + 0x05, /* Set the operating mode of OUT9~OUT16 as the GPIO port */ + IS31FL3216_REG_OUTPUT = + 0x06, /* Set the logic level of OUT9~OUT16 as the output port */ + IS31FL3216_REG_INPUT_CTRL = + 0x07, /* Set the interrupt function of OUT9~OUT16 */ + IS31FL3216_REG_STATE = + 0x08, /* Store the state of OUT9~OUT16 as the input port */ + IS31FL3216_REG_ADC_RATE = + 0x09, /* Set the ADC sample rate of the input signal */ + + IS31FL3216_REG_PWM_16 = 0x10, /* Set the PWM duty cycle data */ + IS31FL3216_REG_PWM_15, + IS31FL3216_REG_PWM_14, + IS31FL3216_REG_PWM_13, + IS31FL3216_REG_PWM_12, + IS31FL3216_REG_PWM_11, + IS31FL3216_REG_PWM_10, + IS31FL3216_REG_PWM_09, + IS31FL3216_REG_PWM_08, + IS31FL3216_REG_PWM_07, + IS31FL3216_REG_PWM_06, + IS31FL3216_REG_PWM_05, + IS31FL3216_REG_PWM_04, + IS31FL3216_REG_PWM_03, + IS31FL3216_REG_PWM_02, + IS31FL3216_REG_PWM_01, + + IS31FL3216_REG_FRAME1_CTRL = 0x20, /* Store the data of 8 frames */ + IS31FL3216_REG_FRAME1_PWM = 0x22, + IS31FL3216_REG_FRAME2_CTRL = 0x32, + IS31FL3216_REG_FRAME2_PWM = 0x34, + IS31FL3216_REG_FRAME3_CTRL = 0x44, + IS31FL3216_REG_FRAME3_PWM = 0x46, + IS31FL3216_REG_FRAME4_CTRL = 0x56, + IS31FL3216_REG_FRAME4_PWM = 0x58, + IS31FL3216_REG_FRAME5_CTRL = 0x68, + IS31FL3216_REG_FRAME5_PWM = 0x6A, + IS31FL3216_REG_FRAME6_CTRL = 0x7A, + IS31FL3216_REG_FRAME6_PWM = 0x7C, + IS31FL3216_REG_FRAME7_CTRL = 0x8C, + IS31FL3216_REG_FRAME7_PWM = 0x8E, + IS31FL3216_REG_FRAME8_CTRL = 0x9E, + IS31FL3216_REG_FRAME8_PWM = 0xA0, + + IS31FL3216_REG_UPDATE = 0xB0, /* Load PWM Register data */ + IS31FL3216_REG_FRAME_DELAY = 0xB6, /* Set the delay time between each frame */ + IS31FL3216_REG_FRAME_START = + 0xB7, /* Set the start frame in Auto Frame Play Mode */ + IS31FL3216_REG_MAX, +} is31fl3216_reg_t; + +typedef enum { + IS31FL3216_CH_1 = 0x0001, /**< channel by bit shit */ + IS31FL3216_CH_2 = 0x0002, + IS31FL3216_CH_3 = 0x0004, + IS31FL3216_CH_4 = 0x0008, + IS31FL3216_CH_5 = 0x0010, + IS31FL3216_CH_6 = 0x0020, + IS31FL3216_CH_7 = 0x0040, + IS31FL3216_CH_8 = 0x0080, + IS31FL3216_CH_9 = 0x0100, + IS31FL3216_CH_10 = 0x0200, + IS31FL3216_CH_11 = 0x0400, + IS31FL3216_CH_12 = 0x0800, + IS31FL3216_CH_13 = 0x1000, + IS31FL3216_CH_14 = 0x2000, + IS31FL3216_CH_15 = 0x4000, + IS31FL3216_CH_16 = 0x8000, + IS31FL3216_CH_ALL = 0xFFFF, +} is31_pwm_channel_t; + +typedef void *is31fl3216_handle_t; + +/** + * @brief The Shutdown Register sets software shutdown mode of IS31FL3216. + * + * @param handle led dev handle + * @param mode shutdown mode or Normal + * + * @return + * - ESP_OK Success + * - ESP_FAIL error + * - ESP_ERR_TIMEOUT timeout + */ +esp_err_t is31fl3216_power(is31fl3216_handle_t handle, is31fl3216_pwr_t mode); + +/** + * @brief set the duty for the channels + * + * @param handle led dev handle + * @param ch_bits the sequence num of channels //e.g.: 1UL << the number of + * channel + * @param duty set the duty between 0-255 + * + * @return + * - ESP_OK Success + * - ESP_FAIL error + */ +esp_err_t is31fl3216_ch_duty_set(is31fl3216_handle_t handle, + is31_pwm_channel_t ch_bits, uint8_t duty); + +/** + * @brief set the work mode of channels + * + * @param handle led dev handle + * @param mode led work mode + * + * @return + * - ESP_OK Success + * - ESP_FAIL error + */ +esp_err_t is31fl3216_work_mode_set(is31fl3216_handle_t handle, + is31fl3216_work_mode_t mode); + +/** + * @brief enable the channels + * + * @param handle led dev handle + * @param ch_bits the sequence num of channels //e.g.: ch_bits = 1UL << the + * number of channel + * + * @return + * - ESP_OK Success + * - ESP_FAIL error + */ +esp_err_t is31fl3216_ch_enable(is31fl3216_handle_t handle, + is31_pwm_channel_t ch_bits); + +/** + * @brief disable the channels + * + * @param handle led dev handle + * @param ch_bits the sequence num of channels //e.g.: chbits = 1UL << the + * number of channel + * + * @return + * - ESP_OK Success + * - ESP_FAIL error + */ +esp_err_t is31fl3216_ch_disable(is31fl3216_handle_t handle, + is31_pwm_channel_t ch_bits); + +/** + * @brief set the mode of output current + * + * @param handle led dev handle + * @param mode output current mode + * + * @return + * - ESP_OK Success + * - ESP_FAIL error + */ +esp_err_t is31fl3216_cur_mode_set(is31fl3216_handle_t handle, + is31fl3216_cur_mode_t mode); + +/** + * @brief set the value of output current + * + * @param handle led dev handle + * @param value output current value + * + * @return + * - ESP_OK Success + * - ESP_FAIL error + */ +esp_err_t is31fl3216_cur_value_set(is31fl3216_handle_t handle, + is31fl3216_cur_value_t value); + +/** + * @brief choose the audio gain + * + * @param handle led dev handle + * @param value selection of audio gain + * + * @return + * - ESP_OK Success + * - ESP_FAIL error + */ +esp_err_t is31fl3216_ags_value_set(is31fl3216_handle_t handle, + is31fl3216_ags_value_t value); + +/** + * @brief enable or disable audio gain + * + * @param handle led dev handle + * @param en 0 or 1 to switch the audio gain + * + * @return + * - ESP_OK Success + * - ESP_FAIL error + */ +esp_err_t is31fl3216_agc_cfg(is31fl3216_handle_t handle, uint32_t en); + +/** + * @brief set the mode of chip cascade + * + * @param handle led dev handle + * @param mode chip cascade mode + * + * @return + * - ESP_OK Success + * - ESP_FAIL error + */ +esp_err_t is31fl3216_cascade_mode_set(is31fl3216_handle_t handle, + is31fl3216_cascade_mode_t mode); + +/** + * @brief update the register + * + * @param handle led dev handle + * + * @return + * - ESP_OK Success + * - ESP_FAIL error + */ +esp_err_t is31fl3216_update_reg(is31fl3216_handle_t handle); + +/** + * @brief set the sample rate + * + * @param handle led dev handle + * @param value set value + * + * @return + * - ESP_OK Success + * - ESP_FAIL error + */ +esp_err_t is31fl3216_sample_rate_set(is31fl3216_handle_t handle, + uint32_t value); + +/** + * @brief set the frame time + * + * @param handle led dev handle + * @param time time to set + * + * @return + * - ESP_OK Success + * - ESP_FAIL error + */ +esp_err_t is31fl3216_frame_time_set(is31fl3216_handle_t handle, + is31fl3216_delay_time_t time); + +/** + * @brief choose the first frame to play + * + * @param handle led dev handle + * @param frame the seqence num of frame + * + * @return + * - ESP_OK Success + * - ESP_FAIL error + */ +esp_err_t is31fl3216_first_frame_set(is31fl3216_handle_t handle, + uint32_t frame); + +/** + * @brief write frame data + * + * @param handle led dev handle + * @param num the seqence num of frame + * @param data data to write + * @param len the length of data + * + * @return + * - ESP_OK Success + * - ESP_FAIL error + */ +esp_err_t is31fl3216_frame_value_set(is31fl3216_handle_t handle, uint32_t num, + uint8_t *data, uint32_t len); + +/** + * @brief IS31FL3216 will reset all registers to default value. + * + * @param handle led dev handle + * + * @return + * - ESP_OK Success + * - ESP_FAIL error + * - ESP_ERR_TIMEOUT timeout + */ +esp_err_t is31fl3216_reset(is31fl3216_handle_t handle); + +/** + * @brief Create and init sensor object and return a led handle + * + * @param bus I2C bus object handle + * + * @return + * - NULL Fail + * - Others Success + */ +is31fl3216_handle_t is31fl3216_init(void); + +/** + * @brief Delete and release a LED object + * + * @param sensor object handle of Is31fl3216 + * @param del_bus Whether to delete the I2C bus + * + * @return + * - ESP_OK Success + * - ESP_FAIL Fail + */ +esp_err_t is31fl3216_deinit(is31fl3216_handle_t handle); #ifdef __cplusplus } diff --git a/components/esp_peripherals/lib/adc_button/adc_button.c b/components/esp_peripherals/lib/adc_button/adc_button.c index fa9416f7..f3ae7c65 100644 --- a/components/esp_peripherals/lib/adc_button/adc_button.c +++ b/components/esp_peripherals/lib/adc_button/adc_button.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,29 +18,33 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ +#include "adc_button.h" + +#include +#include + +#include "audio_idf_version.h" #include "audio_mem.h" +#include "audio_thread.h" #include "driver/adc.h" +#include "esp_adc_cal.h" +#include "esp_log.h" #include "freertos/FreeRTOS.h" #include "freertos/event_groups.h" -#include "freertos/queue.h" -#include "freertos/task.h" #include "math.h" -#include -#include +#include "string.h" -#if CONFIG_IDF_TARGET_ESP32 -#include "esp_adc_cal.h" +#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)) +#define ADC_ATTEN_11db ADC_ATTEN_DB_11 +#define ADC_WIDTH_12Bit ADC_BITWIDTH_12 +#define ADC_WIDTH_13Bit ADC_BITWIDTH_13 #endif -#include "adc_button.h" -#include "audio_thread.h" -#include "esp_log.h" -#include "string.h" #define V_REF 1100 @@ -51,6 +55,7 @@ #define ADC_BTN_INVALID_ID -1 #define ADC_BTN_INVALID_ACT_ID -2 #define ADC_BTN_DETECT_TIME_MS 20 +#define ADC_BTN_DETECTED_CNT 2 #ifndef ENABLE_ADC_VOLUME #define USER_KEY_MAX 7 @@ -59,447 +64,389 @@ static char *TAG = "ADC_BTN"; static EventGroupHandle_t g_event_bit; -typedef struct -{ +typedef struct { adc_button_callback btn_callback; adc_btn_list *head; void *user_data; audio_thread_t audio_thread; } adc_btn_tag_t; -static const int default_step_level[USER_KEY_MAX] - = { 0, 683, 1193, 1631, 2090, 2578, 3103 }; +static const int default_step_level[USER_KEY_MAX] = {0, 683, 1193, 1631, + 2090, 2578, 3103}; static const int DESTROY_BIT = BIT0; static bool _task_flag; -adc_btn_list * -adc_btn_create_list (adc_arr_t *adc_conf, int channels) -{ +adc_btn_list *adc_btn_create_list(adc_arr_t *adc_conf, int channels) { adc_btn_list *head = NULL; adc_btn_list *node = NULL; adc_btn_list *find = NULL; - for (int i = 0; i < channels; i++) - { - node = (adc_btn_list *)audio_calloc (1, sizeof (adc_btn_list)); - if (NULL == node) - { - ESP_LOGE (TAG, "Memory allocation failed! Line: %d", __LINE__); - return NULL; - } - memset (node, 0, sizeof (adc_btn_list)); - adc_arr_t *info = &(node->adc_info); - memcpy (info, adc_conf + i, sizeof (adc_arr_t)); - info->adc_level_step - = (int *)audio_calloc (1, (info->total_steps + 1) * sizeof (int)); - memset (info->adc_level_step, 0, (info->total_steps + 1) * sizeof (int)); - if (NULL == info->adc_level_step) - { - ESP_LOGE (TAG, "Memory allocation failed! Line: %d", __LINE__); - audio_free (node); - return NULL; - } - if (adc_conf[i].adc_level_step == NULL) - { - memcpy (info->adc_level_step, default_step_level, - USER_KEY_MAX * sizeof (int)); - } - else - { - memcpy (info->adc_level_step, adc_conf[i].adc_level_step, - (adc_conf[i].total_steps + 1) * sizeof (int)); - } - if (info->total_steps > USER_KEY_MAX) - { - ESP_LOGE (TAG, "The total_steps should be less than USER_KEY_MAX"); - audio_free (info->adc_level_step); - audio_free (node); - } - node->btn_dscp = (btn_decription *)audio_calloc ( - 1, sizeof (btn_decription) * (adc_conf[i].total_steps)); - if (NULL == node->btn_dscp) - { - ESP_LOGE (TAG, "Memory allocation failed! Line: %d", __LINE__); - audio_free (info->adc_level_step); - audio_free (node); - } - memset (node->btn_dscp, 0, - sizeof (btn_decription) * (adc_conf[i].total_steps)); - node->next = NULL; - if (NULL == head) - { - head = node; - find = head; - } - else - { - find->next = node; - find = node; - } + for (int i = 0; i < channels; i++) { + node = (adc_btn_list *)audio_calloc(1, sizeof(adc_btn_list)); + if (NULL == node) { + ESP_LOGE(TAG, "Memory allocation failed! Line: %d", __LINE__); + return NULL; + } + memset(node, 0, sizeof(adc_btn_list)); + adc_arr_t *info = &(node->adc_info); + memcpy(info, adc_conf + i, sizeof(adc_arr_t)); + info->adc_level_step = + (int *)audio_calloc(1, (info->total_steps + 1) * sizeof(int)); + memset(info->adc_level_step, 0, (info->total_steps + 1) * sizeof(int)); + if (NULL == info->adc_level_step) { + ESP_LOGE(TAG, "Memory allocation failed! Line: %d", __LINE__); + audio_free(node); + return NULL; + } + if (adc_conf[i].adc_level_step == NULL) { + memcpy(info->adc_level_step, default_step_level, + USER_KEY_MAX * sizeof(int)); + } else { + memcpy(info->adc_level_step, adc_conf[i].adc_level_step, + (adc_conf[i].total_steps + 1) * sizeof(int)); + } + if (info->total_steps > USER_KEY_MAX) { + ESP_LOGE(TAG, "The total_steps should be less than USER_KEY_MAX"); + audio_free(info->adc_level_step); + audio_free(node); } + node->btn_dscp = (btn_decription *)audio_calloc( + 1, sizeof(btn_decription) * (adc_conf[i].total_steps)); + if (NULL == node->btn_dscp) { + ESP_LOGE(TAG, "Memory allocation failed! Line: %d", __LINE__); + audio_free(info->adc_level_step); + audio_free(node); + } + memset(node->btn_dscp, 0, + sizeof(btn_decription) * (adc_conf[i].total_steps)); + node->next = NULL; + if (NULL == head) { + head = node; + find = head; + } else { + find->next = node; + find = node; + } + } return head; } -esp_err_t -adc_btn_destroy_list (adc_btn_list *head) -{ - if (head == NULL) - { - ESP_LOGD (TAG, "The head of list is null"); - return ESP_OK; - } +esp_err_t adc_btn_destroy_list(adc_btn_list *head) { + if (head == NULL) { + ESP_LOGD(TAG, "The head of list is null"); + return ESP_OK; + } adc_btn_list *find = head; adc_btn_list *tmp = find; - while (find) - { - adc_arr_t *info = &(find->adc_info); - tmp = find->next; - audio_free (find->btn_dscp); - audio_free (info->adc_level_step); - audio_free (find); - find = tmp; - } + while (find) { + adc_arr_t *info = &(find->adc_info); + tmp = find->next; + audio_free(find->btn_dscp); + audio_free(info->adc_level_step); + audio_free(find); + find = tmp; + } return ESP_OK; } -static int -get_adc_voltage (int channel) -{ - uint32_t data[ADC_SAMPLES_NUM] = { 0 }; +static int get_adc_voltage(int channel) { + uint32_t data[ADC_SAMPLES_NUM] = {0}; uint32_t sum = 0; int tmp = 0; - -#if CONFIG_IDF_TARGET_ESP32 +#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32S2 || \ + CONFIG_IDF_TARGET_ESP32C3 || CONFIG_IDF_TARGET_ESP32S3 esp_adc_cal_characteristics_t characteristics; - esp_adc_cal_characterize (ADC_UNIT_1, ADC_ATTEN_11db, ADC_WIDTH_12Bit, V_REF, - &characteristics); - for (int i = 0; i < ADC_SAMPLES_NUM; ++i) - { - esp_adc_cal_get_voltage (channel, &characteristics, &data[i]); - } +#if CONFIG_IDF_TARGET_ESP32 + esp_adc_cal_characterize(ADC_UNIT_1, ADC_ATTEN_11db, ADC_WIDTH_12Bit, V_REF, + &characteristics); #elif CONFIG_IDF_TARGET_ESP32S2 - for (int i = 0; i < ADC_SAMPLES_NUM; i++) - { - data[i] = adc1_get_raw ((adc1_channel_t)channel); - } + esp_adc_cal_characterize(ADC_UNIT_1, ADC_ATTEN_11db, ADC_WIDTH_BIT_13, 0, + &characteristics); +#else + esp_adc_cal_characterize(ADC_UNIT_1, ADC_ATTEN_11db, ADC_WIDTH_12Bit, 0, + &characteristics); #endif - for (int j = 0; j < ADC_SAMPLES_NUM - 1; j++) - { - for (int i = 0; i < ADC_SAMPLES_NUM - j - 1; i++) - { - if (data[i] > data[i + 1]) - { - tmp = data[i]; - data[i] = data[i + 1]; - data[i + 1] = tmp; - } - } + for (int i = 0; i < ADC_SAMPLES_NUM; ++i) { + esp_adc_cal_get_voltage(channel, &characteristics, &data[i]); + } +#endif + for (int j = 0; j < ADC_SAMPLES_NUM - 1; j++) { + for (int i = 0; i < ADC_SAMPLES_NUM - j - 1; i++) { + if (data[i] > data[i + 1]) { + tmp = data[i]; + data[i] = data[i + 1]; + data[i + 1] = tmp; + } } - for (int num = 1; num < ADC_SAMPLES_NUM - 1; num++) - sum += data[num]; + } + for (int num = 1; num < ADC_SAMPLES_NUM - 1; num++) sum += data[num]; return (sum / (ADC_SAMPLES_NUM - 2)); } -static int -get_button_id (adc_btn_list *node, int adc) -{ +static int get_button_id(adc_btn_list *node, int adc) { int m = ADC_BTN_INVALID_ID; adc_arr_t *info = &(node->adc_info); - for (int i = 0; i < info->total_steps; i++) - { - ESP_LOGV (TAG, "max:%d, adc:%d, i:%d, %d, %d", info->total_steps, adc, i, - info->adc_level_step[i], info->adc_level_step[i + 1]); - if ((adc > info->adc_level_step[i]) - && (adc <= info->adc_level_step[i + 1])) - { - m = i; - break; - } + for (int i = 0; i < info->total_steps; i++) { + ESP_LOGV(TAG, "max:%d, adc:%d, i:%d, %d, %d", info->total_steps, adc, i, + info->adc_level_step[i], info->adc_level_step[i + 1]); + if ((adc > info->adc_level_step[i]) && + (adc <= info->adc_level_step[i + 1])) { + m = i; + break; } + } return m; } -static void -reset_btn (btn_decription *btn_dscp, int btn_num) -{ - memset (btn_dscp, 0, sizeof (btn_decription) * btn_num); - for (int i = 0; i < btn_num; ++i) - { - btn_dscp[i].active_id = ADC_BTN_INVALID_ID; - } +static void reset_btn(btn_decription *btn_dscp, int btn_num) { + memset(btn_dscp, 0, sizeof(btn_decription) * btn_num); + for (int i = 0; i < btn_num; ++i) { + btn_dscp[i].active_id = ADC_BTN_INVALID_ID; + } } -static adc_btn_state_t -get_adc_btn_state (int adc_value, int act_id, adc_btn_list *node) -{ +static adc_btn_state_t get_adc_btn_state(int adc_value, int act_id, + adc_btn_list *node) { adc_btn_state_t st = ADC_BTN_STATE_IDLE; adc_arr_t *info = &(node->adc_info); btn_decription *btn_dscp = node->btn_dscp; - int id = get_button_id (node, adc_value); - if (id == ADC_BTN_INVALID_ID) - { - if (act_id == ADC_BTN_INVALID_ACT_ID) - { - // No old act id and new act id. - return ADC_BTN_STATE_IDLE; - } - if (btn_dscp[act_id].click_cnt <= 1) - { - return ADC_BTN_STATE_IDLE; - } - // Have old act ID, new id is invalid - // Need to send release event - if (btn_dscp[act_id].click_cnt - < (info->press_judge_time / ADC_BTN_DETECT_TIME_MS)) - { - ESP_LOGD (TAG, "pressed: Act ID:%d, ID:%d, Cnt:%d", act_id, id, - btn_dscp[act_id].click_cnt); - st = ADC_BTN_STATE_RELEASE; - } - else - { - ESP_LOGD (TAG, "long press release: Act ID:%d, ID:%d, Cnt:%d", - act_id, id, btn_dscp[act_id].click_cnt); - st = ADC_BTN_STATE_LONG_RELEASE; - } - btn_dscp[act_id].active_id = -1; - btn_dscp[act_id].long_click = 0; - btn_dscp[act_id].click_cnt = 0; - return st; + int id = get_button_id(node, adc_value); + if (id == ADC_BTN_INVALID_ID) { + if (act_id == ADC_BTN_INVALID_ACT_ID) { + // No old act id and new act id. + return ADC_BTN_STATE_IDLE; } - // 1.ID is valid and act ID is invalid. - if (act_id == ADC_BTN_INVALID_ACT_ID) - { - // First new act id - btn_dscp[id].active_id = id; + if (btn_dscp[act_id].click_cnt <= 1) { return ADC_BTN_STATE_IDLE; } + // Have old act ID, new id is invalid + // Need to send release event + if (btn_dscp[act_id].click_cnt < + (info->press_judge_time / ADC_BTN_DETECT_TIME_MS)) { + ESP_LOGD(TAG, "pressed: Act ID:%d, ID:%d, Cnt:%d", act_id, id, + btn_dscp[act_id].click_cnt); + st = ADC_BTN_STATE_RELEASE; + } else { + ESP_LOGD(TAG, "long press release: Act ID:%d, ID:%d, Cnt:%d", act_id, id, + btn_dscp[act_id].click_cnt); + st = ADC_BTN_STATE_LONG_RELEASE; + } + btn_dscp[act_id].active_id = -1; + btn_dscp[act_id].long_click = 0; + btn_dscp[act_id].click_cnt = 0; + return st; + } + // 1.ID is valid and act ID is invalid. + if (act_id == ADC_BTN_INVALID_ACT_ID) { + // First new act id + btn_dscp[id].active_id = id; + return ADC_BTN_STATE_IDLE; + } // 2.ID and act ID are valid, but not equal. - if (id != act_id) - { - ESP_LOGW (TAG, "Old ID:%d, New ID:%d", act_id, id); - // Invalid the act ID - btn_dscp[act_id].active_id = -1; - btn_dscp[act_id].long_click = 0; + if (id != act_id) { + ESP_LOGW(TAG, "Old ID:%d, New ID:%d, Cnt:%d", act_id, id, + btn_dscp[act_id].click_cnt); + // Invalid the act ID + btn_dscp[act_id].active_id = -1; + btn_dscp[act_id].long_click = 0; + // Set the new id act ID + btn_dscp[id].active_id = id; + // Maybe need to check release long pressed. + if (btn_dscp[act_id].click_cnt < ADC_BTN_DETECTED_CNT) { btn_dscp[act_id].click_cnt = 0; - // Set the new id act ID - btn_dscp[id].active_id = id; - // Maybe need to check release long pressed. return ADC_BTN_STATE_IDLE; } + btn_dscp[act_id].click_cnt = 0; + // Have old act ID, new id is invalid + // Need to send release event + if (btn_dscp[act_id].click_cnt < + (info->press_judge_time / ADC_BTN_DETECT_TIME_MS)) { + ESP_LOGD(TAG, "pressed: Act ID:%d, ID:%d, Cnt:%d", act_id, id, + btn_dscp[act_id].click_cnt); + return ADC_BTN_STATE_RELEASE; + } else { + ESP_LOGD(TAG, "long press release: Act ID:%d, ID:%d, Cnt:%d", act_id, id, + btn_dscp[act_id].click_cnt); + return ADC_BTN_STATE_LONG_RELEASE; + } + } // 3.ID and act ID are valid, and equal. btn_dscp[act_id].click_cnt++; - if (btn_dscp[act_id].click_cnt == 3) - { - return ADC_BTN_STATE_PRESSED; - } + if (btn_dscp[act_id].click_cnt == ADC_BTN_DETECTED_CNT) { + return ADC_BTN_STATE_PRESSED; + } - if (btn_dscp[act_id].long_click) - { - return ADC_BTN_STATE_IDLE; - } - if (btn_dscp[act_id].click_cnt - >= (info->press_judge_time / ADC_BTN_DETECT_TIME_MS)) - { - // Send long click event. - ESP_LOGD (TAG, "long press: Act ID:%d, ID:%d, Cnt:%d", act_id, id, - btn_dscp[act_id].click_cnt); - st = ADC_BTN_STATE_LONG_PRESSED; - btn_dscp[act_id].long_click = 1; - } + if (btn_dscp[act_id].long_click) { + return ADC_BTN_STATE_IDLE; + } + if (btn_dscp[act_id].click_cnt >= + (info->press_judge_time / ADC_BTN_DETECT_TIME_MS)) { + // Send long click event. + ESP_LOGD(TAG, "long press: Act ID:%d, ID:%d, Cnt:%d", act_id, id, + btn_dscp[act_id].click_cnt); + st = ADC_BTN_STATE_LONG_PRESSED; + btn_dscp[act_id].long_click = 1; + } return st; } -static void -button_task (void *parameters) -{ +static void button_task(void *parameters) { _task_flag = true; adc_btn_tag_t *tag = (adc_btn_tag_t *)parameters; adc_btn_list *head = tag->head; adc_btn_list *find = head; - xEventGroupClearBits (g_event_bit, DESTROY_BIT); -#if CONFIG_IDF_TARGET_ESP32 - adc1_config_width (ADC_WIDTH_BIT_12); -#elif CONFIG_IDF_TARGET_ESP32S2 - adc1_config_width (ADC_WIDTH_BIT_13); + xEventGroupClearBits(g_event_bit, DESTROY_BIT); +#if CONFIG_IDF_TARGET_ESP32S2 + adc1_config_width(ADC_WIDTH_BIT_13); +#else + adc1_config_width(ADC_WIDTH_BIT_12); #endif - while (find) - { - adc_arr_t *info = &(find->adc_info); - reset_btn (find->btn_dscp, info->total_steps); - adc1_config_channel_atten (info->adc_ch, ADC_ATTEN_11db); - find = find->next; - } + while (find) { + adc_arr_t *info = &(find->adc_info); + reset_btn(find->btn_dscp, info->total_steps); + adc1_config_channel_atten(info->adc_ch, ADC_ATTEN_11db); + find = find->next; + } find = head; #if defined ENABLE_ADC_VOLUME - adc1_config_channel_atten (DIAL_adc_ch, ADC_ATTEN_11db); + adc1_config_channel_atten(DIAL_adc_ch, ADC_ATTEN_11db); short adc_vol_prev = ADC_BTN_INVALID_ID; short adc_vol_cur = ADC_BTN_INVALID_ID; - short internal_time_ms = DIAL_VOL_INTERVAL_TIME_MS - / ADC_SAMPLE_INTERVAL_TIME_MS; /// 10 * 10 = 100ms + short internal_time_ms = DIAL_VOL_INTERVAL_TIME_MS / + ADC_SAMPLE_INTERVAL_TIME_MS; /// 10 * 10 = 100ms static bool empty_flag; static bool full_flag; bool is_first_time = true; -#endif // ENABLE_ADC_VOLUME +#endif // ENABLE_ADC_VOLUME static adc_btn_state_t cur_state = ADC_BTN_STATE_ADC; adc_btn_state_t btn_st = ADC_BTN_STATE_IDLE; int cur_act_id = ADC_BTN_INVALID_ACT_ID; - while (_task_flag) - { + while (_task_flag) { #if defined ENABLE_ADC_VOLUME - if (internal_time_ms == 0) - { - adc_vol_cur = get_adc_voltage (DIAL_adc_ch); - internal_time_ms - = DIAL_VOL_INTERVAL_TIME_MS / ADC_SAMPLE_INTERVAL_TIME_MS; - if (adc_vol_prev > 0) - { - short n = abs (adc_vol_cur - adc_vol_prev); - if (is_first_time) - { - is_first_time = false; - } - if (adc_vol_cur < 200) - { - if (empty_flag == false) - { - ESP_LOGI (TAG, "ABS_LOW:%d, %d->0", n, adc_vol_cur / 25); - empty_flag = true; - } - } - else if (adc_vol_cur > 2500) - { - if (full_flag == false) - { - ESP_LOGI (TAG, "ABS_HIGH:%d, %d->100", n, - adc_vol_cur / 25); - full_flag = true; - } - } - else if (n > 80) - { - empty_flag = false; - full_flag = false; - } - } - adc_vol_prev = adc_vol_cur; + if (internal_time_ms == 0) { + adc_vol_cur = get_adc_voltage(DIAL_adc_ch); + internal_time_ms = + DIAL_VOL_INTERVAL_TIME_MS / ADC_SAMPLE_INTERVAL_TIME_MS; + if (adc_vol_prev > 0) { + short n = abs(adc_vol_cur - adc_vol_prev); + if (is_first_time) { + is_first_time = false; + } + if (adc_vol_cur < 200) { + if (empty_flag == false) { + ESP_LOGI(TAG, "ABS_LOW:%d, %d->0", n, adc_vol_cur / 25); + empty_flag = true; + } + } else if (adc_vol_cur > 2500) { + if (full_flag == false) { + ESP_LOGI(TAG, "ABS_HIGH:%d, %d->100", n, adc_vol_cur / 25); + full_flag = true; + } + } else if (n > 80) { + empty_flag = false; + full_flag = false; } - internal_time_ms--; + } + adc_vol_prev = adc_vol_cur; + } + internal_time_ms--; #else - find = head; - while (find) - { - adc_arr_t *info = &(find->adc_info); - int act_id = ADC_BTN_INVALID_ACT_ID; - btn_decription *btn_dscp = find->btn_dscp; - switch (cur_state) - { - case ADC_BTN_STATE_ADC: - { - int adc = get_adc_voltage (info->adc_ch); - ESP_LOGD (TAG, "ADC:%d", adc); - for (int i = 0; i < info->total_steps; ++i) - { - if (btn_dscp[i].active_id > ADC_BTN_INVALID_ID) - { - act_id = i; - break; - } - } - btn_st = get_adc_btn_state (adc, act_id, find); - if (btn_st != ADC_BTN_STATE_IDLE) - { - cur_act_id = act_id; - cur_state = btn_st; - ESP_LOGD (TAG, "ADC ID:%d", act_id); - } - break; - } - case ADC_BTN_STATE_PRESSED: - { - tag->btn_callback ((void *)tag->user_data, info->adc_ch, - cur_act_id, ADC_BTN_STATE_PRESSED); - cur_state = ADC_BTN_STATE_ADC; - break; - } - case ADC_BTN_STATE_LONG_PRESSED: - { - tag->btn_callback ((void *)tag->user_data, info->adc_ch, - cur_act_id, ADC_BTN_STATE_LONG_PRESSED); - cur_state = ADC_BTN_STATE_ADC; - break; - } - case ADC_BTN_STATE_LONG_RELEASE: - { - tag->btn_callback ((void *)tag->user_data, info->adc_ch, - cur_act_id, ADC_BTN_STATE_LONG_RELEASE); - cur_state = ADC_BTN_STATE_ADC; - break; - } - case ADC_BTN_STATE_RELEASE: - { - tag->btn_callback ((void *)tag->user_data, info->adc_ch, - cur_act_id, ADC_BTN_STATE_RELEASE); - cur_state = ADC_BTN_STATE_ADC; - break; - } - default: - ESP_LOGE (TAG, "Not support state %d", cur_state); + find = head; + while (find) { + adc_arr_t *info = &(find->adc_info); + int act_id = ADC_BTN_INVALID_ACT_ID; + btn_decription *btn_dscp = find->btn_dscp; + switch (cur_state) { + case ADC_BTN_STATE_ADC: { + int adc = get_adc_voltage(info->adc_ch); + ESP_LOGD(TAG, "ADC:%d", adc); + for (int i = 0; i < info->total_steps; ++i) { + if (btn_dscp[i].active_id > ADC_BTN_INVALID_ID) { + act_id = i; break; } - find = find->next; + } + btn_st = get_adc_btn_state(adc, act_id, find); + if (btn_st != ADC_BTN_STATE_IDLE) { + cur_act_id = act_id; + cur_state = btn_st; + ESP_LOGD(TAG, "ADC ID:%d", act_id); + } + break; } -#endif // ENABLE_ADC_VOLUME - - vTaskDelay (ADC_SAMPLE_INTERVAL_TIME_MS / portTICK_PERIOD_MS); + case ADC_BTN_STATE_PRESSED: { + tag->btn_callback((void *)tag->user_data, info->adc_ch, cur_act_id, + ADC_BTN_STATE_PRESSED); + cur_state = ADC_BTN_STATE_ADC; + break; + } + case ADC_BTN_STATE_LONG_PRESSED: { + tag->btn_callback((void *)tag->user_data, info->adc_ch, cur_act_id, + ADC_BTN_STATE_LONG_PRESSED); + cur_state = ADC_BTN_STATE_ADC; + break; + } + case ADC_BTN_STATE_LONG_RELEASE: { + tag->btn_callback((void *)tag->user_data, info->adc_ch, cur_act_id, + ADC_BTN_STATE_LONG_RELEASE); + cur_state = ADC_BTN_STATE_ADC; + break; + } + case ADC_BTN_STATE_RELEASE: { + tag->btn_callback((void *)tag->user_data, info->adc_ch, cur_act_id, + ADC_BTN_STATE_RELEASE); + cur_state = ADC_BTN_STATE_ADC; + break; + } + default: + ESP_LOGE(TAG, "Not support state %d", cur_state); + break; + } + find = find->next; } +#endif // ENABLE_ADC_VOLUME - if (g_event_bit) - { - xEventGroupSetBits (g_event_bit, DESTROY_BIT); - } - audio_free (tag); - vTaskDelete (NULL); + vTaskDelay(ADC_SAMPLE_INTERVAL_TIME_MS / portTICK_PERIOD_MS); + } + + if (g_event_bit) { + xEventGroupSetBits(g_event_bit, DESTROY_BIT); + } + audio_free(tag); + vTaskDelete(NULL); } -void -adc_btn_delete_task (void) -{ - if (_task_flag) - { - _task_flag = false; - } +void adc_btn_delete_task(void) { + if (_task_flag) { + _task_flag = false; + } - if (g_event_bit) - { - xEventGroupWaitBits (g_event_bit, DESTROY_BIT, pdTRUE, pdFALSE, - portMAX_DELAY); - vEventGroupDelete (g_event_bit); - g_event_bit = NULL; - } + if (g_event_bit) { + xEventGroupWaitBits(g_event_bit, DESTROY_BIT, pdTRUE, pdFALSE, + portMAX_DELAY); + vEventGroupDelete(g_event_bit); + g_event_bit = NULL; + } } -void -adc_btn_init (void *user_data, adc_button_callback cb, adc_btn_list *head, - adc_btn_task_cfg_t *task_cfg) -{ - adc_btn_tag_t *tag = audio_calloc (1, sizeof (adc_btn_tag_t)); - if (NULL == tag) - { - ESP_LOGE (TAG, "Memory allocation failed! Line: %d", __LINE__); - return; - } +void adc_btn_init(void *user_data, adc_button_callback cb, adc_btn_list *head, + adc_btn_task_cfg_t *task_cfg) { + adc_btn_tag_t *tag = audio_calloc(1, sizeof(adc_btn_tag_t)); + if (NULL == tag) { + ESP_LOGE(TAG, "Memory allocation failed! Line: %d", __LINE__); + return; + } tag->user_data = user_data; tag->head = head; tag->btn_callback = cb; - g_event_bit = xEventGroupCreate (); + g_event_bit = xEventGroupCreate(); - audio_thread_create (&tag->audio_thread, "button_task", button_task, - (void *)tag, task_cfg->task_stack, task_cfg->task_prio, - task_cfg->ext_stack, task_cfg->task_core); + audio_thread_create(&tag->audio_thread, "button_task", button_task, + (void *)tag, task_cfg->task_stack, task_cfg->task_prio, + task_cfg->ext_stack, task_cfg->task_core); } diff --git a/components/esp_peripherals/lib/adc_button/adc_button.h b/components/esp_peripherals/lib/adc_button/adc_button.h index 1de6fb1e..ae970c87 100644 --- a/components/esp_peripherals/lib/adc_button/adc_button.h +++ b/components/esp_peripherals/lib/adc_button/adc_button.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -28,75 +28,68 @@ #define _ADC_BUTTON_H_ #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif #include "esp_err.h" - typedef enum - { - USER_KEY_ID0, - USER_KEY_ID1, - USER_KEY_ID2, - USER_KEY_ID3, - USER_KEY_ID4, - USER_KEY_ID5, - USER_KEY_ID6, - USER_KEY_MAX, - } user_key_id_num; - - typedef struct - { - int adc_ch; - int *adc_level_step; - int total_steps; - int press_judge_time; - } adc_arr_t; - - typedef enum - { - ADC_BTN_STATE_IDLE, // 0: idle - ADC_BTN_STATE_ADC, // 1: detect - ADC_BTN_STATE_PRESSED, // 2: pressed - ADC_BTN_STATE_RELEASE, // 3: press released - ADC_BTN_STATE_LONG_PRESSED, // 4: long pressed - ADC_BTN_STATE_LONG_RELEASE, // 5: long Press released - } adc_btn_state_t; - - typedef struct - { - int active_id; - int click_cnt; // Timer tick count - int long_click; - } btn_decription; - - typedef struct adc_btn - { - adc_arr_t adc_info; - btn_decription *btn_dscp; - struct adc_btn *next; - } adc_btn_list; - - typedef struct - { - int task_stack; - int task_prio; - int task_core; - bool ext_stack; - } adc_btn_task_cfg_t; - - typedef void (*adc_button_callback) (void *user_data, int adc, int id, - adc_btn_state_t state); - - void adc_btn_init (void *user_data, adc_button_callback cb, - adc_btn_list *head, adc_btn_task_cfg_t *task_cfg); - - adc_btn_list *adc_btn_create_list (adc_arr_t *adc_conf, int channels); - - esp_err_t adc_btn_destroy_list (adc_btn_list *head); - - void adc_btn_delete_task (void); +typedef enum { + USER_KEY_ID0, + USER_KEY_ID1, + USER_KEY_ID2, + USER_KEY_ID3, + USER_KEY_ID4, + USER_KEY_ID5, + USER_KEY_ID6, + USER_KEY_MAX, +} user_key_id_num; + +typedef struct { + int adc_ch; + int *adc_level_step; + int total_steps; + int press_judge_time; +} adc_arr_t; + +typedef enum { + ADC_BTN_STATE_IDLE, // 0: idle + ADC_BTN_STATE_ADC, // 1: detect + ADC_BTN_STATE_PRESSED, // 2: pressed + ADC_BTN_STATE_RELEASE, // 3: press released + ADC_BTN_STATE_LONG_PRESSED, // 4: long pressed + ADC_BTN_STATE_LONG_RELEASE, // 5: long Press released +} adc_btn_state_t; + +typedef struct { + int active_id; + int click_cnt; // Timer tick count + int long_click; +} btn_decription; + +typedef struct adc_btn { + adc_arr_t adc_info; + btn_decription *btn_dscp; + struct adc_btn *next; +} adc_btn_list; + +typedef struct { + int task_stack; + int task_prio; + int task_core; + bool ext_stack; +} adc_btn_task_cfg_t; + +typedef void (*adc_button_callback)(void *user_data, int adc, int id, + adc_btn_state_t state); + +void adc_btn_init(void *user_data, adc_button_callback cb, adc_btn_list *head, + adc_btn_task_cfg_t *task_cfg); + +adc_btn_list *adc_btn_create_list(adc_arr_t *adc_conf, int channels); + +esp_err_t adc_btn_destroy_list(adc_btn_list *head); + +void adc_btn_delete_task(void); #ifdef __cplusplus } diff --git a/components/esp_peripherals/lib/aw2013/aw2013.c b/components/esp_peripherals/lib/aw2013/aw2013.c index 71bf902d..1396d3c1 100644 --- a/components/esp_peripherals/lib/aw2013/aw2013.c +++ b/components/esp_peripherals/lib/aw2013/aw2013.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,17 +18,19 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "aw2013.h" + +#include + #include "board.h" #include "esp_log.h" #include "i2c_bus.h" -#include #define AW2013_ADDR 0x8a #define AW2013_MAX_LED_NUM 3 @@ -38,296 +40,250 @@ static const char *TAG = "AW2013"; static i2c_bus_handle_t i2c_handle; -esp_err_t -aw2013_set_repeat_time (uint8_t cnt) -{ +esp_err_t aw2013_set_repeat_time(uint8_t cnt) { esp_err_t ret = ESP_OK; - AUDIO_NULL_CHECK (TAG, i2c_handle, return ESP_FAIL); + AUDIO_NULL_CHECK(TAG, i2c_handle, return ESP_FAIL); uint8_t reg_val = 0; uint8_t reg_addr = 0x0; cnt %= AW2013_MAX_REPEAT_TIME; - for (int i = 0; i < AW2013_MAX_LED_NUM; i++) - { - reg_addr = AW2013_REG_LED0T0CNT + AW2013_MAX_LED_NUM * i; - ret |= i2c_bus_read_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, - ®_val, 1); - reg_val &= 0xf0; - reg_val |= cnt; - ret |= i2c_bus_write_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, - ®_val, 1); - } + for (int i = 0; i < AW2013_MAX_LED_NUM; i++) { + reg_addr = AW2013_REG_LED0T0CNT + AW2013_MAX_LED_NUM * i; + ret |= + i2c_bus_read_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, ®_val, 1); + reg_val &= 0xf0; + reg_val |= cnt; + ret |= + i2c_bus_write_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, ®_val, 1); + } return ret; } -esp_err_t -aw2013_set_time (aw2013_time_t time, aw2013_time_level_t level) -{ - if (level > AW2013_TIME_LEVEL_8 || time > AW2013_TIME_4) - { - ESP_LOGE (TAG, "Invalid parameters, time: %d, level: %d", time, level); - return ESP_FAIL; - } +esp_err_t aw2013_set_time(aw2013_time_t time, aw2013_time_level_t level) { + if (level > AW2013_TIME_LEVEL_8 || time > AW2013_TIME_4) { + ESP_LOGE(TAG, "Invalid parameters, time: %d, level: %d", time, level); + return ESP_FAIL; + } uint8_t reg_val = 0; uint8_t reg_addr = 0x0; esp_err_t ret = ESP_OK; - AUDIO_NULL_CHECK (TAG, i2c_handle, return ESP_FAIL); + AUDIO_NULL_CHECK(TAG, i2c_handle, return ESP_FAIL); - for (int i = 0; i < AW2013_MAX_LED_NUM; i++) - { - switch (time) - { - case AW2013_TIME_0: - { - reg_addr = AW2013_REG_LED0T0CNT + AW2013_MAX_LED_NUM * i; - ret |= i2c_bus_read_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, - ®_val, 1); - reg_val &= 0x0f; - reg_val |= (level << 4); - ret |= i2c_bus_write_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, - ®_val, 1); - break; - } - case AW2013_TIME_1: - { - if (level > AW2013_TIME_LEVEL_7) - { - level = AW2013_TIME_LEVEL_7; - } - reg_addr = AW2013_REG_LED0T1T2 + AW2013_MAX_LED_NUM * i; - ret |= i2c_bus_read_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, - ®_val, 1); - reg_val &= 0x8f; - reg_val |= (level << 4); - ret |= i2c_bus_write_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, - ®_val, 1); - break; - } - case AW2013_TIME_2: - { - if (level > AW2013_TIME_LEVEL_5) - { - level = AW2013_TIME_LEVEL_5; - } - reg_addr = AW2013_REG_LED0T1T2 + AW2013_MAX_LED_NUM * i; - ret |= i2c_bus_read_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, - ®_val, 1); - reg_val &= 0xf8; - reg_val |= level; - ret |= i2c_bus_write_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, - ®_val, 1); - break; - } - case AW2013_TIME_3: - { - if (level > 7) - { - level = 7; - } - reg_addr = AW2013_REG_LED0T3T4 + AW2013_MAX_LED_NUM * i; - ret |= i2c_bus_read_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, - ®_val, 1); - reg_val &= 0x8f; - reg_val |= (level << 4); - ret |= i2c_bus_write_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, - ®_val, 1); - break; - } - case AW2013_TIME_4: - { - if (level > 7) - { - level = 7; - } - reg_addr = AW2013_REG_LED0T3T4 + AW2013_MAX_LED_NUM * i; - ret |= i2c_bus_read_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, - ®_val, 1); - reg_val &= 0xf8; - reg_val |= level; - ret |= i2c_bus_write_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, - ®_val, 1); - break; - } - default: - { - return ESP_FAIL; - } + for (int i = 0; i < AW2013_MAX_LED_NUM; i++) { + switch (time) { + case AW2013_TIME_0: { + reg_addr = AW2013_REG_LED0T0CNT + AW2013_MAX_LED_NUM * i; + ret |= i2c_bus_read_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, + ®_val, 1); + reg_val &= 0x0f; + reg_val |= (level << 4); + ret |= i2c_bus_write_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, + ®_val, 1); + break; + } + case AW2013_TIME_1: { + if (level > AW2013_TIME_LEVEL_7) { + level = AW2013_TIME_LEVEL_7; } + reg_addr = AW2013_REG_LED0T1T2 + AW2013_MAX_LED_NUM * i; + ret |= i2c_bus_read_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, + ®_val, 1); + reg_val &= 0x8f; + reg_val |= (level << 4); + ret |= i2c_bus_write_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, + ®_val, 1); + break; + } + case AW2013_TIME_2: { + if (level > AW2013_TIME_LEVEL_5) { + level = AW2013_TIME_LEVEL_5; + } + reg_addr = AW2013_REG_LED0T1T2 + AW2013_MAX_LED_NUM * i; + ret |= i2c_bus_read_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, + ®_val, 1); + reg_val &= 0xf8; + reg_val |= level; + ret |= i2c_bus_write_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, + ®_val, 1); + break; + } + case AW2013_TIME_3: { + if (level > 7) { + level = 7; + } + reg_addr = AW2013_REG_LED0T3T4 + AW2013_MAX_LED_NUM * i; + ret |= i2c_bus_read_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, + ®_val, 1); + reg_val &= 0x8f; + reg_val |= (level << 4); + ret |= i2c_bus_write_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, + ®_val, 1); + break; + } + case AW2013_TIME_4: { + if (level > 7) { + level = 7; + } + reg_addr = AW2013_REG_LED0T3T4 + AW2013_MAX_LED_NUM * i; + ret |= i2c_bus_read_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, + ®_val, 1); + reg_val &= 0xf8; + reg_val |= level; + ret |= i2c_bus_write_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, + ®_val, 1); + break; + } + default: { + return ESP_FAIL; + } } + } return ret; } -esp_err_t -aw2013_enable_fade_mode (bool en) -{ +esp_err_t aw2013_enable_fade_mode(bool en) { esp_err_t ret = ESP_OK; uint8_t reg_val = 0; uint8_t reg_addr = 0x0; - AUDIO_NULL_CHECK (TAG, i2c_handle, return ESP_FAIL); + AUDIO_NULL_CHECK(TAG, i2c_handle, return ESP_FAIL); - if (en) - { - for (int i = 0; i < AW2013_MAX_LED_NUM; i++) - { - reg_addr = AW2013_REG_LCFG0 + i; - ret |= i2c_bus_read_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, - ®_val, 1); - reg_val &= ~(0x01 << 4); - reg_val |= (0x03 << 5); - ret |= i2c_bus_write_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, - ®_val, 1); - } + if (en) { + for (int i = 0; i < AW2013_MAX_LED_NUM; i++) { + reg_addr = AW2013_REG_LCFG0 + i; + ret |= i2c_bus_read_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, ®_val, + 1); + reg_val &= ~(0x01 << 4); + reg_val |= (0x03 << 5); + ret |= i2c_bus_write_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, + ®_val, 1); } - else - { - for (int i = 0; i < AW2013_MAX_LED_NUM; i++) - { - reg_addr = AW2013_REG_LCFG0 + i; - ret |= i2c_bus_read_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, - ®_val, 1); - reg_val &= ~(0x03 << 5); - ret |= i2c_bus_write_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, - ®_val, 1); - } + } else { + for (int i = 0; i < AW2013_MAX_LED_NUM; i++) { + reg_addr = AW2013_REG_LCFG0 + i; + ret |= i2c_bus_read_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, ®_val, + 1); + reg_val &= ~(0x03 << 5); + ret |= i2c_bus_write_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, + ®_val, 1); } + } return ret; } -esp_err_t -aw2013_enable_auto_flash (bool en) -{ +esp_err_t aw2013_enable_auto_flash(bool en) { esp_err_t ret = ESP_OK; uint8_t reg_val = 0; uint8_t reg_addr = 0x0; - AUDIO_NULL_CHECK (TAG, i2c_handle, return ESP_FAIL); + AUDIO_NULL_CHECK(TAG, i2c_handle, return ESP_FAIL); - if (en) - { - for (int i = 0; i < AW2013_MAX_LED_NUM; i++) - { - reg_addr = AW2013_REG_LCFG0 + i; - ret |= i2c_bus_read_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, - ®_val, 1); - reg_val |= (0x01 << 4); - ret |= i2c_bus_write_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, - ®_val, 1); - } + if (en) { + for (int i = 0; i < AW2013_MAX_LED_NUM; i++) { + reg_addr = AW2013_REG_LCFG0 + i; + ret |= i2c_bus_read_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, ®_val, + 1); + reg_val |= (0x01 << 4); + ret |= i2c_bus_write_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, + ®_val, 1); } - else - { - for (int i = 0; i < AW2013_MAX_LED_NUM; i++) - { - reg_addr = AW2013_REG_LCFG0 + i; - ret |= i2c_bus_read_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, - ®_val, 1); - reg_val &= ~(0x01 << 4); - ret |= i2c_bus_write_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, - ®_val, 1); - } + } else { + for (int i = 0; i < AW2013_MAX_LED_NUM; i++) { + reg_addr = AW2013_REG_LCFG0 + i; + ret |= i2c_bus_read_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, ®_val, + 1); + reg_val &= ~(0x01 << 4); + ret |= i2c_bus_write_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, + ®_val, 1); } + } return ret; } -esp_err_t -aw2013_set_pwm_value (uint32_t value) -{ +esp_err_t aw2013_set_pwm_value(uint32_t value) { esp_err_t ret = ESP_OK; uint8_t reg_val = 0; uint8_t reg_addr = 0x0; - AUDIO_NULL_CHECK (TAG, i2c_handle, return ESP_FAIL); + AUDIO_NULL_CHECK(TAG, i2c_handle, return ESP_FAIL); reg_addr = AW2013_REG_PWM0; reg_val = (value >> 16) & 0xff; - ret |= i2c_bus_write_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, ®_val, - 1); + ret |= + i2c_bus_write_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, ®_val, 1); reg_addr = AW2013_REG_PWM1; reg_val = (value >> 8) & 0xff; - ret |= i2c_bus_write_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, ®_val, - 1); + ret |= + i2c_bus_write_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, ®_val, 1); reg_addr = AW2013_REG_PWM2; reg_val = value & 0xff; - ret |= i2c_bus_write_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, ®_val, - 1); + ret |= + i2c_bus_write_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, ®_val, 1); return ret; } -esp_err_t -aw2013_set_brightness (aw2013_brightness_t bright) -{ +esp_err_t aw2013_set_brightness(aw2013_brightness_t bright) { esp_err_t ret = ESP_OK; uint8_t reg_val = 0; uint8_t reg_addr = 0x0; - AUDIO_NULL_CHECK (TAG, i2c_handle, return ESP_FAIL); - if (bright > AW2013_BRIGHT_3) - { - bright = AW2013_BRIGHT_3; - } - for (int i = 0; i < AW2013_MAX_LED_NUM; i++) - { - reg_addr = AW2013_REG_LCFG0 + i; - ret |= i2c_bus_read_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, - ®_val, 1); - reg_val &= 0xfc; - reg_val |= bright; - ret |= i2c_bus_write_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, - ®_val, 1); - } + AUDIO_NULL_CHECK(TAG, i2c_handle, return ESP_FAIL); + if (bright > AW2013_BRIGHT_3) { + bright = AW2013_BRIGHT_3; + } + for (int i = 0; i < AW2013_MAX_LED_NUM; i++) { + reg_addr = AW2013_REG_LCFG0 + i; + ret |= + i2c_bus_read_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, ®_val, 1); + reg_val &= 0xfc; + reg_val |= bright; + ret |= + i2c_bus_write_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, ®_val, 1); + } return ret; } -esp_err_t -aw2013_reset (void) -{ +esp_err_t aw2013_reset(void) { esp_err_t ret = ESP_OK; uint8_t reg_val = 0; uint8_t reg_addr = 0x0; - AUDIO_NULL_CHECK (TAG, i2c_handle, return ESP_FAIL); + AUDIO_NULL_CHECK(TAG, i2c_handle, return ESP_FAIL); reg_addr = AW2013_REG_RESET; reg_addr = AW2013_RESET_VALUE; - ret |= i2c_bus_write_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, ®_val, - 1); + ret |= + i2c_bus_write_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, ®_val, 1); reg_addr = AW2013_REG_GCR; reg_val = 0x01; - ret |= i2c_bus_write_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, ®_val, - 1); + ret |= + i2c_bus_write_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, ®_val, 1); reg_addr = AW2013_REG_LCTR; reg_val = 0x07; - ret |= i2c_bus_write_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, ®_val, - 1); - ret |= aw2013_set_brightness (1); + ret |= + i2c_bus_write_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, ®_val, 1); + ret |= aw2013_set_brightness(1); return ret; } -esp_err_t -aw2013_init (void) -{ +esp_err_t aw2013_init(void) { esp_err_t ret = ESP_OK; - i2c_config_t config - = { .mode = I2C_MODE_MASTER, .master.clk_speed = 100000 }; - ret |= get_i2c_pins (AW2013_I2C_PORT, &config); - i2c_handle = i2c_bus_create (AW2013_I2C_PORT, &config); - ret |= aw2013_reset (); - if (ret != ESP_OK) - { - ESP_LOGE (TAG, "Fail to init aw2013"); - } + i2c_config_t config = {.mode = I2C_MODE_MASTER, .master.clk_speed = 100000}; + ret |= get_i2c_pins(AW2013_I2C_PORT, &config); + i2c_handle = i2c_bus_create(AW2013_I2C_PORT, &config); + ret |= aw2013_reset(); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "Fail to init aw2013"); + } return ret; } -esp_err_t -aw2013_deinit (void) -{ +esp_err_t aw2013_deinit(void) { esp_err_t ret = ESP_OK; uint8_t reg_addr = AW2013_REG_RESET; uint8_t reg_val = AW2013_RESET_VALUE; - AUDIO_NULL_CHECK (TAG, i2c_handle, return ESP_FAIL); - ret |= i2c_bus_write_bytes (i2c_handle, AW2013_ADDR, ®_addr, 1, ®_val, - 1); - ret |= i2c_bus_delete (i2c_handle); + AUDIO_NULL_CHECK(TAG, i2c_handle, return ESP_FAIL); + ret |= + i2c_bus_write_bytes(i2c_handle, AW2013_ADDR, ®_addr, 1, ®_val, 1); + ret |= i2c_bus_delete(i2c_handle); return ret; } diff --git a/components/esp_peripherals/lib/aw2013/aw2013.h b/components/esp_peripherals/lib/aw2013/aw2013.h index 9a10455e..983c14ac 100644 --- a/components/esp_peripherals/lib/aw2013/aw2013.h +++ b/components/esp_peripherals/lib/aw2013/aw2013.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -31,8 +31,7 @@ #include "esp_log.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif #define AW2013_I2C_PORT I2C_NUM_0 @@ -64,139 +63,136 @@ extern "C" #define AW2013_REG_LED1T0CNT 0x3C #define AW2013_REG_LED2T0CNT 0x3F - typedef enum - { - AW2013_BRIGHT_0, // Turn off the lights, the electric current is 0mA - AW2013_BRIGHT_1, // 5mA - AW2013_BRIGHT_2, // 10mA - AW2013_BRIGHT_3, // 15mA - } aw2013_brightness_t; - - // Time periods of a auto flash cycle - /*-------------------------------------------*\ - | __________ | - | /| |\ | - | / | | \ | - | / | | \ | - | ________/ | | \__________ | - | | | | | | | | - | |<--t0->|t1 |<--t2-->|t3 |<--t4-->| | - \*-------------------------------------------*/ - typedef enum - { - AW2013_TIME_0, // T0 - AW2013_TIME_1, // T1 - AW2013_TIME_2, // T2 - AW2013_TIME_3, // T3 - AW2013_TIME_4 // T4 - } aw2013_time_t; - - typedef enum - { // T1-T4 T0 - AW2013_TIME_LEVEL_0, // 0.13s (T0 0s) - AW2013_TIME_LEVEL_1, // 0.26s (T0 0.13s) - AW2013_TIME_LEVEL_2, // 0.52s (T0 0.26s) - AW2013_TIME_LEVEL_3, // 1.04s (T0 0.52s) - AW2013_TIME_LEVEL_4, // 2.08s (T0 1.04s) - AW2013_TIME_LEVEL_5, // 4.16s (T0 2.08s) - AW2013_TIME_LEVEL_6, // 8.32s (T0 4.16s) - AW2013_TIME_LEVEL_7, // 16.64s (T0 8.32s) - AW2013_TIME_LEVEL_8, // (T0 16.64s) - } aw2013_time_level_t; - - /** - * @brief Initialize the aw2013 chip - * - * @return - * - ESP_OK Success - * - ESP_FAIL error - */ - esp_err_t aw2013_init (void); - - /** - * @brief Deinitialize the aw2013 chip - * - * @return - * - ESP_OK Success - * - ESP_FAIL error - */ - esp_err_t aw2013_deinit (void); - - /** - * @brief Reset the aw2013 chip - * - * @return - * - ESP_OK Success - * - ESP_FAIL error - */ - esp_err_t aw2013_reset (void); - - /** - * @brief Set rgb value for the aw2013 - * - * @param value The value to be set - * - * @return - * - ESP_OK Success - * - ESP_FAIL error - */ - esp_err_t aw2013_set_pwm_value (uint32_t value); - - /** - * @brief Set repeat times for auto flash - * - * @param cnt Number of repetitions - * - * @return - * - ESP_OK Success - * - ESP_FAIL error - */ - esp_err_t aw2013_set_repeat_time (uint8_t cnt); - - /** - * @brief Set the time for each time period for auto flash - * - * @param time The time period - * @param level The time to be set - * - * @return - * - ESP_OK Success - * - ESP_FAIL error - */ - esp_err_t aw2013_set_time (aw2013_time_t time, aw2013_time_level_t level); - - /** - * @brief Set the brightness - * - * @param bright The brightness to be set - * - * @return - * - ESP_OK Success - * - ESP_FAIL error - */ - esp_err_t aw2013_set_brightness (aw2013_brightness_t bright); - - /** - * @brief Enable the auto flash fuction - * - * @param en Whether to enable - * - * @return - * - ESP_OK Success - * - ESP_FAIL error - */ - esp_err_t aw2013_enable_auto_flash (bool en); - - /** - * @brief Enable the fade fuction - * - * @param en Whether to enable - * - * @return - * - ESP_OK Success - * - ESP_FAIL error - */ - esp_err_t aw2013_enable_fade_mode (bool en); +typedef enum { + AW2013_BRIGHT_0, // Turn off the lights, the electric current is 0mA + AW2013_BRIGHT_1, // 5mA + AW2013_BRIGHT_2, // 10mA + AW2013_BRIGHT_3, // 15mA +} aw2013_brightness_t; + +// Time periods of a auto flash cycle +/*-------------------------------------------*\ +| __________ | +| /| |\ | +| / | | \ | +| / | | \ | +| ________/ | | \__________ | +| | | | | | | | +| |<--t0->|t1 |<--t2-->|t3 |<--t4-->| | +\*-------------------------------------------*/ +typedef enum { + AW2013_TIME_0, // T0 + AW2013_TIME_1, // T1 + AW2013_TIME_2, // T2 + AW2013_TIME_3, // T3 + AW2013_TIME_4 // T4 +} aw2013_time_t; + +typedef enum { // T1-T4 T0 + AW2013_TIME_LEVEL_0, // 0.13s (T0 0s) + AW2013_TIME_LEVEL_1, // 0.26s (T0 0.13s) + AW2013_TIME_LEVEL_2, // 0.52s (T0 0.26s) + AW2013_TIME_LEVEL_3, // 1.04s (T0 0.52s) + AW2013_TIME_LEVEL_4, // 2.08s (T0 1.04s) + AW2013_TIME_LEVEL_5, // 4.16s (T0 2.08s) + AW2013_TIME_LEVEL_6, // 8.32s (T0 4.16s) + AW2013_TIME_LEVEL_7, // 16.64s (T0 8.32s) + AW2013_TIME_LEVEL_8, // (T0 16.64s) +} aw2013_time_level_t; + +/** + * @brief Initialize the aw2013 chip + * + * @return + * - ESP_OK Success + * - ESP_FAIL error + */ +esp_err_t aw2013_init(void); + +/** + * @brief Deinitialize the aw2013 chip + * + * @return + * - ESP_OK Success + * - ESP_FAIL error + */ +esp_err_t aw2013_deinit(void); + +/** + * @brief Reset the aw2013 chip + * + * @return + * - ESP_OK Success + * - ESP_FAIL error + */ +esp_err_t aw2013_reset(void); + +/** + * @brief Set rgb value for the aw2013 + * + * @param value The value to be set + * + * @return + * - ESP_OK Success + * - ESP_FAIL error + */ +esp_err_t aw2013_set_pwm_value(uint32_t value); + +/** + * @brief Set repeat times for auto flash + * + * @param cnt Number of repetitions + * + * @return + * - ESP_OK Success + * - ESP_FAIL error + */ +esp_err_t aw2013_set_repeat_time(uint8_t cnt); + +/** + * @brief Set the time for each time period for auto flash + * + * @param time The time period + * @param level The time to be set + * + * @return + * - ESP_OK Success + * - ESP_FAIL error + */ +esp_err_t aw2013_set_time(aw2013_time_t time, aw2013_time_level_t level); + +/** + * @brief Set the brightness + * + * @param bright The brightness to be set + * + * @return + * - ESP_OK Success + * - ESP_FAIL error + */ +esp_err_t aw2013_set_brightness(aw2013_brightness_t bright); + +/** + * @brief Enable the auto flash fuction + * + * @param en Whether to enable + * + * @return + * - ESP_OK Success + * - ESP_FAIL error + */ +esp_err_t aw2013_enable_auto_flash(bool en); + +/** + * @brief Enable the fade fuction + * + * @param en Whether to enable + * + * @return + * - ESP_OK Success + * - ESP_FAIL error + */ +esp_err_t aw2013_enable_fade_mode(bool en); #ifdef __cplusplus } diff --git a/components/esp_peripherals/lib/blufi/blufi_security.c b/components/esp_peripherals/lib/blufi/blufi_security.c index 63650efe..a30cc195 100644 --- a/components/esp_peripherals/lib/blufi/blufi_security.c +++ b/components/esp_peripherals/lib/blufi/blufi_security.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,42 +18,34 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "audio_mem.h" #include "sdkconfig.h" #ifdef CONFIG_BLUEDROID_ENABLED -#include "esp_log.h" -#include "esp_system.h" #include #include #include +#include "audio_idf_version.h" +#include "esp_log.h" +#include "esp_system.h" #include "mbedtls/aes.h" #include "mbedtls/dhm.h" #include "mbedtls/md5.h" -#if __has_include("esp_idf_version.h") -#include "esp_idf_version.h" -#else -#define ESP_IDF_VERSION_VAL(major, minor, patch) 1 -#endif - #if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)) - -#ifdef CONFIG_IDF_TARGET_ESP32 #include "esp32/rom/crc.h" -#else -#include "esp32s2beta/rom/crc.h" -#endif // CONFIG_IDF_TARGET_ESP32 - #else #include "rom/crc.h" -#endif //(ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)) +#endif //(ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)) +#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)) +#include "esp_random.h" +#endif #define BLUFI_SECURITY_TAG "BLUFI_SECURITY" /* @@ -67,8 +59,7 @@ #define SEC_TYPE_DH_G 0x03 #define SEC_TYPE_DH_PUBLIC 0x04 -struct blufi_security -{ +struct blufi_security { #define DH_SELF_PUB_KEY_LEN 128 #define DH_SELF_PUB_KEY_BIT_LEN (DH_SELF_PUB_KEY_LEN * 8) uint8_t self_public_key[DH_SELF_PUB_KEY_LEN]; @@ -86,188 +77,166 @@ struct blufi_security }; static struct blufi_security *blufi_sec; -static int -myrand (void *rng_state, unsigned char *output, size_t len) -{ +static int myrand(void *rng_state, unsigned char *output, size_t len) { size_t i; - for (i = 0; i < len; ++i) - { - output[i] = esp_random (); - } + for (i = 0; i < len; ++i) { + output[i] = esp_random(); + } return ESP_OK; } -void -blufi_dh_negotiate_data_handler (uint8_t *data, int len, uint8_t **output_data, - int *output_len, bool *need_free) -{ +void blufi_dh_negotiate_data_handler(uint8_t *data, int len, + uint8_t **output_data, int *output_len, + bool *need_free) { int ret; uint8_t type = data[0]; - if (blufi_sec == NULL) - { - ESP_LOGE (BLUFI_SECURITY_TAG, "BLUFI Security is not initialized"); - return; - } + if (blufi_sec == NULL) { + ESP_LOGE(BLUFI_SECURITY_TAG, "BLUFI Security is not initialized"); + return; + } - switch (type) - { + switch (type) { case SEC_TYPE_DH_PARAM_LEN: blufi_sec->dh_param_len = ((data[1] << 8) | data[2]); - if (blufi_sec->dh_param) - { - audio_free (blufi_sec->dh_param); - blufi_sec->dh_param = NULL; - } - blufi_sec->dh_param - = (uint8_t *)audio_calloc (1, blufi_sec->dh_param_len); - if (blufi_sec->dh_param == NULL) - { - ESP_LOGE (BLUFI_SECURITY_TAG, "%s, Malloc failed", __func__); - return; - } - break; - case SEC_TYPE_DH_PARAM_DATA: - { - if (blufi_sec->dh_param == NULL) - { - ESP_LOGE (BLUFI_SECURITY_TAG, "%s, Blufi_sec->dh_param == NULL", - __func__); - return; - } - uint8_t *param = blufi_sec->dh_param; - memcpy (blufi_sec->dh_param, &data[1], blufi_sec->dh_param_len); - ret = mbedtls_dhm_read_params (&blufi_sec->dhm, ¶m, - ¶m[blufi_sec->dh_param_len]); - if (ret) - { - ESP_LOGE (BLUFI_SECURITY_TAG, "%s Read param failed %d", __func__, - ret); - return; - } - audio_free (blufi_sec->dh_param); + if (blufi_sec->dh_param) { + audio_free(blufi_sec->dh_param); blufi_sec->dh_param = NULL; - ret = mbedtls_dhm_make_public ( - &blufi_sec->dhm, (int)mbedtls_mpi_size (&blufi_sec->dhm.P), - blufi_sec->self_public_key, blufi_sec->dhm.len, myrand, NULL); - if (ret) - { - ESP_LOGE (BLUFI_SECURITY_TAG, "%s Make public failed %d", __func__, - ret); - return; - } - - mbedtls_dhm_calc_secret (&blufi_sec->dhm, blufi_sec->share_key, - SHARE_KEY_BIT_LEN, &blufi_sec->share_len, - NULL, NULL); - - mbedtls_md5 (blufi_sec->share_key, blufi_sec->share_len, - blufi_sec->psk); - - mbedtls_aes_setkey_enc (&blufi_sec->aes, blufi_sec->psk, 128); - - /* Alloc output data */ - *output_data = &blufi_sec->self_public_key[0]; - *output_len = blufi_sec->dhm.len; - *need_free = false; + } + blufi_sec->dh_param = (uint8_t *)audio_calloc(1, blufi_sec->dh_param_len); + if (blufi_sec->dh_param == NULL) { + ESP_LOGE(BLUFI_SECURITY_TAG, "%s, Malloc failed", __func__); + return; } break; + case SEC_TYPE_DH_PARAM_DATA: { + if (blufi_sec->dh_param == NULL) { + ESP_LOGE(BLUFI_SECURITY_TAG, "%s, Blufi_sec->dh_param == NULL", + __func__); + return; + } + uint8_t *param = blufi_sec->dh_param; + memcpy(blufi_sec->dh_param, &data[1], blufi_sec->dh_param_len); + ret = mbedtls_dhm_read_params(&blufi_sec->dhm, ¶m, + ¶m[blufi_sec->dh_param_len]); + if (ret) { + ESP_LOGE(BLUFI_SECURITY_TAG, "%s Read param failed %d", __func__, ret); + return; + } + audio_free(blufi_sec->dh_param); + blufi_sec->dh_param = NULL; +#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)) + const int dhm_len = mbedtls_dhm_get_len(&blufi_sec->dhm); + ret = mbedtls_dhm_make_public(&blufi_sec->dhm, dhm_len, + blufi_sec->self_public_key, dhm_len, myrand, + NULL); +#else + ret = mbedtls_dhm_make_public( + &blufi_sec->dhm, (int)mbedtls_mpi_size(&blufi_sec->dhm.P), + blufi_sec->self_public_key, blufi_sec->dhm.len, myrand, NULL); +#endif + if (ret) { + ESP_LOGE(BLUFI_SECURITY_TAG, "%s Make public failed %d", __func__, ret); + return; + } + + mbedtls_dhm_calc_secret(&blufi_sec->dhm, blufi_sec->share_key, + SHARE_KEY_BIT_LEN, &blufi_sec->share_len, NULL, + NULL); + + mbedtls_md5(blufi_sec->share_key, blufi_sec->share_len, blufi_sec->psk); + + mbedtls_aes_setkey_enc(&blufi_sec->aes, blufi_sec->psk, 128); + + /* Alloc output data */ + *output_data = &blufi_sec->self_public_key[0]; +#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)) + *output_len = dhm_len; +#endif + *need_free = false; + + } break; case SEC_TYPE_DH_P: break; case SEC_TYPE_DH_G: break; case SEC_TYPE_DH_PUBLIC: break; - } + } } -int -blufi_aes_encrypt (uint8_t iv8, uint8_t *crypt_data, int crypt_len) -{ +int blufi_aes_encrypt(uint8_t iv8, uint8_t *crypt_data, int crypt_len) { int ret; size_t iv_offset = 0; uint8_t iv0[16]; - memcpy (iv0, blufi_sec->iv, sizeof (blufi_sec->iv)); + memcpy(iv0, blufi_sec->iv, sizeof(blufi_sec->iv)); /* Set iv8 as the iv0[0] */ iv0[0] = iv8; - ret = mbedtls_aes_crypt_cfb128 (&blufi_sec->aes, MBEDTLS_AES_ENCRYPT, - crypt_len, &iv_offset, iv0, crypt_data, - crypt_data); - if (ret) - { - return ESP_FAIL; - } + ret = + mbedtls_aes_crypt_cfb128(&blufi_sec->aes, MBEDTLS_AES_ENCRYPT, crypt_len, + &iv_offset, iv0, crypt_data, crypt_data); + if (ret) { + return ESP_FAIL; + } return crypt_len; } -int -blufi_aes_decrypt (uint8_t iv8, uint8_t *crypt_data, int crypt_len) -{ +int blufi_aes_decrypt(uint8_t iv8, uint8_t *crypt_data, int crypt_len) { int ret; size_t iv_offset = 0; uint8_t iv0[16]; - memcpy (iv0, blufi_sec->iv, sizeof (blufi_sec->iv)); + memcpy(iv0, blufi_sec->iv, sizeof(blufi_sec->iv)); /* Set iv8 as the iv0[0] */ iv0[0] = iv8; - ret = mbedtls_aes_crypt_cfb128 (&blufi_sec->aes, MBEDTLS_AES_DECRYPT, - crypt_len, &iv_offset, iv0, crypt_data, - crypt_data); - if (ret) - { - return ESP_FAIL; - } + ret = + mbedtls_aes_crypt_cfb128(&blufi_sec->aes, MBEDTLS_AES_DECRYPT, crypt_len, + &iv_offset, iv0, crypt_data, crypt_data); + if (ret) { + return ESP_FAIL; + } return crypt_len; } -uint16_t -blufi_crc_checksum (uint8_t iv8, uint8_t *data, int len) -{ +uint16_t blufi_crc_checksum(uint8_t iv8, uint8_t *data, int len) { /* This iv8 ignore, not used */ - return crc16_be (0, data, len); + return crc16_be(0, data, len); } -esp_err_t -blufi_security_init (void) -{ - blufi_sec = (struct blufi_security *)audio_calloc ( - 1, sizeof (struct blufi_security)); - if (blufi_sec == NULL) - { - return ESP_FAIL; - } +esp_err_t blufi_security_init(void) { + blufi_sec = + (struct blufi_security *)audio_calloc(1, sizeof(struct blufi_security)); + if (blufi_sec == NULL) { + return ESP_FAIL; + } - mbedtls_dhm_init (&blufi_sec->dhm); - mbedtls_aes_init (&blufi_sec->aes); + mbedtls_dhm_init(&blufi_sec->dhm); + mbedtls_aes_init(&blufi_sec->aes); - memset (blufi_sec->iv, 0x0, 16); + memset(blufi_sec->iv, 0x0, 16); return ESP_OK; } -esp_err_t -blufi_security_deinit (void) -{ - if (blufi_sec == NULL) - { - return ESP_FAIL; - } - if (blufi_sec->dh_param) - { - audio_free (blufi_sec->dh_param); - blufi_sec->dh_param = NULL; - } - mbedtls_dhm_free (&blufi_sec->dhm); - mbedtls_aes_free (&blufi_sec->aes); +esp_err_t blufi_security_deinit(void) { + if (blufi_sec == NULL) { + return ESP_FAIL; + } + if (blufi_sec->dh_param) { + audio_free(blufi_sec->dh_param); + blufi_sec->dh_param = NULL; + } + mbedtls_dhm_free(&blufi_sec->dhm); + mbedtls_aes_free(&blufi_sec->aes); - memset (blufi_sec, 0x0, sizeof (struct blufi_security)); + memset(blufi_sec, 0x0, sizeof(struct blufi_security)); - audio_free (blufi_sec); + audio_free(blufi_sec); blufi_sec = NULL; return ESP_OK; diff --git a/components/esp_peripherals/lib/blufi/blufi_security.h b/components/esp_peripherals/lib/blufi/blufi_security.h index edb392cc..026b9b4a 100644 --- a/components/esp_peripherals/lib/blufi/blufi_security.h +++ b/components/esp_peripherals/lib/blufi/blufi_security.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -30,79 +30,78 @@ #include "esp_log.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - /** - * @brief BLUFI negotiate data handler - * - * @param[in] data data from phone - * @param[in] len length of data from phone - * @param[in] output_data data to be sent to phone - * @param[in] output_len length of data to be sent to phone - */ - void blufi_dh_negotiate_data_handler (uint8_t *data, int len, - uint8_t **output_data, int *output_len, - bool *need_free); +/** + * @brief BLUFI negotiate data handler + * + * @param[in] data data from phone + * @param[in] len length of data from phone + * @param[in] output_data data to be sent to phone + * @param[in] output_len length of data to be sent to phone + */ +void blufi_dh_negotiate_data_handler(uint8_t *data, int len, + uint8_t **output_data, int *output_len, + bool *need_free); - /** - * @brief BLUFI encrypt the data after negotiating a share key - * - * @param[in] iv8 initial vector(8bit), normally, blufi core will - * input packet sequence number - * @param[in] crypt_data plain text and encrypted data, the encrypt - * function must support autochthonous encrypt - * @param[in] crypt_len length of plain text - * - * @return Nonnegative number is encrypted length, if error, return negative - * number; - */ - int blufi_aes_encrypt (uint8_t iv8, uint8_t *crypt_data, int crypt_len); +/** + * @brief BLUFI encrypt the data after negotiating a share key + * + * @param[in] iv8 initial vector(8bit), normally, blufi core will + * input packet sequence number + * @param[in] crypt_data plain text and encrypted data, the encrypt function + * must support autochthonous encrypt + * @param[in] crypt_len length of plain text + * + * @return Nonnegative number is encrypted length, if error, return negative + * number; + */ +int blufi_aes_encrypt(uint8_t iv8, uint8_t *crypt_data, int crypt_len); - /** - * @brief BLUFI decrypt the data after negotiating a share key - * - * @param[in] iv8 initial vector(8bit), normally, blufi core will - * input packet sequence number - * @param[in] crypt_data encrypted data and plain text, the encrypt - * function must support autochthonous decrypt - * @param[in] crypt_len length of encrypted text - * - * @return Nonnegative number is decrypted length, if error, return negative - * number; - */ - int blufi_aes_decrypt (uint8_t iv8, uint8_t *crypt_data, int crypt_len); +/** + * @brief BLUFI decrypt the data after negotiating a share key + * + * @param[in] iv8 initial vector(8bit), normally, blufi core will + * input packet sequence number + * @param[in] crypt_data encrypted data and plain text, the encrypt function + * must support autochthonous decrypt + * @param[in] crypt_len length of encrypted text + * + * @return Nonnegative number is decrypted length, if error, return negative + * number; + */ +int blufi_aes_decrypt(uint8_t iv8, uint8_t *crypt_data, int crypt_len); - /** - * @brief BLUFI CRC check sum function - * - * @param[in] iv8 initial vector(8bit), normally, blufi core will input - * packet sequence number - * @param[in] data data need to checksum - * @param[in] len length of data - * - * @return None - */ - uint16_t blufi_crc_checksum (uint8_t iv8, uint8_t *data, int len); +/** + * @brief BLUFI CRC check sum function + * + * @param[in] iv8 initial vector(8bit), normally, blufi core will input + * packet sequence number + * @param[in] data data need to checksum + * @param[in] len length of data + * + * @return None + */ +uint16_t blufi_crc_checksum(uint8_t iv8, uint8_t *data, int len); - /** - * @brief Initialize and allocate the resource for BLUFI security - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t blufi_security_init (void); +/** + * @brief Initialize and allocate the resource for BLUFI security + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t blufi_security_init(void); - /** - * @brief Uninitialize and free the resource for BLUFI security - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t blufi_security_deinit (void); +/** + * @brief Uninitialize and free the resource for BLUFI security + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t blufi_security_deinit(void); #ifdef __cplusplus } diff --git a/components/esp_peripherals/lib/blufi/wifibleconfig.c b/components/esp_peripherals/lib/blufi/wifibleconfig.c index ee184337..f47c4c44 100644 --- a/components/esp_peripherals/lib/blufi/wifibleconfig.c +++ b/components/esp_peripherals/lib/blufi/wifibleconfig.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,32 +18,52 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ -#include "audio_mem.h" #include #include #include #include #include -#ifdef CONFIG_BLUEDROID_ENABLED +#include "audio_idf_version.h" +#include "audio_mem.h" + +#if defined(CONFIG_BT_BLE_BLUFI_ENABLE) #include "audio_error.h" -#include "blufi_security.h" -#include "esp_blufi_api.h" #include "esp_bt.h" +#include "esp_log.h" +#include "esp_system.h" +#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0)) +#include "esp_blufi.h" +#else +#include "esp_blufi_api.h" +#endif + +#ifdef CONFIG_BT_BLE_BLUFI_ENABLE #include "esp_bt_defs.h" #include "esp_bt_device.h" #include "esp_bt_main.h" #include "esp_gap_ble_api.h" #include "esp_gap_bt_api.h" -#include "esp_log.h" +#elif CONFIG_BT_NIMBLE_ENABLED +#include "console/console.h" +#include "esp_nimble_hci.h" +#include "host/ble_hs.h" +#include "host/util/util.h" +#include "nimble/nimble_port.h" +#include "nimble/nimble_port_freertos.h" +#include "services/gap/ble_svc_gap.h" +#include "services/gatt/ble_svc_gatt.h" +#endif + +#include "audio_error.h" +#include "blufi_security.h" #include "esp_smartconfig.h" -#include "esp_system.h" #include "esp_wifi.h" #include "periph_wifi.h" #include "wifibleconfig.h" @@ -53,15 +73,14 @@ #define WIFI_LIST_NUM (10) static uint8_t wifi_ble_service_uuid128[32] = { - /* LSB - <--------------------------------------------------------------------------------> - MSB */ - // first uuid, 16bit, [12],[13] is the value - 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, - 0x00, 0x10, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, + /* LSB + <--------------------------------------------------------------------------------> + MSB */ + // first uuid, 16bit, [12],[13] is the value + 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, + 0x00, 0x10, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, }; -typedef struct wifi_ble_config -{ +typedef struct wifi_ble_config { uint8_t ble_server_if; uint16_t ble_conn_id; wifi_config_t sta_config; @@ -70,218 +89,197 @@ typedef struct wifi_ble_config static wifi_ble_config_t *g_wifi_ble_config = NULL; -static void wifi_ble_event_callback (esp_blufi_cb_event_t event, - esp_blufi_cb_param_t *param); +static void wifi_ble_event_callback(esp_blufi_cb_event_t event, + esp_blufi_cb_param_t *param); static esp_ble_adv_data_t wifi_ble_adv_data = { - .set_scan_rsp = false, - .include_name = true, - .include_txpower = true, - .min_interval = 0x100, - .max_interval = 0x100, - .appearance = 0x00, - .manufacturer_len = 0, - .p_manufacturer_data = NULL, - .service_data_len = 0, - .p_service_data = NULL, - .service_uuid_len = 16, - .p_service_uuid = wifi_ble_service_uuid128, - .flag = 0x6, + .set_scan_rsp = false, + .include_name = true, + .include_txpower = true, + .min_interval = 0x100, + .max_interval = 0x100, + .appearance = 0x00, + .manufacturer_len = 0, + .p_manufacturer_data = NULL, + .service_data_len = 0, + .p_service_data = NULL, + .service_uuid_len = 16, + .p_service_uuid = wifi_ble_service_uuid128, + .flag = 0x6, }; static esp_ble_adv_params_t wifi_ble_adv_params = { - .adv_int_min = 0x100, - .adv_int_max = 0x100, - .adv_type = ADV_TYPE_IND, - .own_addr_type = BLE_ADDR_TYPE_PUBLIC, - .channel_map = ADV_CHNL_ALL, - .adv_filter_policy = ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY, + .adv_int_min = 0x100, + .adv_int_max = 0x100, + .adv_type = ADV_TYPE_IND, + .own_addr_type = BLE_ADDR_TYPE_PUBLIC, + .channel_map = ADV_CHNL_ALL, + .adv_filter_policy = ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY, }; static esp_blufi_callbacks_t wifi_ble_callbacks = { - .event_cb = wifi_ble_event_callback, - .negotiate_data_handler = blufi_dh_negotiate_data_handler, - .encrypt_func = blufi_aes_encrypt, - .decrypt_func = blufi_aes_decrypt, - .checksum_func = blufi_crc_checksum, + .event_cb = wifi_ble_event_callback, + .negotiate_data_handler = blufi_dh_negotiate_data_handler, + .encrypt_func = blufi_aes_encrypt, + .decrypt_func = blufi_aes_decrypt, + .checksum_func = blufi_crc_checksum, }; -static void -wifi_ble_gap_event_handler (esp_gap_ble_cb_event_t event, - esp_ble_gap_cb_param_t *param) -{ - switch (event) - { +static void wifi_ble_gap_event_handler(esp_gap_ble_cb_event_t event, + esp_ble_gap_cb_param_t *param) { + switch (event) { case ESP_GAP_BLE_ADV_DATA_SET_COMPLETE_EVT: - esp_ble_gap_start_advertising (&wifi_ble_adv_params); + esp_ble_gap_start_advertising(&wifi_ble_adv_params); break; default: break; - } + } } -esp_err_t -ble_config_stop (void) -{ - if (g_wifi_ble_config != NULL) - { - audio_free (g_wifi_ble_config); - g_wifi_ble_config = NULL; - } - blufi_security_deinit (); - esp_blufi_profile_deinit (); - esp_bluedroid_disable (); - esp_bluedroid_deinit (); +esp_err_t ble_config_stop(void) { + if (g_wifi_ble_config != NULL) { + audio_free(g_wifi_ble_config); + g_wifi_ble_config = NULL; + } + blufi_security_deinit(); + esp_blufi_profile_deinit(); + esp_bluedroid_disable(); + esp_bluedroid_deinit(); return ESP_OK; } -static void -wifi_ble_event_callback (esp_blufi_cb_event_t event, - esp_blufi_cb_param_t *param) -{ +static void wifi_ble_event_callback(esp_blufi_cb_event_t event, + esp_blufi_cb_param_t *param) { /* actually, should post to blufi_task handle the procedure, * now, as a audio_ble, we do it more simply */ esp_err_t ret; - switch (event) - { + switch (event) { case ESP_BLUFI_EVENT_INIT_FINISH: - ESP_LOGI (WIFI_BLE_TAG, "BLUFI init finish"); - esp_ble_gap_set_device_name (BLUFI_DEVICE_NAME); - esp_ble_gap_config_adv_data (&wifi_ble_adv_data); + ESP_LOGI(WIFI_BLE_TAG, "BLUFI init finish"); + esp_ble_gap_set_device_name(BLUFI_DEVICE_NAME); + esp_ble_gap_config_adv_data(&wifi_ble_adv_data); break; case ESP_BLUFI_EVENT_DEINIT_FINISH: - ESP_LOGI (WIFI_BLE_TAG, "BLUFI deinit finish"); + ESP_LOGI(WIFI_BLE_TAG, "BLUFI deinit finish"); break; case ESP_BLUFI_EVENT_BLE_CONNECT: - ESP_LOGI (WIFI_BLE_TAG, "BLUFI ble connect"); - esp_smartconfig_stop (); + ESP_LOGI(WIFI_BLE_TAG, "BLUFI ble connect"); + esp_smartconfig_stop(); g_wifi_ble_config->ble_server_if = param->connect.server_if; g_wifi_ble_config->ble_conn_id = param->connect.conn_id; break; case ESP_BLUFI_EVENT_BLE_DISCONNECT: - ESP_LOGI (WIFI_BLE_TAG, "BLUFI ble disconnect"); + ESP_LOGI(WIFI_BLE_TAG, "BLUFI ble disconnect"); break; case ESP_BLUFI_EVENT_SET_WIFI_OPMODE: - ESP_LOGI (WIFI_BLE_TAG, "BLUFI Set WIFI opmode %d", - param->wifi_mode.op_mode); - ESP_ERROR_CHECK (esp_wifi_set_mode (param->wifi_mode.op_mode)); + ESP_LOGI(WIFI_BLE_TAG, "BLUFI Set WIFI opmode %d", + param->wifi_mode.op_mode); + ESP_ERROR_CHECK(esp_wifi_set_mode(param->wifi_mode.op_mode)); break; case ESP_BLUFI_EVENT_REQ_CONNECT_TO_AP: - ESP_LOGI (WIFI_BLE_TAG, "BLUFI request wifi connect to AP"); - esp_wifi_disconnect (); - if (ESP_OK != esp_wifi_connect ()) - { - esp_periph_send_event (g_wifi_ble_config->periph, - PERIPH_WIFI_CONFIG_ERROR, NULL, 0); - } - else - { - esp_periph_send_event (g_wifi_ble_config->periph, - PERIPH_WIFI_CONFIG_DONE, NULL, 0); - ble_config_stop (); - } + ESP_LOGI(WIFI_BLE_TAG, "BLUFI request wifi connect to AP"); + esp_wifi_disconnect(); + if (ESP_OK != esp_wifi_connect()) { + esp_periph_send_event(g_wifi_ble_config->periph, + PERIPH_WIFI_CONFIG_ERROR, NULL, 0); + } else { + esp_periph_send_event(g_wifi_ble_config->periph, + PERIPH_WIFI_CONFIG_DONE, NULL, 0); + ble_config_stop(); + } break; case ESP_BLUFI_EVENT_REQ_DISCONNECT_FROM_AP: - ESP_LOGI (WIFI_BLE_TAG, "BLUFI request wifi disconnect from AP"); - esp_wifi_disconnect (); + ESP_LOGI(WIFI_BLE_TAG, "BLUFI request wifi disconnect from AP"); + esp_wifi_disconnect(); break; - case ESP_BLUFI_EVENT_GET_WIFI_STATUS: - { - wifi_mode_t mode; - esp_blufi_extra_info_t info; - esp_wifi_get_mode (&mode); - memset (&info, 0, sizeof (esp_blufi_extra_info_t)); - info.sta_bssid_set = true; - info.sta_ssid = g_wifi_ble_config->sta_config.sta.ssid; - esp_blufi_send_wifi_conn_report (mode, ESP_BLUFI_STA_CONN_SUCCESS, 0, - &info); - ESP_LOGI (WIFI_BLE_TAG, "BLUFI get wifi status from AP"); - break; - } + case ESP_BLUFI_EVENT_GET_WIFI_STATUS: { + wifi_mode_t mode; + esp_blufi_extra_info_t info; + esp_wifi_get_mode(&mode); + memset(&info, 0, sizeof(esp_blufi_extra_info_t)); + info.sta_bssid_set = true; + info.sta_ssid = g_wifi_ble_config->sta_config.sta.ssid; + esp_blufi_send_wifi_conn_report(mode, ESP_BLUFI_STA_CONN_SUCCESS, 0, + &info); + ESP_LOGI(WIFI_BLE_TAG, "BLUFI get wifi status from AP"); + break; + } case ESP_BLUFI_EVENT_RECV_SLAVE_DISCONNECT_BLE: - ESP_LOGI (WIFI_BLE_TAG, "BLUFI close a gatt connection"); - esp_blufi_close (g_wifi_ble_config->ble_server_if, - g_wifi_ble_config->ble_conn_id); + ESP_LOGI(WIFI_BLE_TAG, "BLUFI close a gatt connection"); + esp_blufi_close(g_wifi_ble_config->ble_server_if, + g_wifi_ble_config->ble_conn_id); break; case ESP_BLUFI_EVENT_DEAUTHENTICATE_STA: /* TODO */ break; case ESP_BLUFI_EVENT_RECV_STA_BSSID: - memcpy (g_wifi_ble_config->sta_config.sta.bssid, param->sta_bssid.bssid, - 6); + memcpy(g_wifi_ble_config->sta_config.sta.bssid, param->sta_bssid.bssid, + 6); g_wifi_ble_config->sta_config.sta.bssid_set = 1; - esp_wifi_set_config (WIFI_IF_STA, &g_wifi_ble_config->sta_config); - ESP_LOGI (WIFI_BLE_TAG, "Recv STA BSSID %s", - g_wifi_ble_config->sta_config.sta.bssid); + esp_wifi_set_config(WIFI_IF_STA, &g_wifi_ble_config->sta_config); + ESP_LOGI(WIFI_BLE_TAG, "Recv STA BSSID %s", + g_wifi_ble_config->sta_config.sta.bssid); break; case ESP_BLUFI_EVENT_RECV_STA_SSID: - strncpy ((char *)g_wifi_ble_config->sta_config.sta.ssid, - (char *)param->sta_ssid.ssid, param->sta_ssid.ssid_len); + strncpy((char *)g_wifi_ble_config->sta_config.sta.ssid, + (char *)param->sta_ssid.ssid, param->sta_ssid.ssid_len); g_wifi_ble_config->sta_config.sta.ssid[param->sta_ssid.ssid_len] = '\0'; - ret = esp_wifi_set_config (WIFI_IF_STA, &g_wifi_ble_config->sta_config); - ESP_LOGI (WIFI_BLE_TAG, "Recv STA SSID ret %d %s", ret, - g_wifi_ble_config->sta_config.sta.ssid); + ret = esp_wifi_set_config(WIFI_IF_STA, &g_wifi_ble_config->sta_config); + ESP_LOGI(WIFI_BLE_TAG, "Recv STA SSID ret %d %s", ret, + g_wifi_ble_config->sta_config.sta.ssid); break; case ESP_BLUFI_EVENT_RECV_STA_PASSWD: - strncpy ((char *)g_wifi_ble_config->sta_config.sta.password, - (char *)param->sta_passwd.passwd, param->sta_passwd.passwd_len); - g_wifi_ble_config->sta_config.sta.password[param->sta_passwd.passwd_len] - = '\0'; - esp_wifi_set_config (WIFI_IF_STA, &g_wifi_ble_config->sta_config); - ESP_LOGI (WIFI_BLE_TAG, "Recv STA PASSWORD %s", - g_wifi_ble_config->sta_config.sta.password); + strncpy((char *)g_wifi_ble_config->sta_config.sta.password, + (char *)param->sta_passwd.passwd, param->sta_passwd.passwd_len); + g_wifi_ble_config->sta_config.sta.password[param->sta_passwd.passwd_len] = + '\0'; + esp_wifi_set_config(WIFI_IF_STA, &g_wifi_ble_config->sta_config); + ESP_LOGI(WIFI_BLE_TAG, "Recv STA PASSWORD %s", + g_wifi_ble_config->sta_config.sta.password); break; default: - ESP_LOGE (WIFI_BLE_TAG, "Event %d is not supported", event); + ESP_LOGE(WIFI_BLE_TAG, "Event %d is not supported", event); break; - } + } } -esp_err_t -ble_config_start (esp_periph_handle_t periph) -{ - ESP_LOGI (WIFI_BLE_TAG, "ble_config_start"); +esp_err_t ble_config_start(esp_periph_handle_t periph) { + ESP_LOGI(WIFI_BLE_TAG, "ble_config_start"); - esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT (); - if (esp_bt_controller_get_status () == ESP_BT_CONTROLLER_STATUS_IDLE) - { - if (esp_bt_controller_init (&bt_cfg) != ESP_OK) - { - ESP_LOGE (WIFI_BLE_TAG, "%s initialize controller failed", __func__); - return ESP_FAIL; - } + esp_bt_controller_config_t bt_cfg = BT_CONTROLLER_INIT_CONFIG_DEFAULT(); + if (esp_bt_controller_get_status() == ESP_BT_CONTROLLER_STATUS_IDLE) { + if (esp_bt_controller_init(&bt_cfg) != ESP_OK) { + ESP_LOGE(WIFI_BLE_TAG, "%s initialize controller failed", __func__); + return ESP_FAIL; + } - if (esp_bt_controller_enable (ESP_BT_MODE_BLE) != ESP_OK) - { - ESP_LOGE (WIFI_BLE_TAG, "%s enable controller failed", __func__); - return ESP_FAIL; - } + if (esp_bt_controller_enable(ESP_BT_MODE_BLE) != ESP_OK) { + ESP_LOGE(WIFI_BLE_TAG, "%s enable controller failed", __func__); + return ESP_FAIL; + } + } + if (esp_bluedroid_get_status() == ESP_BLUEDROID_STATUS_UNINITIALIZED) { + if (esp_bluedroid_init() != ESP_OK) { + ESP_LOGE(WIFI_BLE_TAG, "%s esp_bluedroid_init failed", __func__); + return ESP_FAIL; } - if (esp_bluedroid_get_status () == ESP_BLUEDROID_STATUS_UNINITIALIZED) - { - if (esp_bluedroid_init () != ESP_OK) - { - ESP_LOGE (WIFI_BLE_TAG, "%s esp_bluedroid_init failed", __func__); - return ESP_FAIL; - } - if (esp_bluedroid_enable () != ESP_OK) - { - ESP_LOGE (WIFI_BLE_TAG, "%s esp_bluedroid_enable failed", __func__); - return ESP_FAIL; - } + if (esp_bluedroid_enable() != ESP_OK) { + ESP_LOGE(WIFI_BLE_TAG, "%s esp_bluedroid_enable failed", __func__); + return ESP_FAIL; } - ESP_LOGI (WIFI_BLE_TAG, "BD ADDR: " ESP_BD_ADDR_STR "", - ESP_BD_ADDR_HEX (esp_bt_dev_get_address ())); - ESP_LOGI (WIFI_BLE_TAG, "BLUFI VERSION %04x", esp_blufi_get_version ()); + } + ESP_LOGI(WIFI_BLE_TAG, "BD ADDR: " ESP_BD_ADDR_STR "", + ESP_BD_ADDR_HEX(esp_bt_dev_get_address())); + ESP_LOGI(WIFI_BLE_TAG, "BLUFI VERSION %04x", esp_blufi_get_version()); - g_wifi_ble_config = audio_calloc (1, sizeof (wifi_ble_config_t)); - AUDIO_MEM_CHECK (WIFI_BLE_TAG, g_wifi_ble_config, return ESP_FAIL); + g_wifi_ble_config = audio_calloc(1, sizeof(wifi_ble_config_t)); + AUDIO_MEM_CHECK(WIFI_BLE_TAG, g_wifi_ble_config, return ESP_FAIL); g_wifi_ble_config->periph = periph; - blufi_security_init (); - esp_ble_gap_register_callback (wifi_ble_gap_event_handler); - esp_blufi_register_callbacks (&wifi_ble_callbacks); - esp_blufi_profile_init (); + blufi_security_init(); + esp_ble_gap_register_callback(wifi_ble_gap_event_handler); + esp_blufi_register_callbacks(&wifi_ble_callbacks); + esp_blufi_profile_init(); return ESP_OK; } diff --git a/components/esp_peripherals/lib/blufi/wifibleconfig.h b/components/esp_peripherals/lib/blufi/wifibleconfig.h index 0d7a9a83..63c21cfc 100644 --- a/components/esp_peripherals/lib/blufi/wifibleconfig.h +++ b/components/esp_peripherals/lib/blufi/wifibleconfig.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -31,29 +31,28 @@ #include "esp_peripherals.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - /** - * @brief Start Wi-Fi BLE config - * - * @param[in] periph The peripheral handle - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t ble_config_start (esp_periph_handle_t periph); +/** + * @brief Start Wi-Fi BLE config + * + * @param[in] periph The peripheral handle + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t ble_config_start(esp_periph_handle_t periph); - /** - * @brief Stop Wi-Fi BLE config. - * - * @return - * - ESP_OK - * - ESP_FAIL - */ - esp_err_t ble_config_stop (void); +/** + * @brief Stop Wi-Fi BLE config. + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t ble_config_stop(void); #ifdef __cplusplus } diff --git a/components/esp_peripherals/lib/button/button.c b/components/esp_peripherals/lib/button/button.c index 3334bf41..8ffe6803 100644 --- a/components/esp_peripherals/lib/button/button.c +++ b/components/esp_peripherals/lib/button/button.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,33 +18,32 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ -#include "freertos/FreeRTOS.h" -#include "freertos/queue.h" -#include "freertos/task.h" +#include "button.h" + #include #include #include #include "audio_mem.h" -#include "button.h" #include "driver/gpio.h" #include "esp_log.h" +#include "freertos/FreeRTOS.h" +#include "freertos/queue.h" +#include "freertos/task.h" #include "sys/queue.h" #ifdef periph_tick_get #define tick_get periph_tick_get #else -static long long -tick_get () -{ +static long long tick_get() { struct timeval te; - gettimeofday (&te, NULL); + gettimeofday(&te, NULL); long long milliseconds = te.tv_sec * 1000LL + te.tv_usec / 1000; return milliseconds; } @@ -52,131 +51,112 @@ tick_get () static const char *TAG = "BUTTON"; -typedef struct esp_button_item -{ +typedef struct esp_button_item { int gpio_num; long long last_press_tick; bool long_pressed; - STAILQ_ENTRY (esp_button_item) entry; + STAILQ_ENTRY(esp_button_item) entry; } esp_button_item_t; -struct esp_button -{ +struct esp_button { int long_press_time_ms; uint64_t gpio_mask; - STAILQ_HEAD (esp_button_list, esp_button_item) btn_list; + STAILQ_HEAD(esp_button_list, esp_button_item) btn_list; }; -static button_status_t -button_get_state (esp_button_handle_t button, esp_button_item_t *btn_item) -{ - int level = gpio_get_level (btn_item->gpio_num); +static button_status_t button_get_state(esp_button_handle_t button, + esp_button_item_t *btn_item) { + int level = gpio_get_level(btn_item->gpio_num); int active_level = 0; int deactive_level = 1; - if (btn_item->last_press_tick == 0 && level == active_level) - { - btn_item->last_press_tick = tick_get (); - btn_item->long_pressed = false; - return BTN_PRESSED; - } + if (btn_item->last_press_tick == 0 && level == active_level) { + btn_item->last_press_tick = tick_get(); + btn_item->long_pressed = false; + return BTN_PRESSED; + } - if (level == deactive_level && btn_item->last_press_tick - && tick_get () - btn_item->last_press_tick > button->long_press_time_ms) - { - btn_item->last_press_tick = 0; - btn_item->long_pressed = false; - return BTN_LONG_RELEASE; - } + if (level == deactive_level && btn_item->last_press_tick && + tick_get() - btn_item->last_press_tick > button->long_press_time_ms) { + btn_item->last_press_tick = 0; + btn_item->long_pressed = false; + return BTN_LONG_RELEASE; + } - if (level == deactive_level && btn_item->last_press_tick) - { - btn_item->last_press_tick = 0; - btn_item->long_pressed = false; - return BTN_RELEASE; - } + if (level == deactive_level && btn_item->last_press_tick) { + btn_item->last_press_tick = 0; + btn_item->long_pressed = false; + return BTN_RELEASE; + } - if (btn_item->long_pressed == false && level == active_level - && tick_get () - btn_item->last_press_tick > button->long_press_time_ms) - { - btn_item->long_pressed = true; - return BTN_LONG_PRESS; - } + if (btn_item->long_pressed == false && level == active_level && + tick_get() - btn_item->last_press_tick > button->long_press_time_ms) { + btn_item->long_pressed = true; + return BTN_LONG_PRESS; + } return BTN_UNCHANGE; } -esp_button_handle_t -button_init (button_config_t *config) -{ - esp_button_handle_t btn = audio_calloc (1, sizeof (struct esp_button)); - AUDIO_MEM_CHECK (TAG, btn, return NULL); - if (config->gpio_mask <= 0) - { - ESP_LOGE (TAG, "required at least 1 gpio"); - return NULL; - } +esp_button_handle_t button_init(button_config_t *config) { + esp_button_handle_t btn = audio_calloc(1, sizeof(struct esp_button)); + AUDIO_MEM_CHECK(TAG, btn, return NULL); + if (config->gpio_mask <= 0) { + ESP_LOGE(TAG, "required at least 1 gpio"); + return NULL; + } btn->gpio_mask = config->gpio_mask; btn->long_press_time_ms = config->long_press_time_ms; - if (btn->long_press_time_ms == 0) - { - btn->long_press_time_ms = DEFAULT_LONG_PRESS_TIME_MS; - } + if (btn->long_press_time_ms == 0) { + btn->long_press_time_ms = DEFAULT_LONG_PRESS_TIME_MS; + } gpio_config_t gpiocfg = { - .pin_bit_mask = btn->gpio_mask, - .mode = GPIO_MODE_INPUT, - .pull_up_en = GPIO_PULLUP_ENABLE, - .pull_down_en = GPIO_PULLDOWN_DISABLE, - .intr_type = GPIO_INTR_ANYEDGE, + .pin_bit_mask = btn->gpio_mask, + .mode = GPIO_MODE_INPUT, + .pull_up_en = GPIO_PULLUP_ENABLE, + .pull_down_en = GPIO_PULLDOWN_DISABLE, + .intr_type = GPIO_INTR_ANYEDGE, }; - gpio_config (&gpiocfg); + gpio_config(&gpiocfg); uint64_t gpio_mask = btn->gpio_mask; int gpio_num = 0; - STAILQ_INIT (&btn->btn_list); - while (gpio_mask) - { - if (gpio_mask & 0x01) - { - ESP_LOGD (TAG, "Mask = %llx, current_mask = %llx, idx=%d", - btn->gpio_mask, gpio_mask, gpio_num); - esp_button_item_t *new_btn - = audio_calloc (1, sizeof (esp_button_item_t)); - AUDIO_MEM_CHECK (TAG, new_btn, { - button_destroy (btn); - return NULL; - }); - new_btn->gpio_num = gpio_num; - if (config->button_intr_handler) - { - gpio_set_intr_type (gpio_num, GPIO_INTR_ANYEDGE); - gpio_isr_handler_add (gpio_num, config->button_intr_handler, - config->intr_context); - gpio_intr_enable (gpio_num); - } - STAILQ_INSERT_TAIL (&btn->btn_list, new_btn, entry); - } - gpio_mask >>= 1; - gpio_num++; + STAILQ_INIT(&btn->btn_list); + while (gpio_mask) { + if (gpio_mask & 0x01) { + ESP_LOGD(TAG, "Mask = %llx, current_mask = %llx, idx=%d", btn->gpio_mask, + gpio_mask, gpio_num); + esp_button_item_t *new_btn = audio_calloc(1, sizeof(esp_button_item_t)); + AUDIO_MEM_CHECK(TAG, new_btn, { + button_destroy(btn); + return NULL; + }); + new_btn->gpio_num = gpio_num; + if (config->button_intr_handler) { + gpio_set_intr_type(gpio_num, GPIO_INTR_ANYEDGE); + gpio_isr_handler_add(gpio_num, config->button_intr_handler, + config->intr_context); + gpio_intr_enable(gpio_num); + } + STAILQ_INSERT_TAIL(&btn->btn_list, new_btn, entry); } + gpio_mask >>= 1; + gpio_num++; + } return btn; } -bool -button_read (esp_button_handle_t button, button_result_t *result) -{ +bool button_read(esp_button_handle_t button, button_result_t *result) { esp_button_item_t *btn_item; button_status_t btn_status; bool changed = false; - memset (result, 0, sizeof (button_result_t)); + memset(result, 0, sizeof(button_result_t)); uint64_t tmp; - STAILQ_FOREACH (btn_item, &button->btn_list, entry) - { - btn_status = button_get_state (button, btn_item); - switch (btn_status) - { + STAILQ_FOREACH(btn_item, &button->btn_list, entry) { + btn_status = button_get_state(button, btn_item); + switch (btn_status) { case BTN_UNCHANGE: break; case BTN_PRESSED: @@ -203,22 +183,19 @@ button_read (esp_button_handle_t button, button_result_t *result) tmp <<= btn_item->gpio_num; result->long_press_mask |= tmp; break; - } + } } return changed; } -esp_err_t -button_destroy (esp_button_handle_t button) -{ +esp_err_t button_destroy(esp_button_handle_t button) { esp_button_item_t *btn_item, *tmp; - STAILQ_FOREACH_SAFE (btn_item, &button->btn_list, entry, tmp) - { - gpio_intr_disable (btn_item->gpio_num); - gpio_isr_handler_remove (btn_item->gpio_num); - STAILQ_REMOVE (&button->btn_list, btn_item, esp_button_item, entry); - audio_free (btn_item); + STAILQ_FOREACH_SAFE(btn_item, &button->btn_list, entry, tmp) { + gpio_intr_disable(btn_item->gpio_num); + gpio_isr_handler_remove(btn_item->gpio_num); + STAILQ_REMOVE(&button->btn_list, btn_item, esp_button_item, entry); + audio_free(btn_item); } - audio_free (button); + audio_free(button); return ESP_OK; } diff --git a/components/esp_peripherals/lib/button/button.h b/components/esp_peripherals/lib/button/button.h index 427d8d69..3e231d94 100644 --- a/components/esp_peripherals/lib/button/button.h +++ b/components/esp_peripherals/lib/button/button.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -31,76 +31,72 @@ #include "driver/gpio.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - /** - * @brief { item_description } - */ - typedef enum - { - BTN_UNCHANGE = 0, - BTN_PRESSED, - BTN_RELEASE, - BTN_LONG_PRESS, - BTN_LONG_RELEASE, - } button_status_t; +/** + * @brief { item_description } + */ +typedef enum { + BTN_UNCHANGE = 0, + BTN_PRESSED, + BTN_RELEASE, + BTN_LONG_PRESS, + BTN_LONG_RELEASE, +} button_status_t; - /** - * @brief { item_description } - */ - typedef struct - { - uint64_t press_mask; - uint64_t release_mask; - uint64_t long_press_mask; - uint64_t long_release_mask; - } button_result_t; +/** + * @brief { item_description } + */ +typedef struct { + uint64_t press_mask; + uint64_t release_mask; + uint64_t long_press_mask; + uint64_t long_release_mask; +} button_result_t; - typedef struct esp_button *esp_button_handle_t; - typedef void (*gpio_intr_handler) (void *); +typedef struct esp_button *esp_button_handle_t; +typedef void (*gpio_intr_handler)(void *); - /** - * @brief { item_description } - */ - typedef struct - { - int long_press_time_ms; - uint64_t gpio_mask; - gpio_intr_handler button_intr_handler; - void *intr_context; - } button_config_t; +/** + * @brief { item_description } + */ +typedef struct { + int long_press_time_ms; + uint64_t gpio_mask; + gpio_intr_handler button_intr_handler; + void *intr_context; +} button_config_t; #define DEFAULT_LONG_PRESS_TIME_MS (2 * 1000) - /** - * @brief { function_description } - * - * @param config The configuration - * - * @return { description_of_the_return_value } - */ - esp_button_handle_t button_init (button_config_t *config); +/** + * @brief { function_description } + * + * @param config The configuration + * + * @return { description_of_the_return_value } + */ +esp_button_handle_t button_init(button_config_t *config); - /** - * @brief { function_description } - * - * @param[in] button The button - * @param result The result - * - * @return { description_of_the_return_value } - */ - bool button_read (esp_button_handle_t button, button_result_t *result); +/** + * @brief { function_description } + * + * @param[in] button The button + * @param result The result + * + * @return { description_of_the_return_value } + */ +bool button_read(esp_button_handle_t button, button_result_t *result); - /** - * @brief { function_description } - * - * @param[in] button The button - * - * @return { description_of_the_return_value } - */ - esp_err_t button_destroy (esp_button_handle_t button); +/** + * @brief { function_description } + * + * @param[in] button The button + * + * @return { description_of_the_return_value } + */ +esp_err_t button_destroy(esp_button_handle_t button); #ifdef __cplusplus } diff --git a/components/esp_peripherals/lib/gpio_isr/gpio_isr.c b/components/esp_peripherals/lib/gpio_isr/gpio_isr.c index aad3515a..687390e1 100644 --- a/components/esp_peripherals/lib/gpio_isr/gpio_isr.c +++ b/components/esp_peripherals/lib/gpio_isr/gpio_isr.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -29,33 +29,27 @@ static const char *TAG = "GPIO_ISR"; -esp_err_t -gpio_isr_init (int gpio_num, gpio_int_type_t type, - gpio_isr_t gpio_isr_handle_func, void *isr_param) -{ +esp_err_t gpio_isr_init(int gpio_num, gpio_int_type_t type, + gpio_isr_t gpio_isr_handle_func, void *isr_param) { esp_err_t ret = ESP_OK; - if (gpio_num < 0 || NULL == gpio_isr_handle_func) - { - ESP_LOGE (TAG, "Please check the parameters!"); - return ESP_OK; - } - ret |= gpio_set_direction (gpio_num, GPIO_MODE_INPUT); - ret |= gpio_set_intr_type (gpio_num, type); - ret |= gpio_isr_handler_add (gpio_num, gpio_isr_handle_func, isr_param); - ret |= gpio_intr_enable (gpio_num); + if (gpio_num < 0 || NULL == gpio_isr_handle_func) { + ESP_LOGE(TAG, "Please check the parameters!"); + return ESP_OK; + } + ret |= gpio_set_direction(gpio_num, GPIO_MODE_INPUT); + ret |= gpio_set_intr_type(gpio_num, type); + ret |= gpio_isr_handler_add(gpio_num, gpio_isr_handle_func, isr_param); + ret |= gpio_intr_enable(gpio_num); return ret; } -esp_err_t -gpio_isr_deinit (int gpio_num) -{ +esp_err_t gpio_isr_deinit(int gpio_num) { esp_err_t ret = ESP_OK; - if (gpio_num < 0) - { - ESP_LOGE (TAG, "The gpio number should greater than or equal to 0"); - return ESP_FAIL; - } - ret |= gpio_isr_handler_remove (gpio_num); - ret |= gpio_intr_disable (gpio_num); + if (gpio_num < 0) { + ESP_LOGE(TAG, "The gpio number should greater than or equal to 0"); + return ESP_FAIL; + } + ret |= gpio_isr_handler_remove(gpio_num); + ret |= gpio_intr_disable(gpio_num); return ret; } diff --git a/components/esp_peripherals/lib/gpio_isr/gpio_isr.h b/components/esp_peripherals/lib/gpio_isr/gpio_isr.h index 41d7f8aa..14a0e2ca 100644 --- a/components/esp_peripherals/lib/gpio_isr/gpio_isr.h +++ b/components/esp_peripherals/lib/gpio_isr/gpio_isr.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -31,33 +31,32 @@ #include "esp_err.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - /** - * @brief Initialize the gpio's interrupt service routines. - * - * @param gpio_num The number of gpio to be initialized - * @param type The type of interrupts - * @param gpio_isr_handle_func Interrupt handler - * @param isr_param The parameters of interrupt handler - * - * @return - */ - esp_err_t gpio_isr_init (int gpio_num, gpio_int_type_t type, - gpio_isr_t gpio_isr_handle_func, void *isr_param); +/** + * @brief Initialize the gpio's interrupt service routines. + * + * @param gpio_num The number of gpio to be initialized + * @param type The type of interrupts + * @param gpio_isr_handle_func Interrupt handler + * @param isr_param The parameters of interrupt handler + * + * @return + */ +esp_err_t gpio_isr_init(int gpio_num, gpio_int_type_t type, + gpio_isr_t gpio_isr_handle_func, void *isr_param); - /** - * @brief Deinitialize the gpio isr - * - * @param gpio_num The number of gpio to be deinitialized - * - * @return - * - ESP_OK on success - * - ESP_FAIL on failed - */ - esp_err_t gpio_isr_deinit (int gpio_num); +/** + * @brief Deinitialize the gpio isr + * + * @param gpio_num The number of gpio to be deinitialized + * + * @return + * - ESP_OK on success + * - ESP_FAIL on failed + */ +esp_err_t gpio_isr_deinit(int gpio_num); #ifdef __cplusplus } diff --git a/components/esp_peripherals/lib/sdcard/sdcard.c b/components/esp_peripherals/lib/sdcard/sdcard.c index efa14ca8..68755bdd 100644 --- a/components/esp_peripherals/lib/sdcard/sdcard.c +++ b/components/esp_peripherals/lib/sdcard/sdcard.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,205 +18,210 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include -#include "freertos/FreeRTOS.h" -#include "freertos/task.h" - #include "esp_err.h" #include "esp_log.h" #include "esp_vfs_fat.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "soc/soc_caps.h" -#include "driver/gpio.h" -#include "driver/sdmmc_defs.h" +#if SOC_SDMMC_HOST_SUPPORTED #include "driver/sdmmc_host.h" - +#endif #include "board.h" +#include "driver/gpio.h" +#include "driver/sdmmc_defs.h" +#include "esp_idf_version.h" #include "sdcard.h" static const char *TAG = "SDCARD"; -int g_gpio = -1; - -#define PIN_NUM_MISO 2 -#define PIN_NUM_MOSI 15 -#define PIN_NUM_CLK 14 -#define PIN_NUM_CS 13 - -static void -sdmmc_card_print_info (const sdmmc_card_t *card) -{ - ESP_LOGD (TAG, "Name: %s\n", card->cid.name); - ESP_LOGD (TAG, "Type: %s\n", - (card->ocr & SD_OCR_SDHC_CAP) ? "SDHC/SDXC" : "SDSC"); - ESP_LOGD (TAG, "Speed: %s\n", - (card->csd.tr_speed > 25000000) ? "high speed" : "default speed"); - ESP_LOGD (TAG, "Size: %lluMB\n", - ((uint64_t)card->csd.capacity) * card->csd.sector_size - / (1024 * 1024)); - ESP_LOGD (TAG, "CSD: ver=%d, sector_size=%d, capacity=%d read_bl_len=%d\n", - card->csd.csd_ver, card->csd.sector_size, card->csd.capacity, - card->csd.read_block_len); - ESP_LOGD (TAG, "SCR: sd_spec=%d, bus_width=%d\n", card->scr.sd_spec, - card->scr.bus_width); +static int g_gpio = -1; + +static void sdmmc_card_print_info(const sdmmc_card_t *card) { + ESP_LOGD(TAG, "Name: %s\n", card->cid.name); + ESP_LOGD(TAG, "Type: %s\n", + (card->ocr & SD_OCR_SDHC_CAP) ? "SDHC/SDXC" : "SDSC"); + ESP_LOGD(TAG, "Speed: %s\n", + (card->csd.tr_speed > 25000000) ? "high speed" : "default speed"); + ESP_LOGD( + TAG, "Size: %lluMB\n", + ((uint64_t)card->csd.capacity) * card->csd.sector_size / (1024 * 1024)); + ESP_LOGD(TAG, "CSD: ver=%d, sector_size=%d, capacity=%d read_bl_len=%d\n", + card->csd.csd_ver, card->csd.sector_size, card->csd.capacity, + card->csd.read_block_len); + ESP_LOGD(TAG, "SCR: sd_spec=%d, bus_width=%d\n", card->scr.sd_spec, + card->scr.bus_width); } -esp_err_t -sdcard_mount (const char *base_path, periph_sdcard_mode_t mode) -{ - if (mode >= SD_MODE_MAX) - { - ESP_LOGE (TAG, - "PLease select the correct sd mode: 1-line SD mode, 4-line SD " - "mode or SPI mode!, current mode is %d", - mode); - return ESP_FAIL; - } +esp_err_t sdcard_mount(const char *base_path, periph_sdcard_mode_t mode) { + if (mode >= SD_MODE_MAX) { + ESP_LOGE(TAG, + "PLease select the correct sd mode: 1-line SD mode, 4-line SD " + "mode or SPI mode!, current mode is %d", + mode); + return ESP_FAIL; + } sdmmc_card_t *card = NULL; - esp_err_t ret; - esp_vfs_fat_sdmmc_mount_config_t mount_config - = { .format_if_mount_failed = false, - .max_files = get_sdcard_open_file_num_max () }; - - if (mode != SD_MODE_SPI) - { - ESP_LOGI (TAG, "Using 1-line SD mode, 4-line SD mode, base path=%s", - base_path); - sdmmc_host_t host = SDMMC_HOST_DEFAULT (); - host.max_freq_khz = SDMMC_FREQ_HIGHSPEED; - - sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT (); - slot_config.gpio_cd = g_gpio; - slot_config.width = mode & 0X01; - - gpio_set_pull_mode (GPIO_NUM_15, GPIO_PULLUP_ONLY); - gpio_set_pull_mode (GPIO_NUM_2, GPIO_PULLUP_ONLY); - gpio_set_pull_mode (GPIO_NUM_13, GPIO_PULLUP_ONLY); - - if (mode == SD_MODE_4_LINE) - { - gpio_set_pull_mode (GPIO_NUM_4, GPIO_PULLUP_ONLY); - gpio_set_pull_mode (GPIO_NUM_12, GPIO_PULLUP_ONLY); - } - - ret = esp_vfs_fat_sdmmc_mount (base_path, &host, &slot_config, - &mount_config, &card); - } - else - { - ESP_LOGI (TAG, "Using SPI mode, base path=%s", base_path); - sdmmc_host_t host = SDSPI_HOST_DEFAULT (); - sdspi_slot_config_t slot_config = SDSPI_SLOT_CONFIG_DEFAULT (); - slot_config.gpio_miso = PIN_NUM_MISO; - slot_config.gpio_mosi = PIN_NUM_MOSI; - slot_config.gpio_sck = PIN_NUM_CLK; - slot_config.gpio_cs = PIN_NUM_CS; - - ret = esp_vfs_fat_sdmmc_mount (base_path, &host, &slot_config, - &mount_config, &card); + esp_err_t ret = ESP_FAIL; + + esp_vfs_fat_sdmmc_mount_config_t mount_config = { + .format_if_mount_failed = false, + .max_files = get_sdcard_open_file_num_max(), + }; + if (mode != SD_MODE_SPI) { +#if SOC_SDMMC_HOST_SUPPORTED + ESP_LOGI(TAG, "Using %d-line SD mode, base path=%s", mode, base_path); + + sdmmc_host_t host = SDMMC_HOST_DEFAULT(); + // host.max_freq_khz = SDMMC_FREQ_HIGHSPEED; + + sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT(); + // slot_config.gpio_cd = g_gpio; + slot_config.width = mode; + // Enable internal pullups on enabled pins. The internal pullups + // are insufficient however, please make sure 10k external pullups are + // connected on the bus. This is for debug / example purpose only. + slot_config.flags |= SDMMC_SLOT_FLAG_INTERNAL_PULLUP; + +#if SOC_SDMMC_USE_GPIO_MATRIX + slot_config.clk = ESP_SD_PIN_CLK; + slot_config.cmd = ESP_SD_PIN_CMD; + slot_config.d0 = ESP_SD_PIN_D0; + slot_config.d1 = ESP_SD_PIN_D1; + slot_config.d2 = ESP_SD_PIN_D2; + slot_config.d3 = ESP_SD_PIN_D3; + slot_config.d4 = ESP_SD_PIN_D4; + slot_config.d5 = ESP_SD_PIN_D5; + slot_config.d6 = ESP_SD_PIN_D6; + slot_config.d7 = ESP_SD_PIN_D7; + slot_config.cd = ESP_SD_PIN_CD; + slot_config.wp = ESP_SD_PIN_WP; +#endif + ret = esp_vfs_fat_sdmmc_mount(base_path, &host, &slot_config, &mount_config, + &card); +#endif + } else { + ESP_LOGI(TAG, "Using SPI mode, base path=%s", base_path); +#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 2, 0)) + sdmmc_host_t host = SDSPI_HOST_DEFAULT(); + spi_bus_config_t bus_cfg = { + .mosi_io_num = ESP_SD_PIN_CMD, + .miso_io_num = ESP_SD_PIN_D0, + .sclk_io_num = ESP_SD_PIN_CLK, + .quadwp_io_num = -1, + .quadhd_io_num = -1, + .max_transfer_sz = 4000, + }; +#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0)) + ret = spi_bus_initialize(host.slot, &bus_cfg, SPI_DMA_CH_AUTO); +#else + ret = spi_bus_initialize(host.slot, &bus_cfg, host.slot); +#endif + if (ret != ESP_OK) { + ESP_LOGE(TAG, "Failed to initialize bus."); + return ret; } - - switch (ret) - { + sdspi_device_config_t slot_config = SDSPI_DEVICE_CONFIG_DEFAULT(); + slot_config.gpio_cs = ESP_SD_PIN_D3; + slot_config.host_id = host.slot; + ret = esp_vfs_fat_sdspi_mount(base_path, &host, &slot_config, &mount_config, + &card); +#else + sdmmc_host_t host = SDSPI_HOST_DEFAULT(); + sdspi_slot_config_t slot_config = SDSPI_SLOT_CONFIG_DEFAULT(); + slot_config.gpio_miso = ESP_SD_PIN_D0; + slot_config.gpio_mosi = ESP_SD_PIN_CMD; + slot_config.gpio_sck = ESP_SD_PIN_CLK; + slot_config.gpio_cs = ESP_SD_PIN_D3; + + ret = esp_vfs_fat_sdmmc_mount(base_path, &host, &slot_config, &mount_config, + &card); +#endif + } + + switch (ret) { case ESP_OK: // Card has been initialized, print its properties - sdmmc_card_print_info (card); - ESP_LOGI (TAG, "CID name %s!\n", card->cid.name); + sdmmc_card_print_info(card); + ESP_LOGI(TAG, "CID name %s!\n", card->cid.name); break; case ESP_ERR_INVALID_STATE: - ESP_LOGE (TAG, "File system already mounted"); + ESP_LOGE(TAG, "File system already mounted"); break; case ESP_FAIL: - ESP_LOGE (TAG, "Failed to mount filesystem. If you want the card to be " - "formatted, set format_if_mount_failed = true."); + ESP_LOGE(TAG, + "Failed to mount filesystem. If you want the card to be " + "formatted, set format_if_mount_failed = true."); break; default: - ESP_LOGE (TAG, - "Failed to initialize the card (%d). Make sure SD card lines " - "have pull-up resistors in place.", - ret); + ESP_LOGE(TAG, + "Failed to initialize the card (%d). Make sure SD card lines " + "have pull-up resistors in place.", + ret); break; - } + } return ret; } -esp_err_t -sdcard_unmount (void) -{ - esp_err_t ret = esp_vfs_fat_sdmmc_unmount (); +esp_err_t sdcard_unmount(void) { + esp_err_t ret = esp_vfs_fat_sdmmc_unmount(); - if (ret == ESP_ERR_INVALID_STATE) - { - ESP_LOGE (TAG, "File system not mounted"); - } + if (ret == ESP_ERR_INVALID_STATE) { + ESP_LOGE(TAG, "File system not mounted"); + } return ret; } -bool -sdcard_is_exist () -{ - if (g_gpio >= 0) - { - return (gpio_get_level (g_gpio) == 0x00); - } - else - { - return true; - } +bool sdcard_is_exist() { + if (g_gpio >= 0) { + return (gpio_get_level(g_gpio) == 0x00); + } else { + return true; + } return false; } -int IRAM_ATTR -sdcard_read_detect_pin (void) -{ - if (g_gpio >= 0) - { - return gpio_get_level (g_gpio); - } - else - { - return -1; - } +int IRAM_ATTR sdcard_read_detect_pin(void) { + if (g_gpio >= 0) { + return gpio_get_level(g_gpio); + } else { + return -1; + } return 0; } -esp_err_t -sdcard_destroy () -{ - if (g_gpio >= 0) - { - return gpio_isr_handler_remove (g_gpio); - } +esp_err_t sdcard_destroy() { + if (g_gpio >= 0) { + return gpio_isr_handler_remove(g_gpio); + } return ESP_OK; } -esp_err_t -sdcard_init (int card_detect_pin, void (*detect_intr_handler) (void *), - void *isr_context) -{ +esp_err_t sdcard_init(int card_detect_pin, void (*detect_intr_handler)(void *), + void *isr_context) { esp_err_t ret = ESP_OK; - if (card_detect_pin >= 0) - { - gpio_set_direction (card_detect_pin, GPIO_MODE_INPUT); - if (detect_intr_handler) - { - gpio_set_intr_type (card_detect_pin, GPIO_INTR_ANYEDGE); - gpio_isr_handler_add (card_detect_pin, detect_intr_handler, - isr_context); - gpio_intr_enable (card_detect_pin); - } - gpio_pullup_en (card_detect_pin); + if (card_detect_pin >= 0) { + gpio_set_direction(card_detect_pin, GPIO_MODE_INPUT); + if (detect_intr_handler) { + gpio_set_intr_type(card_detect_pin, GPIO_INTR_ANYEDGE); + gpio_isr_handler_add(card_detect_pin, detect_intr_handler, isr_context); + gpio_intr_enable(card_detect_pin); } + gpio_pullup_en(card_detect_pin); + } g_gpio = card_detect_pin; return ret; } diff --git a/components/esp_peripherals/lib/sdcard/sdcard.h b/components/esp_peripherals/lib/sdcard/sdcard.h index e096e12a..5077fe66 100644 --- a/components/esp_peripherals/lib/sdcard/sdcard.h +++ b/components/esp_peripherals/lib/sdcard/sdcard.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -31,72 +31,70 @@ #include "periph_sdcard.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - /** - * @brief { function_description } - * - * @param[in] gpio The gpio - * @param[in] detect_intr_handler The detect intr handler - * @param isr_context The isr context - * - * @return { description_of_the_return_value } - */ - esp_err_t sdcard_init (int gpio, void (*detect_intr_handler) (void *), - void *isr_context); +/** + * @brief { function_description } + * + * @param[in] gpio The gpio + * @param[in] detect_intr_handler The detect intr handler + * @param isr_context The isr context + * + * @return { description_of_the_return_value } + */ +esp_err_t sdcard_init(int gpio, void (*detect_intr_handler)(void *), + void *isr_context); - /** - * @brief mount sdcard to FAT filesystem - * - * @param base_path path where partition should be registered (e.g. - * "/sdcard") - * - * @return - * - ESP_OK on success - * - ESP_ERR_INVALID_STATE if esp_vfs_fat_sdmmc_mount was already called - * - ESP_ERR_NO_MEM if memory can not be allocated - * - ESP_FAIL if partition can not be mounted - * - other error codes from SDMMC or SPI drivers, SDMMC protocol, or - * FATFS drivers - */ - esp_err_t sdcard_mount (const char *base_path, periph_sdcard_mode_t mode); +/** + * @brief mount sdcard to FAT filesystem + * + * @param base_path path where partition should be registered (e.g. "/sdcard") + * + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_STATE if esp_vfs_fat_sdmmc_mount was already called + * - ESP_ERR_NO_MEM if memory can not be allocated + * - ESP_FAIL if partition can not be mounted + * - other error codes from SDMMC or SPI drivers, SDMMC protocol, or FATFS + * drivers + */ +esp_err_t sdcard_mount(const char *base_path, periph_sdcard_mode_t mode); - /** - * @brief Unmount FAT filesystem and release resources acquired using - * esp_vfs_fat_sdmmc_mount - * - * @return - * - ESP_OK on success - * - ESP_ERR_INVALID_STATE if sd_card_mount hasn't been called - */ - esp_err_t sdcard_unmount (void); +/** + * @brief Unmount FAT filesystem and release resources acquired using + * esp_vfs_fat_sdmmc_mount + * + * @return + * - ESP_OK on success + * - ESP_ERR_INVALID_STATE if sd_card_mount hasn't been called + */ +esp_err_t sdcard_unmount(void); - /** - * @brief remove the sdcard device GPIO interruption in Audio board - * - * @return - * - ESP_OK on success - * - ESP_FAIL destory sdcard gpio handle failed - */ - esp_err_t sdcard_destroy (void); +/** + * @brief remove the sdcard device GPIO interruption in Audio board + * + * @return + * - ESP_OK on success + * - ESP_FAIL destory sdcard gpio handle failed + */ +esp_err_t sdcard_destroy(void); - /** - * @brief get the status of sdcard is insert or not - * - * @return - * - true sdcard is insert - * - false sdcard is unplug - */ - bool sdcard_is_exist (); +/** + * @brief get the status of sdcard is insert or not + * + * @return + * - true sdcard is insert + * - false sdcard is unplug + */ +bool sdcard_is_exist(); - /** - * @brief Read value of CARD DETECT Pin - * - * @return value of CARD DETECT PIN - */ - int sdcard_read_detect_pin (void); +/** + * @brief Read value of CARD DETECT Pin + * + * @return value of CARD DETECT PIN + */ +int sdcard_read_detect_pin(void); #ifdef __cplusplus } diff --git a/components/esp_peripherals/lib/tca9554/tca9554.c b/components/esp_peripherals/lib/tca9554/tca9554.c new file mode 100644 index 00000000..be075c79 --- /dev/null +++ b/components/esp_peripherals/lib/tca9554/tca9554.c @@ -0,0 +1,198 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2021 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include "tca9554.h" + +#include + +#include "board.h" +#include "driver/gpio.h" +#include "esp_log.h" +#include "i2c_bus.h" + +static char *TAG = "TCA9554"; +static i2c_bus_handle_t i2c_handle; + +#define SET_BITS(_m, _s, _v) ((_v) ? (_m) | ((_s)) : (_m) & ~((_s))) +#define GET_BITS(_m, _s) (((_m) & (_s)) ? true : false) + +#define TCA9554_INPUT_PORT 0x00 +#define TCA9554_OUTPUT_PORT 0x01 +#define TCA9554_POLARITY_INVERSION_PORT 0x02 +#define TCA9554_CONFIGURATION_PORT 0x03 + +typedef struct { + uint8_t addr; + char *name; +} tca9554_dev_t; + +static tca9554_dev_t dev_list[] = { + {0x70, "TCA9554A"}, + {0x40, "TCA9554"}, +}; + +static uint8_t tca9554_addr; + +static esp_err_t expander_dev_prob() { + for (size_t i = 0; i < sizeof(dev_list) / sizeof(dev_list[0]); i++) { + if (ESP_OK == i2c_bus_probe_addr(i2c_handle, dev_list[i].addr)) { + ESP_LOGI(TAG, "Detected IO expander device at 0x%02X, name is: %s", + dev_list[i].addr, dev_list[i].name); + tca9554_addr = dev_list[i].addr; + return ESP_OK; + } + } + tca9554_addr = 0; + ESP_LOGE(TAG, "IO expander device has not detected"); + return ESP_ERR_NOT_FOUND; +} + +static esp_err_t tca9554_write_reg(uint8_t reg_addr, uint8_t data) { + return i2c_bus_write_bytes(i2c_handle, tca9554_addr, ®_addr, + sizeof(reg_addr), &data, sizeof(data)); +} + +static char tca9554_read_reg(uint8_t reg_addr) { + uint8_t data; + i2c_bus_read_bytes(i2c_handle, tca9554_addr, ®_addr, sizeof(reg_addr), + &data, sizeof(data)); + return data; +} + +static int i2c_init(gpio_num_t clk, gpio_num_t sda) { + int res = 0; + i2c_config_t es_i2c_cfg = { + .mode = I2C_MODE_MASTER, + .sda_pullup_en = GPIO_PULLUP_ENABLE, + .scl_pullup_en = GPIO_PULLUP_ENABLE, + .master.clk_speed = 100000, + .scl_io_num = clk, + .sda_io_num = sda, + }; + i2c_handle = i2c_bus_create(I2C_NUM_0, &es_i2c_cfg); + return res; +} + +esp_tca9554_io_level_t tca9554_get_input_state( + esp_tca9554_gpio_num_t gpio_num) { + char data = 0; + if (gpio_num < TCA9554_GPIO_NUM_MAX) { + data = tca9554_read_reg(TCA9554_INPUT_PORT); + } else { + ESP_LOGE(TAG, "gpio num is error, current gpio: %d", gpio_num); + return TCA9554_LEVEL_ERROR; + } + + return GET_BITS(data, gpio_num); +} + +esp_tca9554_io_level_t tca9554_get_output_state( + esp_tca9554_gpio_num_t gpio_num) { + char data = 0; + if (gpio_num < TCA9554_GPIO_NUM_MAX) { + data = tca9554_read_reg(TCA9554_OUTPUT_PORT); + } else { + ESP_LOGE(TAG, "gpio num is error, current gpio: %d", gpio_num); + return TCA9554_LEVEL_ERROR; + } + + return GET_BITS(data, gpio_num); +} + +esp_err_t tca9554_set_output_state(esp_tca9554_gpio_num_t gpio_num, + esp_tca9554_io_level_t level) { + char data; + esp_err_t res = ESP_FAIL; + if (gpio_num < TCA9554_GPIO_NUM_MAX) { + data = tca9554_read_reg(TCA9554_OUTPUT_PORT); + res = + tca9554_write_reg(TCA9554_OUTPUT_PORT, SET_BITS(data, gpio_num, level)); + } else { + ESP_LOGE(TAG, "gpio num is error, current gpio: %d", gpio_num); + } + return res; +} + +esp_err_t tca9554_set_polarity_inversion(esp_tca9554_gpio_num_t gpio_num, + esp_tca9554_io_polarity_t polarity) { + char data; + esp_err_t res = ESP_FAIL; + if (gpio_num < TCA9554_GPIO_NUM_MAX) { + data = tca9554_read_reg(TCA9554_POLARITY_INVERSION_PORT); + res = tca9554_write_reg(TCA9554_POLARITY_INVERSION_PORT, + SET_BITS(data, gpio_num, polarity)); + } else { + ESP_LOGE(TAG, "gpio num is error, current gpio: %d", gpio_num); + } + return res; +} + +esp_tca9554_io_config_t tca9554_get_io_config(esp_tca9554_gpio_num_t gpio_num) { + char data = 0; + if (gpio_num < TCA9554_GPIO_NUM_MAX) { + data = tca9554_read_reg(TCA9554_CONFIGURATION_PORT); + } else { + ESP_LOGE(TAG, "gpio num is error, current gpio: %d", gpio_num); + return TCA9554_LEVEL_ERROR; + } + + return GET_BITS(data, gpio_num); +} + +esp_err_t tca9554_set_io_config(esp_tca9554_gpio_num_t gpio_num, + esp_tca9554_io_config_t io_config) { + char data; + esp_err_t res = ESP_FAIL; + if (gpio_num < TCA9554_GPIO_NUM_MAX) { + data = tca9554_read_reg(TCA9554_CONFIGURATION_PORT); + res = tca9554_write_reg(TCA9554_CONFIGURATION_PORT, + SET_BITS(data, gpio_num, io_config)); + } else { + ESP_LOGE(TAG, "gpio num is error, current gpio: %d", gpio_num); + } + return res; +} + +void tca9554_read_all() { + for (int i = 0; i < 0x04; i++) { + uint8_t reg = tca9554_read_reg(i); + ESP_LOGI(TAG, "REG:%02x, %02x", i, reg); + } +} + +esp_err_t tca9554_init(esp_tca9554_config_t *cfg) { + esp_err_t ret = ESP_OK; + i2c_init(cfg->i2c_scl, cfg->i2c_sda); + + expander_dev_prob(); + + return ret; +} + +esp_err_t tca9554_deinit() { + i2c_bus_delete(i2c_handle); + return ESP_OK; +} diff --git a/components/esp_peripherals/lib/tca9554/tca9554.h b/components/esp_peripherals/lib/tca9554/tca9554.h new file mode 100644 index 00000000..c8887a97 --- /dev/null +++ b/components/esp_peripherals/lib/tca9554/tca9554.h @@ -0,0 +1,165 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2021 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#ifndef _TCA9554_H +#define _TCA9554_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + TCA9554_GPIO_NUM_0 = BIT(0), + TCA9554_GPIO_NUM_1 = BIT(1), + TCA9554_GPIO_NUM_2 = BIT(2), + TCA9554_GPIO_NUM_3 = BIT(3), + TCA9554_GPIO_NUM_4 = BIT(4), + TCA9554_GPIO_NUM_5 = BIT(5), + TCA9554_GPIO_NUM_6 = BIT(6), + TCA9554_GPIO_NUM_7 = BIT(7), + TCA9554_GPIO_NUM_MAX +} esp_tca9554_gpio_num_t; + +typedef enum { + TCA9554_IO_LOW, + TCA9554_IO_HIGH, + TCA9554_LEVEL_ERROR +} esp_tca9554_io_level_t; + +typedef enum { + TCA9554_IO_RETAINED, + TCA9554_IO_INVERTED +} esp_tca9554_io_polarity_t; + +typedef enum { TCA9554_IO_OUTPUT, TCA9554_IO_INPUT } esp_tca9554_io_config_t; + +typedef struct { + gpio_num_t i2c_sda; + gpio_num_t i2c_scl; + gpio_num_t interrupt_output; +} esp_tca9554_config_t; + +/* + * @brief Initialize TCA9554 chip + * + * @param codec_cfg configuration of TCA9554 + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t tca9554_init(esp_tca9554_config_t *cfg); + +/** + * @brief Deinitialize TCA9554 chip + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t tca9554_deinit(void); + +/* + * @brief Get TCA9554 input level + * + * @param gpio_num GPIO of TCA9554 + * + * @return + * - esp_tca9554_io_level_t + */ +esp_tca9554_io_level_t tca9554_get_input_state(esp_tca9554_gpio_num_t gpio_num); + +/* + * @brief Get PCA95xian39 output level + * + * @param gpio_num GPIO of TCA9554 + * + * @return + * - esp_tca9554_io_level_t + */ +esp_tca9554_io_level_t tca9554_get_output_state( + esp_tca9554_gpio_num_t gpio_num); + +/* + * @brief Get TCA9554 output state + * + * @param gpio_num GPIO of TCA9554 + * + * @return + * - esp_tca9554_io_level_t + */ +esp_err_t tca9554_set_output_state(esp_tca9554_gpio_num_t gpio_num, + esp_tca9554_io_level_t level); + +/* + * @brief Set TCA9554 polarity + * + * @param gpio_num GPIO of TCA9554 + * polarity polarity + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t tca9554_set_polarity_inversion(esp_tca9554_gpio_num_t gpio_num, + esp_tca9554_io_polarity_t polarity); + +/* + * @brief Get TCA9554 output level + * + * @param gpio_num GPIO of TCA9554 + * + * @return + * - esp_tca9554_io_level_t + */ +esp_tca9554_io_config_t tca9554_get_io_config(esp_tca9554_gpio_num_t gpio_num); + +/* + * @brief Set TCA9554 io config + * + * @param gpio_num GPIO of TCA9554 + * io_config io config + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t tca9554_set_io_config(esp_tca9554_gpio_num_t gpio_num, + esp_tca9554_io_config_t io_config); + +/** + * @brief Print all TCA9554 registers + * + * @return + * - void + */ +void tca9554_read_all(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/components/esp_peripherals/lib/touch/touch.c b/components/esp_peripherals/lib/touch/touch.c index 6951ee9a..0cb1ec7c 100644 --- a/components/esp_peripherals/lib/touch/touch.c +++ b/components/esp_peripherals/lib/touch/touch.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,15 +18,14 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ -#include "freertos/FreeRTOS.h" -#include "freertos/queue.h" -#include "freertos/task.h" +#include "touch.h" + #include #include #include @@ -35,9 +34,11 @@ #include "driver/gpio.h" #include "driver/touch_pad.h" #include "esp_log.h" +#include "freertos/FreeRTOS.h" +#include "freertos/queue.h" +#include "freertos/task.h" #include "sdkconfig.h" #include "sys/queue.h" -#include "touch.h" #define TOUCHPAD_TRIGGER_THRESHOLD 100 #define TOUCHPAD_FILTER_PERIOD (30) @@ -47,8 +48,7 @@ static const char *TAG = "TOUCH"; -typedef struct esp_touch_item -{ +typedef struct esp_touch_item { int touch_num; long long last_tap_tick; long long update_threshold_tick; @@ -58,244 +58,210 @@ typedef struct esp_touch_item uint16_t threshold_value; bool long_tapped; bool tapped; - STAILQ_ENTRY (esp_touch_item) entry; + STAILQ_ENTRY(esp_touch_item) entry; } esp_touch_item_t; -struct esp_touch -{ +struct esp_touch { int long_tap_time_ms; int touch_mask; int tap_threshold_percent; touch_intr_handler intr_fn; void *intr_context; - STAILQ_HEAD (esp_touch_list, esp_touch_item) touch_list; + STAILQ_HEAD(esp_touch_list, esp_touch_item) touch_list; }; #ifdef periph_tick_get #define tick_get periph_tick_get #else -static long long -tick_get () -{ +static long long tick_get() { struct timeval te; - gettimeofday (&te, NULL); // get current time - long long milliseconds - = te.tv_sec * 1000LL + te.tv_usec / 1000; // calculate milliseconds + gettimeofday(&te, NULL); // get current time + long long milliseconds = + te.tv_sec * 1000LL + te.tv_usec / 1000; // calculate milliseconds return milliseconds; } #endif -static void -touch_pad_isr_handler (void *arg) -{ +static void touch_pad_isr_handler(void *arg) { esp_touch_handle_t touch = (esp_touch_handle_t)arg; #if CONFIG_IDF_TARGET_ESP32 - touch_pad_clear_status (); + touch_pad_clear_status(); #endif - if (touch->intr_fn) - { - touch->intr_fn (touch->intr_context); - } + if (touch->intr_fn) { + touch->intr_fn(touch->intr_context); + } } -esp_touch_handle_t -esp_touch_init (touch_config_t *config) -{ - esp_touch_handle_t touch = audio_calloc (1, sizeof (struct esp_touch)); - AUDIO_MEM_CHECK (TAG, touch, return NULL); +esp_touch_handle_t esp_touch_init(touch_config_t *config) { + esp_touch_handle_t touch = audio_calloc(1, sizeof(struct esp_touch)); + AUDIO_MEM_CHECK(TAG, touch, return NULL); - if (config->touch_mask <= 0) - { - ESP_LOGE (TAG, "required at least 1 touch"); - return NULL; - } + if (config->touch_mask <= 0) { + ESP_LOGE(TAG, "required at least 1 touch"); + return NULL; + } touch->touch_mask = config->touch_mask; touch->long_tap_time_ms = config->long_tap_time_ms; touch->tap_threshold_percent = config->tap_threshold_percent; - if (touch->long_tap_time_ms == 0) - { - touch->long_tap_time_ms = DEFAULT_LONG_TAP_TIME_MS; - } + if (touch->long_tap_time_ms == 0) { + touch->long_tap_time_ms = DEFAULT_LONG_TAP_TIME_MS; + } - if (touch->tap_threshold_percent == 0) - { - touch->tap_threshold_percent = DEFAULT_TOUCH_THRESHOLD_PERCENT; - } - bool _success = (touch_pad_init () == ESP_OK); + if (touch->tap_threshold_percent == 0) { + touch->tap_threshold_percent = DEFAULT_TOUCH_THRESHOLD_PERCENT; + } + bool _success = (touch_pad_init() == ESP_OK); - AUDIO_MEM_CHECK (TAG, _success, { - audio_free (touch); + AUDIO_MEM_CHECK(TAG, _success, { + audio_free(touch); return NULL; }); int touch_mask = touch->touch_mask; int touch_num = 0; int touch_index = 0; - STAILQ_INIT (&touch->touch_list); - while (touch_mask) - { - if (touch_mask & 0x01) - { - ESP_LOGD (TAG, "Mask = %x, current_mask = %x, idx=%d", - touch->touch_mask, touch_mask, touch_num); - esp_touch_item_t *new_touch - = audio_calloc (1, sizeof (esp_touch_item_t)); - AUDIO_MEM_CHECK (TAG, new_touch, { - esp_touch_destroy (touch); - audio_free (touch); - return NULL; - }); - new_touch->touch_num = touch_num; - new_touch->last_read_tick = tick_get () + touch_index * 10; + STAILQ_INIT(&touch->touch_list); + while (touch_mask) { + if (touch_mask & 0x01) { + ESP_LOGD(TAG, "Mask = %x, current_mask = %x, idx=%d", touch->touch_mask, + touch_mask, touch_num); + esp_touch_item_t *new_touch = audio_calloc(1, sizeof(esp_touch_item_t)); + AUDIO_MEM_CHECK(TAG, new_touch, { + esp_touch_destroy(touch); + audio_free(touch); + return NULL; + }); + new_touch->touch_num = touch_num; + new_touch->last_read_tick = tick_get() + touch_index * 10; #if CONFIG_IDF_TARGET_ESP32 - touch_pad_config (touch_num, 0); + touch_pad_config(touch_num, 0); #elif CONFIG_IDF_TARGET_ESP32S2 - touch_pad_config (touch_num); + touch_pad_config(touch_num); #endif - if (config->touch_intr_handler) - { - touch_pad_set_thresh (touch_num, TOUCHPAD_TRIGGER_THRESHOLD); - } - STAILQ_INSERT_TAIL (&touch->touch_list, new_touch, entry); - touch_index++; - } - touch_mask >>= 1; - touch_num++; + if (config->touch_intr_handler) { + touch_pad_set_thresh(touch_num, TOUCHPAD_TRIGGER_THRESHOLD); + } + STAILQ_INSERT_TAIL(&touch->touch_list, new_touch, entry); + touch_index++; } + touch_mask >>= 1; + touch_num++; + } touch->intr_fn = config->touch_intr_handler; touch->intr_context = config->intr_context; - if (config->touch_intr_handler) - { + if (config->touch_intr_handler) { #if CONFIG_IDF_TARGET_ESP32 - touch_pad_isr_register (touch_pad_isr_handler, touch); - touch_pad_intr_enable (); + touch_pad_isr_register(touch_pad_isr_handler, touch); + touch_pad_intr_enable(); #elif CONFIG_IDF_TARGET_ESP32S2 - touch_pad_isr_register (touch_pad_isr_handler, touch, - TOUCH_PAD_INTR_MASK_ALL); - touch_pad_intr_enable (TOUCH_PAD_INTR_MASK_ALL); + touch_pad_isr_register(touch_pad_isr_handler, touch, + TOUCH_PAD_INTR_MASK_ALL); + touch_pad_intr_enable(TOUCH_PAD_INTR_MASK_ALL); #endif - } + } #if CONFIG_IDF_TARGET_ESP32 - touch_pad_filter_start (TOUCHPAD_FILTER_PERIOD); + touch_pad_filter_start(TOUCHPAD_FILTER_PERIOD); #endif return touch; } -static touch_status_t -touch_get_state (esp_touch_handle_t touch, esp_touch_item_t *touch_item, - long long tick) -{ - if (tick - touch_item->last_read_tick < TOUCHPAD_READ_INTERVAL_MS) - { - return TOUCH_UNCHANGE; - } +static touch_status_t touch_get_state(esp_touch_handle_t touch, + esp_touch_item_t *touch_item, + long long tick) { + if (tick - touch_item->last_read_tick < TOUCHPAD_READ_INTERVAL_MS) { + return TOUCH_UNCHANGE; + } touch_item->last_read_tick = tick; esp_err_t err = ESP_OK; #if CONFIG_IDF_TARGET_ESP32 - err = touch_pad_read_filtered (touch_item->touch_num, - &touch_item->last_read_value); + err = touch_pad_read_filtered(touch_item->touch_num, + &touch_item->last_read_value); #elif CONFIG_IDF_TARGET_ESP32S2 err = ESP_OK; #endif - if (err != ESP_OK) - { - return TOUCH_UNCHANGE; - } - if (touch_item->untouch_value == 0) - { - touch_item->untouch_value = touch_item->last_read_value; - int threshold_value - = touch_item->untouch_value * touch->tap_threshold_percent / 100; - touch_item->threshold_value = threshold_value; - } + if (err != ESP_OK) { + return TOUCH_UNCHANGE; + } + if (touch_item->untouch_value == 0) { + touch_item->untouch_value = touch_item->last_read_value; + int threshold_value = + touch_item->untouch_value * touch->tap_threshold_percent / 100; + touch_item->threshold_value = threshold_value; + } - if (!touch_item->tapped - && touch_item->last_read_value < touch_item->threshold_value) - { - touch_item->tapped = true; - } - else if (touch_item->tapped - && touch_item->last_read_value > touch_item->threshold_value) - { - touch_item->tapped = false; - } + if (!touch_item->tapped && + touch_item->last_read_value < touch_item->threshold_value) { + touch_item->tapped = true; + + } else if (touch_item->tapped && + touch_item->last_read_value > touch_item->threshold_value) { + touch_item->tapped = false; + } // Update touch threshold - if (tick - touch_item->update_threshold_tick > UPDATE_THRESHOLD_PERIOD_MS - && !touch_item->tapped) - { - touch_item->update_threshold_tick = tick; - touch_item->untouch_value += touch_item->last_read_value; - touch_item->untouch_value /= 2; - int threshold_value - = touch_item->untouch_value * touch->tap_threshold_percent / 100; - touch_item->threshold_value = threshold_value; - // ESP_LOGD(TAG, "UPDATE THRESHOLD[%d]=%d", touch_item->touch_num, - // threshold_value); - } + if (tick - touch_item->update_threshold_tick > UPDATE_THRESHOLD_PERIOD_MS && + !touch_item->tapped) { + touch_item->update_threshold_tick = tick; + touch_item->untouch_value += touch_item->last_read_value; + touch_item->untouch_value /= 2; + int threshold_value = + touch_item->untouch_value * touch->tap_threshold_percent / 100; + touch_item->threshold_value = threshold_value; + // ESP_LOGD(TAG, "UPDATE THRESHOLD[%d]=%d", touch_item->touch_num, + // threshold_value); + } - if (touch_item->last_tap_tick == 0 && touch_item->tapped) - { - touch_item->last_tap_tick = tick_get (); - touch_item->long_tapped = false; - ESP_LOGD (TAG, "TOUCH_TAPPED[%d] %d, threshold %d", - touch_item->touch_num, touch_item->last_read_value, - touch_item->threshold_value); - return TOUCH_TAP; - } + if (touch_item->last_tap_tick == 0 && touch_item->tapped) { + touch_item->last_tap_tick = tick_get(); + touch_item->long_tapped = false; + ESP_LOGD(TAG, "TOUCH_TAPPED[%d] %d, threshold %d", touch_item->touch_num, + touch_item->last_read_value, touch_item->threshold_value); + return TOUCH_TAP; + } - if (!touch_item->tapped && touch_item->last_tap_tick - && tick_get () - touch_item->last_tap_tick > touch->long_tap_time_ms) - { - touch_item->last_tap_tick = 0; - touch_item->long_tapped = false; - ESP_LOGD (TAG, "TOUCH_LONG_RELEASE[%d] %d, threshold %d", - touch_item->touch_num, touch_item->last_read_value, - touch_item->threshold_value); - return TOUCH_LONG_RELEASE; - } + if (!touch_item->tapped && touch_item->last_tap_tick && + tick_get() - touch_item->last_tap_tick > touch->long_tap_time_ms) { + touch_item->last_tap_tick = 0; + touch_item->long_tapped = false; + ESP_LOGD(TAG, "TOUCH_LONG_RELEASE[%d] %d, threshold %d", + touch_item->touch_num, touch_item->last_read_value, + touch_item->threshold_value); + return TOUCH_LONG_RELEASE; + } - if (!touch_item->tapped && touch_item->last_tap_tick) - { - touch_item->last_tap_tick = 0; - touch_item->long_tapped = false; - ESP_LOGD (TAG, "TOUCH_RELEASE[%d] %d, threshold %d", - touch_item->touch_num, touch_item->last_read_value, - touch_item->threshold_value); - return TOUCH_RELEASE; - } + if (!touch_item->tapped && touch_item->last_tap_tick) { + touch_item->last_tap_tick = 0; + touch_item->long_tapped = false; + ESP_LOGD(TAG, "TOUCH_RELEASE[%d] %d, threshold %d", touch_item->touch_num, + touch_item->last_read_value, touch_item->threshold_value); + return TOUCH_RELEASE; + } - if (touch_item->long_tapped == false && touch_item->tapped - && tick_get () - touch_item->last_tap_tick > touch->long_tap_time_ms) - { - touch_item->long_tapped = true; - ESP_LOGD (TAG, "TOUCH_LONG_TAP[%d] %d, threshold %d", - touch_item->touch_num, touch_item->last_read_value, - touch_item->threshold_value); - return TOUCH_LONG_TAP; - } + if (touch_item->long_tapped == false && touch_item->tapped && + tick_get() - touch_item->last_tap_tick > touch->long_tap_time_ms) { + touch_item->long_tapped = true; + ESP_LOGD(TAG, "TOUCH_LONG_TAP[%d] %d, threshold %d", touch_item->touch_num, + touch_item->last_read_value, touch_item->threshold_value); + return TOUCH_LONG_TAP; + } return TOUCH_UNCHANGE; } -bool -esp_touch_read (esp_touch_handle_t touch, touch_result_t *result) -{ +bool esp_touch_read(esp_touch_handle_t touch, touch_result_t *result) { esp_touch_item_t *touch_item; touch_status_t touch_status; bool changed = false; - memset (result, 0, sizeof (touch_result_t)); + memset(result, 0, sizeof(touch_result_t)); int tmp; - long long tick = tick_get (); - STAILQ_FOREACH (touch_item, &touch->touch_list, entry) - { - touch_status = touch_get_state (touch, touch_item, tick); - switch (touch_status) - { + long long tick = tick_get(); + STAILQ_FOREACH(touch_item, &touch->touch_list, entry) { + touch_status = touch_get_state(touch, touch_item, tick); + switch (touch_status) { case TOUCH_UNCHANGE: break; case TOUCH_TAP: @@ -322,29 +288,26 @@ esp_touch_read (esp_touch_handle_t touch, touch_result_t *result) tmp <<= touch_item->touch_num; result->long_tap_mask |= tmp; break; - } + } } return changed; } -esp_err_t -esp_touch_destroy (esp_touch_handle_t touch) -{ +esp_err_t esp_touch_destroy(esp_touch_handle_t touch) { esp_touch_item_t *touch_item, *tmp; #if CONFIG_IDF_TARGET_ESP32 - touch_pad_filter_delete (); - touch_pad_intr_disable (); + touch_pad_filter_delete(); + touch_pad_intr_disable(); #elif CONFIG_IDF_TARGET_ESP32S2 - touch_pad_intr_disable (TOUCH_PAD_INTR_MASK_ALL); + touch_pad_intr_disable(TOUCH_PAD_INTR_MASK_ALL); #endif - touch_pad_isr_deregister (touch_pad_isr_handler, touch); - STAILQ_FOREACH_SAFE (touch_item, &touch->touch_list, entry, tmp) - { - STAILQ_REMOVE (&touch->touch_list, touch_item, esp_touch_item, entry); - audio_free (touch_item); + touch_pad_isr_deregister(touch_pad_isr_handler, touch); + STAILQ_FOREACH_SAFE(touch_item, &touch->touch_list, entry, tmp) { + STAILQ_REMOVE(&touch->touch_list, touch_item, esp_touch_item, entry); + audio_free(touch_item); } - touch_pad_deinit (); - audio_free (touch); + touch_pad_deinit(); + audio_free(touch); return ESP_OK; } diff --git a/components/esp_peripherals/lib/touch/touch.h b/components/esp_peripherals/lib/touch/touch.h index 78ac69fa..c792a319 100644 --- a/components/esp_peripherals/lib/touch/touch.h +++ b/components/esp_peripherals/lib/touch/touch.h @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,9 +18,9 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ @@ -30,78 +30,74 @@ #include "audio_error.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif - /** - * @brief { item_description } - */ - typedef enum - { - TOUCH_UNCHANGE = 0, - TOUCH_TAP, - TOUCH_RELEASE, - TOUCH_LONG_TAP, - TOUCH_LONG_RELEASE, - } touch_status_t; +/** + * @brief { item_description } + */ +typedef enum { + TOUCH_UNCHANGE = 0, + TOUCH_TAP, + TOUCH_RELEASE, + TOUCH_LONG_TAP, + TOUCH_LONG_RELEASE, +} touch_status_t; - /** - * @brief { item_description } - */ - typedef struct - { - int tap_mask; - int release_mask; - int long_tap_mask; - int long_release_mask; - } touch_result_t; +/** + * @brief { item_description } + */ +typedef struct { + int tap_mask; + int release_mask; + int long_tap_mask; + int long_release_mask; +} touch_result_t; - typedef struct esp_touch *esp_touch_handle_t; - typedef void (*touch_intr_handler) (void *); +typedef struct esp_touch *esp_touch_handle_t; +typedef void (*touch_intr_handler)(void *); #define DEFAULT_LONG_TAP_TIME_MS (2 * 1000) #define DEFAULT_TOUCH_THRESHOLD_PERCENT (70) - /** - * @brief { item_description } - */ - typedef struct - { - int long_tap_time_ms; - int touch_mask; - int tap_threshold_percent; - touch_intr_handler touch_intr_handler; - void *intr_context; - } touch_config_t; +/** + * @brief { item_description } + */ +typedef struct { + int long_tap_time_ms; + int touch_mask; + int tap_threshold_percent; + touch_intr_handler touch_intr_handler; + void *intr_context; +} touch_config_t; - /** - * @brief { function_description } - * - * @param config The configuration - * - * @return { description_of_the_return_value } - */ - esp_touch_handle_t esp_touch_init (touch_config_t *config); +/** + * @brief { function_description } + * + * @param config The configuration + * + * @return { description_of_the_return_value } + */ +esp_touch_handle_t esp_touch_init(touch_config_t *config); - /** - * @brief { function_description } - * - * @param[in] touch The touch - * @param result The result - * - * @return { description_of_the_return_value } - */ - bool esp_touch_read (esp_touch_handle_t touch, touch_result_t *result); +/** + * @brief { function_description } + * + * @param[in] touch The touch + * @param result The result + * + * @return { description_of_the_return_value } + */ +bool esp_touch_read(esp_touch_handle_t touch, touch_result_t *result); - /** - * @brief { function_description } - * - * @param[in] touch The touch - * - * @return { description_of_the_return_value } - */ - esp_err_t esp_touch_destroy (esp_touch_handle_t touch); +/** + * @brief { function_description } + * + * @param[in] touch The touch + * + * @return { description_of_the_return_value } + */ +esp_err_t esp_touch_destroy(esp_touch_handle_t touch); #ifdef __cplusplus } diff --git a/components/esp_peripherals/periph_adc_button.c b/components/esp_peripherals/periph_adc_button.c index 8affb360..f9b94256 100644 --- a/components/esp_peripherals/periph_adc_button.c +++ b/components/esp_peripherals/periph_adc_button.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,96 +18,80 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "periph_adc_button.h" + +#include + #include "audio_error.h" #include "audio_mem.h" #include "esp_log.h" -#include static const char *TAG = "PERIPH_ADC_BUTTON"; -typedef struct -{ +typedef struct { int adc_channels; adc_btn_list *list; adc_btn_task_cfg_t task_cfg; } periph_adc_btn_t; -static void -btn_cb (void *user_data, int adc, int id, adc_btn_state_t state) -{ +static void btn_cb(void *user_data, int adc, int id, adc_btn_state_t state) { esp_periph_handle_t self = (esp_periph_handle_t)user_data; periph_adc_button_event_id_t event_id = PERIPH_ADC_BUTTON_IDLE; - if (state == ADC_BTN_STATE_PRESSED) - { - event_id = PERIPH_ADC_BUTTON_PRESSED; - } - else if (state == ADC_BTN_STATE_LONG_PRESSED) - { - event_id = PERIPH_ADC_BUTTON_LONG_PRESSED; - } - else if (state == ADC_BTN_STATE_RELEASE) - { - event_id = PERIPH_ADC_BUTTON_RELEASE; - } - else if (state == ADC_BTN_STATE_LONG_RELEASE) - { - event_id = PERIPH_ADC_BUTTON_LONG_RELEASE; - } + if (state == ADC_BTN_STATE_PRESSED) { + event_id = PERIPH_ADC_BUTTON_PRESSED; + } else if (state == ADC_BTN_STATE_LONG_PRESSED) { + event_id = PERIPH_ADC_BUTTON_LONG_PRESSED; + } else if (state == ADC_BTN_STATE_RELEASE) { + event_id = PERIPH_ADC_BUTTON_RELEASE; + } else if (state == ADC_BTN_STATE_LONG_RELEASE) { + event_id = PERIPH_ADC_BUTTON_LONG_RELEASE; + } // Send ID as data and ADC as data_len - esp_periph_send_event (self, event_id, (void *)id, adc); + esp_periph_send_event(self, event_id, (void *)id, adc); } -static esp_err_t -_adc_button_destroy (esp_periph_handle_t self) -{ - periph_adc_btn_t *periph_adc_btn = esp_periph_get_data (self); - adc_btn_delete_task (); - adc_btn_destroy_list (periph_adc_btn->list); - audio_free (periph_adc_btn); +static esp_err_t _adc_button_destroy(esp_periph_handle_t self) { + periph_adc_btn_t *periph_adc_btn = esp_periph_get_data(self); + adc_btn_delete_task(); + adc_btn_destroy_list(periph_adc_btn->list); + audio_free(periph_adc_btn); return ESP_OK; } -static esp_err_t -_adc_button_init (esp_periph_handle_t self) -{ - periph_adc_btn_t *periph_adc_btn = esp_periph_get_data (self); - adc_btn_init ((void *)self, btn_cb, periph_adc_btn->list, - &periph_adc_btn->task_cfg); +static esp_err_t _adc_button_init(esp_periph_handle_t self) { + periph_adc_btn_t *periph_adc_btn = esp_periph_get_data(self); + adc_btn_init((void *)self, btn_cb, periph_adc_btn->list, + &periph_adc_btn->task_cfg); return ESP_OK; } -esp_periph_handle_t -periph_adc_button_init (periph_adc_button_cfg_t *config) -{ - esp_periph_handle_t periph - = esp_periph_create (PERIPH_ID_ADC_BTN, "periph_adc_btn"); - AUDIO_MEM_CHECK (TAG, periph, return NULL); +esp_periph_handle_t periph_adc_button_init(periph_adc_button_cfg_t *config) { + esp_periph_handle_t periph = + esp_periph_create(PERIPH_ID_ADC_BTN, "periph_adc_btn"); + AUDIO_MEM_CHECK(TAG, periph, return NULL); - periph_adc_btn_t *periph_adc_btn - = audio_calloc (1, sizeof (periph_adc_btn_t)); - AUDIO_MEM_CHECK (TAG, periph_adc_btn, { - audio_free (periph); + periph_adc_btn_t *periph_adc_btn = audio_calloc(1, sizeof(periph_adc_btn_t)); + AUDIO_MEM_CHECK(TAG, periph_adc_btn, { + audio_free(periph); return NULL; }); periph_adc_btn->adc_channels = config->arr_size; - periph_adc_btn->list = adc_btn_create_list (config->arr, config->arr_size); - memcpy (&periph_adc_btn->task_cfg, &config->task_cfg, - sizeof (adc_btn_task_cfg_t)); - AUDIO_MEM_CHECK (TAG, periph_adc_btn->list, { - audio_free (periph); - audio_free (periph_adc_btn); + periph_adc_btn->list = adc_btn_create_list(config->arr, config->arr_size); + memcpy(&periph_adc_btn->task_cfg, &config->task_cfg, + sizeof(adc_btn_task_cfg_t)); + AUDIO_MEM_CHECK(TAG, periph_adc_btn->list, { + audio_free(periph); + audio_free(periph_adc_btn); return NULL; }); - esp_periph_set_data (periph, periph_adc_btn); - esp_periph_set_function (periph, _adc_button_init, NULL, - _adc_button_destroy); + esp_periph_set_data(periph, periph_adc_btn); + esp_periph_set_function(periph, _adc_button_init, NULL, _adc_button_destroy); return periph; } diff --git a/components/esp_peripherals/periph_aw2013.c b/components/esp_peripherals/periph_aw2013.c index 73d3fddc..dc5f84e8 100644 --- a/components/esp_peripherals/periph_aw2013.c +++ b/components/esp_peripherals/periph_aw2013.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,21 +18,21 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "periph_aw2013.h" + #include "audio_mem.h" #include "aw2013.h" #include "esp_peripherals.h" static const char *TAG = "PERIPH_AW2013"; -typedef struct -{ +typedef struct { aw2013_time_level_t time[5]; aw2013_brightness_t bright; periph_aw2013_mode_t mode; @@ -40,129 +40,108 @@ typedef struct uint8_t rpt_time; } periph_aw2013_t; -static esp_err_t -_aw2013_set_mode (periph_aw2013_mode_t mode) -{ +static esp_err_t _aw2013_set_mode(periph_aw2013_mode_t mode) { esp_err_t ret = ESP_OK; - switch (mode) - { + switch (mode) { case AW2013_MODE_LED: - ret |= aw2013_enable_auto_flash (false); - ret |= aw2013_enable_fade_mode (false); + ret |= aw2013_enable_auto_flash(false); + ret |= aw2013_enable_fade_mode(false); break; case AW2013_MODE_FADE: - ret |= aw2013_enable_auto_flash (false); - ret |= aw2013_enable_fade_mode (true); + ret |= aw2013_enable_auto_flash(false); + ret |= aw2013_enable_fade_mode(true); break; case AW2013_MODE_AUTO: - ret |= aw2013_enable_auto_flash (true); - ret |= aw2013_enable_fade_mode (false); + ret |= aw2013_enable_auto_flash(true); + ret |= aw2013_enable_fade_mode(false); break; default: - ESP_LOGE (TAG, "Invalid mode :%d", mode); + ESP_LOGE(TAG, "Invalid mode :%d", mode); return ESP_FAIL; - } + } return ESP_OK; } -static esp_err_t -_aw2013_init (esp_periph_handle_t self) -{ +static esp_err_t _aw2013_init(esp_periph_handle_t self) { esp_err_t ret = ESP_OK; - periph_aw2013_t *aw2013 = esp_periph_get_data (self); - - ret |= aw2013_init (); - for (int i = 0; i <= AW2013_TIME_4; i++) - { - ret |= aw2013_set_time (i, aw2013->time[i]); - } - ret |= aw2013_set_repeat_time (aw2013->rpt_time); - ret |= aw2013_set_brightness (aw2013->bright); - ret |= _aw2013_set_mode (aw2013->mode); - ret |= aw2013_set_pwm_value (aw2013->rgb_value); + periph_aw2013_t *aw2013 = esp_periph_get_data(self); + + ret |= aw2013_init(); + for (int i = 0; i <= AW2013_TIME_4; i++) { + ret |= aw2013_set_time(i, aw2013->time[i]); + } + ret |= aw2013_set_repeat_time(aw2013->rpt_time); + ret |= aw2013_set_brightness(aw2013->bright); + ret |= _aw2013_set_mode(aw2013->mode); + ret |= aw2013_set_pwm_value(aw2013->rgb_value); return ret; } -static esp_err_t -_aw2013_destroy (esp_periph_handle_t self) -{ +static esp_err_t _aw2013_destroy(esp_periph_handle_t self) { esp_err_t ret = ESP_OK; - periph_aw2013_t *aw2013 = esp_periph_get_data (self); + periph_aw2013_t *aw2013 = esp_periph_get_data(self); - ret |= aw2013_deinit (); - audio_free (aw2013); + ret |= aw2013_deinit(); + audio_free(aw2013); return ret; } -esp_err_t -periph_aw2013_set_brightless (esp_periph_handle_t periph, - aw2013_brightness_t bright) -{ - periph_aw2013_t *aw2013 = esp_periph_get_data (periph); - if (bright < AW2013_BRIGHT_0 || bright > AW2013_BRIGHT_3) - { - ESP_LOGE (TAG, "Fail to set parameters, bright: %d", bright); - return ESP_FAIL; - } +esp_err_t periph_aw2013_set_brightless(esp_periph_handle_t periph, + aw2013_brightness_t bright) { + periph_aw2013_t *aw2013 = esp_periph_get_data(periph); + if (bright < AW2013_BRIGHT_0 || bright > AW2013_BRIGHT_3) { + ESP_LOGE(TAG, "Fail to set parameters, bright: %d", bright); + return ESP_FAIL; + } aw2013->bright = bright; - return aw2013_set_brightness (bright); + return aw2013_set_brightness(bright); } -esp_err_t -periph_aw2013_set_rgb_value (esp_periph_handle_t periph, uint32_t value) -{ - periph_aw2013_t *aw2013 = esp_periph_get_data (periph); +esp_err_t periph_aw2013_set_rgb_value(esp_periph_handle_t periph, + uint32_t value) { + periph_aw2013_t *aw2013 = esp_periph_get_data(periph); aw2013->rgb_value = value; - return aw2013_set_pwm_value (value); + return aw2013_set_pwm_value(value); } -esp_err_t -periph_aw2013_set_repeat_time (esp_periph_handle_t periph, uint8_t cnt) -{ - periph_aw2013_t *aw2013 = esp_periph_get_data (periph); +esp_err_t periph_aw2013_set_repeat_time(esp_periph_handle_t periph, + uint8_t cnt) { + periph_aw2013_t *aw2013 = esp_periph_get_data(periph); aw2013->rpt_time = cnt; - return aw2013_set_repeat_time (cnt); + return aw2013_set_repeat_time(cnt); } -esp_err_t -periph_aw2013_set_mode (esp_periph_handle_t periph, periph_aw2013_mode_t mode) -{ - if (mode < 0 || mode > AW2013_MODE_AUTO) - { - ESP_LOGE (TAG, "Fail to set parameters, mode: %d", mode); - return ESP_FAIL; - } - periph_aw2013_t *aw2013 = esp_periph_get_data (periph); +esp_err_t periph_aw2013_set_mode(esp_periph_handle_t periph, + periph_aw2013_mode_t mode) { + if (mode < 0 || mode > AW2013_MODE_AUTO) { + ESP_LOGE(TAG, "Fail to set parameters, mode: %d", mode); + return ESP_FAIL; + } + periph_aw2013_t *aw2013 = esp_periph_get_data(periph); aw2013->mode = mode; - return _aw2013_set_mode (mode); + return _aw2013_set_mode(mode); } -esp_err_t -periph_aw2013_set_time (esp_periph_handle_t periph, aw2013_time_t time, - aw2013_time_level_t level) -{ - if (time < 0 || time > AW2013_TIME_4 || level < 0 - || level > AW2013_TIME_LEVEL_8) - { - ESP_LOGE (TAG, "Fail to set parameters, time: %d, level: %d", time, - level); - return ESP_FAIL; - } - periph_aw2013_t *aw2013 = esp_periph_get_data (periph); +esp_err_t periph_aw2013_set_time(esp_periph_handle_t periph, aw2013_time_t time, + aw2013_time_level_t level) { + if (time < 0 || time > AW2013_TIME_4 || level < 0 || + level > AW2013_TIME_LEVEL_8) { + ESP_LOGE(TAG, "Fail to set parameters, time: %d, level: %d", time, level); + return ESP_FAIL; + } + periph_aw2013_t *aw2013 = esp_periph_get_data(periph); aw2013->time[time] = level; - return aw2013_set_time (time, level); + return aw2013_set_time(time, level); } -esp_periph_handle_t -periph_aw2013_init (periph_aw2013_cfg_t *aw2013_cfg) -{ - esp_periph_handle_t periph - = esp_periph_create (PERIPH_ID_AW2013, "periph_aw2013"); - AUDIO_NULL_CHECK (TAG, periph, return NULL); +esp_periph_handle_t periph_aw2013_init(periph_aw2013_cfg_t *aw2013_cfg) { + esp_periph_handle_t periph = + esp_periph_create(PERIPH_ID_AW2013, "periph_aw2013"); + AUDIO_NULL_CHECK(TAG, periph, return NULL); - periph_aw2013_t *aw2013 = audio_calloc (1, sizeof (periph_aw2013_t)); - AUDIO_MEM_CHECK (TAG, aw2013, { - audio_free (periph); + periph_aw2013_t *aw2013 = audio_calloc(1, sizeof(periph_aw2013_t)); + AUDIO_MEM_CHECK(TAG, aw2013, { + audio_free(periph); return NULL; }); @@ -178,7 +157,7 @@ periph_aw2013_init (periph_aw2013_cfg_t *aw2013_cfg) // Cycle all the time aw2013->rpt_time = 0; - esp_periph_set_data (periph, aw2013); - esp_periph_set_function (periph, _aw2013_init, NULL, _aw2013_destroy); + esp_periph_set_data(periph, aw2013); + esp_periph_set_function(periph, _aw2013_init, NULL, _aw2013_destroy); return periph; } diff --git a/components/esp_peripherals/periph_button.c b/components/esp_peripherals/periph_button.c index a818984e..697878dd 100644 --- a/components/esp_peripherals/periph_button.c +++ b/components/esp_peripherals/periph_button.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,129 +18,113 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "periph_button.h" + #include "audio_mem.h" #include "button.h" #include "esp_log.h" static const char *TAG = "PERIPH_BUTTON"; -#define VALIDATE_BTN(periph, ret) \ - if (!(periph && esp_periph_get_id (periph) == PERIPH_ID_BUTTON)) \ - { \ - ESP_LOGE (TAG, "Invalid BUTTON periph, at line %d", __LINE__); \ - return ret; \ - } +#define VALIDATE_BTN(periph, ret) \ + if (!(periph && esp_periph_get_id(periph) == PERIPH_ID_BUTTON)) { \ + ESP_LOGE(TAG, "Invalid BUTTON periph, at line %d", __LINE__); \ + return ret; \ + } -typedef struct -{ +typedef struct { esp_button_handle_t btn; uint64_t gpio_mask; int long_press_time_ms; } periph_button_t; -static void -button_send_event (esp_periph_handle_t self, int event_id, uint64_t mask) -{ +static void button_send_event(esp_periph_handle_t self, int event_id, + uint64_t mask) { int gpio_num = 0; - while (mask) - { - if (mask & 0x01) - { - esp_periph_send_event (self, event_id, (void *)gpio_num, 0); - } - mask >>= 1; - gpio_num++; + while (mask) { + if (mask & 0x01) { + esp_periph_send_event(self, event_id, (void *)gpio_num, 0); } + mask >>= 1; + gpio_num++; + } } -static esp_err_t -_button_run (esp_periph_handle_t self, audio_event_iface_msg_t *msg) -{ +static esp_err_t _button_run(esp_periph_handle_t self, + audio_event_iface_msg_t *msg) { button_result_t result; - periph_button_t *periph_btn = esp_periph_get_data (self); - if (button_read (periph_btn->btn, &result)) - { - ESP_LOGD (TAG, - "Button event, press_mask %llx, release_mask: %llx, " - "long_press_mask: %llx, long_release_mask: %llx", - result.press_mask, result.release_mask, result.long_press_mask, - result.long_release_mask); - button_send_event (self, PERIPH_BUTTON_PRESSED, result.press_mask); - button_send_event (self, PERIPH_BUTTON_RELEASE, result.release_mask); - button_send_event (self, PERIPH_BUTTON_LONG_PRESSED, - result.long_press_mask); - button_send_event (self, PERIPH_BUTTON_LONG_RELEASE, - result.long_release_mask); - } + periph_button_t *periph_btn = esp_periph_get_data(self); + if (button_read(periph_btn->btn, &result)) { + ESP_LOGD(TAG, + "Button event, press_mask %llx, release_mask: %llx, " + "long_press_mask: %llx, long_release_mask: %llx", + result.press_mask, result.release_mask, result.long_press_mask, + result.long_release_mask); + button_send_event(self, PERIPH_BUTTON_PRESSED, result.press_mask); + button_send_event(self, PERIPH_BUTTON_RELEASE, result.release_mask); + button_send_event(self, PERIPH_BUTTON_LONG_PRESSED, result.long_press_mask); + button_send_event(self, PERIPH_BUTTON_LONG_RELEASE, + result.long_release_mask); + } return ESP_OK; } -static esp_err_t -_button_destroy (esp_periph_handle_t self) -{ - periph_button_t *periph_btn = esp_periph_get_data (self); - button_destroy (periph_btn->btn); - audio_free (periph_btn); +static esp_err_t _button_destroy(esp_periph_handle_t self) { + periph_button_t *periph_btn = esp_periph_get_data(self); + esp_periph_stop_timer(self); + button_destroy(periph_btn->btn); + audio_free(periph_btn); return ESP_OK; } -static void IRAM_ATTR -button_intr_handler (void *param) -{ +static void IRAM_ATTR button_intr_handler(void *param) { esp_periph_handle_t periph = (esp_periph_handle_t)param; - esp_periph_send_cmd_from_isr (periph, 0, NULL, 0); + esp_periph_send_cmd_from_isr(periph, 0, NULL, 0); } -static void -button_timer_handler (xTimerHandle tmr) -{ - esp_periph_handle_t periph = (esp_periph_handle_t)pvTimerGetTimerID (tmr); - esp_periph_send_cmd_from_isr (periph, 0, NULL, 0); +static void button_timer_handler(xTimerHandle tmr) { + esp_periph_handle_t periph = (esp_periph_handle_t)pvTimerGetTimerID(tmr); + esp_periph_send_cmd_from_isr(periph, 0, NULL, 0); } -static esp_err_t -_button_init (esp_periph_handle_t self) -{ +static esp_err_t _button_init(esp_periph_handle_t self) { int ret = 0; - VALIDATE_BTN (self, ESP_FAIL); - periph_button_t *periph_btn = esp_periph_get_data (self); + VALIDATE_BTN(self, ESP_FAIL); + periph_button_t *periph_btn = esp_periph_get_data(self); button_config_t btn_config = { - .gpio_mask = periph_btn->gpio_mask, - .long_press_time_ms = periph_btn->long_press_time_ms, - .button_intr_handler = button_intr_handler, - .intr_context = self, + .gpio_mask = periph_btn->gpio_mask, + .long_press_time_ms = periph_btn->long_press_time_ms, + .button_intr_handler = button_intr_handler, + .intr_context = self, }; - periph_btn->btn = button_init (&btn_config); + periph_btn->btn = button_init(&btn_config); - esp_periph_start_timer (self, 50 / portTICK_RATE_MS, button_timer_handler); + esp_periph_start_timer(self, 50 / portTICK_RATE_MS, button_timer_handler); return ret; } -esp_periph_handle_t -periph_button_init (periph_button_cfg_t *config) -{ - esp_periph_handle_t periph - = esp_periph_create (PERIPH_ID_BUTTON, "periph_btn"); - AUDIO_MEM_CHECK (TAG, periph, return NULL); - periph_button_t *periph_btn = audio_calloc (1, sizeof (periph_button_t)); +esp_periph_handle_t periph_button_init(periph_button_cfg_t *config) { + esp_periph_handle_t periph = + esp_periph_create(PERIPH_ID_BUTTON, "periph_btn"); + AUDIO_MEM_CHECK(TAG, periph, return NULL); + periph_button_t *periph_btn = audio_calloc(1, sizeof(periph_button_t)); - AUDIO_MEM_CHECK (TAG, periph_btn, { - audio_free (periph); + AUDIO_MEM_CHECK(TAG, periph_btn, { + audio_free(periph); return NULL; }); periph_btn->gpio_mask = config->gpio_mask; periph_btn->long_press_time_ms = config->long_press_time_ms; - esp_periph_set_data (periph, periph_btn); - esp_periph_set_function (periph, _button_init, _button_run, _button_destroy); + esp_periph_set_data(periph, periph_btn); + esp_periph_set_function(periph, _button_init, _button_run, _button_destroy); return periph; } diff --git a/components/esp_peripherals/periph_console.c b/components/esp_peripherals/periph_console.c index bc99129a..89202443 100644 --- a/components/esp_peripherals/periph_console.c +++ b/components/esp_peripherals/periph_console.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,27 +18,24 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "periph_console.h" + +#include + #include "argtable3/argtable3.h" +#include "audio_idf_version.h" #include "audio_mem.h" #include "driver/uart.h" #include "esp_console.h" #include "esp_log.h" #include "esp_vfs_dev.h" #include "sys/queue.h" -#include - -#if __has_include("esp_idf_version.h") -#include "esp_idf_version.h" -#else -#define ESP_IDF_VERSION_VAL(major, minor, patch) 1 -#endif #define CONSOLE_MAX_ARGUMENTS (5) static const char *TAG = "PERIPH_CONSOLE"; @@ -46,8 +43,7 @@ static const int STOPPED_BIT = BIT1; typedef struct periph_console *periph_console_handle_t; -typedef struct periph_console -{ +typedef struct periph_console { char *buffer; int total_bytes; bool run; @@ -60,284 +56,250 @@ typedef struct periph_console char *prompt_string; } periph_console_t; -static char * -conslole_parse_arguments (char *str, char **saveptr) -{ +static char *conslole_parse_arguments(char *str, char **saveptr) { char *p; - if (str != NULL) - { - *saveptr = str; - } + if (str != NULL) { + *saveptr = str; + } p = *saveptr; - if (!p) - { - return NULL; - } + if (!p) { + return NULL; + } /* Skipping white space.*/ - while (*p == ' ' || *p == '\t') - { - p++; - } + while (*p == ' ' || *p == '\t') { + p++; + } - if (*p == '"') - { - /* If an argument starts with a double quote then its delimiter is - * another quote.*/ - p++; - *saveptr = strstr (p, "\""); - } - else - { - /* The delimiter is white space.*/ - *saveptr = strpbrk (p, " \t"); - } + if (*p == '"') { + /* If an argument starts with a double quote then its delimiter is another + * quote.*/ + p++; + *saveptr = strstr(p, "\""); + } else { + /* The delimiter is white space.*/ + *saveptr = strpbrk(p, " \t"); + } /* Replacing the delimiter with a zero.*/ - if (*saveptr != NULL) - { - *(*saveptr)++ = '\0'; - } + if (*saveptr != NULL) { + *(*saveptr)++ = '\0'; + } return *p != '\0' ? p : NULL; } -bool -console_get_line (periph_console_handle_t console, unsigned max_size, - TickType_t time_to_wait) -{ +bool console_get_line(periph_console_handle_t console, unsigned max_size, + TickType_t time_to_wait) { char c; char tx[3]; int nread = 0; #if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)) - nread = uart_read_bytes (CONFIG_ESP_CONSOLE_UART_NUM, (uint8_t *)&c, 1, - time_to_wait); + nread = uart_read_bytes(CONFIG_ESP_CONSOLE_UART_NUM, (uint8_t *)&c, 1, + time_to_wait); #else - nread = uart_read_bytes (CONFIG_CONSOLE_UART_NUM, (uint8_t *)&c, 1, - time_to_wait); + nread = + uart_read_bytes(CONFIG_CONSOLE_UART_NUM, (uint8_t *)&c, 1, time_to_wait); #endif - if (nread <= 0) - { - return false; - } - if ((c == 8) || (c == 127)) - { // backspace or del - if (console->total_bytes > 0) - { - console->total_bytes--; - tx[0] = c; - tx[1] = 0x20; - tx[2] = c; + if (nread <= 0) { + return false; + } + if ((c == 8) || (c == 127)) { // backspace or del + if (console->total_bytes > 0) { + console->total_bytes--; + tx[0] = c; + tx[1] = 0x20; + tx[2] = c; #if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)) - uart_write_bytes (CONFIG_ESP_CONSOLE_UART_NUM, (const char *)tx, 3); + uart_write_bytes(CONFIG_ESP_CONSOLE_UART_NUM, (const char *)tx, 3); #else - uart_write_bytes (CONFIG_CONSOLE_UART_NUM, (const char *)tx, 3); + uart_write_bytes(CONFIG_CONSOLE_UART_NUM, (const char *)tx, 3); #endif - } - return false; } - if (c == '\n' || c == '\r') - { - tx[0] = '\r'; - tx[1] = '\n'; + return false; + } + if (c == '\n' || c == '\r') { + tx[0] = '\r'; + tx[1] = '\n'; #if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)) - uart_write_bytes (CONFIG_ESP_CONSOLE_UART_NUM, (const char *)tx, 2); + uart_write_bytes(CONFIG_ESP_CONSOLE_UART_NUM, (const char *)tx, 2); #else - uart_write_bytes (CONFIG_CONSOLE_UART_NUM, (const char *)tx, 2); + uart_write_bytes(CONFIG_CONSOLE_UART_NUM, (const char *)tx, 2); #endif - console->buffer[console->total_bytes] = 0; - return true; - } + console->buffer[console->total_bytes] = 0; + return true; + } - if (c < 0x20) - { - return false; - } + if (c < 0x20) { + return false; + } #if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)) - uart_write_bytes (CONFIG_ESP_CONSOLE_UART_NUM, (const char *)&c, 1); + uart_write_bytes(CONFIG_ESP_CONSOLE_UART_NUM, (const char *)&c, 1); #else - uart_write_bytes (CONFIG_CONSOLE_UART_NUM, (const char *)&c, 1); + uart_write_bytes(CONFIG_CONSOLE_UART_NUM, (const char *)&c, 1); #endif console->buffer[console->total_bytes++] = (char)c; - if (console->total_bytes > max_size) - { - console->total_bytes = 0; - } + if (console->total_bytes > max_size) { + console->total_bytes = 0; + } return false; } -static bool -console_exec (esp_periph_handle_t self, char *cmd, int argc, char *argv[]) -{ - periph_console_handle_t console - = (periph_console_handle_t)esp_periph_get_data (self); - if (cmd == NULL) - { - return false; - } +static bool console_exec(esp_periph_handle_t self, char *cmd, int argc, + char *argv[]) { + periph_console_handle_t console = + (periph_console_handle_t)esp_periph_get_data(self); + if (cmd == NULL) { + return false; + } int i; - for (i = 0; i < console->command_num; i++) - { - if (strcasecmp (cmd, console->commands[i].cmd) == 0) - { - if (console->commands[i].func) - { - console->commands[i].func (self, argc, argv); - return true; - } - int cmd_id = console->commands[i].id; - if (cmd_id == 0) - { - cmd_id = i; - } - esp_periph_send_event (self, cmd_id, argv, argc); - return true; - } - } - printf ("----------------------\r\n"); - printf ("Perpheral console HELP\r\n"); - printf ("----------------------\r\n"); - for (i = 0; i < console->command_num; i++) - { - printf ("%s \t%s\r\n", console->commands[i].cmd, - console->commands[i].help); + for (i = 0; i < console->command_num; i++) { + if (strcasecmp(cmd, console->commands[i].cmd) == 0) { + if (console->commands[i].func) { + console->commands[i].func(self, argc, argv); + return true; + } + int cmd_id = console->commands[i].id; + if (cmd_id == 0) { + cmd_id = i; + } + esp_periph_send_event(self, cmd_id, argv, argc); + return true; } + } + printf("----------------------\r\n"); + printf("Perpheral console HELP\r\n"); + printf("----------------------\r\n"); + for (i = 0; i < console->command_num; i++) { + printf("%s \t%s\r\n", console->commands[i].cmd, console->commands[i].help); + } return false; } -static esp_err_t -_console_destroy (esp_periph_handle_t self) -{ - periph_console_handle_t console - = (periph_console_handle_t)esp_periph_get_data (self); +static esp_err_t _console_destroy(esp_periph_handle_t self) { + periph_console_handle_t console = + (periph_console_handle_t)esp_periph_get_data(self); console->run = false; - xEventGroupWaitBits (console->state_event_bits, STOPPED_BIT, false, true, - portMAX_DELAY); - vEventGroupDelete (console->state_event_bits); - if (console->prompt_string) - { - audio_free (console->prompt_string); - } - audio_free (console->buffer); - audio_free (console); + xEventGroupWaitBits(console->state_event_bits, STOPPED_BIT, false, true, + portMAX_DELAY); + vEventGroupDelete(console->state_event_bits); + if (console->prompt_string) { + audio_free(console->prompt_string); + } + audio_free(console->buffer); + audio_free(console); return ESP_OK; } -static void -_console_task (void *pv) -{ +static void _console_task(void *pv) { esp_periph_handle_t self = (esp_periph_handle_t)pv; char *lp, *cmd, *tokp; char *args[CONSOLE_MAX_ARGUMENTS + 1]; int n; - periph_console_handle_t console - = (periph_console_handle_t)esp_periph_get_data (self); - if (console->total_bytes >= console->buffer_size) - { - console->total_bytes = 0; - } + periph_console_handle_t console = + (periph_console_handle_t)esp_periph_get_data(self); + if (console->total_bytes >= console->buffer_size) { + console->total_bytes = 0; + } console->run = true; - xEventGroupClearBits (console->state_event_bits, STOPPED_BIT); + xEventGroupClearBits(console->state_event_bits, STOPPED_BIT); const char *prompt_string = CONSOLE_DEFAULT_PROMPT_STRING; - if (console->prompt_string) - { - prompt_string = console->prompt_string; - } - printf ("\r\n%s ", prompt_string); - while (console->run) - { - if (console_get_line (console, console->buffer_size, - 10 / portTICK_RATE_MS)) - { - if (console->total_bytes) - { - ESP_LOGD (TAG, "Read line: %s", console->buffer); - } - lp = conslole_parse_arguments (console->buffer, &tokp); - cmd = lp; - n = 0; - while ((lp = conslole_parse_arguments (NULL, &tokp)) != NULL) - { - if (n >= CONSOLE_MAX_ARGUMENTS) - { - printf ("too many arguments\r\n"); - cmd = NULL; - break; - } - args[n++] = lp; - } - args[n] = NULL; - if (console->total_bytes > 0) - { - console_exec (self, cmd, n, args); - console->total_bytes = 0; - } - printf ("%s ", prompt_string); + if (console->prompt_string) { + prompt_string = console->prompt_string; + } + printf("\r\n%s ", prompt_string); + while (console->run) { + if (console_get_line(console, console->buffer_size, + 10 / portTICK_RATE_MS)) { + if (console->total_bytes) { + ESP_LOGD(TAG, "Read line: %s", console->buffer); + } + lp = conslole_parse_arguments(console->buffer, &tokp); + cmd = lp; + n = 0; + while ((lp = conslole_parse_arguments(NULL, &tokp)) != NULL) { + if (n >= CONSOLE_MAX_ARGUMENTS) { + printf("too many arguments\r\n"); + cmd = NULL; + break; } + args[n++] = lp; + } + args[n] = NULL; + if (console->total_bytes > 0) { + console_exec(self, cmd, n, args); + console->total_bytes = 0; + } + printf("%s ", prompt_string); } - xEventGroupSetBits (console->state_event_bits, STOPPED_BIT); - vTaskDelete (NULL); + } + xEventGroupSetBits(console->state_event_bits, STOPPED_BIT); + vTaskDelete(NULL); } -static esp_err_t -_console_init (esp_periph_handle_t self) -{ - periph_console_handle_t console - = (periph_console_handle_t)esp_periph_get_data (self); +static esp_err_t _console_init(esp_periph_handle_t self) { + periph_console_handle_t console = + (periph_console_handle_t)esp_periph_get_data(self); - setvbuf (stdin, NULL, _IONBF, 0); - setvbuf (stdout, NULL, _IONBF, 0); + setvbuf(stdin, NULL, _IONBF, 0); + setvbuf(stdout, NULL, _IONBF, 0); /* Minicom, screen, idf_monitor send CR when ENTER key is pressed */ - esp_vfs_dev_uart_set_rx_line_endings (ESP_LINE_ENDINGS_CR); +#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0)) + esp_vfs_dev_uart_port_set_rx_line_endings(CONFIG_ESP_CONSOLE_UART_NUM, + ESP_LINE_ENDINGS_CR); +#else + esp_vfs_dev_uart_set_rx_line_endings(ESP_LINE_ENDINGS_CR); +#endif /* Move the caret to the beginning of the next line on '\n' */ - esp_vfs_dev_uart_set_tx_line_endings (ESP_LINE_ENDINGS_CRLF); +#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0)) + esp_vfs_dev_uart_port_set_tx_line_endings(CONFIG_ESP_CONSOLE_UART_NUM, + ESP_LINE_ENDINGS_CRLF); +#else + esp_vfs_dev_uart_set_tx_line_endings(ESP_LINE_ENDINGS_CRLF); +#endif #if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)) - uart_driver_install (CONFIG_ESP_CONSOLE_UART_NUM, console->buffer_size * 2, - 0, 0, NULL, 0); + uart_driver_install(CONFIG_ESP_CONSOLE_UART_NUM, console->buffer_size * 2, 0, + 0, NULL, 0); #else - uart_driver_install (CONFIG_CONSOLE_UART_NUM, console->buffer_size * 2, 0, 0, - NULL, 0); + uart_driver_install(CONFIG_CONSOLE_UART_NUM, console->buffer_size * 2, 0, 0, + NULL, 0); #endif /* Tell VFS to use UART driver */ #if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)) - esp_vfs_dev_uart_use_driver (CONFIG_ESP_CONSOLE_UART_NUM); + esp_vfs_dev_uart_use_driver(CONFIG_ESP_CONSOLE_UART_NUM); #else - esp_vfs_dev_uart_use_driver (CONFIG_CONSOLE_UART_NUM); + esp_vfs_dev_uart_use_driver(CONFIG_CONSOLE_UART_NUM); #endif - console->buffer = (char *)audio_malloc (console->buffer_size); - AUDIO_MEM_CHECK (TAG, console->buffer, { return ESP_ERR_NO_MEM; }); + console->buffer = (char *)audio_malloc(console->buffer_size); + AUDIO_MEM_CHECK(TAG, console->buffer, { return ESP_ERR_NO_MEM; }); - if (xTaskCreate (_console_task, "console_task", console->task_stack, self, - console->task_prio, NULL) - != pdTRUE) - { - ESP_LOGE (TAG, "Error create console task, memory exhausted?"); - return ESP_FAIL; - } + if (xTaskCreate(_console_task, "console_task", console->task_stack, self, + console->task_prio, NULL) != pdTRUE) { + ESP_LOGE(TAG, "Error create console task, memory exhausted?"); + return ESP_FAIL; + } return ESP_OK; } -esp_periph_handle_t -periph_console_init (periph_console_cfg_t *config) -{ - esp_periph_handle_t periph - = esp_periph_create (PERIPH_ID_CONSOLE, "periph_console"); - AUDIO_MEM_CHECK (TAG, periph, return NULL); - periph_console_t *console = audio_calloc (1, sizeof (periph_console_t)); - AUDIO_MEM_CHECK (TAG, console, { - audio_free (periph); +esp_periph_handle_t periph_console_init(periph_console_cfg_t *config) { + esp_periph_handle_t periph = + esp_periph_create(PERIPH_ID_CONSOLE, "periph_console"); + AUDIO_MEM_CHECK(TAG, periph, return NULL); + periph_console_t *console = audio_calloc(1, sizeof(periph_console_t)); + AUDIO_MEM_CHECK(TAG, console, { + audio_free(periph); return NULL; }); console->commands = config->commands; @@ -345,29 +307,25 @@ periph_console_init (periph_console_cfg_t *config) console->task_stack = CONSOLE_DEFAULT_TASK_STACK; console->task_prio = CONSOLE_DEFAULT_TASK_PRIO; console->buffer_size = CONSOLE_DEFAULT_BUFFER_SIZE; - if (config->buffer_size > 0) - { - console->buffer_size = config->buffer_size; - } - if (config->task_stack > 0) - { - console->task_stack = config->task_stack; - } - if (config->task_prio) - { - console->task_prio = config->task_prio; - } - if (config->prompt_string) - { - console->prompt_string = audio_strdup (config->prompt_string); - AUDIO_MEM_CHECK (TAG, console->prompt_string, { - audio_free (periph); - audio_free (console); - return NULL; - }); - } - console->state_event_bits = xEventGroupCreate (); - esp_periph_set_data (periph, console); - esp_periph_set_function (periph, _console_init, NULL, _console_destroy); + if (config->buffer_size > 0) { + console->buffer_size = config->buffer_size; + } + if (config->task_stack > 0) { + console->task_stack = config->task_stack; + } + if (config->task_prio) { + console->task_prio = config->task_prio; + } + if (config->prompt_string) { + console->prompt_string = audio_strdup(config->prompt_string); + AUDIO_MEM_CHECK(TAG, console->prompt_string, { + audio_free(periph); + audio_free(console); + return NULL; + }); + } + console->state_event_bits = xEventGroupCreate(); + esp_periph_set_data(periph, console); + esp_periph_set_function(periph, _console_init, NULL, _console_destroy); return periph; } diff --git a/components/esp_peripherals/periph_gpio_isr.c b/components/esp_peripherals/periph_gpio_isr.c index 3542b3d9..5befe9d3 100644 --- a/components/esp_peripherals/periph_gpio_isr.c +++ b/components/esp_peripherals/periph_gpio_isr.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,167 +18,145 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "periph_gpio_isr.h" + +#include + #include "audio_error.h" #include "audio_mem.h" #include "driver/gpio.h" #include "esp_log.h" #include "esp_peripherals.h" #include "sys/queue.h" -#include static const char *TAG = "PERIPH_GPIO_ISR"; -typedef struct gpio_info_node -{ +typedef struct gpio_info_node { gpio_isr_info_t gpio_info; - STAILQ_ENTRY (gpio_info_node) entries; + STAILQ_ENTRY(gpio_info_node) entries; } gpio_isr_node_t; static esp_periph_handle_t g_handle = NULL; -static STAILQ_HEAD (gpio_isr_list, gpio_info_node) gpio_isr_info_list; +static STAILQ_HEAD(gpio_isr_list, gpio_info_node) gpio_isr_info_list; -static void IRAM_ATTR -gpio_isr_handler (void *param) -{ +static void IRAM_ATTR gpio_isr_handler(void *param) { int gpio_num = (int)param; - esp_periph_send_cmd_from_isr (g_handle, gpio_num, NULL, 0); + esp_periph_send_cmd_from_isr(g_handle, gpio_num, NULL, 0); } -static esp_err_t -_gpio_isr_init (esp_periph_handle_t self) -{ +static esp_err_t _gpio_isr_init(esp_periph_handle_t self) { esp_err_t ret = ESP_OK; gpio_isr_node_t *tmp_node = NULL; gpio_isr_info_t *tmp_info = NULL; - STAILQ_FOREACH (tmp_node, &gpio_isr_info_list, entries) - { + STAILQ_FOREACH(tmp_node, &gpio_isr_info_list, entries) { tmp_info = &tmp_node->gpio_info; - ret |= gpio_isr_init (tmp_info->gpio_num, tmp_info->type, gpio_isr_handler, - (void *)tmp_info->gpio_num); + ret |= gpio_isr_init(tmp_info->gpio_num, tmp_info->type, gpio_isr_handler, + (void *)tmp_info->gpio_num); } return ret; } -static esp_err_t -_gpio_isr_run (esp_periph_handle_t self, audio_event_iface_msg_t *msg) -{ +static esp_err_t _gpio_isr_run(esp_periph_handle_t self, + audio_event_iface_msg_t *msg) { esp_err_t ret = ESP_OK; - if (msg->cmd >= 0) - { - ret = esp_periph_send_event (self, 0, (void *)msg->cmd, 0); - return ret; - } + if (msg->cmd >= 0) { + ret = esp_periph_send_event(self, 0, (void *)msg->cmd, 0); + return ret; + } return ESP_FAIL; } -static esp_err_t -_gpio_isr_destory (esp_periph_handle_t self) -{ +static esp_err_t _gpio_isr_destory(esp_periph_handle_t self) { esp_err_t ret = ESP_OK; gpio_isr_node_t *tmp, *item; gpio_isr_info_t *tmp_info = NULL; - STAILQ_FOREACH_SAFE (item, &gpio_isr_info_list, entries, tmp) - { + STAILQ_FOREACH_SAFE(item, &gpio_isr_info_list, entries, tmp) { tmp_info = &item->gpio_info; - ret |= gpio_isr_deinit (tmp_info->gpio_num); - STAILQ_REMOVE (&gpio_isr_info_list, item, gpio_info_node, entries); - audio_free (item); + ret |= gpio_isr_deinit(tmp_info->gpio_num); + STAILQ_REMOVE(&gpio_isr_info_list, item, gpio_info_node, entries); + audio_free(item); } return ret; } -esp_err_t -periph_gpio_isr_add (gpio_isr_info_t *gpio_info) -{ - AUDIO_NULL_CHECK (TAG, gpio_info, return ESP_FAIL); +esp_err_t periph_gpio_isr_add(gpio_isr_info_t *gpio_info) { + AUDIO_NULL_CHECK(TAG, gpio_info, return ESP_FAIL); gpio_isr_node_t *tmp_node = NULL; gpio_isr_info_t *tmp_info = NULL; - STAILQ_FOREACH (tmp_node, &gpio_isr_info_list, entries) - { + STAILQ_FOREACH(tmp_node, &gpio_isr_info_list, entries) { tmp_info = &tmp_node->gpio_info; - if (tmp_info->gpio_num == gpio_info->gpio_num) - { - ESP_LOGW (TAG, "The gpio has already registered isr"); - return ESP_FAIL; - } + if (tmp_info->gpio_num == gpio_info->gpio_num) { + ESP_LOGW(TAG, "The gpio has already registered isr"); + return ESP_FAIL; + } } - gpio_isr_node_t *gpio_isr_node - = (gpio_isr_node_t *)audio_calloc (1, sizeof (gpio_isr_node_t)); - AUDIO_NULL_CHECK (TAG, gpio_isr_node, return ESP_FAIL); - memcpy (gpio_isr_node, gpio_info, sizeof (gpio_isr_info_t)); - STAILQ_INSERT_TAIL (&gpio_isr_info_list, gpio_isr_node, entries); - return gpio_isr_init (gpio_info->gpio_num, gpio_info->type, gpio_isr_handler, - (void *)gpio_info->gpio_num); + gpio_isr_node_t *gpio_isr_node = + (gpio_isr_node_t *)audio_calloc(1, sizeof(gpio_isr_node_t)); + AUDIO_NULL_CHECK(TAG, gpio_isr_node, return ESP_FAIL); + memcpy(gpio_isr_node, gpio_info, sizeof(gpio_isr_info_t)); + STAILQ_INSERT_TAIL(&gpio_isr_info_list, gpio_isr_node, entries); + return gpio_isr_init(gpio_info->gpio_num, gpio_info->type, gpio_isr_handler, + (void *)gpio_info->gpio_num); } -esp_err_t -periph_gpio_isr_delete (int gpio_num) -{ +esp_err_t periph_gpio_isr_delete(int gpio_num) { esp_err_t ret = ESP_OK; - if (gpio_num < 0) - { - ESP_LOGW (TAG, "The gpio number should be greater than 0"); - } + if (gpio_num < 0) { + ESP_LOGW(TAG, "The gpio number should be greater than 0"); + } gpio_isr_node_t *tmp_node = NULL; gpio_isr_info_t *tmp_info = NULL; - STAILQ_FOREACH (tmp_node, &gpio_isr_info_list, entries) - { + STAILQ_FOREACH(tmp_node, &gpio_isr_info_list, entries) { tmp_info = &tmp_node->gpio_info; - if (tmp_info->gpio_num == gpio_num) - { - STAILQ_REMOVE (&gpio_isr_info_list, tmp_node, gpio_info_node, entries); - ret |= gpio_isr_deinit (tmp_info->gpio_num); - audio_free (tmp_node); - return ret; - } + if (tmp_info->gpio_num == gpio_num) { + STAILQ_REMOVE(&gpio_isr_info_list, tmp_node, gpio_info_node, entries); + ret |= gpio_isr_deinit(tmp_info->gpio_num); + audio_free(tmp_node); + return ret; + } } - ESP_LOGW (TAG, "The gpio %d hasn't been registered", gpio_num); + ESP_LOGW(TAG, "The gpio %d hasn't been registered", gpio_num); return ESP_FAIL; } -esp_periph_handle_t -periph_gpio_isr_init (periph_gpio_isr_cfg_t *isr_config) -{ - esp_periph_handle_t periph - = esp_periph_create (PERIPH_ID_GPIO_ISR, "periph_gpio_isr"); - AUDIO_NULL_CHECK (TAG, periph, return NULL); - - STAILQ_INIT (&gpio_isr_info_list); - - if (isr_config) - { - for (int i = 0; i < isr_config->info_size; i++) - { - gpio_isr_node_t *gpio_isr_node - = (gpio_isr_node_t *)audio_calloc (1, sizeof (gpio_isr_node_t)); - AUDIO_NULL_CHECK (TAG, gpio_isr_node, { - audio_free (periph); - return NULL; - }); - memcpy (gpio_isr_node, &isr_config->gpio_isr_info[i], - sizeof (gpio_isr_info_t)); - STAILQ_INSERT_TAIL (&gpio_isr_info_list, gpio_isr_node, entries); - } +esp_periph_handle_t periph_gpio_isr_init(periph_gpio_isr_cfg_t *isr_config) { + esp_periph_handle_t periph = + esp_periph_create(PERIPH_ID_GPIO_ISR, "periph_gpio_isr"); + AUDIO_NULL_CHECK(TAG, periph, return NULL); + + STAILQ_INIT(&gpio_isr_info_list); + + if (isr_config) { + for (int i = 0; i < isr_config->info_size; i++) { + gpio_isr_node_t *gpio_isr_node = + (gpio_isr_node_t *)audio_calloc(1, sizeof(gpio_isr_node_t)); + AUDIO_NULL_CHECK(TAG, gpio_isr_node, { + audio_free(periph); + return NULL; + }); + memcpy(gpio_isr_node, &isr_config->gpio_isr_info[i], + sizeof(gpio_isr_info_t)); + STAILQ_INSERT_TAIL(&gpio_isr_info_list, gpio_isr_node, entries); } + } - esp_periph_set_data (periph, &gpio_isr_info_list); - esp_periph_set_function (periph, _gpio_isr_init, _gpio_isr_run, - _gpio_isr_destory); + esp_periph_set_data(periph, &gpio_isr_info_list); + esp_periph_set_function(periph, _gpio_isr_init, _gpio_isr_run, + _gpio_isr_destory); g_handle = periph; return periph; } diff --git a/components/esp_peripherals/periph_is31fl3216.c b/components/esp_peripherals/periph_is31fl3216.c index 3b1e97dd..3fd5d6b2 100644 --- a/components/esp_peripherals/periph_is31fl3216.c +++ b/components/esp_peripherals/periph_is31fl3216.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,20 +18,23 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "periph_is31fl3216.h" + +#include +#include + #include "IS31FL3216.h" #include "audio_mem.h" #include "esp_log.h" #include "freertos/FreeRTOS.h" #include "freertos/queue.h" #include "freertos/task.h" -#include #define IS31FL3216_TASK_STACK_SIZE (2048 + 1024) #define IS31FL3216_TASK_PRIORITY 3 @@ -42,460 +45,391 @@ static const char *TAG = "PERIPH_IS31"; static const int DESTROY_BIT = BIT0; -#define VALIDATE_IS31FL3216(periph, ret) \ - if (!(periph && esp_periph_get_id (periph) == PERIPH_ID_IS31FL3216)) \ - { \ - ESP_LOGE (TAG, "Invalid is31fl3216 periph, at line %d", __LINE__); \ - return ret; \ - } +#define VALIDATE_IS31FL3216(periph, ret) \ + if (!(periph && esp_periph_get_id(periph) == PERIPH_ID_IS31FL3216)) { \ + ESP_LOGE(TAG, "Invalid is31fl3216 periph, at line %d", __LINE__); \ + return ret; \ + } static const uint8_t light_audio_frames[8][ONE_FRAME_BYTE_SIZE] = { - { 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, - { 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xff }, - { 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0x00, 0x00, 0x00, 0xff, 0xff }, - { 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0x00, 0xff, 0xff, 0xff }, - { 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xff, 0xff, 0xff }, - { 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xff, 0xFF, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, + {0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, + {0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xff}, + {0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0x00, 0x00, 0x00, 0xff, 0xff}, + {0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0x00, 0xff, 0xff, 0xff}, + {0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xff, 0xff, 0xff}, + {0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xff, 0xFF, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}, }; -typedef enum -{ +typedef enum { PERIPH_IS31_CMD_CHG_STATE, PERIPH_IS31_CMD_QUIT, } periph_is31_cmd_t; -typedef struct -{ - uint16_t max_light_num; // Maximum light number - uint16_t light_num; // Working lights number - uint16_t light_mask; // Light bits mask - int interval_time; // Interval working time - uint16_t act_time; // Action times - uint8_t duty_step; // Duty step - periph_is31_shift_mode_t shift_mode; // Shift mode step +typedef struct { + uint16_t max_light_num; // Maximum light number + uint16_t light_num; // Working lights number + uint16_t light_mask; // Light bits mask + int interval_time; // Interval working time + uint16_t act_time; // Action times + uint8_t duty_step; // Duty step + periph_is31_shift_mode_t shift_mode; // Shift mode step } periph_is31_arg_t; -typedef struct -{ +typedef struct { periph_is31_arg_t *arg; - uint8_t duty[IS31FL3216_CH_NUM]; // Duty of lights + uint8_t duty[IS31FL3216_CH_NUM]; // Duty of lights is31fl3216_handle_t handle; periph_is31fl3216_state_t cur_state; QueueHandle_t evt; EventGroupHandle_t g_event_bit; } periph_is31fl3216_t; -typedef struct -{ +typedef struct { periph_is31_cmd_t type; uint32_t data; } periph_is31_msg_t; -static esp_err_t -is31_leds_ctrl (is31fl3216_handle_t *handle, uint16_t mask) -{ +static esp_err_t is31_leds_ctrl(is31fl3216_handle_t *handle, uint16_t mask) { esp_err_t ret = ESP_OK; - for (int i = 0; i < IS31FL3216_CH_NUM; i++) - { - if (mask & (1UL << i)) - { - ret |= is31fl3216_ch_enable (handle, 1UL << i); - } - else - { - ret |= is31fl3216_ch_disable (handle, 1UL << i); - } + for (int i = 0; i < IS31FL3216_CH_NUM; i++) { + if (mask & (1UL << i)) { + ret |= is31fl3216_ch_enable(handle, 1UL << i); + } else { + ret |= is31fl3216_ch_disable(handle, 1UL << i); } + } return ret; } -static esp_err_t -is31_leds_duty (is31fl3216_handle_t *handle, int duty, uint16_t mask) -{ +static esp_err_t is31_leds_duty(is31fl3216_handle_t *handle, int duty, + uint16_t mask) { esp_err_t ret = ESP_OK; - for (int i = 0; i < IS31FL3216_CH_NUM; i++) - { - if (mask & (1UL << i)) - ret |= is31fl3216_ch_duty_set (handle, 1UL << i, duty); - } + for (int i = 0; i < IS31FL3216_CH_NUM; i++) { + if (mask & (1UL << i)) + ret |= is31fl3216_ch_duty_set(handle, 1UL << i, duty); + } return ret; } -static void -is31_evt_send (void *que, periph_is31_cmd_t type, uint32_t data, int dir) -{ - periph_is31_msg_t evt = { 0 }; +static void is31_evt_send(void *que, periph_is31_cmd_t type, uint32_t data, + int dir) { + periph_is31_msg_t evt = {0}; evt.type = type; evt.data = data; - if (dir) - { - xQueueSendToFront (que, &evt, 0); - } - else - { - xQueueSend (que, &evt, 0); - } + if (dir) { + xQueueSendToFront(que, &evt, 0); + } else { + xQueueSend(que, &evt, 0); + } } -static esp_err_t -is31_change_state (periph_is31fl3216_t *is31, int state, - periph_is31_arg_t *arg) -{ +static esp_err_t is31_change_state(periph_is31fl3216_t *is31, int state, + periph_is31_arg_t *arg) { esp_err_t ret = ESP_OK; - switch (state) - { + switch (state) { case IS31FL3216_STATE_OFF: - ret |= is31fl3216_ch_disable (is31->handle, arg->light_mask); + ret |= is31fl3216_ch_disable(is31->handle, arg->light_mask); arg->interval_time = portMAX_DELAY; is31->cur_state = IS31FL3216_STATE_OFF; break; case IS31FL3216_STATE_ON: - if (is31->cur_state == IS31FL3216_STATE_BY_AUDIO) - { - ret |= is31fl3216_work_mode_set (is31->handle, IS31FL3216_MODE_PWM); - is31_leds_duty (is31->handle, IS31FL3216_DUTY_MAX, arg->light_mask); - } - is31_leds_ctrl (is31->handle, arg->light_mask); + if (is31->cur_state == IS31FL3216_STATE_BY_AUDIO) { + ret |= is31fl3216_work_mode_set(is31->handle, IS31FL3216_MODE_PWM); + is31_leds_duty(is31->handle, IS31FL3216_DUTY_MAX, arg->light_mask); + } + is31_leds_ctrl(is31->handle, arg->light_mask); arg->interval_time = portMAX_DELAY; is31->cur_state = IS31FL3216_STATE_ON; break; case IS31FL3216_STATE_FLASH: - if (is31->cur_state == IS31FL3216_STATE_BY_AUDIO) - { - ret |= is31fl3216_work_mode_set (is31->handle, IS31FL3216_MODE_PWM); - } + if (is31->cur_state == IS31FL3216_STATE_BY_AUDIO) { + ret |= is31fl3216_work_mode_set(is31->handle, IS31FL3216_MODE_PWM); + } is31->cur_state = IS31FL3216_STATE_FLASH; break; case IS31FL3216_STATE_SHIFT: - if (is31->cur_state == IS31FL3216_STATE_BY_AUDIO) - { - ret |= is31fl3216_work_mode_set (is31->handle, IS31FL3216_MODE_PWM); - } + if (is31->cur_state == IS31FL3216_STATE_BY_AUDIO) { + ret |= is31fl3216_work_mode_set(is31->handle, IS31FL3216_MODE_PWM); + } is31->cur_state = IS31FL3216_STATE_SHIFT; break; case IS31FL3216_STATE_BY_AUDIO: - is31fl3216_reset (is31->handle); - is31fl3216_work_mode_set (is31->handle, IS31FL3216_MODE_FRAME); - is31fl3216_sample_rate_set (is31->handle, 0xB4); // Set adc sample rate - is31fl3216_frame_value_set (is31->handle, 1, - (uint8_t *)&light_audio_frames, - sizeof (light_audio_frames)); - is31fl3216_first_frame_set (is31->handle, 0); + is31fl3216_reset(is31->handle); + is31fl3216_work_mode_set(is31->handle, IS31FL3216_MODE_FRAME); + is31fl3216_sample_rate_set(is31->handle, 0xB4); // Set adc sample rate + is31fl3216_frame_value_set(is31->handle, 1, + (uint8_t *)&light_audio_frames, + sizeof(light_audio_frames)); + is31fl3216_first_frame_set(is31->handle, 0); is31->cur_state = IS31FL3216_STATE_BY_AUDIO; arg->interval_time = portMAX_DELAY; break; default: - ESP_LOGE (TAG, "State %d is not supported", state); + ESP_LOGE(TAG, "State %d is not supported", state); break; - } + } return ret; } -static void -is31fl3216_run_task (void *Para) -{ +static void is31fl3216_run_task(void *Para) { esp_periph_handle_t periph = (esp_periph_handle_t)Para; - periph_is31fl3216_t *is31 = esp_periph_get_data (periph); + periph_is31fl3216_t *is31 = esp_periph_get_data(periph); periph_is31_arg_t is31_arg = { - .max_light_num = IS31FL3216_CH_NUM, - .light_num = 1, - .light_mask = 1, - .interval_time = 1000, - .act_time = 0, - .duty_step = DEFAULT_FLASH_STEP, - .shift_mode = 0, + .max_light_num = IS31FL3216_CH_NUM, + .light_num = 1, + .light_mask = 1, + .interval_time = 1000, + .act_time = 0, + .duty_step = DEFAULT_FLASH_STEP, + .shift_mode = 0, }; - periph_is31_msg_t msg = { 0 }; + periph_is31_msg_t msg = {0}; int wait_time_ms = portMAX_DELAY; bool task_run = true; - xEventGroupClearBits (is31->g_event_bit, DESTROY_BIT); + xEventGroupClearBits(is31->g_event_bit, DESTROY_BIT); int cur_duty = 0; int sig = 2; int cur_bits_mask = 0; int i = 0; uint16_t act_times = 0; - while (task_run) - { - if (xQueueReceive (is31->evt, &msg, (wait_time_ms / portTICK_PERIOD_MS))) - { - ESP_LOGD (TAG, "cmd:%d, data:%d", msg.type, msg.data); - switch (msg.type) - { - case PERIPH_IS31_CMD_CHG_STATE: - memcpy (&is31_arg, is31->arg, sizeof (periph_is31_arg_t)); - wait_time_ms = is31->arg->interval_time; - - memset (is31->arg, 0, sizeof (periph_is31_arg_t)); - is31->arg->interval_time = portMAX_DELAY; - is31->arg->max_light_num = IS31FL3216_CH_NUM; - is31->arg->duty_step = DEFAULT_FLASH_STEP; - is31_change_state (is31, msg.data, &is31_arg); - - if (IS31FL3216_STATE_FLASH == msg.data) - { - sig = is31_arg.duty_step; - } - if (is31_arg.act_time && wait_time_ms) - { - act_times = is31_arg.act_time / wait_time_ms; - } - else - { - act_times = 0; - } - break; - - case PERIPH_IS31_CMD_QUIT: - task_run = false; - if (is31->g_event_bit) - { - xEventGroupSetBits (is31->g_event_bit, DESTROY_BIT); - } - break; - default: - break; - } - if (task_run == false) - { - ESP_LOGW (TAG, "Quit is31fl3216 task ..."); - break; - } - } - switch (is31->cur_state) - { - case IS31FL3216_STATE_FLASH: - { - is31_leds_duty (is31->handle, cur_duty, is31_arg.light_mask); - is31_leds_ctrl (is31->handle, is31_arg.light_mask); - cur_duty += sig; - if (cur_duty > IS31FL3216_DUTY_MAX) - { - cur_duty = IS31FL3216_DUTY_MAX; - sig = -(is31_arg.duty_step); - } - if (cur_duty < 0) - { - cur_duty = 0; - sig = (is31_arg.duty_step); - } + while (task_run) { + if (xQueueReceive(is31->evt, &msg, (wait_time_ms / portTICK_PERIOD_MS))) { + ESP_LOGD(TAG, "cmd:%d, data:%" PRIu32, msg.type, msg.data); + switch (msg.type) { + case PERIPH_IS31_CMD_CHG_STATE: + memcpy(&is31_arg, is31->arg, sizeof(periph_is31_arg_t)); + wait_time_ms = is31->arg->interval_time; + + memset(is31->arg, 0, sizeof(periph_is31_arg_t)); + is31->arg->interval_time = portMAX_DELAY; + is31->arg->max_light_num = IS31FL3216_CH_NUM; + is31->arg->duty_step = DEFAULT_FLASH_STEP; + is31_change_state(is31, msg.data, &is31_arg); + + if (IS31FL3216_STATE_FLASH == msg.data) { + sig = is31_arg.duty_step; + } + if (is31_arg.act_time && wait_time_ms) { + act_times = is31_arg.act_time / wait_time_ms; + } else { + act_times = 0; } - if (is31_arg.act_time == 0) - { - act_times = 0; - break; - } - act_times--; - if (act_times == 0) - { - wait_time_ms = portMAX_DELAY; - is31->cur_state = IS31FL3216_STATE_UNKNOWN; - is31_leds_ctrl (is31->handle, 0); - } break; - case IS31FL3216_STATE_SHIFT: - if (is31_arg.shift_mode == PERIPH_IS31_SHIFT_MODE_SINGLE) - { - cur_bits_mask = ((1UL << is31_arg.light_num) - 1) << (i++); - if (i == (is31_arg.max_light_num - is31_arg.light_num + 1)) - { - i = 0; - } - } - else if (is31_arg.shift_mode == PERIPH_IS31_SHIFT_MODE_ACC) - { - cur_bits_mask = (1UL << (is31_arg.light_num * ((i++) + 1))) - 1; - if ((cur_bits_mask >> is31_arg.max_light_num) & 0x01) - { - cur_bits_mask = 0; - i = 0; - } - } - is31_leds_duty (is31->handle, IS31FL3216_DUTY_MAX, cur_bits_mask); - is31_leds_ctrl (is31->handle, cur_bits_mask); - - ESP_LOGD (TAG, "Mask:%08x, %d", cur_bits_mask, wait_time_ms); - if (is31_arg.act_time == 0) - { - act_times = 0; - break; - } - act_times--; - if (act_times == 0) - { - wait_time_ms = portMAX_DELAY; - is31->cur_state = IS31FL3216_STATE_UNKNOWN; - is31_leds_ctrl (is31->handle, 0); - } + case PERIPH_IS31_CMD_QUIT: + task_run = false; + if (is31->g_event_bit) { + xEventGroupSetBits(is31->g_event_bit, DESTROY_BIT); + } break; default: break; + } + if (task_run == false) { + ESP_LOGW(TAG, "Quit is31fl3216 task ..."); + break; + } + } + switch (is31->cur_state) { + case IS31FL3216_STATE_FLASH: { + is31_leds_duty(is31->handle, cur_duty, is31_arg.light_mask); + is31_leds_ctrl(is31->handle, is31_arg.light_mask); + cur_duty += sig; + if (cur_duty > IS31FL3216_DUTY_MAX) { + cur_duty = IS31FL3216_DUTY_MAX; + sig = -(is31_arg.duty_step); + } + if (cur_duty < 0) { + cur_duty = 0; + sig = (is31_arg.duty_step); } + } + if (is31_arg.act_time == 0) { + act_times = 0; + break; + } + act_times--; + if (act_times == 0) { + wait_time_ms = portMAX_DELAY; + is31->cur_state = IS31FL3216_STATE_UNKNOWN; + is31_leds_ctrl(is31->handle, 0); + } + break; + case IS31FL3216_STATE_SHIFT: + if (is31_arg.shift_mode == PERIPH_IS31_SHIFT_MODE_SINGLE) { + cur_bits_mask = ((1UL << is31_arg.light_num) - 1) << (i++); + if (i == (is31_arg.max_light_num - is31_arg.light_num + 1)) { + i = 0; + } + } else if (is31_arg.shift_mode == PERIPH_IS31_SHIFT_MODE_ACC) { + cur_bits_mask = (1UL << (is31_arg.light_num * ((i++) + 1))) - 1; + if ((cur_bits_mask >> is31_arg.max_light_num) & 0x01) { + cur_bits_mask = 0; + i = 0; + } + } + is31_leds_duty(is31->handle, IS31FL3216_DUTY_MAX, cur_bits_mask); + is31_leds_ctrl(is31->handle, cur_bits_mask); + + ESP_LOGD(TAG, "Mask:%08x, %d", cur_bits_mask, wait_time_ms); + if (is31_arg.act_time == 0) { + act_times = 0; + break; + } + act_times--; + if (act_times == 0) { + wait_time_ms = portMAX_DELAY; + is31->cur_state = IS31FL3216_STATE_UNKNOWN; + is31_leds_ctrl(is31->handle, 0); + } + + break; + default: + break; } - vTaskDelete (NULL); + } + vTaskDelete(NULL); } -esp_err_t -periph_is31fl3216_set_state (esp_periph_handle_t periph, - periph_is31fl3216_state_t state) -{ - periph_is31fl3216_t *is31fl3216 = esp_periph_get_data (periph); - is31_evt_send (is31fl3216->evt, PERIPH_IS31_CMD_CHG_STATE, state, 0); +esp_err_t periph_is31fl3216_set_state(esp_periph_handle_t periph, + periph_is31fl3216_state_t state) { + periph_is31fl3216_t *is31fl3216 = esp_periph_get_data(periph); + is31_evt_send(is31fl3216->evt, PERIPH_IS31_CMD_CHG_STATE, state, 0); return ESP_OK; } -esp_err_t -periph_is31fl3216_set_blink_pattern (esp_periph_handle_t periph, - uint16_t blink_pattern) -{ - periph_is31fl3216_t *is31fl3216 = esp_periph_get_data (periph); +esp_err_t periph_is31fl3216_set_blink_pattern(esp_periph_handle_t periph, + uint16_t blink_pattern) { + periph_is31fl3216_t *is31fl3216 = esp_periph_get_data(periph); is31fl3216->arg->light_mask = blink_pattern; return ESP_OK; } -esp_err_t -periph_is31fl3216_set_duty (esp_periph_handle_t periph, uint8_t index, - uint8_t value) -{ - periph_is31fl3216_t *is31fl3216 = esp_periph_get_data (periph); +esp_err_t periph_is31fl3216_set_duty(esp_periph_handle_t periph, uint8_t index, + uint8_t value) { + periph_is31fl3216_t *is31fl3216 = esp_periph_get_data(periph); is31fl3216->duty[index] = value; - is31fl3216_ch_duty_set (is31fl3216->handle, 1UL << index, - is31fl3216->duty[index]); + is31fl3216_ch_duty_set(is31fl3216->handle, 1UL << index, + is31fl3216->duty[index]); return ESP_OK; } -esp_err_t -periph_is31fl3216_set_duty_step (esp_periph_handle_t periph, uint8_t step) -{ - periph_is31fl3216_t *is31fl3216 = esp_periph_get_data (periph); +esp_err_t periph_is31fl3216_set_duty_step(esp_periph_handle_t periph, + uint8_t step) { + periph_is31fl3216_t *is31fl3216 = esp_periph_get_data(periph); is31fl3216->arg->duty_step = step; return ESP_OK; } -esp_err_t -periph_is31fl3216_set_interval (esp_periph_handle_t periph, - uint16_t interval_ms) -{ - periph_is31fl3216_t *is31fl3216 = esp_periph_get_data (periph); +esp_err_t periph_is31fl3216_set_interval(esp_periph_handle_t periph, + uint16_t interval_ms) { + periph_is31fl3216_t *is31fl3216 = esp_periph_get_data(periph); is31fl3216->arg->interval_time = interval_ms; return ESP_OK; } -esp_err_t -periph_is31fl3216_set_shift_mode (esp_periph_handle_t periph, - periph_is31_shift_mode_t mode) -{ - periph_is31fl3216_t *is31fl3216 = esp_periph_get_data (periph); +esp_err_t periph_is31fl3216_set_shift_mode(esp_periph_handle_t periph, + periph_is31_shift_mode_t mode) { + periph_is31fl3216_t *is31fl3216 = esp_periph_get_data(periph); is31fl3216->arg->shift_mode = mode; return ESP_OK; } -esp_err_t -periph_is31fl3216_set_light_on_num (esp_periph_handle_t periph, - uint16_t light_on_num, - uint16_t max_light_num) -{ - periph_is31fl3216_t *is31fl3216 = esp_periph_get_data (periph); +esp_err_t periph_is31fl3216_set_light_on_num(esp_periph_handle_t periph, + uint16_t light_on_num, + uint16_t max_light_num) { + periph_is31fl3216_t *is31fl3216 = esp_periph_get_data(periph); is31fl3216->arg->max_light_num = max_light_num; is31fl3216->arg->light_num = light_on_num; return ESP_OK; } -esp_err_t -periph_is31fl3216_set_act_time (esp_periph_handle_t periph, uint16_t act_ms) -{ - periph_is31fl3216_t *is31fl3216 = esp_periph_get_data (periph); +esp_err_t periph_is31fl3216_set_act_time(esp_periph_handle_t periph, + uint16_t act_ms) { + periph_is31fl3216_t *is31fl3216 = esp_periph_get_data(periph); is31fl3216->arg->act_time = act_ms; return ESP_OK; } -static esp_err_t -_is31fl3216_init (esp_periph_handle_t self) -{ - periph_is31fl3216_t *is31fl3216 = esp_periph_get_data (self); +static esp_err_t _is31fl3216_init(esp_periph_handle_t self) { + periph_is31fl3216_t *is31fl3216 = esp_periph_get_data(self); esp_err_t ret = ESP_OK; - is31fl3216_ch_disable (is31fl3216->handle, IS31FL3216_CH_ALL); - is31_leds_duty (is31fl3216->handle, 0, IS31FL3216_CH_ALL); - xTaskCreate (is31fl3216_run_task, "is31fl3216_run_task", - IS31FL3216_TASK_STACK_SIZE, (void *)self, - IS31FL3216_TASK_PRIORITY, NULL); - if (ret) - { - ESP_LOGE (TAG, "Failed to initialize is31fl3216"); - return ESP_FAIL; - } + is31fl3216_ch_disable(is31fl3216->handle, IS31FL3216_CH_ALL); + is31_leds_duty(is31fl3216->handle, 0, IS31FL3216_CH_ALL); + xTaskCreate(is31fl3216_run_task, "is31fl3216_run_task", + IS31FL3216_TASK_STACK_SIZE, (void *)self, + IS31FL3216_TASK_PRIORITY, NULL); + if (ret) { + ESP_LOGE(TAG, "Failed to initialize is31fl3216"); + return ESP_FAIL; + } return ESP_OK; } -static esp_err_t -_is31fl3216_destroy (esp_periph_handle_t self) -{ - VALIDATE_IS31FL3216 (self, ESP_FAIL); - periph_is31fl3216_t *is31fl3216 = esp_periph_get_data (self); - is31_evt_send (is31fl3216->evt, PERIPH_IS31_CMD_QUIT, 0, 0); - if (is31fl3216->g_event_bit) - { - xEventGroupWaitBits (is31fl3216->g_event_bit, DESTROY_BIT, pdTRUE, - pdFALSE, portMAX_DELAY); - vEventGroupDelete (is31fl3216->g_event_bit); - is31fl3216->g_event_bit = NULL; - } +static esp_err_t _is31fl3216_destroy(esp_periph_handle_t self) { + VALIDATE_IS31FL3216(self, ESP_FAIL); + periph_is31fl3216_t *is31fl3216 = esp_periph_get_data(self); + is31_evt_send(is31fl3216->evt, PERIPH_IS31_CMD_QUIT, 0, 0); + if (is31fl3216->g_event_bit) { + xEventGroupWaitBits(is31fl3216->g_event_bit, DESTROY_BIT, pdTRUE, pdFALSE, + portMAX_DELAY); + vEventGroupDelete(is31fl3216->g_event_bit); + is31fl3216->g_event_bit = NULL; + } esp_err_t ret = ESP_OK; - ret |= is31fl3216_ch_disable (is31fl3216->handle, IS31FL3216_CH_ALL); - ret |= is31fl3216_deinit (is31fl3216->handle); - audio_free (is31fl3216->arg); - vQueueDelete (is31fl3216->evt); - audio_free (is31fl3216); - if (ret) - { - ESP_LOGE (TAG, "Error occurred when stopping the is31fl3216"); - return ESP_FAIL; - } + ret |= is31fl3216_ch_disable(is31fl3216->handle, IS31FL3216_CH_ALL); + ret |= is31fl3216_deinit(is31fl3216->handle); + audio_free(is31fl3216->arg); + vQueueDelete(is31fl3216->evt); + audio_free(is31fl3216); + if (ret) { + ESP_LOGE(TAG, "Error occurred when stopping the is31fl3216"); + return ESP_FAIL; + } return ESP_OK; } -esp_periph_handle_t -periph_is31fl3216_init (periph_is31fl3216_cfg_t *is31fl3216_config) -{ - esp_periph_handle_t periph - = esp_periph_create (PERIPH_ID_IS31FL3216, "periph_is31fl3216"); - AUDIO_MEM_CHECK (TAG, periph, return NULL); - - periph_is31fl3216_t *is31fl3216 - = audio_calloc (1, sizeof (periph_is31fl3216_t)); - AUDIO_MEM_CHECK (TAG, is31fl3216, { - audio_free (periph); +esp_periph_handle_t periph_is31fl3216_init( + periph_is31fl3216_cfg_t *is31fl3216_config) { + esp_periph_handle_t periph = + esp_periph_create(PERIPH_ID_IS31FL3216, "periph_is31fl3216"); + AUDIO_MEM_CHECK(TAG, periph, return NULL); + + periph_is31fl3216_t *is31fl3216 = + audio_calloc(1, sizeof(periph_is31fl3216_t)); + AUDIO_MEM_CHECK(TAG, is31fl3216, { + audio_free(periph); return NULL; }); - is31fl3216->g_event_bit = xEventGroupCreate (); - AUDIO_NULL_CHECK (TAG, is31fl3216->g_event_bit, { - audio_free (periph); - audio_free (is31fl3216); + is31fl3216->g_event_bit = xEventGroupCreate(); + AUDIO_NULL_CHECK(TAG, is31fl3216->g_event_bit, { + audio_free(periph); + audio_free(is31fl3216); }); - is31fl3216->evt = xQueueCreate (2, sizeof (periph_is31_msg_t)); - AUDIO_MEM_CHECK (TAG, is31fl3216->evt, { - audio_free (periph); - vEventGroupDelete (is31fl3216->g_event_bit); - audio_free (is31fl3216); + is31fl3216->evt = xQueueCreate(2, sizeof(periph_is31_msg_t)); + AUDIO_MEM_CHECK(TAG, is31fl3216->evt, { + audio_free(periph); + vEventGroupDelete(is31fl3216->g_event_bit); + audio_free(is31fl3216); return NULL; }); - is31fl3216->arg = audio_calloc (1, sizeof (periph_is31_arg_t)); - AUDIO_MEM_CHECK (TAG, is31fl3216->arg, { - vQueueDelete (is31fl3216->evt); - vEventGroupDelete (is31fl3216->g_event_bit); - audio_free (periph); - audio_free (is31fl3216); + is31fl3216->arg = audio_calloc(1, sizeof(periph_is31_arg_t)); + AUDIO_MEM_CHECK(TAG, is31fl3216->arg, { + vQueueDelete(is31fl3216->evt); + vEventGroupDelete(is31fl3216->g_event_bit); + audio_free(periph); + audio_free(is31fl3216); return NULL; }); is31fl3216->arg->max_light_num = IS31FL3216_CH_NUM; @@ -506,29 +440,20 @@ periph_is31fl3216_init (periph_is31fl3216_cfg_t *is31fl3216_config) is31fl3216->arg->duty_step = DEFAULT_FLASH_STEP; is31fl3216->arg->shift_mode = PERIPH_IS31_SHIFT_MODE_ACC; - if (is31fl3216_config->duty == NULL) - { - ESP_LOGW (TAG, "The duty array is NULL"); - } - else - { - for (int i = 0; i < IS31FL3216_CH_NUM; i++) - { - is31fl3216->duty[i] = is31fl3216_config->duty[i]; - } - } - is31fl3216->handle = is31fl3216_init (); - AUDIO_MEM_CHECK (TAG, is31fl3216, { - audio_free (is31fl3216->arg); - vQueueDelete (is31fl3216->evt); - audio_free (periph); - vEventGroupDelete (is31fl3216->g_event_bit); - audio_free (is31fl3216); + for (int i = 0; i < IS31FL3216_CH_NUM; i++) { + is31fl3216->duty[i] = is31fl3216_config->duty[i]; + } + is31fl3216->handle = is31fl3216_init(); + AUDIO_MEM_CHECK(TAG, is31fl3216, { + audio_free(is31fl3216->arg); + vQueueDelete(is31fl3216->evt); + audio_free(periph); + vEventGroupDelete(is31fl3216->g_event_bit); + audio_free(is31fl3216); return NULL; }); - esp_periph_set_data (periph, is31fl3216); - esp_periph_set_function (periph, _is31fl3216_init, NULL, - _is31fl3216_destroy); + esp_periph_set_data(periph, is31fl3216); + esp_periph_set_function(periph, _is31fl3216_init, NULL, _is31fl3216_destroy); return periph; } diff --git a/components/esp_peripherals/periph_lcd.c b/components/esp_peripherals/periph_lcd.c new file mode 100644 index 00000000..4d792855 --- /dev/null +++ b/components/esp_peripherals/periph_lcd.c @@ -0,0 +1,154 @@ +/* + * ESPRESSIF MIT License + * + * Copyright (c) 2021 + * + * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in + * which case, it is free of charge, to any person obtaining a copy of this + * software and associated documentation files (the "Software"), to deal in the + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + +#include + +#include "audio_idf_version.h" +#include "audio_mem.h" +#include "audio_sys.h" +#include "board.h" +#include "esp_log.h" + +#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0)) +#include "esp_lcd_panel_ops.h" +#include "periph_lcd.h" + +static const char *TAG = "PERIPH_LCD"; + +typedef struct periph_lcd { + void *io_bus; + get_lcd_io_bus new_panel_io; + esp_lcd_panel_io_spi_config_t lcd_io_cfg; + get_lcd_panel new_lcd_panel; + esp_lcd_panel_dev_config_t lcd_dev_cfg; + + esp_lcd_panel_io_handle_t lcd_io_handle; + esp_lcd_panel_handle_t lcd_panel_handle; + + perph_lcd_rest rest_cb; + void *rest_cb_ctx; + bool lcd_swap_xy; + bool lcd_mirror_x; + bool lcd_mirror_y; + bool lcd_color_invert; +} periph_lcd_t; + +esp_err_t _lcd_rest_default(esp_periph_handle_t self, void *ctx); + +static esp_err_t _lcd_run(esp_periph_handle_t self, + audio_event_iface_msg_t *msg) { + return ESP_OK; +} + +static esp_err_t _lcd_init(esp_periph_handle_t self) { + periph_lcd_t *periph_lcd = esp_periph_get_data(self); + if (periph_lcd->rest_cb) { + periph_lcd->rest_cb(self, periph_lcd->rest_cb_ctx); + } + // Initialize LCD panel + ESP_ERROR_CHECK(esp_lcd_panel_init(periph_lcd->lcd_panel_handle)); + + ESP_ERROR_CHECK(esp_lcd_panel_invert_color(periph_lcd->lcd_panel_handle, + periph_lcd->lcd_color_invert)); + ESP_ERROR_CHECK(esp_lcd_panel_set_gap(periph_lcd->lcd_panel_handle, 0, 0)); + ESP_ERROR_CHECK(esp_lcd_panel_swap_xy(periph_lcd->lcd_panel_handle, + periph_lcd->lcd_swap_xy)); + ESP_ERROR_CHECK(esp_lcd_panel_mirror(periph_lcd->lcd_panel_handle, + periph_lcd->lcd_mirror_x, + periph_lcd->lcd_mirror_y)); + return ESP_OK; +} + +static esp_err_t _lcd_destroy(esp_periph_handle_t self) { + periph_lcd_t *periph_lcd = esp_periph_get_data(self); + esp_lcd_panel_del(periph_lcd->lcd_panel_handle); + esp_lcd_panel_io_del(periph_lcd->lcd_io_handle); + return ESP_OK; +} + +esp_err_t _lcd_rest_default(esp_periph_handle_t self, void *ctx) { + periph_lcd_t *periph_lcd = esp_periph_get_data(self); + ESP_ERROR_CHECK(esp_lcd_panel_reset(periph_lcd->lcd_panel_handle)); + return ESP_OK; +} + +esp_err_t _setup_lcd(esp_periph_handle_t self) { + periph_lcd_t *periph_lcd = esp_periph_get_data(self); + // Attach the LCD to the specific bus + ESP_ERROR_CHECK(periph_lcd->new_panel_io( + (esp_lcd_spi_bus_handle_t)periph_lcd->io_bus, &periph_lcd->lcd_io_cfg, + &periph_lcd->lcd_io_handle)); + // Initialize the LCD configuration + ESP_ERROR_CHECK(periph_lcd->new_lcd_panel(periph_lcd->lcd_io_handle, + &periph_lcd->lcd_dev_cfg, + &periph_lcd->lcd_panel_handle)); + return ESP_OK; +} + +esp_periph_handle_t periph_lcd_init(periph_lcd_cfg_t *config) { + periph_lcd_t *periph_lcd = audio_calloc(1, sizeof(periph_lcd_t)); + AUDIO_MEM_CHECK(TAG, periph_lcd, return NULL); + periph_lcd->io_bus = config->io_bus; + + memcpy(&periph_lcd->lcd_io_cfg, config->lcd_io_cfg, + sizeof(esp_lcd_panel_io_spi_config_t)); + memcpy(&periph_lcd->lcd_dev_cfg, config->lcd_dev_cfg, + sizeof(esp_lcd_panel_dev_config_t)); + periph_lcd->new_panel_io = config->new_panel_io; + periph_lcd->new_lcd_panel = config->new_lcd_panel; + periph_lcd->lcd_swap_xy = config->lcd_swap_xy; + periph_lcd->lcd_mirror_x = config->lcd_mirror_x; + periph_lcd->lcd_mirror_y = config->lcd_mirror_y; + periph_lcd->lcd_color_invert = config->lcd_color_invert; + periph_lcd->rest_cb = config->rest_cb; + + esp_periph_handle_t periph = esp_periph_create(PERIPH_ID_LCD, "periph_lcd"); + AUDIO_MEM_CHECK(TAG, periph, { + audio_free(periph_lcd); + return NULL; + }); + if (periph_lcd->rest_cb == NULL) { + periph_lcd->rest_cb = _lcd_rest_default; + } + periph_lcd->rest_cb_ctx = config->rest_cb_ctx; + + esp_periph_set_data(periph, periph_lcd); + esp_periph_set_function(periph, NULL, _lcd_run, _lcd_destroy); + + _setup_lcd(periph); + _lcd_init(periph); + return periph; +} + +esp_lcd_panel_handle_t periph_lcd_get_panel_handle(esp_periph_handle_t handle) { + periph_lcd_t *periph_lcd = esp_periph_get_data(handle); + if (periph_lcd) { + return periph_lcd->lcd_panel_handle; + } + return NULL; +} + +#endif diff --git a/components/esp_peripherals/periph_led.c b/components/esp_peripherals/periph_led.c index 65a674f6..39126660 100644 --- a/components/esp_peripherals/periph_led.c +++ b/components/esp_peripherals/periph_led.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,34 +18,34 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "periph_led.h" + +#include +#include + #include "audio_mem.h" #include "audio_mutex.h" #include "audio_sys.h" #include "esp_log.h" #include "esp_peripherals.h" -#include -#include #define MAX_LED_CHANNEL (8) static const char *TAG = "PERIPH_LED"; -#define VALIDATE_LED(periph, ret) \ - if (!(periph && esp_periph_get_id (periph) == PERIPH_ID_LED)) \ - { \ - ESP_LOGE (TAG, "Invalid LED periph, at line %d", __LINE__); \ - return ret; \ - } +#define VALIDATE_LED(periph, ret) \ + if (!(periph && esp_periph_get_id(periph) == PERIPH_ID_LED)) { \ + ESP_LOGE(TAG, "Invalid LED periph, at line %d", __LINE__); \ + return ret; \ + } -typedef struct -{ +typedef struct { int index; int pin; int high_level_ms; @@ -58,8 +58,7 @@ typedef struct int level; } periph_led_channel_t; -typedef struct periph_led -{ +typedef struct periph_led { ledc_mode_t led_speed_mode; ledc_timer_bit_t led_duty_resolution; ledc_timer_t led_timer_num; @@ -68,231 +67,188 @@ typedef struct periph_led periph_led_channel_t channels[MAX_LED_CHANNEL]; } periph_led_t; -static esp_err_t -_led_run (esp_periph_handle_t self, audio_event_iface_msg_t *msg) -{ +static esp_err_t _led_run(esp_periph_handle_t self, + audio_event_iface_msg_t *msg) { return ESP_OK; } -static esp_err_t -_led_init (esp_periph_handle_t self) -{ - VALIDATE_LED (self, ESP_FAIL); - periph_led_t *periph_led = esp_periph_get_data (self); +static esp_err_t _led_init(esp_periph_handle_t self) { + VALIDATE_LED(self, ESP_FAIL); + periph_led_t *periph_led = esp_periph_get_data(self); ledc_timer_config_t ledc_timer = { - .duty_resolution - = periph_led->led_duty_resolution, // resolution of PWM duty - .freq_hz = periph_led->led_freq_hz, // frequency of PWM signal - .speed_mode = periph_led->led_speed_mode, // timer mode - .timer_num = periph_led->led_timer_num // timer index + .duty_resolution = + periph_led->led_duty_resolution, // resolution of PWM duty + .freq_hz = periph_led->led_freq_hz, // frequency of PWM signal + .speed_mode = periph_led->led_speed_mode, // timer mode + .timer_num = periph_led->led_timer_num // timer index }; // Set configuration of timer0 for high speed channels - ledc_timer_config (&ledc_timer); - ledc_fade_func_install (0); + ledc_timer_config(&ledc_timer); + ledc_fade_func_install(0); return ESP_OK; } -static esp_err_t -_led_destroy (esp_periph_handle_t self) -{ - periph_led_t *periph_led = esp_periph_get_data (self); - for (int i = 0; i < MAX_LED_CHANNEL; i++) - { - periph_led_channel_t *ch = &periph_led->channels[i]; - if (ch->index > 0 && ch->pin > 0) - { - ledc_stop (periph_led->led_speed_mode, ch->index, ch->level); - } +static esp_err_t _led_destroy(esp_periph_handle_t self) { + periph_led_t *periph_led = esp_periph_get_data(self); + for (int i = 0; i < MAX_LED_CHANNEL; i++) { + periph_led_channel_t *ch = &periph_led->channels[i]; + if (ch->index > 0 && ch->pin > 0) { + ledc_stop(periph_led->led_speed_mode, ch->index, ch->level); } - esp_periph_stop_timer (self); - ledc_fade_func_uninstall (); - mutex_destroy (periph_led->led_mutex); - audio_free (periph_led); + } + esp_periph_stop_timer(self); + ledc_fade_func_uninstall(); + mutex_destroy(periph_led->led_mutex); + audio_free(periph_led); return ESP_OK; } -esp_periph_handle_t -periph_led_init (periph_led_cfg_t *config) -{ - esp_periph_handle_t periph = esp_periph_create (PERIPH_ID_LED, "periph_led"); +esp_periph_handle_t periph_led_init(periph_led_cfg_t *config) { + esp_periph_handle_t periph = esp_periph_create(PERIPH_ID_LED, "periph_led"); // check periph - periph_led_t *periph_led = audio_calloc (1, sizeof (periph_led_t)); + periph_led_t *periph_led = audio_calloc(1, sizeof(periph_led_t)); // check periph_led periph_led->led_speed_mode = config->led_speed_mode; periph_led->led_duty_resolution = config->led_duty_resolution; periph_led->led_timer_num = config->led_timer_num; periph_led->led_freq_hz = config->led_freq_hz; - periph_led->led_mutex = mutex_create (); - if (periph_led->led_freq_hz == 0) - { - periph_led->led_freq_hz = 5000; - } - memset (&periph_led->channels, -1, sizeof (periph_led->channels)); - esp_periph_set_data (periph, periph_led); - esp_periph_set_function (periph, _led_init, _led_run, _led_destroy); + periph_led->led_mutex = mutex_create(); + if (periph_led->led_freq_hz == 0) { + periph_led->led_freq_hz = 5000; + } + memset(&periph_led->channels, -1, sizeof(periph_led->channels)); + esp_periph_set_data(periph, periph_led); + esp_periph_set_function(periph, _led_init, _led_run, _led_destroy); return periph; } -static periph_led_channel_t * -_find_led_channel (periph_led_t *periph_led, int gpio_num) -{ +static periph_led_channel_t *_find_led_channel(periph_led_t *periph_led, + int gpio_num) { periph_led_channel_t *ch = NULL; - for (int i = 0; i < MAX_LED_CHANNEL; i++) - { - if (periph_led->channels[i].pin == gpio_num) - { - ch = &periph_led->channels[i]; - ch->index = i; - break; - } - else if (periph_led->channels[i].pin == -1) - { - ch = &periph_led->channels[i]; - ch->index = i; - } + for (int i = 0; i < MAX_LED_CHANNEL; i++) { + if (periph_led->channels[i].pin == gpio_num) { + ch = &periph_led->channels[i]; + ch->index = i; + break; + } else if (periph_led->channels[i].pin == -1) { + ch = &periph_led->channels[i]; + ch->index = i; } + } return ch; } -static void -led_timer_handler (xTimerHandle tmr) -{ - esp_periph_handle_t periph = (esp_periph_handle_t)pvTimerGetTimerID (tmr); +static void led_timer_handler(xTimerHandle tmr) { + esp_periph_handle_t periph = (esp_periph_handle_t)pvTimerGetTimerID(tmr); - periph_led_t *periph_led = esp_periph_get_data (periph); - mutex_lock (periph_led->led_mutex); - for (int i = 0; i < MAX_LED_CHANNEL; i++) - { - periph_led_channel_t *ch = &periph_led->channels[i]; - if (ch->pin < 0 || ch->stop == true) - { - continue; - } + periph_led_t *periph_led = esp_periph_get_data(periph); + mutex_lock(periph_led->led_mutex); + for (int i = 0; i < MAX_LED_CHANNEL; i++) { + periph_led_channel_t *ch = &periph_led->channels[i]; + if (ch->pin < 0 || ch->stop == true) { + continue; + } - if (ch->loop == 0) - { - ledc_stop (periph_led->led_speed_mode, ch->index, ch->level); - esp_periph_send_event (periph, PERIPH_LED_BLINK_FINISH, - (void *)ch->pin, 0); - ch->stop = true; - continue; - } + if (ch->loop == 0) { + ledc_stop(periph_led->led_speed_mode, ch->index, ch->level); + esp_periph_send_event(periph, PERIPH_LED_BLINK_FINISH, (void *)ch->pin, + 0); + ch->stop = true; + continue; + } - if (!ch->is_high_level - && audio_sys_get_time_ms () - ch->tick > ch->low_level_ms) - { - if (ch->loop > 0) - { - ch->loop--; - } - // now, switch on - if (ch->fade) - { - ledc_set_fade_with_time (periph_led->led_speed_mode, ch->index, - pow (2, periph_led->led_duty_resolution) - - 1, - ch->high_level_ms); - ledc_fade_start (periph_led->led_speed_mode, ch->index, - LEDC_FADE_NO_WAIT); - } - else - { - ledc_set_duty (periph_led->led_speed_mode, ch->index, - pow (2, periph_led->led_duty_resolution) - 1); - ledc_update_duty (periph_led->led_speed_mode, ch->index); - } - if (ch->low_level_ms > 0) - { - ch->is_high_level = true; - } - ch->tick = audio_sys_get_time_ms (); - } - else if (ch->is_high_level - && audio_sys_get_time_ms () - ch->tick > ch->high_level_ms) - { - if (ch->loop > 0) - { - ch->loop--; - } - // switch off - if (ch->fade) - { - ledc_set_fade_with_time (periph_led->led_speed_mode, ch->index, - 0, ch->low_level_ms); - ledc_fade_start (periph_led->led_speed_mode, ch->index, - LEDC_FADE_NO_WAIT); - } - else - { - ledc_set_duty (periph_led->led_speed_mode, ch->index, 0); - ledc_update_duty (periph_led->led_speed_mode, ch->index); - } - if (ch->high_level_ms > 0) - { - ch->is_high_level = false; - } - ch->tick = audio_sys_get_time_ms (); - } + if (!ch->is_high_level && + audio_sys_get_time_ms() - ch->tick > ch->low_level_ms) { + if (ch->loop > 0) { + ch->loop--; + } + // now, switch on + if (ch->fade) { + ledc_set_fade_with_time(periph_led->led_speed_mode, ch->index, + pow(2, periph_led->led_duty_resolution) - 1, + ch->high_level_ms); + ledc_fade_start(periph_led->led_speed_mode, ch->index, + LEDC_FADE_NO_WAIT); + } else { + ledc_set_duty(periph_led->led_speed_mode, ch->index, + pow(2, periph_led->led_duty_resolution) - 1); + ledc_update_duty(periph_led->led_speed_mode, ch->index); + } + if (ch->low_level_ms > 0) { + ch->is_high_level = true; + } + ch->tick = audio_sys_get_time_ms(); + } else if (ch->is_high_level && + audio_sys_get_time_ms() - ch->tick > ch->high_level_ms) { + if (ch->loop > 0) { + ch->loop--; + } + // switch off + if (ch->fade) { + ledc_set_fade_with_time(periph_led->led_speed_mode, ch->index, 0, + ch->low_level_ms); + ledc_fade_start(periph_led->led_speed_mode, ch->index, + LEDC_FADE_NO_WAIT); + } else { + ledc_set_duty(periph_led->led_speed_mode, ch->index, 0); + ledc_update_duty(periph_led->led_speed_mode, ch->index); + } + if (ch->high_level_ms > 0) { + ch->is_high_level = false; + } + ch->tick = audio_sys_get_time_ms(); } - mutex_unlock (periph_led->led_mutex); + } + mutex_unlock(periph_led->led_mutex); } -esp_err_t -periph_led_blink (esp_periph_handle_t periph, int gpio_num, int time_on_ms, - int time_off_ms, bool fade, int loop, - periph_led_idle_level_t level) -{ - periph_led_t *periph_led = esp_periph_get_data (periph); - periph_led_channel_t *ch = _find_led_channel (periph_led, gpio_num); - if (ch == NULL) - { - return ESP_FAIL; - } +esp_err_t periph_led_blink(esp_periph_handle_t periph, int gpio_num, + int time_on_ms, int time_off_ms, bool fade, int loop, + periph_led_idle_level_t level) { + periph_led_t *periph_led = esp_periph_get_data(periph); + periph_led_channel_t *ch = _find_led_channel(periph_led, gpio_num); + if (ch == NULL) { + return ESP_FAIL; + } ledc_channel_config_t ledc_channel_cfg = { - .channel = ch->index, - .duty = 0, - .gpio_num = gpio_num, - .speed_mode = periph_led->led_speed_mode, - .timer_sel = periph_led->led_timer_num, + .channel = ch->index, + .duty = 0, + .gpio_num = gpio_num, + .speed_mode = periph_led->led_speed_mode, + .timer_sel = periph_led->led_timer_num, }; - ledc_channel_config (&ledc_channel_cfg); + ledc_channel_config(&ledc_channel_cfg); ch->pin = gpio_num; - ch->tick = audio_sys_get_time_ms (); + ch->tick = audio_sys_get_time_ms(); ch->loop = loop; ch->fade = fade; - if (level == PERIPH_LED_IDLE_LEVEL_LOW) - { - ch->is_high_level = false; - ch->high_level_ms = time_on_ms; - ch->low_level_ms = time_off_ms; - } - else - { - ch->is_high_level = true; - ch->high_level_ms = time_off_ms; - ch->low_level_ms = time_on_ms; - } + if (level == PERIPH_LED_IDLE_LEVEL_LOW) { + ch->is_high_level = false; + ch->high_level_ms = time_on_ms; + ch->low_level_ms = time_off_ms; + } else { + ch->is_high_level = true; + ch->high_level_ms = time_off_ms; + ch->low_level_ms = time_on_ms; + } ch->stop = false; ch->level = level; - esp_periph_start_timer (periph, portTICK_RATE_MS, led_timer_handler); + esp_periph_start_timer(periph, portTICK_RATE_MS, led_timer_handler); return ESP_OK; } -esp_err_t -periph_led_stop (esp_periph_handle_t periph, int gpio_num) -{ - periph_led_t *periph_led = esp_periph_get_data (periph); - periph_led_channel_t *ch = _find_led_channel (periph_led, gpio_num); - if (ch && (ch->pin < 0 || ch->index < 0)) - { - return ESP_OK; - } +esp_err_t periph_led_stop(esp_periph_handle_t periph, int gpio_num) { + periph_led_t *periph_led = esp_periph_get_data(periph); + periph_led_channel_t *ch = _find_led_channel(periph_led, gpio_num); + if (ch && (ch->pin < 0 || ch->index < 0)) { + return ESP_OK; + } - mutex_lock (periph_led->led_mutex); + mutex_lock(periph_led->led_mutex); ch->stop = true; - ledc_stop (periph_led->led_speed_mode, ch->index, ch->level); - mutex_unlock (periph_led->led_mutex); + ledc_stop(periph_led->led_speed_mode, ch->index, ch->level); + mutex_unlock(periph_led->led_mutex); return ESP_OK; } diff --git a/components/esp_peripherals/periph_sdcard.c b/components/esp_peripherals/periph_sdcard.c index 3f5bbf7d..80521789 100644 --- a/components/esp_peripherals/periph_sdcard.c +++ b/components/esp_peripherals/periph_sdcard.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,38 +18,38 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ -#include "periph_sdcard.h" +#include "esp_log.h" +#if SOC_SDMMC_HOST_SUPPORTED +#include "driver/sdmmc_host.h" +#endif #include "audio_mem.h" #include "driver/gpio.h" #include "driver/sdmmc_defs.h" -#include "driver/sdmmc_host.h" -#include "esp_log.h" +#include "periph_sdcard.h" #include "sdcard.h" static const char *TAG = "PERIPH_SDCARD"; #define SDCARD_CHECK_TIMEOUT_MS (20) -#define VALIDATE_SDCARD(periph, ret) \ - if (!(periph && esp_periph_get_id (periph) == PERIPH_ID_SDCARD)) \ - { \ - ESP_LOGE (TAG, "Invalid SDCARD periph, at line %d", __LINE__); \ - return ret; \ - } +#define VALIDATE_SDCARD(periph, ret) \ + if (!(periph && esp_periph_get_id(periph) == PERIPH_ID_SDCARD)) { \ + ESP_LOGE(TAG, "Invalid SDCARD periph, at line %d", __LINE__); \ + return ret; \ + } #define tick_get periph_tick_get -static esp_err_t periph_sdcard_mount (esp_periph_handle_t periph); -static esp_err_t periph_sdcard_unmount (esp_periph_handle_t periph); +static esp_err_t periph_sdcard_mount(esp_periph_handle_t periph); +static esp_err_t periph_sdcard_unmount(esp_periph_handle_t periph); -typedef struct -{ +typedef struct { char *root; int card_detect_pin; bool is_mounted; @@ -57,174 +57,138 @@ typedef struct periph_sdcard_mode_t sd_mode; } periph_sdcard_t; -static void IRAM_ATTR -sdcard_gpio_intr_handler (void *param) -{ +static void IRAM_ATTR sdcard_gpio_intr_handler(void *param) { esp_periph_handle_t periph = (esp_periph_handle_t)param; - periph_sdcard_t *sdcard = esp_periph_get_data (periph); - - if (sdcard_is_exist () && !sdcard->is_mounted) - { - esp_periph_send_cmd_from_isr (periph, SDCARD_STATUS_CARD_DETECT_CHANGE, - NULL, 0); - } - else if (!sdcard_is_exist () && sdcard->is_mounted) - { - esp_periph_send_cmd_from_isr (periph, SDCARD_STATUS_CARD_DETECT_CHANGE, - NULL, 0); - } + periph_sdcard_t *sdcard = esp_periph_get_data(periph); + + if (sdcard_is_exist() && !sdcard->is_mounted) { + esp_periph_send_cmd_from_isr(periph, SDCARD_STATUS_CARD_DETECT_CHANGE, NULL, + 0); + } else if (!sdcard_is_exist() && sdcard->is_mounted) { + esp_periph_send_cmd_from_isr(periph, SDCARD_STATUS_CARD_DETECT_CHANGE, NULL, + 0); + } } -static esp_err_t -_sdcard_run (esp_periph_handle_t self, audio_event_iface_msg_t *msg) -{ - if (msg->cmd != SDCARD_STATUS_CARD_DETECT_CHANGE) - { - return ESP_OK; - } - periph_sdcard_t *sdcard = esp_periph_get_data (self); - if (sdcard_is_exist () && !sdcard->is_mounted) - { - periph_sdcard_mount (self); - } - else if (!sdcard_is_exist () && sdcard->is_mounted) - { - periph_sdcard_unmount (self); - } +static esp_err_t _sdcard_run(esp_periph_handle_t self, + audio_event_iface_msg_t *msg) { + if (msg->cmd != SDCARD_STATUS_CARD_DETECT_CHANGE) { + return ESP_OK; + } + periph_sdcard_t *sdcard = esp_periph_get_data(self); + if (sdcard_is_exist() && !sdcard->is_mounted) { + periph_sdcard_mount(self); + } else if (!sdcard_is_exist() && sdcard->is_mounted) { + periph_sdcard_unmount(self); + } return ESP_OK; } -static void -sdcard_timer_handler (xTimerHandle tmr) -{ - esp_periph_handle_t periph = (esp_periph_handle_t)pvTimerGetTimerID (tmr); - esp_periph_send_cmd (periph, SDCARD_STATUS_CARD_DETECT_CHANGE, NULL, 0); +static void sdcard_timer_handler(xTimerHandle tmr) { + esp_periph_handle_t periph = (esp_periph_handle_t)pvTimerGetTimerID(tmr); + esp_periph_send_cmd(periph, SDCARD_STATUS_CARD_DETECT_CHANGE, NULL, 0); } -static esp_err_t -_sdcard_init (esp_periph_handle_t self) -{ - periph_sdcard_t *sdcard = esp_periph_get_data (self); - esp_err_t ret - = sdcard_init (sdcard->card_detect_pin, sdcard_gpio_intr_handler, self); - if (sdcard_is_exist ()) - { - ret |= periph_sdcard_mount (self); - } - else - { - ESP_LOGE (TAG, "no sdcard detect"); - } - esp_periph_start_timer (self, 1000 / portTICK_RATE_MS, sdcard_timer_handler); +static esp_err_t _sdcard_init(esp_periph_handle_t self) { + periph_sdcard_t *sdcard = esp_periph_get_data(self); + esp_err_t ret = + sdcard_init(sdcard->card_detect_pin, sdcard_gpio_intr_handler, self); + if (sdcard_is_exist()) { + ret |= periph_sdcard_mount(self); + } else { + ESP_LOGE(TAG, "no sdcard detect"); + } + esp_periph_start_timer(self, 1000 / portTICK_RATE_MS, sdcard_timer_handler); return ESP_OK; } -static esp_err_t -_sdcard_destroy (esp_periph_handle_t self) -{ - VALIDATE_SDCARD (self, ESP_FAIL); +static esp_err_t _sdcard_destroy(esp_periph_handle_t self) { + VALIDATE_SDCARD(self, ESP_FAIL); esp_err_t ret = ESP_OK; - - ret |= sdcard_unmount (); - ret |= sdcard_destroy (); - if (ret != ESP_OK) - { - ESP_LOGE (TAG, "stop sdcard error!"); - } - periph_sdcard_t *sdcard = esp_periph_get_data (self); - audio_free (sdcard->root); - audio_free (sdcard); + periph_sdcard_t *sdcard = esp_periph_get_data(self); + if (sdcard->is_mounted) { + ret |= sdcard_unmount(); + sdcard->is_mounted = false; + } + ret |= sdcard_destroy(); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "stop sdcard error!"); + } + esp_periph_stop_timer(self); + audio_free(sdcard->root); + audio_free(sdcard); return ret; } -esp_err_t -periph_sdcard_mount (esp_periph_handle_t periph) -{ - VALIDATE_SDCARD (periph, ESP_FAIL); - - periph_sdcard_t *sdcard = esp_periph_get_data (periph); - - int ret = sdcard_mount (sdcard->root, sdcard->sd_mode); - if (ret == ESP_OK) - { - ESP_LOGD (TAG, "Mount SDCARD success"); - sdcard->is_mounted = true; - return esp_periph_send_event (periph, SDCARD_STATUS_MOUNTED, NULL, 0); - } - else if (ret == ESP_ERR_INVALID_STATE) - { - ESP_LOGD (TAG, "periph sdcard handle already mounted!"); - return ESP_OK; - } - else - { - esp_periph_send_event (periph, SDCARD_STATUS_MOUNT_ERROR, NULL, 0); - sdcard->is_mounted = false; - ESP_LOGE (TAG, "mount sdcard error!"); - return ESP_FAIL; - } +esp_err_t periph_sdcard_mount(esp_periph_handle_t periph) { + VALIDATE_SDCARD(periph, ESP_FAIL); + + periph_sdcard_t *sdcard = esp_periph_get_data(periph); + + int ret = sdcard_mount(sdcard->root, sdcard->sd_mode); + if (ret == ESP_OK) { + ESP_LOGD(TAG, "Mount SDCARD success"); + sdcard->is_mounted = true; + return esp_periph_send_event(periph, SDCARD_STATUS_MOUNTED, NULL, 0); + } else if (ret == ESP_ERR_INVALID_STATE) { + ESP_LOGD(TAG, "periph sdcard handle already mounted!"); + return ESP_OK; + } else { + esp_periph_send_event(periph, SDCARD_STATUS_MOUNT_ERROR, NULL, 0); + sdcard->is_mounted = false; + ESP_LOGE(TAG, "mount sdcard error!"); + return ESP_FAIL; + } } -esp_err_t -periph_sdcard_unmount (esp_periph_handle_t periph) -{ - VALIDATE_SDCARD (periph, ESP_FAIL); - periph_sdcard_t *sdcard = esp_periph_get_data (periph); - int ret = sdcard_unmount (); - if (ret == ESP_OK) - { - ESP_LOGD (TAG, "UnMount SDCARD success"); - sdcard->is_mounted = false; - return esp_periph_send_event (periph, SDCARD_STATUS_UNMOUNTED, NULL, 0); - } - else - { - esp_periph_send_event (periph, SDCARD_STATUS_UNMOUNT_ERROR, NULL, 0); - ESP_LOGE (TAG, "unmount sdcard error!"); - sdcard->is_mounted = false; - return ESP_FAIL; - } +esp_err_t periph_sdcard_unmount(esp_periph_handle_t periph) { + VALIDATE_SDCARD(periph, ESP_FAIL); + periph_sdcard_t *sdcard = esp_periph_get_data(periph); + int ret = sdcard_unmount(); + if (ret == ESP_OK) { + ESP_LOGD(TAG, "UnMount SDCARD success"); + sdcard->is_mounted = false; + return esp_periph_send_event(periph, SDCARD_STATUS_UNMOUNTED, NULL, 0); + } else { + esp_periph_send_event(periph, SDCARD_STATUS_UNMOUNT_ERROR, NULL, 0); + ESP_LOGE(TAG, "unmount sdcard error!"); + sdcard->is_mounted = false; + return ESP_FAIL; + } return ESP_OK; } -esp_periph_handle_t -periph_sdcard_init (periph_sdcard_cfg_t *sdcard_cfg) -{ - esp_periph_handle_t periph - = esp_periph_create (PERIPH_ID_SDCARD, "periph_sdcard"); - AUDIO_MEM_CHECK (TAG, periph, return NULL); +esp_periph_handle_t periph_sdcard_init(periph_sdcard_cfg_t *sdcard_cfg) { + esp_periph_handle_t periph = + esp_periph_create(PERIPH_ID_SDCARD, "periph_sdcard"); + AUDIO_MEM_CHECK(TAG, periph, return NULL); - periph_sdcard_t *sdcard = audio_calloc (1, sizeof (periph_sdcard_t)); - AUDIO_MEM_CHECK (TAG, sdcard, { - audio_free (periph); + periph_sdcard_t *sdcard = audio_calloc(1, sizeof(periph_sdcard_t)); + AUDIO_MEM_CHECK(TAG, sdcard, { + audio_free(periph); return NULL; }); - if (sdcard_cfg->root) - { - sdcard->root = audio_strdup (sdcard_cfg->root); - } - else - { - sdcard->root = audio_strdup ("/sdcard"); - } - AUDIO_MEM_CHECK (TAG, sdcard->root, { - audio_free (sdcard); - audio_free (periph); + if (sdcard_cfg->root) { + sdcard->root = audio_strdup(sdcard_cfg->root); + } else { + sdcard->root = audio_strdup("/sdcard"); + } + AUDIO_MEM_CHECK(TAG, sdcard->root, { + audio_free(sdcard); + audio_free(periph); return NULL; }); sdcard->card_detect_pin = sdcard_cfg->card_detect_pin; sdcard->sd_mode = sdcard_cfg->mode; - esp_periph_set_data (periph, sdcard); - esp_periph_set_function (periph, _sdcard_init, _sdcard_run, _sdcard_destroy); + esp_periph_set_data(periph, sdcard); + esp_periph_set_function(periph, _sdcard_init, _sdcard_run, _sdcard_destroy); return periph; } -bool -periph_sdcard_is_mounted (esp_periph_handle_t periph) -{ - VALIDATE_SDCARD (periph, ESP_FAIL); - periph_sdcard_t *sdcard = esp_periph_get_data (periph); +bool periph_sdcard_is_mounted(esp_periph_handle_t periph) { + VALIDATE_SDCARD(periph, ESP_FAIL); + periph_sdcard_t *sdcard = esp_periph_get_data(periph); return sdcard->is_mounted; } diff --git a/components/esp_peripherals/periph_spiffs.c b/components/esp_peripherals/periph_spiffs.c index 55e0149c..f308c628 100644 --- a/components/esp_peripherals/periph_spiffs.c +++ b/components/esp_peripherals/periph_spiffs.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,33 +18,32 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "periph_spiffs.h" + #include "audio_mem.h" #include "esp_log.h" #include "esp_spiffs.h" static const char *TAG = "PERIPH_SPIFFS"; -#define VALIDATE_SPIFFS(periph, ret) \ - if (!(periph && esp_periph_get_id (periph) == PERIPH_ID_SPIFFS)) \ - { \ - ESP_LOGE (TAG, "Invalid SPIFFS periph, at line %d", __LINE__); \ - return ret; \ - } +#define VALIDATE_SPIFFS(periph, ret) \ + if (!(periph && esp_periph_get_id(periph) == PERIPH_ID_SPIFFS)) { \ + ESP_LOGE(TAG, "Invalid SPIFFS periph, at line %d", __LINE__); \ + return ret; \ + } #define SPIFFS_DEFAULT_MAX_FILES 5 -static esp_err_t periph_spiffs_mount (esp_periph_handle_t periph); -static esp_err_t periph_spiffs_unmount (esp_periph_handle_t periph); +static esp_err_t periph_spiffs_mount(esp_periph_handle_t periph); +static esp_err_t periph_spiffs_unmount(esp_periph_handle_t periph); -typedef struct -{ +typedef struct { char *root; char *partition_label; size_t max_files; @@ -52,185 +51,143 @@ typedef struct bool is_mounted; } periph_spiffs_t; -static esp_err_t -_spiffs_run (esp_periph_handle_t self, audio_event_iface_msg_t *msg) -{ +static esp_err_t _spiffs_run(esp_periph_handle_t self, + audio_event_iface_msg_t *msg) { return ESP_OK; } -static esp_err_t -_spiffs_init (esp_periph_handle_t self) -{ - return periph_spiffs_mount (self); +static esp_err_t _spiffs_init(esp_periph_handle_t self) { + return periph_spiffs_mount(self); ; } -static esp_err_t -_spiffs_destroy (esp_periph_handle_t self) -{ - VALIDATE_SPIFFS (self, ESP_FAIL); +static esp_err_t _spiffs_destroy(esp_periph_handle_t self) { + VALIDATE_SPIFFS(self, ESP_FAIL); esp_err_t ret = ESP_OK; - ret |= periph_spiffs_unmount (self); - if (ret != ESP_OK) - { - ESP_LOGE (TAG, "Failed to unmount SPIFFS"); - } - - periph_spiffs_t *spiffs = esp_periph_get_data (self); - audio_free (spiffs->root); - if (spiffs->partition_label != NULL) - { - audio_free (spiffs->partition_label); - } - audio_free (spiffs); + ret |= periph_spiffs_unmount(self); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "Failed to unmount SPIFFS"); + } + + periph_spiffs_t *spiffs = esp_periph_get_data(self); + audio_free(spiffs->root); + if (spiffs->partition_label != NULL) { + audio_free(spiffs->partition_label); + } + audio_free(spiffs); return ret; } -esp_err_t -periph_spiffs_mount (esp_periph_handle_t periph) -{ - VALIDATE_SPIFFS (periph, ESP_FAIL); +esp_err_t periph_spiffs_mount(esp_periph_handle_t periph) { + VALIDATE_SPIFFS(periph, ESP_FAIL); - periph_spiffs_t *spiffs = esp_periph_get_data (periph); + periph_spiffs_t *spiffs = esp_periph_get_data(periph); - esp_vfs_spiffs_conf_t conf - = { .base_path = spiffs->root, - .partition_label = spiffs->partition_label, - .max_files = spiffs->max_files, - .format_if_mount_failed = spiffs->format_if_mount_failed }; + esp_vfs_spiffs_conf_t conf = { + .base_path = spiffs->root, + .partition_label = spiffs->partition_label, + .max_files = spiffs->max_files, + .format_if_mount_failed = spiffs->format_if_mount_failed}; // Use settings defined above to initialize and mount SPIFFS filesystem. // Note: esp_vfs_spiffs_register is an all-in-one convenience function. - esp_err_t ret = esp_vfs_spiffs_register (&conf); - if (ret != ESP_OK) - { - if (ret == ESP_FAIL) - { - ESP_LOGE (TAG, "Failed to mount or format filesystem"); - } - else if (ret == ESP_ERR_NOT_FOUND) - { - printf ("root %s ", spiffs->root); - ESP_LOGE (TAG, "Failed to find SPIFFS partition"); - } - else - { - ESP_LOGE (TAG, "Failed to initialize SPIFFS (%d)", ret); - } - return ESP_FAIL; + esp_err_t ret = esp_vfs_spiffs_register(&conf); + if (ret != ESP_OK) { + if (ret == ESP_FAIL) { + ESP_LOGE(TAG, "Failed to mount or format filesystem"); + } else if (ret == ESP_ERR_NOT_FOUND) { + printf("root %s ", spiffs->root); + ESP_LOGE(TAG, "Failed to find SPIFFS partition"); + } else { + ESP_LOGE(TAG, "Failed to initialize SPIFFS (%d)", ret); } - - if (ret == ESP_OK) - { - ESP_LOGD (TAG, "Mount SPIFFS success"); - spiffs->is_mounted = true; - size_t total = 0, used = 0; - ret = esp_spiffs_info (NULL, &total, &used); - if (ret != ESP_OK) - { - ESP_LOGE (TAG, "Failed to get SPIFFS partition information (%d)", - ret); - } - else - { - ESP_LOGI (TAG, "Partition size: total: %d, used: %d", total, used); - } - return esp_periph_send_event (periph, SPIFFS_STATUS_MOUNTED, NULL, 0); - } - else if (ret == ESP_ERR_INVALID_STATE) - { - ESP_LOGD (TAG, "Periph SPIFFS handle already mounted!"); - return ESP_OK; - } - else - { - esp_periph_send_event (periph, SPIFFS_STATUS_MOUNT_ERROR, NULL, 0); - spiffs->is_mounted = false; - ESP_LOGE (TAG, "Mount SPIFFS error!"); - return ESP_FAIL; + return ESP_FAIL; + } + + if (ret == ESP_OK) { + ESP_LOGD(TAG, "Mount SPIFFS success"); + spiffs->is_mounted = true; + size_t total = 0, used = 0; + ret = esp_spiffs_info(conf.partition_label, &total, &used); + if (ret != ESP_OK) { + ESP_LOGE(TAG, "Failed to get SPIFFS partition information (%d)", ret); + } else { + ESP_LOGI(TAG, "Partition size: total: %d, used: %d", total, used); } + return esp_periph_send_event(periph, SPIFFS_STATUS_MOUNTED, NULL, 0); + } else if (ret == ESP_ERR_INVALID_STATE) { + ESP_LOGD(TAG, "Periph SPIFFS handle already mounted!"); + return ESP_OK; + } else { + esp_periph_send_event(periph, SPIFFS_STATUS_MOUNT_ERROR, NULL, 0); + spiffs->is_mounted = false; + ESP_LOGE(TAG, "Mount SPIFFS error!"); + return ESP_FAIL; + } } -esp_err_t -periph_spiffs_unmount (esp_periph_handle_t periph) -{ - VALIDATE_SPIFFS (periph, ESP_FAIL); - periph_spiffs_t *spiffs = esp_periph_get_data (periph); - - int ret = esp_vfs_spiffs_unregister (spiffs->partition_label); - if (ret == ESP_OK) - { - ESP_LOGD (TAG, "Unmount SPIFFS success"); - spiffs->is_mounted = false; - return esp_periph_send_event (periph, SPIFFS_STATUS_UNMOUNTED, NULL, 0); - } - else - { - esp_periph_send_event (periph, SPIFFS_STATUS_UNMOUNT_ERROR, NULL, 0); - ESP_LOGE (TAG, "Unmount SPIFFS error!"); - spiffs->is_mounted = false; - return ESP_FAIL; - } +esp_err_t periph_spiffs_unmount(esp_periph_handle_t periph) { + VALIDATE_SPIFFS(periph, ESP_FAIL); + periph_spiffs_t *spiffs = esp_periph_get_data(periph); + + int ret = esp_vfs_spiffs_unregister(spiffs->partition_label); + if (ret == ESP_OK) { + ESP_LOGD(TAG, "Unmount SPIFFS success"); + spiffs->is_mounted = false; + return esp_periph_send_event(periph, SPIFFS_STATUS_UNMOUNTED, NULL, 0); + } else { + esp_periph_send_event(periph, SPIFFS_STATUS_UNMOUNT_ERROR, NULL, 0); + ESP_LOGE(TAG, "Unmount SPIFFS error!"); + spiffs->is_mounted = false; + return ESP_FAIL; + } return ESP_OK; } -esp_periph_handle_t -periph_spiffs_init (periph_spiffs_cfg_t *spiffs_cfg) -{ - esp_periph_handle_t periph - = esp_periph_create (PERIPH_ID_SPIFFS, "periph_spiffs"); - AUDIO_MEM_CHECK (TAG, periph, return NULL); +esp_periph_handle_t periph_spiffs_init(periph_spiffs_cfg_t *spiffs_cfg) { + esp_periph_handle_t periph = + esp_periph_create(PERIPH_ID_SPIFFS, "periph_spiffs"); + AUDIO_MEM_CHECK(TAG, periph, return NULL); - periph_spiffs_t *spiffs = audio_calloc (1, sizeof (periph_spiffs_t)); - AUDIO_MEM_CHECK (TAG, spiffs, { - audio_free (periph); + periph_spiffs_t *spiffs = audio_calloc(1, sizeof(periph_spiffs_t)); + AUDIO_MEM_CHECK(TAG, spiffs, { + audio_free(periph); return NULL; }); - if (spiffs_cfg->root) - { - spiffs->root = audio_strdup (spiffs_cfg->root); - } - else - { - spiffs->root = audio_strdup ("/spiffs"); - } - - if (spiffs_cfg->partition_label) - { - spiffs->partition_label = audio_strdup (spiffs_cfg->partition_label); - } - else - { - spiffs->partition_label = NULL; - } - - if (spiffs_cfg->max_files < SPIFFS_DEFAULT_MAX_FILES) - { - spiffs->max_files = SPIFFS_DEFAULT_MAX_FILES; - } - else - { - spiffs->max_files = spiffs_cfg->max_files; - } + if (spiffs_cfg->root) { + spiffs->root = audio_strdup(spiffs_cfg->root); + } else { + spiffs->root = audio_strdup("/spiffs"); + } + + if (spiffs_cfg->partition_label) { + spiffs->partition_label = audio_strdup(spiffs_cfg->partition_label); + } else { + spiffs->partition_label = NULL; + } + + if (spiffs_cfg->max_files < SPIFFS_DEFAULT_MAX_FILES) { + spiffs->max_files = SPIFFS_DEFAULT_MAX_FILES; + } else { + spiffs->max_files = spiffs_cfg->max_files; + } spiffs->format_if_mount_failed = spiffs_cfg->format_if_mount_failed; - AUDIO_MEM_CHECK (TAG, spiffs->root, { - audio_free (spiffs); - audio_free (periph); + AUDIO_MEM_CHECK(TAG, spiffs->root, { + audio_free(spiffs); + audio_free(periph); return NULL; }); - esp_periph_set_data (periph, spiffs); - esp_periph_set_function (periph, _spiffs_init, _spiffs_run, _spiffs_destroy); + esp_periph_set_data(periph, spiffs); + esp_periph_set_function(periph, _spiffs_init, _spiffs_run, _spiffs_destroy); return periph; } -bool -periph_spiffs_is_mounted (esp_periph_handle_t periph) -{ - VALIDATE_SPIFFS (periph, ESP_FAIL); - periph_spiffs_t *spiffs = esp_periph_get_data (periph); +bool periph_spiffs_is_mounted(esp_periph_handle_t periph) { + VALIDATE_SPIFFS(periph, ESP_FAIL); + periph_spiffs_t *spiffs = esp_periph_get_data(periph); return spiffs->is_mounted; } diff --git a/components/esp_peripherals/periph_touch.c b/components/esp_peripherals/periph_touch.c index 2a38bc5e..4e24d36c 100644 --- a/components/esp_peripherals/periph_touch.c +++ b/components/esp_peripherals/periph_touch.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,13 +18,14 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "periph_touch.h" + #include "audio_mem.h" #include "esp_log.h" #include "esp_peripherals.h" @@ -32,15 +33,13 @@ static const char *TAG = "PERIPH_TOUCH"; -#define VALIDATE_TOUCH(periph, ret) \ - if (!(periph && esp_periph_get_id (periph) == PERIPH_ID_TOUCH)) \ - { \ - ESP_LOGE (TAG, "Invalid TOUCH periph, at line %d", __LINE__); \ - return ret; \ - } +#define VALIDATE_TOUCH(periph, ret) \ + if (!(periph && esp_periph_get_id(periph) == PERIPH_ID_TOUCH)) { \ + ESP_LOGE(TAG, "Invalid TOUCH periph, at line %d", __LINE__); \ + return ret; \ + } -typedef struct periph_touch -{ +typedef struct periph_touch { esp_touch_handle_t touch; int touch_mask; int long_tap_time_ms; @@ -48,98 +47,84 @@ typedef struct periph_touch touch_result_t result; } periph_touch_t; -static void -touch_send_event (esp_periph_handle_t self, int event_id, int mask) -{ +static void touch_send_event(esp_periph_handle_t self, int event_id, int mask) { int touch_num = 0; - while (mask) - { - if (mask & 0x01) - { - esp_periph_send_event (self, event_id, (void *)touch_num, 0); - } - mask >>= 1; - touch_num++; + while (mask) { + if (mask & 0x01) { + esp_periph_send_event(self, event_id, (void *)touch_num, 0); } + mask >>= 1; + touch_num++; + } } -static esp_err_t -_touch_run (esp_periph_handle_t self, audio_event_iface_msg_t *msg) -{ - periph_touch_t *periph_touch = esp_periph_get_data (self); - touch_send_event (self, PERIPH_TOUCH_TAP, periph_touch->result.tap_mask); - touch_send_event (self, PERIPH_TOUCH_RELEASE, - periph_touch->result.release_mask); - touch_send_event (self, PERIPH_TOUCH_LONG_TAP, - periph_touch->result.long_tap_mask); - touch_send_event (self, PERIPH_TOUCH_LONG_RELEASE, - periph_touch->result.long_release_mask); +static esp_err_t _touch_run(esp_periph_handle_t self, + audio_event_iface_msg_t *msg) { + periph_touch_t *periph_touch = esp_periph_get_data(self); + touch_send_event(self, PERIPH_TOUCH_TAP, periph_touch->result.tap_mask); + touch_send_event(self, PERIPH_TOUCH_RELEASE, + periph_touch->result.release_mask); + touch_send_event(self, PERIPH_TOUCH_LONG_TAP, + periph_touch->result.long_tap_mask); + touch_send_event(self, PERIPH_TOUCH_LONG_RELEASE, + periph_touch->result.long_release_mask); return ESP_OK; } -static void -touch_timer_handler (xTimerHandle tmr) -{ - esp_periph_handle_t periph = (esp_periph_handle_t)pvTimerGetTimerID (tmr); - - periph_touch_t *periph_touch = esp_periph_get_data (periph); - if (esp_touch_read (periph_touch->touch, &periph_touch->result)) - { - ESP_LOGD (TAG, - "Touch event, tap %x, release_mask: %x, long_tap_mask: %x, " - "long_tap_mask: %x", - periph_touch->result.tap_mask, - periph_touch->result.release_mask, - periph_touch->result.long_tap_mask, - periph_touch->result.long_release_mask); - esp_periph_send_cmd (periph, 0, NULL, 0); - } +static void touch_timer_handler(xTimerHandle tmr) { + esp_periph_handle_t periph = (esp_periph_handle_t)pvTimerGetTimerID(tmr); + + periph_touch_t *periph_touch = esp_periph_get_data(periph); + if (esp_touch_read(periph_touch->touch, &periph_touch->result)) { + ESP_LOGD(TAG, + "Touch event, tap %x, release_mask: %x, long_tap_mask: %x, " + "long_tap_mask: %x", + periph_touch->result.tap_mask, periph_touch->result.release_mask, + periph_touch->result.long_tap_mask, + periph_touch->result.long_release_mask); + esp_periph_send_cmd(periph, 0, NULL, 0); + } } -static esp_err_t -_touch_init (esp_periph_handle_t self) -{ - VALIDATE_TOUCH (self, ESP_FAIL); - periph_touch_t *periph_touch = esp_periph_get_data (self); +static esp_err_t _touch_init(esp_periph_handle_t self) { + VALIDATE_TOUCH(self, ESP_FAIL); + periph_touch_t *periph_touch = esp_periph_get_data(self); touch_config_t touch_config = { - .touch_mask = periph_touch->touch_mask, - .long_tap_time_ms = periph_touch->long_tap_time_ms, - .tap_threshold_percent = periph_touch->tap_threshold_percent, + .touch_mask = periph_touch->touch_mask, + .long_tap_time_ms = periph_touch->long_tap_time_ms, + .tap_threshold_percent = periph_touch->tap_threshold_percent, }; - periph_touch->touch = esp_touch_init (&touch_config); + periph_touch->touch = esp_touch_init(&touch_config); - esp_periph_start_timer (self, 150 / portTICK_PERIOD_MS, touch_timer_handler); - ESP_LOGW (TAG, "_touch_init"); + esp_periph_start_timer(self, 150 / portTICK_PERIOD_MS, touch_timer_handler); + ESP_LOGW(TAG, "_touch_init"); return ESP_OK; } -static esp_err_t -_touch_destroy (esp_periph_handle_t self) -{ - periph_touch_t *periph_touch = esp_periph_get_data (self); - esp_touch_destroy (periph_touch->touch); - audio_free (periph_touch); +static esp_err_t _touch_destroy(esp_periph_handle_t self) { + periph_touch_t *periph_touch = esp_periph_get_data(self); + esp_periph_stop_timer(self); + esp_touch_destroy(periph_touch->touch); + audio_free(periph_touch); return ESP_OK; } -esp_periph_handle_t -periph_touch_init (periph_touch_cfg_t *config) -{ - esp_periph_handle_t periph - = esp_periph_create (PERIPH_ID_TOUCH, "periph_touch"); - AUDIO_MEM_CHECK (TAG, periph, return NULL); - periph_touch_t *periph_touch = audio_calloc (1, sizeof (periph_touch_t)); - AUDIO_MEM_CHECK (TAG, periph_touch, { - audio_free (periph); +esp_periph_handle_t periph_touch_init(periph_touch_cfg_t *config) { + esp_periph_handle_t periph = + esp_periph_create(PERIPH_ID_TOUCH, "periph_touch"); + AUDIO_MEM_CHECK(TAG, periph, return NULL); + periph_touch_t *periph_touch = audio_calloc(1, sizeof(periph_touch_t)); + AUDIO_MEM_CHECK(TAG, periph_touch, { + audio_free(periph); return NULL; }); periph_touch->touch_mask = config->touch_mask; periph_touch->long_tap_time_ms = config->long_tap_time_ms; periph_touch->tap_threshold_percent = config->tap_threshold_percent; - esp_periph_set_data (periph, periph_touch); - esp_periph_set_function (periph, _touch_init, _touch_run, _touch_destroy); + esp_periph_set_data(periph, periph_touch); + esp_periph_set_function(periph, _touch_init, _touch_run, _touch_destroy); return periph; } diff --git a/components/esp_peripherals/periph_wifi.c b/components/esp_peripherals/periph_wifi.c index d28c14a7..5f28556c 100644 --- a/components/esp_peripherals/periph_wifi.c +++ b/components/esp_peripherals/periph_wifi.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,38 +18,39 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ +#include "periph_wifi.h" + +#include + +#include "audio_idf_version.h" +#include "audio_mem.h" #include "esp_event.h" #include "esp_log.h" +#include "esp_peripherals.h" #include "esp_smartconfig.h" #include "esp_wifi.h" #include "esp_wpa2.h" -#include - -#include "audio_mem.h" -#include "esp_peripherals.h" -#include "periph_wifi.h" #include "wifibleconfig.h" - -#if __has_include("esp_idf_version.h") -#include "esp_idf_version.h" -#else -#define ESP_IDF_VERSION_VAL(major, minor, patch) 1 +#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0)) +#include "esp_netif.h" +#include "esp_wifi_netif.h" +#include "nvs_flash.h" +static esp_netif_t *sta = NULL; #endif static const char *TAG = "PERIPH_WIFI"; -#define VALIDATE_WIFI(periph, ret) \ - if (!(periph && esp_periph_get_id (periph) == PERIPH_ID_WIFI)) \ - { \ - ESP_LOGE (TAG, "Invalid WIFI periph, at line %d", __LINE__); \ - return ret; \ - } +#define VALIDATE_WIFI(periph, ret) \ + if (!(periph && esp_periph_get_id(periph) == PERIPH_ID_WIFI)) { \ + ESP_LOGE(TAG, "Invalid WIFI periph, at line %d", __LINE__); \ + return ret; \ + } #define DEFAULT_RECONNECT_TIMEOUT_MS (1000) @@ -59,8 +60,7 @@ static const char *TAG = "PERIPH_WIFI"; typedef struct periph_wifi *periph_wifi_handle_t; -struct periph_wifi -{ +struct periph_wifi { periph_wifi_state_t wifi_state; bool disable_auto_reconnect; bool is_open; @@ -79,554 +79,504 @@ static const int SMARTCONFIG_DONE_BIT = BIT2; static const int SMARTCONFIG_ERROR_BIT = BIT3; static esp_periph_handle_t g_periph = NULL; - -esp_err_t -periph_wifi_wait_for_connected (esp_periph_handle_t periph, - TickType_t tick_to_wait) -{ - VALIDATE_WIFI (periph, ESP_FAIL); - periph_wifi_handle_t periph_wifi - = (periph_wifi_handle_t)esp_periph_get_data (periph); - EventBits_t connected_bit = xEventGroupWaitBits ( +static wifi_config_t wifi_config; + +esp_err_t periph_wifi_wait_for_connected(esp_periph_handle_t periph, + TickType_t tick_to_wait) { + VALIDATE_WIFI(periph, ESP_FAIL); + periph_wifi_handle_t periph_wifi = + (periph_wifi_handle_t)esp_periph_get_data(periph); + EventBits_t connected_bit = xEventGroupWaitBits( periph_wifi->state_event, CONNECTED_BIT, false, true, tick_to_wait); - if (connected_bit & CONNECTED_BIT) - { - return ESP_OK; - } -#ifdef CONFIG_BLUEDROID_ENABLED - if (periph_wifi->config_mode == WIFI_CONFIG_BLUEFI) - { - ble_config_stop (); - } + if (connected_bit & CONNECTED_BIT) { + return ESP_OK; + } +#if defined(CONFIG_BTDM_CTRL_MODE_BLE_ONLY) || \ + defined(CONFIG_BTDM_CTRL_MODE_BTDM) + if (periph_wifi->config_mode == WIFI_CONFIG_BLUEFI) { + ble_config_stop(); + } #endif return ESP_FAIL; } -periph_wifi_state_t -periph_wifi_is_connected (esp_periph_handle_t periph) -{ - VALIDATE_WIFI (periph, false); - periph_wifi_handle_t wifi - = (periph_wifi_handle_t)esp_periph_get_data (periph); +periph_wifi_state_t periph_wifi_is_connected(esp_periph_handle_t periph) { + VALIDATE_WIFI(periph, false); + periph_wifi_handle_t wifi = (periph_wifi_handle_t)esp_periph_get_data(periph); return wifi->wifi_state; } #if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)) -static void -_wifi_smartconfig_event_callback (void *arg, esp_event_base_t event_base, - int32_t event_id, void *event_data) -{ +static void _wifi_smartconfig_event_callback(void *arg, + esp_event_base_t event_base, + int32_t event_id, + void *event_data) { wifi_config_t sta_conf; - periph_wifi_handle_t periph_wifi - = (periph_wifi_handle_t)esp_periph_get_data (g_periph); - switch (event_id) - { + periph_wifi_handle_t periph_wifi = + (periph_wifi_handle_t)esp_periph_get_data(g_periph); + switch (event_id) { case SC_EVENT_SCAN_DONE: - ESP_LOGD (TAG, "SC_EVENT_SCAN_DONE"); + ESP_LOGD(TAG, "SC_EVENT_SCAN_DONE"); break; case SC_EVENT_FOUND_CHANNEL: - ESP_LOGD (TAG, "SC_EVENT_FOUND_CHANNEL"); + ESP_LOGD(TAG, "SC_EVENT_FOUND_CHANNEL"); break; case SC_EVENT_GOT_SSID_PSWD: - ESP_LOGE (TAG, "SC_EVENT_GOT_SSID_PSWD"); - smartconfig_event_got_ssid_pswd_t *evt - = (smartconfig_event_got_ssid_pswd_t *)event_data; - memset (&sta_conf, 0x00, sizeof (sta_conf)); - memcpy (sta_conf.sta.ssid, evt->ssid, sizeof (sta_conf.sta.ssid)); - memcpy (sta_conf.sta.password, evt->password, - sizeof (sta_conf.sta.password)); + ESP_LOGE(TAG, "SC_EVENT_GOT_SSID_PSWD"); + smartconfig_event_got_ssid_pswd_t *evt = + (smartconfig_event_got_ssid_pswd_t *)event_data; + memset(&sta_conf, 0x00, sizeof(sta_conf)); + memcpy(sta_conf.sta.ssid, evt->ssid, sizeof(sta_conf.sta.ssid)); + memcpy(sta_conf.sta.password, evt->password, + sizeof(sta_conf.sta.password)); sta_conf.sta.bssid_set = evt->bssid_set; - if (sta_conf.sta.bssid_set == true) - { - memcpy (sta_conf.sta.bssid, evt->bssid, sizeof (sta_conf.sta.bssid)); - } - ESP_LOGE (TAG, "SSID=%s, PASS=%s", sta_conf.sta.ssid, - sta_conf.sta.password); - - esp_wifi_disconnect (); - - if (esp_wifi_set_config (WIFI_IF_STA, &sta_conf) != ESP_OK) - { - periph_wifi->wifi_state = PERIPH_WIFI_CONFIG_ERROR; - xEventGroupSetBits (periph_wifi->state_event, SMARTCONFIG_ERROR_BIT); - } - if (esp_wifi_connect () != ESP_OK) - { - periph_wifi->wifi_state = PERIPH_WIFI_CONFIG_ERROR; - xEventGroupSetBits (periph_wifi->state_event, SMARTCONFIG_ERROR_BIT); - esp_periph_send_event (g_periph, PERIPH_WIFI_CONFIG_ERROR, NULL, 0); - break; - } + if (sta_conf.sta.bssid_set == true) { + memcpy(sta_conf.sta.bssid, evt->bssid, sizeof(sta_conf.sta.bssid)); + } + ESP_LOGE(TAG, "SSID=%s, PASS=%s", sta_conf.sta.ssid, + sta_conf.sta.password); + + esp_wifi_disconnect(); + + if (esp_wifi_set_config(WIFI_IF_STA, &sta_conf) != ESP_OK) { + periph_wifi->wifi_state = PERIPH_WIFI_CONFIG_ERROR; + xEventGroupSetBits(periph_wifi->state_event, SMARTCONFIG_ERROR_BIT); + } + if (esp_wifi_connect() != ESP_OK) { + periph_wifi->wifi_state = PERIPH_WIFI_CONFIG_ERROR; + xEventGroupSetBits(periph_wifi->state_event, SMARTCONFIG_ERROR_BIT); + esp_periph_send_event(g_periph, PERIPH_WIFI_CONFIG_ERROR, NULL, 0); + break; + } break; case SC_EVENT_SEND_ACK_DONE: - ESP_LOGE (TAG, "SC_EVENT_SEND_ACK_DONE"); + ESP_LOGE(TAG, "SC_EVENT_SEND_ACK_DONE"); periph_wifi->wifi_state = PERIPH_WIFI_CONFIG_DONE; - esp_periph_send_event (g_periph, PERIPH_WIFI_CONFIG_DONE, NULL, 0); - xEventGroupSetBits (periph_wifi->state_event, SMARTCONFIG_DONE_BIT); - esp_smartconfig_stop (); + esp_periph_send_event(g_periph, PERIPH_WIFI_CONFIG_DONE, NULL, 0); + xEventGroupSetBits(periph_wifi->state_event, SMARTCONFIG_DONE_BIT); + esp_smartconfig_stop(); break; - } + } } #else -static void -_wifi_smartconfig_event_callback (smartconfig_status_t status, void *pdata) -{ +static void _wifi_smartconfig_event_callback(smartconfig_status_t status, + void *pdata) { wifi_config_t sta_conf; smartconfig_type_t *type; - periph_wifi_handle_t periph_wifi - = (periph_wifi_handle_t)esp_periph_get_data (g_periph); - switch (status) - { + periph_wifi_handle_t periph_wifi = + (periph_wifi_handle_t)esp_periph_get_data(g_periph); + switch (status) { case SC_STATUS_WAIT: - ESP_LOGD (TAG, "SC_STATUS_WAIT"); + ESP_LOGD(TAG, "SC_STATUS_WAIT"); break; case SC_STATUS_FIND_CHANNEL: - ESP_LOGD (TAG, "SC_STATUS_FIND_CHANNEL"); + ESP_LOGD(TAG, "SC_STATUS_FIND_CHANNEL"); break; case SC_STATUS_GETTING_SSID_PSWD: type = pdata; - ESP_LOGD (TAG, "SC_STATUS_GETTING_SSID_PSWD, SC_TYPE=%d", (int)*type); + ESP_LOGD(TAG, "SC_STATUS_GETTING_SSID_PSWD, SC_TYPE=%d", (int)*type); break; case SC_STATUS_LINK: - ESP_LOGE (TAG, "SC_STATUS_LINK"); - memset (&sta_conf, 0x00, sizeof (sta_conf)); - memcpy (&sta_conf.sta, pdata, sizeof (wifi_sta_config_t)); - ESP_LOGE (TAG, "SSID=%s, PASS=%s", sta_conf.sta.ssid, - sta_conf.sta.password); - esp_wifi_disconnect (); - - if (esp_wifi_set_config (WIFI_IF_STA, &sta_conf) != ESP_OK) - { - periph_wifi->wifi_state = PERIPH_WIFI_CONFIG_ERROR; - xEventGroupSetBits (periph_wifi->state_event, SMARTCONFIG_ERROR_BIT); - } - if (esp_wifi_connect () != ESP_OK) - { - periph_wifi->wifi_state = PERIPH_WIFI_CONFIG_ERROR; - xEventGroupSetBits (periph_wifi->state_event, SMARTCONFIG_ERROR_BIT); - esp_periph_send_event (g_periph, PERIPH_WIFI_CONFIG_ERROR, NULL, 0); - break; - } + ESP_LOGE(TAG, "SC_STATUS_LINK"); + memset(&sta_conf, 0x00, sizeof(sta_conf)); + memcpy(&sta_conf.sta, pdata, sizeof(wifi_sta_config_t)); + ESP_LOGE(TAG, "SSID=%s, PASS=%s", sta_conf.sta.ssid, + sta_conf.sta.password); + esp_wifi_disconnect(); + + if (esp_wifi_set_config(WIFI_IF_STA, &sta_conf) != ESP_OK) { + periph_wifi->wifi_state = PERIPH_WIFI_CONFIG_ERROR; + xEventGroupSetBits(periph_wifi->state_event, SMARTCONFIG_ERROR_BIT); + } + if (esp_wifi_connect() != ESP_OK) { + periph_wifi->wifi_state = PERIPH_WIFI_CONFIG_ERROR; + xEventGroupSetBits(periph_wifi->state_event, SMARTCONFIG_ERROR_BIT); + esp_periph_send_event(g_periph, PERIPH_WIFI_CONFIG_ERROR, NULL, 0); + break; + } break; case SC_STATUS_LINK_OVER: - ESP_LOGE (TAG, "SC_STATUS_LINK_OVER"); - - if (pdata != NULL) - { - char phone_ip[4] = { 0 }; - memcpy (phone_ip, (const void *)pdata, 4); - ESP_LOGD (TAG, "Phone ip: %d.%d.%d.%d", phone_ip[0], phone_ip[1], - phone_ip[2], phone_ip[3]); - periph_wifi->wifi_state = PERIPH_WIFI_CONFIG_DONE; - esp_periph_send_event (g_periph, PERIPH_WIFI_CONFIG_DONE, NULL, 0); - xEventGroupSetBits (periph_wifi->state_event, SMARTCONFIG_DONE_BIT); - } - else - { - periph_wifi->wifi_state = PERIPH_WIFI_CONFIG_ERROR; - esp_periph_send_event (g_periph, PERIPH_WIFI_CONFIG_ERROR, NULL, 0); - xEventGroupSetBits (periph_wifi->state_event, SMARTCONFIG_ERROR_BIT); - } - esp_smartconfig_stop (); + ESP_LOGE(TAG, "SC_STATUS_LINK_OVER"); + + if (pdata != NULL) { + char phone_ip[4] = {0}; + memcpy(phone_ip, (const void *)pdata, 4); + ESP_LOGD(TAG, "Phone ip: %d.%d.%d.%d", phone_ip[0], phone_ip[1], + phone_ip[2], phone_ip[3]); + periph_wifi->wifi_state = PERIPH_WIFI_CONFIG_DONE; + esp_periph_send_event(g_periph, PERIPH_WIFI_CONFIG_DONE, NULL, 0); + xEventGroupSetBits(periph_wifi->state_event, SMARTCONFIG_DONE_BIT); + } else { + periph_wifi->wifi_state = PERIPH_WIFI_CONFIG_ERROR; + esp_periph_send_event(g_periph, PERIPH_WIFI_CONFIG_ERROR, NULL, 0); + xEventGroupSetBits(periph_wifi->state_event, SMARTCONFIG_ERROR_BIT); + } + esp_smartconfig_stop(); break; - } + } } #endif -esp_err_t -periph_wifi_wait_for_disconnected (esp_periph_handle_t periph, - TickType_t tick_to_wait) -{ - VALIDATE_WIFI (periph, ESP_FAIL); - periph_wifi_handle_t periph_wifi - = (periph_wifi_handle_t)esp_periph_get_data (periph); - EventBits_t disconnected_bit = xEventGroupWaitBits ( +esp_err_t periph_wifi_wait_for_disconnected(esp_periph_handle_t periph, + TickType_t tick_to_wait) { + VALIDATE_WIFI(periph, ESP_FAIL); + periph_wifi_handle_t periph_wifi = + (periph_wifi_handle_t)esp_periph_get_data(periph); + EventBits_t disconnected_bit = xEventGroupWaitBits( periph_wifi->state_event, DISCONNECTED_BIT, false, true, tick_to_wait); - if (disconnected_bit & DISCONNECTED_BIT) - { - return ESP_OK; - } + if (disconnected_bit & DISCONNECTED_BIT) { + return ESP_OK; + } return ESP_FAIL; } -esp_err_t -periph_wifi_config_start (esp_periph_handle_t periph, - periph_wifi_config_mode_t mode) -{ - VALIDATE_WIFI (periph, ESP_FAIL); - periph_wifi_handle_t periph_wifi - = (periph_wifi_handle_t)esp_periph_get_data (periph); +esp_err_t periph_wifi_config_start(esp_periph_handle_t periph, + periph_wifi_config_mode_t mode) { + VALIDATE_WIFI(periph, ESP_FAIL); + periph_wifi_handle_t periph_wifi = + (periph_wifi_handle_t)esp_periph_get_data(periph); esp_err_t err = ESP_OK; periph_wifi->disable_auto_reconnect = true; periph_wifi->config_mode = mode; - esp_wifi_disconnect (); + esp_wifi_disconnect(); - if (periph_wifi_wait_for_disconnected (periph, portMAX_DELAY) != ESP_OK) - { - return ESP_FAIL; - } + if (periph_wifi_wait_for_disconnected(periph, portMAX_DELAY) != ESP_OK) { + return ESP_FAIL; + } periph_wifi->wifi_state = PERIPH_WIFI_SETTING; - if (mode >= WIFI_CONFIG_ESPTOUCH && mode <= WIFI_CONFIG_ESPTOUCH_AIRKISS) - { - err = ESP_OK; // 0; - // esp_wifi_start(); - err |= esp_smartconfig_set_type (mode); - err |= esp_smartconfig_fast_mode (true); + if (mode >= WIFI_CONFIG_ESPTOUCH && mode <= WIFI_CONFIG_ESPTOUCH_AIRKISS) { + err = ESP_OK; // 0; + // esp_wifi_start(); + err |= esp_smartconfig_set_type(mode); + err |= esp_smartconfig_fast_mode(true); #if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)) - smartconfig_start_config_t cfg = SMARTCONFIG_START_CONFIG_DEFAULT (); - err |= esp_smartconfig_start (&cfg); - esp_event_handler_register (SC_EVENT, ESP_EVENT_ANY_ID, - &_wifi_smartconfig_event_callback, NULL); + smartconfig_start_config_t cfg = SMARTCONFIG_START_CONFIG_DEFAULT(); + err |= esp_smartconfig_start(&cfg); + esp_event_handler_register(SC_EVENT, ESP_EVENT_ANY_ID, + &_wifi_smartconfig_event_callback, NULL); #else - err |= esp_smartconfig_start (_wifi_smartconfig_event_callback, 0); + err |= esp_smartconfig_start(_wifi_smartconfig_event_callback, 0); #endif - xEventGroupClearBits (periph_wifi->state_event, SMARTCONFIG_DONE_BIT); - xEventGroupClearBits (periph_wifi->state_event, SMARTCONFIG_ERROR_BIT); - } - else if (mode == WIFI_CONFIG_WPS) - { - // todo : add wps - return ESP_OK; - } - else if (mode == WIFI_CONFIG_BLUEFI) - { -#ifdef CONFIG_BLUEDROID_ENABLED - ble_config_start (periph); + xEventGroupClearBits(periph_wifi->state_event, SMARTCONFIG_DONE_BIT); + xEventGroupClearBits(periph_wifi->state_event, SMARTCONFIG_ERROR_BIT); + + } else if (mode == WIFI_CONFIG_WPS) { + // todo : add wps + return ESP_OK; + } else if (mode == WIFI_CONFIG_BLUEFI) { +#if defined(CONFIG_BTDM_CTRL_MODE_BLE_ONLY) || \ + defined(CONFIG_BTDM_CTRL_MODE_BTDM) + ble_config_start(periph); #endif - return ESP_OK; - } + return ESP_OK; + } return err; } -esp_err_t -periph_wifi_config_wait_done (esp_periph_handle_t periph, - TickType_t tick_to_wait) -{ - VALIDATE_WIFI (periph, ESP_FAIL); - periph_wifi_handle_t periph_wifi - = (periph_wifi_handle_t)esp_periph_get_data (periph); - EventBits_t wificonfig_bit = xEventGroupWaitBits ( +esp_err_t periph_wifi_config_wait_done(esp_periph_handle_t periph, + TickType_t tick_to_wait) { + VALIDATE_WIFI(periph, ESP_FAIL); + periph_wifi_handle_t periph_wifi = + (periph_wifi_handle_t)esp_periph_get_data(periph); + EventBits_t wificonfig_bit = xEventGroupWaitBits( periph_wifi->state_event, SMARTCONFIG_DONE_BIT | SMARTCONFIG_ERROR_BIT, false, false, tick_to_wait); - if (wificonfig_bit & SMARTCONFIG_DONE_BIT) - { - return ESP_OK; - } - if (wificonfig_bit & SMARTCONFIG_ERROR_BIT) - { - return ESP_FAIL; - } - esp_smartconfig_stop (); + if (wificonfig_bit & SMARTCONFIG_DONE_BIT) { + return ESP_OK; + } + if (wificonfig_bit & SMARTCONFIG_ERROR_BIT) { + return ESP_FAIL; + } + esp_smartconfig_stop(); return ESP_FAIL; } -static void -wifi_reconnect_timer (xTimerHandle tmr) -{ - esp_periph_handle_t periph = (esp_periph_handle_t)pvTimerGetTimerID (tmr); - periph_wifi_handle_t periph_wifi - = (periph_wifi_handle_t)esp_periph_get_data (periph); - esp_periph_stop_timer (periph); - if (periph_wifi->disable_auto_reconnect != true) - { - esp_wifi_connect (); - } +static void wifi_reconnect_timer(xTimerHandle tmr) { + esp_periph_handle_t periph = (esp_periph_handle_t)pvTimerGetTimerID(tmr); + periph_wifi_handle_t periph_wifi = + (periph_wifi_handle_t)esp_periph_get_data(periph); + esp_periph_stop_timer(periph); + if (periph_wifi->disable_auto_reconnect != true) { + esp_wifi_connect(); + } } #if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)) -static void -_wifi_event_callback (void *arg, esp_event_base_t event_base, int32_t event_id, - void *event_data) -{ +static void _wifi_event_callback(void *arg, esp_event_base_t event_base, + int32_t event_id, void *event_data) { esp_periph_handle_t self = (esp_periph_handle_t)arg; - periph_wifi_handle_t periph_wifi - = (periph_wifi_handle_t)esp_periph_get_data (self); - if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START) - { - esp_wifi_connect (); - } - else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) - { - ip_event_got_ip_t *event = (ip_event_got_ip_t *)event_data; - ESP_LOGI (TAG, "Got ip:" IPSTR, IP2STR (&event->ip_info.ip)); - periph_wifi->wifi_state = PERIPH_WIFI_CONNECTED; - xEventGroupClearBits (periph_wifi->state_event, DISCONNECTED_BIT); - esp_periph_send_event (self, PERIPH_WIFI_CONNECTED, NULL, 0); - xEventGroupSetBits (periph_wifi->state_event, CONNECTED_BIT); - wifi_config_t w_config; - memset (&w_config, 0x00, sizeof (wifi_config_t)); - esp_wifi_get_config (WIFI_IF_STA, &w_config); - strcpy (periph_wifi->ssid, (char *)w_config.sta.ssid); - } - else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) - { - periph_wifi->wifi_state = PERIPH_WIFI_DISCONNECTED; - xEventGroupClearBits (periph_wifi->state_event, CONNECTED_BIT); - xEventGroupSetBits (periph_wifi->state_event, DISCONNECTED_BIT); - esp_periph_send_event (self, PERIPH_WIFI_DISCONNECTED, NULL, 0); - - ESP_LOGW (TAG, - "Wi-Fi disconnected from SSID %s, auto-reconnect %s, " - "reconnect after %d ms", - periph_wifi->ssid, - periph_wifi->disable_auto_reconnect == 0 ? "enabled" - : "disabled", - periph_wifi->reconnect_timeout_ms); - if (periph_wifi->disable_auto_reconnect) - { - return; - } - esp_periph_start_timer ( - self, periph_wifi->reconnect_timeout_ms / portTICK_RATE_MS, - wifi_reconnect_timer); - } - else - { - ESP_LOGW (TAG, "WiFi Event cb, Unhandle event_base:%s, event_id:%d", - event_base, event_id); + periph_wifi_handle_t periph_wifi = + (periph_wifi_handle_t)esp_periph_get_data(self); + if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START) { + esp_wifi_connect(); + } else if (event_base == IP_EVENT && event_id == IP_EVENT_STA_GOT_IP) { + ip_event_got_ip_t *event = (ip_event_got_ip_t *)event_data; + ESP_LOGI(TAG, "Got ip:" IPSTR, IP2STR(&event->ip_info.ip)); + periph_wifi->wifi_state = PERIPH_WIFI_CONNECTED; + xEventGroupClearBits(periph_wifi->state_event, DISCONNECTED_BIT); + esp_periph_send_event(self, PERIPH_WIFI_CONNECTED, NULL, 0); + xEventGroupSetBits(periph_wifi->state_event, CONNECTED_BIT); + wifi_config_t w_config; + memset(&w_config, 0x00, sizeof(wifi_config_t)); + esp_wifi_get_config(WIFI_IF_STA, &w_config); + strcpy(periph_wifi->ssid, (char *)w_config.sta.ssid); + } else if (event_base == WIFI_EVENT && + event_id == WIFI_EVENT_STA_DISCONNECTED) { + periph_wifi->wifi_state = PERIPH_WIFI_DISCONNECTED; + xEventGroupClearBits(periph_wifi->state_event, CONNECTED_BIT); + xEventGroupSetBits(periph_wifi->state_event, DISCONNECTED_BIT); + esp_periph_send_event(self, PERIPH_WIFI_DISCONNECTED, NULL, 0); + + ESP_LOGW(TAG, + "Wi-Fi disconnected from SSID %s, auto-reconnect %s, reconnect " + "after %d ms", + periph_wifi->ssid, + periph_wifi->disable_auto_reconnect == 0 ? "enabled" : "disabled", + periph_wifi->reconnect_timeout_ms); + if (periph_wifi->disable_auto_reconnect) { + return; } + esp_periph_start_timer(self, + periph_wifi->reconnect_timeout_ms / portTICK_RATE_MS, + wifi_reconnect_timer); + + } else { + ESP_LOGW(TAG, "WiFi Event cb, Unhandle event_base:%s, event_id:%d", + event_base, (int)event_id); + } } #else -static esp_err_t -_wifi_event_callback (void *ctx, system_event_t *event) -{ +static esp_err_t _wifi_event_callback(void *ctx, system_event_t *event) { esp_periph_handle_t self = (esp_periph_handle_t)ctx; - periph_wifi_handle_t periph_wifi - = (periph_wifi_handle_t)esp_periph_get_data (self); - switch (event->event_id) - { + periph_wifi_handle_t periph_wifi = + (periph_wifi_handle_t)esp_periph_get_data(self); + switch (event->event_id) { case SYSTEM_EVENT_STA_START: periph_wifi->wifi_state = PERIPH_WIFI_CONNECTING; - esp_wifi_connect (); + esp_wifi_connect(); break; case SYSTEM_EVENT_STA_CONNECTED: break; case SYSTEM_EVENT_STA_GOT_IP: periph_wifi->wifi_state = PERIPH_WIFI_CONNECTED; - xEventGroupClearBits (periph_wifi->state_event, DISCONNECTED_BIT); - esp_periph_send_event (self, PERIPH_WIFI_CONNECTED, NULL, 0); - xEventGroupSetBits (periph_wifi->state_event, CONNECTED_BIT); + xEventGroupClearBits(periph_wifi->state_event, DISCONNECTED_BIT); + esp_periph_send_event(self, PERIPH_WIFI_CONNECTED, NULL, 0); + xEventGroupSetBits(periph_wifi->state_event, CONNECTED_BIT); wifi_config_t w_config; - memset (&w_config, 0x00, sizeof (wifi_config_t)); - esp_wifi_get_config (WIFI_IF_STA, &w_config); - strcpy (periph_wifi->ssid, (char *)w_config.sta.ssid); + memset(&w_config, 0x00, sizeof(wifi_config_t)); + esp_wifi_get_config(WIFI_IF_STA, &w_config); + strcpy(periph_wifi->ssid, (char *)w_config.sta.ssid); break; case SYSTEM_EVENT_STA_DISCONNECTED: periph_wifi->wifi_state = PERIPH_WIFI_DISCONNECTED; - xEventGroupClearBits (periph_wifi->state_event, CONNECTED_BIT); - xEventGroupSetBits (periph_wifi->state_event, DISCONNECTED_BIT); - esp_periph_send_event (self, PERIPH_WIFI_DISCONNECTED, NULL, 0); - - ESP_LOGW (TAG, - "Wi-Fi disconnected from SSID %s, auto-reconnect %s, " - "reconnect after %d ms", - periph_wifi->ssid, - periph_wifi->disable_auto_reconnect == 0 ? "enabled" - : "disabled", - periph_wifi->reconnect_timeout_ms); - if (periph_wifi->disable_auto_reconnect) - { - break; - } - esp_periph_start_timer ( + xEventGroupClearBits(periph_wifi->state_event, CONNECTED_BIT); + xEventGroupSetBits(periph_wifi->state_event, DISCONNECTED_BIT); + esp_periph_send_event(self, PERIPH_WIFI_DISCONNECTED, NULL, 0); + + ESP_LOGW( + TAG, + "Wi-Fi disconnected from SSID %s, auto-reconnect %s, reconnect after " + "%d ms", + periph_wifi->ssid, + periph_wifi->disable_auto_reconnect == 0 ? "enabled" : "disabled", + periph_wifi->reconnect_timeout_ms); + if (periph_wifi->disable_auto_reconnect) { + break; + } + esp_periph_start_timer( self, periph_wifi->reconnect_timeout_ms / portTICK_RATE_MS, wifi_reconnect_timer); break; default: break; - } + } return ESP_OK; } #endif -static esp_err_t -_wifi_run (esp_periph_handle_t self, audio_event_iface_msg_t *msg) -{ - esp_periph_send_event (self, msg->cmd, NULL, 0); +static esp_err_t _wifi_run(esp_periph_handle_t self, + audio_event_iface_msg_t *msg) { + esp_periph_send_event(self, msg->cmd, NULL, 0); return ESP_OK; } -static esp_err_t -_wifi_init (esp_periph_handle_t self) -{ - periph_wifi_handle_t periph_wifi - = (periph_wifi_handle_t)esp_periph_get_data (self); - wifi_config_t wifi_config; - - if (periph_wifi->is_open) - { - ESP_LOGE (TAG, "Wifi has initialized"); - return ESP_FAIL; - } +esp_err_t esp_wifi_set_listen_interval(esp_periph_handle_t periph, + int interval) { + if (wifi_config.sta.listen_interval != interval) { + wifi_config.sta.listen_interval = interval; + } else { + ESP_LOGW(TAG, "Wifi listen interval %d is already set", interval); + } + return ESP_OK; +} + +static esp_err_t _wifi_init(esp_periph_handle_t self) { + periph_wifi_handle_t periph_wifi = + (periph_wifi_handle_t)esp_periph_get_data(self); + + if (periph_wifi->is_open) { + ESP_LOGE(TAG, "Wifi has initialized"); + return ESP_FAIL; + } #if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)) - ESP_ERROR_CHECK (esp_event_loop_create_default ()); -#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 1, 0)) - esp_netif_create_default_wifi_sta (); + ESP_ERROR_CHECK(esp_event_loop_create_default()); +#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0)) + sta = esp_netif_create_default_wifi_sta(); +#elif (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 1, 0)) + esp_netif_create_default_wifi_sta(); #endif - ESP_ERROR_CHECK (esp_event_handler_register (WIFI_EVENT, ESP_EVENT_ANY_ID, - &_wifi_event_callback, self)); - ESP_ERROR_CHECK (esp_event_handler_register (IP_EVENT, IP_EVENT_STA_GOT_IP, - &_wifi_event_callback, self)); + ESP_ERROR_CHECK(esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, + &_wifi_event_callback, self)); + ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, IP_EVENT_STA_GOT_IP, + &_wifi_event_callback, self)); #else #include "esp_event_loop.h" - if (esp_event_loop_get_queue () == NULL) - { - ESP_ERROR_CHECK (esp_event_loop_init (_wifi_event_callback, self)); - } - else - { - esp_event_loop_set_cb (_wifi_event_callback, self); - } + if (esp_event_loop_get_queue() == NULL) { + ESP_ERROR_CHECK(esp_event_loop_init(_wifi_event_callback, self)); + } else { + esp_event_loop_set_cb(_wifi_event_callback, self); + } #endif - wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT (); - ESP_ERROR_CHECK (esp_wifi_init (&cfg)); - - memset (&wifi_config, 0x00, sizeof (wifi_config_t)); - if (periph_wifi->ssid) - { - strcpy ((char *)wifi_config.sta.ssid, periph_wifi->ssid); - ESP_LOGD (TAG, "WIFI_SSID=%s", wifi_config.sta.ssid); - if (periph_wifi->password) - { - strcpy ((char *)wifi_config.sta.password, periph_wifi->password); - ESP_LOGD (TAG, "WIFI_PASS=%s", wifi_config.sta.password); - } - ESP_ERROR_CHECK (esp_wifi_set_storage (WIFI_STORAGE_RAM)); - ESP_ERROR_CHECK (esp_wifi_set_mode (WIFI_MODE_STA)); - ESP_ERROR_CHECK (esp_wifi_set_config (WIFI_IF_STA, &wifi_config)); + wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); + ESP_ERROR_CHECK(esp_wifi_init(&cfg)); + + if (periph_wifi->ssid) { + strcpy((char *)wifi_config.sta.ssid, periph_wifi->ssid); + ESP_LOGD(TAG, "WIFI_SSID=%s", wifi_config.sta.ssid); + if (periph_wifi->password) { + strcpy((char *)wifi_config.sta.password, periph_wifi->password); + ESP_LOGD(TAG, "WIFI_PASS=%s", wifi_config.sta.password); + } + ESP_ERROR_CHECK(esp_wifi_set_storage(WIFI_STORAGE_RAM)); + ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA)); + ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config)); + ESP_ERROR_CHECK(esp_wifi_set_ps(WIFI_PS_MIN_MODEM)); + } + if (periph_wifi->wpa2_e_cfg->diasble_wpa2_e) { + unsigned int ca_pem_bytes = periph_wifi->wpa2_e_cfg->ca_pem_end - + periph_wifi->wpa2_e_cfg->ca_pem_start; + unsigned int client_crt_bytes = periph_wifi->wpa2_e_cfg->wpa2_e_cert_end - + periph_wifi->wpa2_e_cfg->wpa2_e_cert_start; + unsigned int client_key_bytes = periph_wifi->wpa2_e_cfg->wpa2_e_key_end - + periph_wifi->wpa2_e_cfg->wpa2_e_key_start; + + ESP_ERROR_CHECK(esp_wifi_sta_wpa2_ent_set_ca_cert( + (const unsigned char *)periph_wifi->wpa2_e_cfg->ca_pem_start, + ca_pem_bytes)); + ESP_ERROR_CHECK(esp_wifi_sta_wpa2_ent_set_cert_key( + (const unsigned char *)periph_wifi->wpa2_e_cfg->wpa2_e_cert_start, + client_crt_bytes, + (const unsigned char *)periph_wifi->wpa2_e_cfg->wpa2_e_key_start, + client_key_bytes, NULL, 0)); + ESP_ERROR_CHECK(esp_wifi_sta_wpa2_ent_set_identity( + (uint8_t *)periph_wifi->wpa2_e_cfg->eap_id, + strlen(periph_wifi->wpa2_e_cfg->eap_id))); + if (periph_wifi->wpa2_e_cfg->eap_method == EAP_PEAP || + periph_wifi->wpa2_e_cfg->eap_method == EAP_TTLS) { + ESP_ERROR_CHECK(esp_wifi_sta_wpa2_ent_set_username( + (uint8_t *)periph_wifi->wpa2_e_cfg->eap_username, + strlen(periph_wifi->wpa2_e_cfg->eap_username))); + ESP_ERROR_CHECK(esp_wifi_sta_wpa2_ent_set_password( + (uint8_t *)periph_wifi->wpa2_e_cfg->eap_password, + strlen(periph_wifi->wpa2_e_cfg->eap_password))); } - if (periph_wifi->wpa2_e_cfg->diasble_wpa2_e) - { - unsigned int ca_pem_bytes = periph_wifi->wpa2_e_cfg->ca_pem_end - - periph_wifi->wpa2_e_cfg->ca_pem_start; - unsigned int client_crt_bytes - = periph_wifi->wpa2_e_cfg->wpa2_e_cert_end - - periph_wifi->wpa2_e_cfg->wpa2_e_cert_start; - unsigned int client_key_bytes - = periph_wifi->wpa2_e_cfg->wpa2_e_key_end - - periph_wifi->wpa2_e_cfg->wpa2_e_key_start; - - ESP_ERROR_CHECK (esp_wifi_sta_wpa2_ent_set_ca_cert ( - (const unsigned char *)periph_wifi->wpa2_e_cfg->ca_pem_start, - ca_pem_bytes)); - ESP_ERROR_CHECK (esp_wifi_sta_wpa2_ent_set_cert_key ( - (const unsigned char *)periph_wifi->wpa2_e_cfg->wpa2_e_cert_start, - client_crt_bytes, - (const unsigned char *)periph_wifi->wpa2_e_cfg->wpa2_e_key_start, - client_key_bytes, NULL, 0)); - ESP_ERROR_CHECK (esp_wifi_sta_wpa2_ent_set_identity ( - (uint8_t *)periph_wifi->wpa2_e_cfg->eap_id, - strlen (periph_wifi->wpa2_e_cfg->eap_id))); - if (periph_wifi->wpa2_e_cfg->eap_method == EAP_PEAP - || periph_wifi->wpa2_e_cfg->eap_method == EAP_TTLS) - { - ESP_ERROR_CHECK (esp_wifi_sta_wpa2_ent_set_username ( - (uint8_t *)periph_wifi->wpa2_e_cfg->eap_username, - strlen (periph_wifi->wpa2_e_cfg->eap_username))); - ESP_ERROR_CHECK (esp_wifi_sta_wpa2_ent_set_password ( - (uint8_t *)periph_wifi->wpa2_e_cfg->eap_password, - strlen (periph_wifi->wpa2_e_cfg->eap_password))); - } #if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 0, 0)) - ESP_ERROR_CHECK (esp_wifi_sta_wpa2_ent_enable ()); + ESP_ERROR_CHECK(esp_wifi_sta_wpa2_ent_enable()); #else - esp_wpa2_config_t wpa2_config = WPA2_CONFIG_INIT_DEFAULT (); - ESP_ERROR_CHECK (esp_wifi_sta_wpa2_ent_enable (&wpa2_config)); + esp_wpa2_config_t wpa2_config = WPA2_CONFIG_INIT_DEFAULT(); + ESP_ERROR_CHECK(esp_wifi_sta_wpa2_ent_enable(&wpa2_config)); #endif - } + } - ESP_ERROR_CHECK (esp_wifi_start ()); + ESP_ERROR_CHECK(esp_wifi_start()); periph_wifi->is_open = true; periph_wifi->wifi_state = PERIPH_WIFI_DISCONNECTED; - xEventGroupClearBits (periph_wifi->state_event, CONNECTED_BIT); - xEventGroupSetBits (periph_wifi->state_event, DISCONNECTED_BIT); + xEventGroupClearBits(periph_wifi->state_event, CONNECTED_BIT); + xEventGroupSetBits(periph_wifi->state_event, DISCONNECTED_BIT); return ESP_OK; } -static esp_err_t -_wifi_destroy (esp_periph_handle_t self) -{ - periph_wifi_handle_t periph_wifi - = (periph_wifi_handle_t)esp_periph_get_data (self); - esp_periph_stop_timer (self); +static esp_err_t _wifi_destroy(esp_periph_handle_t self) { + periph_wifi_handle_t periph_wifi = + (periph_wifi_handle_t)esp_periph_get_data(self); + esp_periph_stop_timer(self); periph_wifi->disable_auto_reconnect = true; - esp_wifi_disconnect (); - periph_wifi_wait_for_disconnected (self, portMAX_DELAY); - esp_wifi_stop (); - esp_wifi_deinit (); - audio_free (periph_wifi->ssid); - audio_free (periph_wifi->password); - - vEventGroupDelete (periph_wifi->state_event); - if (periph_wifi->wpa2_e_cfg != NULL) - { - audio_free (periph_wifi->wpa2_e_cfg); - periph_wifi->wpa2_e_cfg = NULL; - } - audio_free (periph_wifi); + esp_wifi_disconnect(); + periph_wifi_wait_for_disconnected(self, portMAX_DELAY); + esp_wifi_stop(); + esp_wifi_deinit(); + audio_free(periph_wifi->ssid); + audio_free(periph_wifi->password); + + vEventGroupDelete(periph_wifi->state_event); + if (periph_wifi->wpa2_e_cfg != NULL) { + audio_free(periph_wifi->wpa2_e_cfg); + periph_wifi->wpa2_e_cfg = NULL; + } + audio_free(periph_wifi); g_periph = NULL; + +#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0)) + esp_event_loop_delete_default(); + esp_netif_destroy_default_wifi(sta); +#endif return ESP_OK; } -esp_periph_handle_t -periph_wifi_init (periph_wifi_cfg_t *config) -{ +esp_periph_handle_t periph_wifi_init(periph_wifi_cfg_t *config) { esp_periph_handle_t periph = NULL; periph_wifi_handle_t periph_wifi = NULL; - bool _success - = ((periph = esp_periph_create (PERIPH_ID_WIFI, "periph_wifi")) - && (periph_wifi = audio_calloc (1, sizeof (struct periph_wifi))) - && (periph_wifi->state_event = xEventGroupCreate ()) - && (config->ssid - ? (bool)(periph_wifi->ssid = audio_strdup (config->ssid)) - : true) - && (config->password ? (bool)(periph_wifi->password - = audio_strdup (config->password)) - : true)); - - AUDIO_MEM_CHECK (TAG, _success, goto _periph_wifi_init_failed); + bool _success = + ((periph = esp_periph_create(PERIPH_ID_WIFI, "periph_wifi")) && + (periph_wifi = audio_calloc(1, sizeof(struct periph_wifi))) && + (periph_wifi->state_event = xEventGroupCreate()) && + (config->ssid ? (bool)(periph_wifi->ssid = audio_strdup(config->ssid)) + : true) && + (config->password + ? (bool)(periph_wifi->password = audio_strdup(config->password)) + : true)); + + AUDIO_MEM_CHECK(TAG, _success, goto _periph_wifi_init_failed); periph_wifi->reconnect_timeout_ms = config->reconnect_timeout_ms; - if (periph_wifi->reconnect_timeout_ms == 0) - { - periph_wifi->reconnect_timeout_ms = DEFAULT_RECONNECT_TIMEOUT_MS; - } + if (periph_wifi->reconnect_timeout_ms == 0) { + periph_wifi->reconnect_timeout_ms = DEFAULT_RECONNECT_TIMEOUT_MS; + } periph_wifi->disable_auto_reconnect = config->disable_auto_reconnect; - periph_wifi->wpa2_e_cfg - = audio_malloc (sizeof (periph_wpa2_enterprise_cfg_t)); - AUDIO_NULL_CHECK (TAG, periph_wifi->wpa2_e_cfg, { - audio_free (periph); + periph_wifi->wpa2_e_cfg = audio_malloc(sizeof(periph_wpa2_enterprise_cfg_t)); + AUDIO_NULL_CHECK(TAG, periph_wifi->wpa2_e_cfg, { + audio_free(periph); goto _periph_wifi_init_failed; }); - memcpy (periph_wifi->wpa2_e_cfg, &config->wpa2_e_cfg, - sizeof (periph_wpa2_enterprise_cfg_t)); + memcpy(periph_wifi->wpa2_e_cfg, &config->wpa2_e_cfg, + sizeof(periph_wpa2_enterprise_cfg_t)); + memset(&wifi_config, 0x00, sizeof(wifi_config_t)); - esp_periph_set_data (periph, periph_wifi); - esp_periph_set_function (periph, _wifi_init, _wifi_run, _wifi_destroy); + esp_periph_set_data(periph, periph_wifi); + esp_periph_set_function(periph, _wifi_init, _wifi_run, _wifi_destroy); g_periph = periph; return periph; _periph_wifi_init_failed: - if (periph_wifi) - { - vEventGroupDelete (periph_wifi->state_event); - audio_free (periph_wifi->ssid); - audio_free (periph_wifi->password); - audio_free (periph_wifi); - } + if (periph_wifi) { + vEventGroupDelete(periph_wifi->state_event); + audio_free(periph_wifi->ssid); + audio_free(periph_wifi->password); + audio_free(periph_wifi); + } return NULL; } diff --git a/components/esp_peripherals/periph_ws2812.c b/components/esp_peripherals/periph_ws2812.c index b842c820..58a92ac9 100644 --- a/components/esp_peripherals/periph_ws2812.c +++ b/components/esp_peripherals/periph_ws2812.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,25 +18,30 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ #include "periph_ws2812.h" + +#include +#include + #include "audio_mem.h" #include "audio_sys.h" -#include "driver/rmt.h" #include "esp_log.h" #include "esp_peripherals.h" #include "freertos/FreeRTOS.h" #include "freertos/semphr.h" #include "freertos/task.h" #include "soc/dport_access.h" +#if !defined CONFIG_IDF_TARGET_ESP32C3 && !defined CONFIG_IDF_TARGET_ESP32C6 #include "soc/dport_reg.h" -#include -#include +#endif +#include "audio_idf_version.h" +#include "driver/rmt.h" static const char *TAG = "PERIPH_WS2812"; @@ -44,30 +49,27 @@ static const char *TAG = "PERIPH_WS2812"; #define DURATION 12.5 #define RMTCHANNEL 0 #define MAX_PULSES 32 -#define PULSE_T0H ((uint32_t) (350 / (DURATION * DIVIDER)) & 0x00007FFF) -#define PULSE_T1H ((uint32_t) (900 / (DURATION * DIVIDER)) & 0x00007FFF) -#define PULSE_T0L ((uint32_t) (900 / (DURATION * DIVIDER)) & 0x00007FFF) -#define PULSE_T1L ((uint32_t) (350 / (DURATION * DIVIDER)) & 0x00007FFF) +#define PULSE_T0H ((uint32_t)(350 / (DURATION * DIVIDER)) & 0x00007FFF) +#define PULSE_T1H ((uint32_t)(900 / (DURATION * DIVIDER)) & 0x00007FFF) +#define PULSE_T0L ((uint32_t)(900 / (DURATION * DIVIDER)) & 0x00007FFF) +#define PULSE_T1L ((uint32_t)(350 / (DURATION * DIVIDER)) & 0x00007FFF) #define PULSE_TRS (50000 / (DURATION * DIVIDER)) -#define PULSE_BIT0 \ +#define PULSE_BIT0 \ (((uint32_t)PULSE_T0L << 16) + (((uint32_t)1) << 15) + (PULSE_T0H)) -#define PULSE_BIT1 \ +#define PULSE_BIT1 \ (((uint32_t)PULSE_T1L << 16) + (((uint32_t)1) << 15) + (PULSE_T1H)) #define FADE_STEP 30 #define INTERVAL_TIME_MS 10 -typedef union -{ - struct __attribute__ ((packed)) - { +typedef union { + struct __attribute__((packed)) { uint8_t r, g, b; }; uint32_t num; } rgb_value; -typedef struct -{ +typedef struct { periph_rgb_value color; periph_ws2812_mode_t mode; uint32_t time_on_ms; @@ -78,15 +80,13 @@ typedef struct bool is_set; } periph_ws2812_state_t; -typedef struct -{ +typedef struct { uint32_t pos; uint32_t half; uint8_t *buffer; } periph_ws2812_process_t; -typedef struct periph_ws2812 -{ +typedef struct periph_ws2812 { periph_rgb_value *color; uint32_t led_num; TimerHandle_t timer; @@ -96,9 +96,7 @@ typedef struct periph_ws2812 periph_ws2812_process_t process; } periph_ws2812_t; -static esp_err_t -ws2812_init_rmt_channel (int rmt_channel, int gpio_num) -{ +static esp_err_t ws2812_init_rmt_channel(int rmt_channel, int gpio_num) { rmt_config_t rmt_tx; rmt_tx.channel = rmt_channel; rmt_tx.gpio_num = gpio_num; @@ -110,373 +108,319 @@ ws2812_init_rmt_channel (int rmt_channel, int gpio_num) rmt_tx.tx_config.idle_level = 0; rmt_tx.tx_config.idle_output_en = true; rmt_tx.rmt_mode = RMT_MODE_TX; - rmt_config (&rmt_tx); - rmt_driver_install (rmt_tx.channel, 0, 0); - - rmt_set_tx_thr_intr_en (RMTCHANNEL, true, MAX_PULSES); - rmt_set_mem_block_num (RMTCHANNEL, 1); - rmt_set_mem_pd (RMTCHANNEL, false); - rmt_set_tx_loop_mode (RMTCHANNEL, false); - rmt_set_source_clk (RMTCHANNEL, RMT_BASECLK_APB); - rmt_set_intr_enable_mask (BIT (0) | BIT (24)); + rmt_config(&rmt_tx); + rmt_driver_install(rmt_tx.channel, 0, 0); + + rmt_set_tx_thr_intr_en(RMTCHANNEL, true, MAX_PULSES); + rmt_set_mem_block_num(RMTCHANNEL, 1); + rmt_set_mem_pd(RMTCHANNEL, false); + rmt_set_tx_loop_mode(RMTCHANNEL, false); +#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)) + rmt_set_source_clk(RMTCHANNEL, RMT_BASECLK_DEFAULT); +#else + rmt_set_source_clk(RMTCHANNEL, RMT_BASECLK_APB); +#endif +#if (ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(4, 3, 0)) + rmt_set_intr_enable_mask(BIT(0) | BIT(24)); +#endif return ESP_OK; } -static esp_err_t -ws2812_data_copy (periph_ws2812_t *ws) -{ +static esp_err_t ws2812_data_copy(periph_ws2812_t *ws) { unsigned int i, j, len, bit; len = ws->led_num * 3; - ; // - ws->process.pos; - rmt_item32_t *rmt_data = malloc (sizeof (rmt_item32_t) * len * 8); - - for (i = 0; i < len; i++) - { - bit = ws->process.buffer[i]; - for (j = 0; j < 8; j++, bit <<= 1) - { - if ((bit >> 7) & 0x01) - { - rmt_data[j + i * 8].val = PULSE_BIT1; - } - else - { - rmt_data[j + i * 8].val = PULSE_BIT0; - } - } - if (i + ws->process.pos == ws->led_num * 3 - 1) - { - rmt_data[7 + i * 8].duration1 = PULSE_TRS; - } + ; // - ws->process.pos; + rmt_item32_t *rmt_data = malloc(sizeof(rmt_item32_t) * len * 8); + + for (i = 0; i < len; i++) { + bit = ws->process.buffer[i]; + for (j = 0; j < 8; j++, bit <<= 1) { + if ((bit >> 7) & 0x01) { + rmt_data[j + i * 8].val = PULSE_BIT1; + } else { + rmt_data[j + i * 8].val = PULSE_BIT0; + } + } + if (i + ws->process.pos == ws->led_num * 3 - 1) { + rmt_data[7 + i * 8].duration1 = PULSE_TRS; } + } - rmt_write_items (RMTCHANNEL, rmt_data, len * 8, portMAX_DELAY); + rmt_write_items(RMTCHANNEL, rmt_data, len * 8, portMAX_DELAY); - if (rmt_data) - { - free (rmt_data); - rmt_data = NULL; - } + if (rmt_data) { + free(rmt_data); + rmt_data = NULL; + } return ESP_OK; } -static void -rmt_handle_tx_end (rmt_channel_t channel, void *arg) -{ +static void rmt_handle_tx_end(rmt_channel_t channel, void *arg) { portBASE_TYPE taskAwoken = 0; periph_ws2812_t *ws = (periph_ws2812_t *)(arg); - xSemaphoreGiveFromISR (ws->sem, &taskAwoken); + xSemaphoreGiveFromISR(ws->sem, &taskAwoken); } -static esp_err_t -ws2812_set_colors (periph_ws2812_t *ws) -{ - AUDIO_NULL_CHECK (TAG, ws, return ESP_FAIL); +static esp_err_t ws2812_set_colors(periph_ws2812_t *ws) { + AUDIO_NULL_CHECK(TAG, ws, return ESP_FAIL); - ws->process.buffer = audio_malloc (ws->led_num * 3 * sizeof (uint8_t)); - AUDIO_NULL_CHECK (TAG, ws->process.buffer, return ESP_FAIL); + ws->process.buffer = audio_malloc(ws->led_num * 3 * sizeof(uint8_t)); + AUDIO_NULL_CHECK(TAG, ws->process.buffer, return ESP_FAIL); - for (int i = 0; i < ws->led_num; i++) - { - rgb_value rgb = { .num = ws->color[i] }; - ws->process.buffer[0 + i * 3] = rgb.g; - ws->process.buffer[1 + i * 3] = rgb.r; - ws->process.buffer[2 + i * 3] = rgb.b; - } + for (int i = 0; i < ws->led_num; i++) { + rgb_value rgb = {.num = ws->color[i]}; + ws->process.buffer[0 + i * 3] = rgb.g; + ws->process.buffer[1 + i * 3] = rgb.r; + ws->process.buffer[2 + i * 3] = rgb.b; + } ws->process.pos = 0; ws->process.half = 0; - ws2812_data_copy (ws); - xSemaphoreTake (ws->sem, portMAX_DELAY); - if (ws->process.buffer) - { - audio_free (ws->process.buffer); - ws->process.buffer = NULL; - } + ws2812_data_copy(ws); + xSemaphoreTake(ws->sem, portMAX_DELAY); + if (ws->process.buffer) { + audio_free(ws->process.buffer); + ws->process.buffer = NULL; + } return ESP_OK; } -static void -ws2812_timer_handler (TimerHandle_t tmr) -{ - esp_periph_handle_t periph = (esp_periph_handle_t)pvTimerGetTimerID (tmr); - periph_ws2812_t *periph_ws2812 = esp_periph_get_data (periph); +static void ws2812_timer_handler(TimerHandle_t tmr) { + esp_periph_handle_t periph = (esp_periph_handle_t)pvTimerGetTimerID(tmr); + periph_ws2812_t *periph_ws2812 = esp_periph_get_data(periph); periph_ws2812_state_t *st = periph_ws2812->state; - for (int i = 0; i < periph_ws2812->led_num; i++) - { - switch (st[i].mode) - { - case PERIPH_WS2812_ONE: - if (st[i].is_on) - { - periph_ws2812->color[i] = st[i].color; - ws2812_set_colors (periph_ws2812); - st[i].is_on = false; - st[i].loop = 0; - } - break; - - case PERIPH_WS2812_BLINK: - if (st[i].is_set == false) - { - continue; - } - if (st[i].loop == 0) - { - periph_ws2812->color[i] = LED2812_COLOR_BLACK; - ws2812_set_colors (periph_ws2812); - st[i].is_set = false; - } - - if (st[i].is_on - && audio_sys_get_time_ms () - st[i].tick > st[i].time_off_ms) - { - if (st[i].loop > 0) - { - st[i].loop--; - } - else - { - continue; - } - st[i].is_on = false; - st[i].tick = audio_sys_get_time_ms (); - periph_ws2812->color[i] = st[i].color; - ws2812_set_colors (periph_ws2812); - } - else if (!st[i].is_on - && audio_sys_get_time_ms () - st[i].tick > st[i].time_on_ms) - { - st[i].is_on = true; - st[i].tick = audio_sys_get_time_ms (); - periph_ws2812->color[i] = LED2812_COLOR_BLACK; - ws2812_set_colors (periph_ws2812); - } - break; - - case PERIPH_WS2812_FADE: - if (st[i].is_set == false) - { - continue; - } - if (st[i].loop == 0) - { - periph_ws2812->color[i] = LED2812_COLOR_BLACK; - ws2812_set_colors (periph_ws2812); - st[i].is_set = false; - continue; - } - - if (st[i].is_on - && (audio_sys_get_time_ms () - st[i].tick - > ((st[i].time_on_ms / FADE_STEP)))) - { - st[i].tick = audio_sys_get_time_ms (); - rgb_value rgb = { .num = st[i].color }; - rgb_value rgb1 = { .num = periph_ws2812->color[i] }; - rgb1.r -= (uint8_t)rgb.r / FADE_STEP; - rgb1.g -= (uint8_t)rgb.g / FADE_STEP; - rgb1.b -= (uint8_t)rgb.b / FADE_STEP; - ws2812_set_colors (periph_ws2812); - periph_ws2812->color[i] = rgb1.num; - if ((rgb1.r <= (uint8_t)rgb.r / FADE_STEP) - && (rgb1.g <= (uint8_t)rgb.g / FADE_STEP) - && (rgb1.b <= (uint8_t)rgb.b / FADE_STEP)) - { - st[i].is_on = false; - st[i].loop--; - } - } - else if ((st[i].is_on == false) - && (audio_sys_get_time_ms () - st[i].tick - > ((st[i].time_off_ms / FADE_STEP)))) - { - st[i].tick = audio_sys_get_time_ms (); - rgb_value rgb = { .num = st[i].color }; - rgb_value rgb1 = { .num = periph_ws2812->color[i] }; - rgb1.r += (uint8_t)rgb.r / FADE_STEP; - rgb1.g += (uint8_t)rgb.g / FADE_STEP; - rgb1.b += (uint8_t)rgb.b / FADE_STEP; - ws2812_set_colors (periph_ws2812); - periph_ws2812->color[i] = rgb1.num; - if ((((uint8_t)rgb.r - rgb1.r) <= (uint8_t)rgb.r / FADE_STEP) - && (((uint8_t)rgb.g - rgb1.g) <= (uint8_t)rgb.g / FADE_STEP) - && (((uint8_t)rgb.b - rgb1.b) <= (uint8_t)rgb.b / FADE_STEP)) - { - st[i].is_on = true; - } - } - break; - default: - ESP_LOGW (TAG, "The ws2812 mode[%d] is invalid", st[i].mode); - break; + for (int i = 0; i < periph_ws2812->led_num; i++) { + switch (st[i].mode) { + case PERIPH_WS2812_ONE: + if (st[i].is_on) { + periph_ws2812->color[i] = st[i].color; + ws2812_set_colors(periph_ws2812); + st[i].is_on = false; + st[i].loop = 0; } - } -} + break; -static esp_err_t -_ws2812_run (esp_periph_handle_t periph, audio_event_iface_msg_t *msg) -{ - return ESP_OK; -} - -static esp_err_t -_ws2812_init (esp_periph_handle_t periph) -{ - return ESP_OK; -} + case PERIPH_WS2812_BLINK: + if (st[i].is_set == false) { + continue; + } + if (st[i].loop == 0) { + periph_ws2812->color[i] = LED2812_COLOR_BLACK; + ws2812_set_colors(periph_ws2812); + st[i].is_set = false; + } -static esp_err_t -_ws2812_destroy (esp_periph_handle_t periph) -{ - periph_ws2812_t *periph_ws2812 = esp_periph_get_data (periph); - AUDIO_NULL_CHECK (TAG, periph_ws2812, return ESP_FAIL); - - if (periph_ws2812) - { - periph_ws2812_state_t *st = periph_ws2812->state; - for (int i = 0; i < periph_ws2812->led_num; i++) - { - st[i].color = LED2812_COLOR_BLACK; + if (st[i].is_on && + audio_sys_get_time_ms() - st[i].tick > st[i].time_off_ms) { + if (st[i].loop > 0) { + st[i].loop--; + } else { + continue; + } + st[i].is_on = false; + st[i].tick = audio_sys_get_time_ms(); + periph_ws2812->color[i] = st[i].color; + ws2812_set_colors(periph_ws2812); + } else if (!st[i].is_on && + audio_sys_get_time_ms() - st[i].tick > st[i].time_on_ms) { st[i].is_on = true; - st[i].mode = PERIPH_WS2812_ONE; + st[i].tick = audio_sys_get_time_ms(); + periph_ws2812->color[i] = LED2812_COLOR_BLACK; + ws2812_set_colors(periph_ws2812); } - ws2812_set_colors (periph_ws2812); + break; - if (periph_ws2812->color) - { - audio_free (periph_ws2812->color); - periph_ws2812->color = NULL; + case PERIPH_WS2812_FADE: + if (st[i].is_set == false) { + continue; + } + if (st[i].loop == 0) { + periph_ws2812->color[i] = LED2812_COLOR_BLACK; + ws2812_set_colors(periph_ws2812); + st[i].is_set = false; + continue; } - if (periph_ws2812->state) - { - audio_free (periph_ws2812->state); - periph_ws2812->state = NULL; + if (st[i].is_on && (audio_sys_get_time_ms() - st[i].tick > + ((st[i].time_on_ms / FADE_STEP)))) { + st[i].tick = audio_sys_get_time_ms(); + rgb_value rgb = {.num = st[i].color}; + rgb_value rgb1 = {.num = periph_ws2812->color[i]}; + rgb1.r -= (uint8_t)rgb.r / FADE_STEP; + rgb1.g -= (uint8_t)rgb.g / FADE_STEP; + rgb1.b -= (uint8_t)rgb.b / FADE_STEP; + ws2812_set_colors(periph_ws2812); + periph_ws2812->color[i] = rgb1.num; + if ((rgb1.r <= (uint8_t)rgb.r / FADE_STEP) && + (rgb1.g <= (uint8_t)rgb.g / FADE_STEP) && + (rgb1.b <= (uint8_t)rgb.b / FADE_STEP)) { + st[i].is_on = false; + st[i].loop--; + } + } else if ((st[i].is_on == false) && + (audio_sys_get_time_ms() - st[i].tick > + ((st[i].time_off_ms / FADE_STEP)))) { + st[i].tick = audio_sys_get_time_ms(); + rgb_value rgb = {.num = st[i].color}; + rgb_value rgb1 = {.num = periph_ws2812->color[i]}; + rgb1.r += (uint8_t)rgb.r / FADE_STEP; + rgb1.g += (uint8_t)rgb.g / FADE_STEP; + rgb1.b += (uint8_t)rgb.b / FADE_STEP; + ws2812_set_colors(periph_ws2812); + periph_ws2812->color[i] = rgb1.num; + if ((((uint8_t)rgb.r - rgb1.r) <= (uint8_t)rgb.r / FADE_STEP) && + (((uint8_t)rgb.g - rgb1.g) <= (uint8_t)rgb.g / FADE_STEP) && + (((uint8_t)rgb.b - rgb1.b) <= (uint8_t)rgb.b / FADE_STEP)) { + st[i].is_on = true; + } } + break; + default: + ESP_LOGW(TAG, "The ws2812 mode[%d] is invalid", st[i].mode); + break; + } + } +} - esp_periph_stop_timer (periph); - rmt_tx_stop (RMTCHANNEL); - rmt_driver_uninstall (RMTCHANNEL); - vSemaphoreDelete (periph_ws2812->sem); +static esp_err_t _ws2812_run(esp_periph_handle_t periph, + audio_event_iface_msg_t *msg) { + return ESP_OK; +} - audio_free (periph_ws2812); - periph_ws2812 = NULL; +static esp_err_t _ws2812_init(esp_periph_handle_t periph) { return ESP_OK; } + +static esp_err_t _ws2812_destroy(esp_periph_handle_t periph) { + periph_ws2812_t *periph_ws2812 = esp_periph_get_data(periph); + AUDIO_NULL_CHECK(TAG, periph_ws2812, return ESP_FAIL); + + if (periph_ws2812) { + periph_ws2812_state_t *st = periph_ws2812->state; + for (int i = 0; i < periph_ws2812->led_num; i++) { + st[i].color = LED2812_COLOR_BLACK; + st[i].is_on = true; + st[i].mode = PERIPH_WS2812_ONE; + } + ws2812_set_colors(periph_ws2812); + + if (periph_ws2812->color) { + audio_free(periph_ws2812->color); + periph_ws2812->color = NULL; + } + + if (periph_ws2812->state) { + audio_free(periph_ws2812->state); + periph_ws2812->state = NULL; } + esp_periph_stop_timer(periph); + rmt_tx_stop(RMTCHANNEL); + rmt_driver_uninstall(RMTCHANNEL); + vSemaphoreDelete(periph_ws2812->sem); + + audio_free(periph_ws2812); + periph_ws2812 = NULL; + } + return ESP_OK; } -esp_periph_handle_t -periph_ws2812_init (periph_ws2812_cfg_t *config) -{ - AUDIO_NULL_CHECK (TAG, config, return NULL); +esp_periph_handle_t periph_ws2812_init(periph_ws2812_cfg_t *config) { + AUDIO_NULL_CHECK(TAG, config, return NULL); - esp_periph_handle_t periph - = esp_periph_create (PERIPH_ID_WS2812, "periph_ws2812"); - periph_ws2812_t *periph_ws2812 = audio_calloc (1, sizeof (periph_ws2812_t)); - AUDIO_NULL_CHECK (TAG, periph_ws2812, goto ws2812_init_err); + esp_periph_handle_t periph = + esp_periph_create(PERIPH_ID_WS2812, "periph_ws2812"); + periph_ws2812_t *periph_ws2812 = audio_calloc(1, sizeof(periph_ws2812_t)); + AUDIO_NULL_CHECK(TAG, periph_ws2812, goto ws2812_init_err); periph_ws2812->led_num = config->led_num; periph_ws2812->timer = NULL; - periph_ws2812->sem = xSemaphoreCreateBinary (); + periph_ws2812->sem = xSemaphoreCreateBinary(); periph_ws2812->rmt_intr_handle = NULL; - periph_ws2812->color - = audio_malloc (sizeof (periph_rgb_value) * periph_ws2812->led_num); - AUDIO_NULL_CHECK (TAG, periph_ws2812->color, goto ws2812_init_err); + periph_ws2812->color = + audio_malloc(sizeof(periph_rgb_value) * periph_ws2812->led_num); + AUDIO_NULL_CHECK(TAG, periph_ws2812->color, goto ws2812_init_err); - for (int i = 0; i < periph_ws2812->led_num; i++) - { - periph_ws2812->color[i] = LED2812_COLOR_BLACK; - } + for (int i = 0; i < periph_ws2812->led_num; i++) { + periph_ws2812->color[i] = LED2812_COLOR_BLACK; + } - periph_ws2812->state = audio_malloc (sizeof (periph_ws2812_state_t) - * (periph_ws2812->led_num)); - AUDIO_NULL_CHECK (TAG, periph_ws2812->state, goto ws2812_init_err); + periph_ws2812->state = + audio_malloc(sizeof(periph_ws2812_state_t) * (periph_ws2812->led_num)); + AUDIO_NULL_CHECK(TAG, periph_ws2812->state, goto ws2812_init_err); - ws2812_init_rmt_channel (RMTCHANNEL, (gpio_num_t)config->gpio_num); - esp_periph_set_data (periph, periph_ws2812); - rmt_register_tx_end_callback (rmt_handle_tx_end, (void *)periph_ws2812); + ws2812_init_rmt_channel(RMTCHANNEL, (gpio_num_t)config->gpio_num); + esp_periph_set_data(periph, periph_ws2812); + rmt_register_tx_end_callback(rmt_handle_tx_end, (void *)periph_ws2812); - esp_periph_set_function (periph, _ws2812_init, _ws2812_run, _ws2812_destroy); - ws2812_set_colors (periph_ws2812); - ESP_LOGD (TAG, "periph ws2812 init"); + esp_periph_set_function(periph, _ws2812_init, _ws2812_run, _ws2812_destroy); + ws2812_set_colors(periph_ws2812); + ESP_LOGD(TAG, "periph ws2812 init"); return periph; ws2812_init_err: - if (periph_ws2812->sem) - { - vSemaphoreDelete (periph_ws2812->sem); - periph_ws2812->sem = NULL; - } - if (periph_ws2812->color) - { - audio_free (periph_ws2812->color); - periph_ws2812->color = NULL; - } - if (periph_ws2812->state) - { - audio_free (periph_ws2812->state); - periph_ws2812->state = NULL; - } - if (periph_ws2812) - { - audio_free (periph_ws2812); - periph_ws2812 = NULL; - } - if (periph) - { - audio_free (periph); - } + if (periph_ws2812->sem) { + vSemaphoreDelete(periph_ws2812->sem); + periph_ws2812->sem = NULL; + } + if (periph_ws2812->color) { + audio_free(periph_ws2812->color); + periph_ws2812->color = NULL; + } + if (periph_ws2812->state) { + audio_free(periph_ws2812->state); + periph_ws2812->state = NULL; + } + if (periph_ws2812) { + audio_free(periph_ws2812); + periph_ws2812 = NULL; + } + if (periph) { + audio_free(periph); + } periph = NULL; return periph; } -esp_err_t -periph_ws2812_control (esp_periph_handle_t periph, - periph_ws2812_ctrl_cfg_t *control_cfg, void *ctx) -{ - periph_ws2812_t *periph_ws2812 = esp_periph_get_data (periph); - - AUDIO_NULL_CHECK (TAG, periph_ws2812, return ESP_FAIL); - AUDIO_NULL_CHECK (TAG, control_cfg, return ESP_FAIL); - - for (int i = 0; i < periph_ws2812->led_num; i++) - { - periph_ws2812->state[i].color = control_cfg[i].color; - periph_ws2812->color[i] = control_cfg[i].color; - periph_ws2812->state[i].time_on_ms = control_cfg[i].time_on_ms; - periph_ws2812->state[i].time_off_ms = control_cfg[i].time_off_ms; - periph_ws2812->state[i].tick = audio_sys_get_time_ms (); - periph_ws2812->state[i].loop = control_cfg[i].loop; - periph_ws2812->state[i].is_on = true; - periph_ws2812->state[i].is_set = true; - periph_ws2812->state[i].mode = control_cfg[i].mode; - } - - esp_periph_start_timer (periph, INTERVAL_TIME_MS / portTICK_RATE_MS, - ws2812_timer_handler); +esp_err_t periph_ws2812_control(esp_periph_handle_t periph, + periph_ws2812_ctrl_cfg_t *control_cfg, + void *ctx) { + periph_ws2812_t *periph_ws2812 = esp_periph_get_data(periph); + + AUDIO_NULL_CHECK(TAG, periph_ws2812, return ESP_FAIL); + AUDIO_NULL_CHECK(TAG, control_cfg, return ESP_FAIL); + + for (int i = 0; i < periph_ws2812->led_num; i++) { + periph_ws2812->state[i].color = control_cfg[i].color; + periph_ws2812->color[i] = control_cfg[i].color; + periph_ws2812->state[i].time_on_ms = control_cfg[i].time_on_ms; + periph_ws2812->state[i].time_off_ms = control_cfg[i].time_off_ms; + periph_ws2812->state[i].tick = audio_sys_get_time_ms(); + periph_ws2812->state[i].loop = control_cfg[i].loop; + periph_ws2812->state[i].is_on = true; + periph_ws2812->state[i].is_set = true; + periph_ws2812->state[i].mode = control_cfg[i].mode; + } + + esp_periph_start_timer(periph, INTERVAL_TIME_MS / portTICK_RATE_MS, + ws2812_timer_handler); return ESP_OK; } -esp_err_t -periph_ws2812_stop (esp_periph_handle_t periph) -{ - periph_ws2812_t *periph_ws2812 = esp_periph_get_data (periph); +esp_err_t periph_ws2812_stop(esp_periph_handle_t periph) { + periph_ws2812_t *periph_ws2812 = esp_periph_get_data(periph); - AUDIO_NULL_CHECK (TAG, periph_ws2812, return ESP_FAIL); + AUDIO_NULL_CHECK(TAG, periph_ws2812, return ESP_FAIL); periph_ws2812_state_t *st = periph_ws2812->state; - for (int i = 0; i < periph_ws2812->led_num; i++) - { - st[i].color = LED2812_COLOR_BLACK; - st[i].is_on = true; - st[i].mode = PERIPH_WS2812_ONE; - } - ws2812_set_colors (periph_ws2812); + for (int i = 0; i < periph_ws2812->led_num; i++) { + st[i].color = LED2812_COLOR_BLACK; + st[i].is_on = true; + st[i].mode = PERIPH_WS2812_ONE; + } + ws2812_set_colors(periph_ws2812); return ESP_OK; } diff --git a/components/esp_peripherals/test/esp_peripherals_test.c b/components/esp_peripherals/test/esp_peripherals_test.c index 5699680e..d87623ee 100644 --- a/components/esp_peripherals/test/esp_peripherals_test.c +++ b/components/esp_peripherals/test/esp_peripherals_test.c @@ -6,10 +6,10 @@ * Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in * which case, it is free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the - * Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Software without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. @@ -18,22 +18,23 @@ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. * */ -#include "audio_event_iface.h" -#include "esp_err.h" -#include "esp_log.h" -#include "freertos/FreeRTOS.h" -#include "freertos/task.h" +#include "esp_peripherals.h" + #include #include +#include "audio_event_iface.h" #include "audio_mem.h" #include "board.h" -#include "esp_peripherals.h" +#include "esp_err.h" +#include "esp_log.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" #include "nvs_flash.h" #include "periph_adc_button.h" #include "periph_button.h" @@ -53,537 +54,479 @@ static const char *TAG = "ESP_PERIPH_TEST"; #define TEST_PERIPHERALS_MEMORY_LEAK_TIMES 1000 -static void -periph_adc_button_test (void) -{ - ESP_LOGI (TAG, "Set up peripherals handle"); - esp_periph_config_t periph_cfg = DEFAULT_ESP_PERIPH_SET_CONFIG (); - esp_periph_set_handle_t set = esp_periph_set_init (&periph_cfg); - TEST_ASSERT_NOT_NULL (set); - - ESP_LOGI (TAG, "Register ADC button to peripherals"); - periph_adc_button_cfg_t adc_btn_cfg = PERIPH_ADC_BUTTON_DEFAULT_CONFIG (); - adc_arr_t adc_btn_tag = ADC_DEFAULT_ARR (); +static void periph_adc_button_test(void) { + ESP_LOGI(TAG, "Set up peripherals handle"); + esp_periph_config_t periph_cfg = DEFAULT_ESP_PERIPH_SET_CONFIG(); + esp_periph_set_handle_t set = esp_periph_set_init(&periph_cfg); + TEST_ASSERT_NOT_NULL(set); + + ESP_LOGI(TAG, "Register ADC button to peripherals"); + periph_adc_button_cfg_t adc_btn_cfg = PERIPH_ADC_BUTTON_DEFAULT_CONFIG(); + adc_arr_t adc_btn_tag = ADC_DEFAULT_ARR(); adc_btn_tag.total_steps = 6; - int btn_array[7] = { 190, 600, 1000, 1375, 1775, 2195, 3100 }; + int btn_array[7] = {190, 600, 1000, 1375, 1775, 2195, 3100}; adc_btn_tag.adc_level_step = btn_array; adc_btn_cfg.arr = &adc_btn_tag; adc_btn_cfg.arr_size = 1; - esp_periph_handle_t adc_btn_handle = periph_adc_button_init (&adc_btn_cfg); - TEST_ASSERT_NOT_NULL (adc_btn_handle); - TEST_ASSERT_FALSE (esp_periph_start (set, adc_btn_handle)); - - ESP_LOGI (TAG, "Set up event listener"); - audio_event_iface_cfg_t evt_cfg = AUDIO_EVENT_IFACE_DEFAULT_CFG (); - audio_event_iface_handle_t evt = audio_event_iface_init (&evt_cfg); - TEST_ASSERT_NOT_NULL (evt); - - ESP_LOGI (TAG, "Listening event from peripherals"); - TEST_ASSERT_FALSE (audio_event_iface_set_listener ( - esp_periph_set_get_event_iface (set), evt)); - - ESP_LOGI (TAG, "Test start, please press buttons on the board ... "); - while (1) - { - audio_event_iface_msg_t msg; - TEST_ASSERT_FALSE (audio_event_iface_listen (evt, &msg, portMAX_DELAY)); - ESP_LOGI (TAG, "action: %d, act id: %d", msg.cmd, (int)msg.data); - if ((int)msg.data == 0) - { - ESP_LOGW (TAG, "press id 0, quit test"); - break; - } + esp_periph_handle_t adc_btn_handle = periph_adc_button_init(&adc_btn_cfg); + TEST_ASSERT_NOT_NULL(adc_btn_handle); + TEST_ASSERT_FALSE(esp_periph_start(set, adc_btn_handle)); + + ESP_LOGI(TAG, "Set up event listener"); + audio_event_iface_cfg_t evt_cfg = AUDIO_EVENT_IFACE_DEFAULT_CFG(); + audio_event_iface_handle_t evt = audio_event_iface_init(&evt_cfg); + TEST_ASSERT_NOT_NULL(evt); + + ESP_LOGI(TAG, "Listening event from peripherals"); + TEST_ASSERT_FALSE( + audio_event_iface_set_listener(esp_periph_set_get_event_iface(set), evt)); + + ESP_LOGI(TAG, "Test start, please press buttons on the board ... "); + while (1) { + audio_event_iface_msg_t msg; + TEST_ASSERT_FALSE(audio_event_iface_listen(evt, &msg, portMAX_DELAY)); + ESP_LOGI(TAG, "action: %d, act id: %d", msg.cmd, (int)msg.data); + if ((int)msg.data == 0) { + ESP_LOGW(TAG, "press id 0, quit test"); + break; } - - ESP_LOGI (TAG, "Quit test, release all resources"); - TEST_ASSERT_FALSE (esp_periph_set_stop_all (set)); - TEST_ASSERT_FALSE (audio_event_iface_remove_listener ( - esp_periph_set_get_event_iface (set), evt)); - TEST_ASSERT_FALSE (audio_event_iface_destroy (evt)); - TEST_ASSERT_FALSE (esp_periph_set_destroy (set)); + } + + ESP_LOGI(TAG, "Quit test, release all resources"); + TEST_ASSERT_FALSE(esp_periph_set_stop_all(set)); + TEST_ASSERT_FALSE(audio_event_iface_remove_listener( + esp_periph_set_get_event_iface(set), evt)); + TEST_ASSERT_FALSE(audio_event_iface_destroy(evt)); + TEST_ASSERT_FALSE(esp_periph_set_destroy(set)); } -TEST_CASE ("adc button test", "[peripherals]") { periph_adc_button_test (); } +TEST_CASE("adc button test", "[peripherals]") { periph_adc_button_test(); } -static void -periph_gpio_button_test (void) -{ - ESP_LOGI (TAG, "Set up peripherals handle"); - esp_periph_config_t periph_cfg = DEFAULT_ESP_PERIPH_SET_CONFIG (); - esp_periph_set_handle_t set = esp_periph_set_init (&periph_cfg); - TEST_ASSERT_NOT_NULL (set); +static void periph_gpio_button_test(void) { + ESP_LOGI(TAG, "Set up peripherals handle"); + esp_periph_config_t periph_cfg = DEFAULT_ESP_PERIPH_SET_CONFIG(); + esp_periph_set_handle_t set = esp_periph_set_init(&periph_cfg); + TEST_ASSERT_NOT_NULL(set); - ESP_LOGI (TAG, "Register gpio button to peripherals"); + ESP_LOGI(TAG, "Register gpio button to peripherals"); periph_button_cfg_t btn_cfg = { - .gpio_mask = (1ULL << get_input_rec_id ()) - | (1ULL << get_input_mode_id ()), // REC BTN & MODE BTN + .gpio_mask = (1ULL << get_input_rec_id()) | + (1ULL << get_input_mode_id()), // REC BTN & MODE BTN }; - esp_periph_handle_t button_handle = periph_button_init (&btn_cfg); - TEST_ASSERT_NOT_NULL (button_handle); - TEST_ASSERT_FALSE (esp_periph_start (set, button_handle)); - - ESP_LOGI (TAG, "Set up event listener"); - audio_event_iface_cfg_t evt_cfg = AUDIO_EVENT_IFACE_DEFAULT_CFG (); - audio_event_iface_handle_t evt = audio_event_iface_init (&evt_cfg); - TEST_ASSERT_NOT_NULL (evt); - - ESP_LOGI (TAG, "Listening event from peripherals"); - TEST_ASSERT_FALSE (audio_event_iface_set_listener ( - esp_periph_set_get_event_iface (set), evt)); - - ESP_LOGI (TAG, "Test start, please press buttons on the board ... "); - while (1) - { - audio_event_iface_msg_t msg; - TEST_ASSERT_FALSE (audio_event_iface_listen (evt, &msg, portMAX_DELAY)); - ESP_LOGI (TAG, "action: %d, act id: %d", msg.cmd, (int)msg.data); - if ((int)msg.data == get_input_mode_id ()) - { - ESP_LOGW (TAG, "press [mode] button, quit test"); - break; - } + esp_periph_handle_t button_handle = periph_button_init(&btn_cfg); + TEST_ASSERT_NOT_NULL(button_handle); + TEST_ASSERT_FALSE(esp_periph_start(set, button_handle)); + + ESP_LOGI(TAG, "Set up event listener"); + audio_event_iface_cfg_t evt_cfg = AUDIO_EVENT_IFACE_DEFAULT_CFG(); + audio_event_iface_handle_t evt = audio_event_iface_init(&evt_cfg); + TEST_ASSERT_NOT_NULL(evt); + + ESP_LOGI(TAG, "Listening event from peripherals"); + TEST_ASSERT_FALSE( + audio_event_iface_set_listener(esp_periph_set_get_event_iface(set), evt)); + + ESP_LOGI(TAG, "Test start, please press buttons on the board ... "); + while (1) { + audio_event_iface_msg_t msg; + TEST_ASSERT_FALSE(audio_event_iface_listen(evt, &msg, portMAX_DELAY)); + ESP_LOGI(TAG, "action: %d, act id: %d", msg.cmd, (int)msg.data); + if ((int)msg.data == get_input_mode_id()) { + ESP_LOGW(TAG, "press [mode] button, quit test"); + break; } - - ESP_LOGI (TAG, "Quit test, release all resources"); - TEST_ASSERT_FALSE (esp_periph_set_stop_all (set)); - TEST_ASSERT_FALSE (audio_event_iface_remove_listener ( - esp_periph_set_get_event_iface (set), evt)); - TEST_ASSERT_FALSE (audio_event_iface_destroy (evt)); - TEST_ASSERT_FALSE (esp_periph_set_destroy (set)); + } + + ESP_LOGI(TAG, "Quit test, release all resources"); + TEST_ASSERT_FALSE(esp_periph_set_stop_all(set)); + TEST_ASSERT_FALSE(audio_event_iface_remove_listener( + esp_periph_set_get_event_iface(set), evt)); + TEST_ASSERT_FALSE(audio_event_iface_destroy(evt)); + TEST_ASSERT_FALSE(esp_periph_set_destroy(set)); } -TEST_CASE ("gpio button test", "[peripherals]") { periph_gpio_button_test (); } +TEST_CASE("gpio button test", "[peripherals]") { periph_gpio_button_test(); } -static esp_err_t -play_func (esp_periph_handle_t periph, int argc, char *argv[]) -{ - if (argc == 1) - { - ESP_LOGI (TAG, "play muisc, url:%s", argv[0]); - } - else if (argc == 0) - { - ESP_LOGI (TAG, "play"); - } - else - { - ESP_LOGE (TAG, "error input"); - } +static esp_err_t play_func(esp_periph_handle_t periph, int argc, char *argv[]) { + if (argc == 1) { + ESP_LOGI(TAG, "play music, url:%s", argv[0]); + } else if (argc == 0) { + ESP_LOGI(TAG, "play"); + } else { + ESP_LOGE(TAG, "error input"); + } return ESP_OK; } -static esp_err_t -pause_func (esp_periph_handle_t periph, int argc, char *argv[]) -{ - if (argc == 0) - { - ESP_LOGI (TAG, "pause"); - } - else - { - ESP_LOGE (TAG, "error input"); - } +static esp_err_t pause_func(esp_periph_handle_t periph, int argc, + char *argv[]) { + if (argc == 0) { + ESP_LOGI(TAG, "pause"); + } else { + ESP_LOGE(TAG, "error input"); + } return ESP_OK; } static bool task_flag; -static esp_err_t -quit_func (esp_periph_handle_t periph, int argc, char *argv[]) -{ - if (argc == 0) - { - ESP_LOGI (TAG, "quit console"); - task_flag = false; - } - else - { - ESP_LOGE (TAG, "error input"); - } +static esp_err_t quit_func(esp_periph_handle_t periph, int argc, char *argv[]) { + if (argc == 0) { + ESP_LOGI(TAG, "quit console"); + task_flag = false; + } else { + ESP_LOGE(TAG, "error input"); + } return ESP_OK; } const periph_console_cmd_t cli_cmd[] = { - { - .cmd = "play", - .id = 0, - .help = "play music", - .func = play_func, - }, - { - .cmd = "pause", - .id = 1, - .help = "pause music", - .func = pause_func, - }, - { .cmd = "quit", .id = 2, .help = "quit command line", .func = quit_func } -}; - -static void -periph_console_test (void) -{ - ESP_LOGI (TAG, "Set up peripherals handle"); - esp_periph_config_t periph_cfg = DEFAULT_ESP_PERIPH_SET_CONFIG (); - esp_periph_set_handle_t set = esp_periph_set_init (&periph_cfg); - TEST_ASSERT_NOT_NULL (set); - - ESP_LOGI (TAG, "Register console to peripherals"); + { + .cmd = "play", + .id = 0, + .help = "play music", + .func = play_func, + }, + { + .cmd = "pause", + .id = 1, + .help = "pause music", + .func = pause_func, + }, + {.cmd = "quit", .id = 2, .help = "quit command line", .func = quit_func}}; + +static void periph_console_test(void) { + ESP_LOGI(TAG, "Set up peripherals handle"); + esp_periph_config_t periph_cfg = DEFAULT_ESP_PERIPH_SET_CONFIG(); + esp_periph_set_handle_t set = esp_periph_set_init(&periph_cfg); + TEST_ASSERT_NOT_NULL(set); + + ESP_LOGI(TAG, "Register console to peripherals"); periph_console_cfg_t console_cfg = { - .command_num = sizeof (cli_cmd) / sizeof (periph_console_cmd_t), - .commands = cli_cmd, + .command_num = sizeof(cli_cmd) / sizeof(periph_console_cmd_t), + .commands = cli_cmd, }; - esp_periph_handle_t console_handle = periph_console_init (&console_cfg); - TEST_ASSERT_NOT_NULL (console_handle); + esp_periph_handle_t console_handle = periph_console_init(&console_cfg); + TEST_ASSERT_NOT_NULL(console_handle); task_flag = true; - ESP_LOGI (TAG, "Start console, please input ..."); - TEST_ASSERT_FALSE (esp_periph_start (set, console_handle)); + ESP_LOGI(TAG, "Start console, please input ..."); + TEST_ASSERT_FALSE(esp_periph_start(set, console_handle)); - while (task_flag) - { - vTaskDelay (10 / portTICK_RATE_MS); - } + while (task_flag) { + vTaskDelay(10 / portTICK_RATE_MS); + } - ESP_LOGI (TAG, "Quit test, release all resources"); - TEST_ASSERT_FALSE (esp_periph_set_stop_all (set)); - TEST_ASSERT_FALSE (esp_periph_set_destroy (set)); + ESP_LOGI(TAG, "Quit test, release all resources"); + TEST_ASSERT_FALSE(esp_periph_set_stop_all(set)); + TEST_ASSERT_FALSE(esp_periph_set_destroy(set)); } -TEST_CASE ("console test", "[peripherals]") { periph_console_test (); } - -static void -periph_gpio_isr_test (void) -{ - ESP_LOGI (TAG, "Set up peripherals handle"); - esp_periph_config_t periph_cfg = DEFAULT_ESP_PERIPH_SET_CONFIG (); - esp_periph_set_handle_t set = esp_periph_set_init (&periph_cfg); - TEST_ASSERT_NOT_NULL (set); - - ESP_LOGI (TAG, "Register gpio isr to peripherals"); - gpio_isr_info_t gpio_isr_info - = { .gpio_num = SDCARD_INTR_GPIO, .type = GPIO_INTR_ANYEDGE }; - periph_gpio_isr_cfg_t gpio_isr_cfg - = { .info_size = 1, .gpio_isr_info = &gpio_isr_info }; - esp_periph_handle_t gpio_isr_handle = periph_gpio_isr_init (&gpio_isr_cfg); - TEST_ASSERT_NOT_NULL (gpio_isr_handle); - TEST_ASSERT_FALSE (esp_periph_start (set, gpio_isr_handle)); - - ESP_LOGI (TAG, "Set up event listener"); - audio_event_iface_cfg_t evt_cfg = AUDIO_EVENT_IFACE_DEFAULT_CFG (); - audio_event_iface_handle_t evt = audio_event_iface_init (&evt_cfg); - TEST_ASSERT_NOT_NULL (evt); - - ESP_LOGI (TAG, "Listening event from peripherals, please insert a sdcard to " - "the board ..."); - TEST_ASSERT_FALSE (audio_event_iface_set_listener ( - esp_periph_set_get_event_iface (set), evt)); - - while (1) - { - audio_event_iface_msg_t msg; - TEST_ASSERT_FALSE (audio_event_iface_listen (evt, &msg, portMAX_DELAY)); - - if ((int)msg.data == SDCARD_INTR_GPIO) - { - ESP_LOGW (TAG, "Detect sdcard insertion, quit test"); - break; - } +TEST_CASE("console test", "[peripherals]") { periph_console_test(); } + +static void periph_gpio_isr_test(void) { + ESP_LOGI(TAG, "Set up peripherals handle"); + esp_periph_config_t periph_cfg = DEFAULT_ESP_PERIPH_SET_CONFIG(); + esp_periph_set_handle_t set = esp_periph_set_init(&periph_cfg); + TEST_ASSERT_NOT_NULL(set); + + ESP_LOGI(TAG, "Register gpio isr to peripherals"); + gpio_isr_info_t gpio_isr_info = {.gpio_num = SDCARD_INTR_GPIO, + .type = GPIO_INTR_ANYEDGE}; + periph_gpio_isr_cfg_t gpio_isr_cfg = {.info_size = 1, + .gpio_isr_info = &gpio_isr_info}; + esp_periph_handle_t gpio_isr_handle = periph_gpio_isr_init(&gpio_isr_cfg); + TEST_ASSERT_NOT_NULL(gpio_isr_handle); + TEST_ASSERT_FALSE(esp_periph_start(set, gpio_isr_handle)); + + ESP_LOGI(TAG, "Set up event listener"); + audio_event_iface_cfg_t evt_cfg = AUDIO_EVENT_IFACE_DEFAULT_CFG(); + audio_event_iface_handle_t evt = audio_event_iface_init(&evt_cfg); + TEST_ASSERT_NOT_NULL(evt); + + ESP_LOGI(TAG, + "Listening event from peripherals, please insert a sdcard to the " + "board ..."); + TEST_ASSERT_FALSE( + audio_event_iface_set_listener(esp_periph_set_get_event_iface(set), evt)); + + while (1) { + audio_event_iface_msg_t msg; + TEST_ASSERT_FALSE(audio_event_iface_listen(evt, &msg, portMAX_DELAY)); + + if ((int)msg.data == SDCARD_INTR_GPIO) { + ESP_LOGW(TAG, "Detect sdcard insertion, quit test"); + break; } - - ESP_LOGI (TAG, "Quit test, release all resources"); - TEST_ASSERT_FALSE (esp_periph_set_stop_all (set)); - TEST_ASSERT_FALSE (audio_event_iface_remove_listener ( - esp_periph_set_get_event_iface (set), evt)); - TEST_ASSERT_FALSE (audio_event_iface_destroy (evt)); - TEST_ASSERT_FALSE (esp_periph_set_destroy (set)); + } + + ESP_LOGI(TAG, "Quit test, release all resources"); + TEST_ASSERT_FALSE(esp_periph_set_stop_all(set)); + TEST_ASSERT_FALSE(audio_event_iface_remove_listener( + esp_periph_set_get_event_iface(set), evt)); + TEST_ASSERT_FALSE(audio_event_iface_destroy(evt)); + TEST_ASSERT_FALSE(esp_periph_set_destroy(set)); } -TEST_CASE ("gpio isr test", "[peripherals]") { periph_gpio_isr_test (); } +TEST_CASE("gpio isr test", "[peripherals]") { periph_gpio_isr_test(); } -static void -periph_is31fl3216_test (void) -{ - ESP_LOGI (TAG, "Set up peripherals handle"); - esp_periph_config_t periph_cfg = DEFAULT_ESP_PERIPH_SET_CONFIG (); - esp_periph_set_handle_t set = esp_periph_set_init (&periph_cfg); - TEST_ASSERT_NOT_NULL (set); - periph_is31fl3216_cfg_t is31fl3216_cfg = { .state = IS31FL3216_STATE_ON }; +static void periph_is31fl3216_test(void) { + ESP_LOGI(TAG, "Set up peripherals handle"); + esp_periph_config_t periph_cfg = DEFAULT_ESP_PERIPH_SET_CONFIG(); + esp_periph_set_handle_t set = esp_periph_set_init(&periph_cfg); + TEST_ASSERT_NOT_NULL(set); + periph_is31fl3216_cfg_t is31fl3216_cfg = {.state = IS31FL3216_STATE_ON}; - ESP_LOGI (TAG, "Register gpio isr to peripherals"); - esp_periph_handle_t is31fl3216_handle - = periph_is31fl3216_init (&is31fl3216_cfg); - TEST_ASSERT_FALSE (esp_periph_start (set, is31fl3216_handle)); + ESP_LOGI(TAG, "Register gpio isr to peripherals"); + esp_periph_handle_t is31fl3216_handle = + periph_is31fl3216_init(&is31fl3216_cfg); + TEST_ASSERT_FALSE(esp_periph_start(set, is31fl3216_handle)); - for (int i = 0; i < BLUE_LED_MAX_NUM; i++) - { - TEST_ASSERT_FALSE ( - periph_is31fl3216_set_duty (is31fl3216_handle, i, 255)); - } + for (int i = 0; i < BLUE_LED_MAX_NUM; i++) { + TEST_ASSERT_FALSE(periph_is31fl3216_set_duty(is31fl3216_handle, i, 255)); + } - TEST_ASSERT_FALSE (periph_is31fl3216_set_light_on_num (is31fl3216_handle, 1, - BLUE_LED_MAX_NUM)); - TEST_ASSERT_FALSE (periph_is31fl3216_set_interval (is31fl3216_handle, 100)); - TEST_ASSERT_FALSE (periph_is31fl3216_set_shift_mode ( + TEST_ASSERT_FALSE(periph_is31fl3216_set_light_on_num(is31fl3216_handle, 1, + BLUE_LED_MAX_NUM)); + TEST_ASSERT_FALSE(periph_is31fl3216_set_interval(is31fl3216_handle, 100)); + TEST_ASSERT_FALSE(periph_is31fl3216_set_shift_mode( is31fl3216_handle, PERIPH_IS31_SHIFT_MODE_ACC)); - TEST_ASSERT_FALSE ( - periph_is31fl3216_set_state (is31fl3216_handle, IS31FL3216_STATE_SHIFT)); - ESP_LOGI (TAG, "Start testing for 5 seconds..."); + TEST_ASSERT_FALSE( + periph_is31fl3216_set_state(is31fl3216_handle, IS31FL3216_STATE_SHIFT)); + ESP_LOGI(TAG, "Start testing for 5 seconds..."); - vTaskDelay (5000 / portTICK_RATE_MS); + vTaskDelay(5000 / portTICK_RATE_MS); - ESP_LOGI (TAG, "Quit test, release all resources"); - TEST_ASSERT_FALSE (esp_periph_set_stop_all (set)); - TEST_ASSERT_FALSE (esp_periph_set_destroy (set)); + ESP_LOGI(TAG, "Quit test, release all resources"); + TEST_ASSERT_FALSE(esp_periph_set_stop_all(set)); + TEST_ASSERT_FALSE(esp_periph_set_destroy(set)); } -TEST_CASE ("is31fl3216 test", "[peripherals]") { periph_is31fl3216_test (); } +TEST_CASE("is31fl3216 test", "[peripherals]") { periph_is31fl3216_test(); } -static void -periph_led_test (void) -{ - ESP_LOGI (TAG, "Set up peripherals handle"); - esp_periph_config_t periph_cfg = DEFAULT_ESP_PERIPH_SET_CONFIG (); - esp_periph_set_handle_t set = esp_periph_set_init (&periph_cfg); - TEST_ASSERT_NOT_NULL (set); +static void periph_led_test(void) { + ESP_LOGI(TAG, "Set up peripherals handle"); + esp_periph_config_t periph_cfg = DEFAULT_ESP_PERIPH_SET_CONFIG(); + esp_periph_set_handle_t set = esp_periph_set_init(&periph_cfg); + TEST_ASSERT_NOT_NULL(set); periph_led_cfg_t led_cfg = { - .led_speed_mode = LEDC_LOW_SPEED_MODE, - .led_duty_resolution = LEDC_TIMER_10_BIT, - .led_timer_num = LEDC_TIMER_0, - .led_freq_hz = 5000, + .led_speed_mode = LEDC_LOW_SPEED_MODE, + .led_duty_resolution = LEDC_TIMER_10_BIT, + .led_timer_num = LEDC_TIMER_0, + .led_freq_hz = 5000, }; - esp_periph_handle_t led_handle = periph_led_init (&led_cfg); - TEST_ASSERT_FALSE (esp_periph_start (set, led_handle)); - - TEST_ASSERT_FALSE (periph_led_blink (led_handle, get_blue_led_gpio (), 1000, - 1000, true, -1, 0)); - TEST_ASSERT_FALSE (periph_led_blink (led_handle, get_green_led_gpio (), 500, - 500, false, 4, 0)); - - ESP_LOGI (TAG, "running..."); - vTaskDelay (1000 / portTICK_RATE_MS); - ESP_LOGI (TAG, "STOP BLUE LED"); - TEST_ASSERT_FALSE (periph_led_stop (led_handle, get_blue_led_gpio ())); - - vTaskDelay (1000 / portTICK_RATE_MS); - ESP_LOGI (TAG, "Changing blink preset..."); - TEST_ASSERT_FALSE (periph_led_blink (led_handle, get_blue_led_gpio (), 500, - 200, false, -1, 0)); - TEST_ASSERT_FALSE (periph_led_blink (led_handle, get_green_led_gpio (), 500, - 1000, true, -1, 0)); - - ESP_LOGI (TAG, "Quit test, release all resources"); - TEST_ASSERT_FALSE (esp_periph_set_stop_all (set)); - TEST_ASSERT_FALSE (esp_periph_set_destroy (set)); + esp_periph_handle_t led_handle = periph_led_init(&led_cfg); + TEST_ASSERT_FALSE(esp_periph_start(set, led_handle)); + + TEST_ASSERT_FALSE(periph_led_blink(led_handle, get_blue_led_gpio(), 1000, + 1000, true, -1, 0)); + TEST_ASSERT_FALSE(periph_led_blink(led_handle, get_green_led_gpio(), 500, 500, + false, 4, 0)); + + ESP_LOGI(TAG, "running..."); + vTaskDelay(1000 / portTICK_RATE_MS); + ESP_LOGI(TAG, "STOP BLUE LED"); + TEST_ASSERT_FALSE(periph_led_stop(led_handle, get_blue_led_gpio())); + + vTaskDelay(1000 / portTICK_RATE_MS); + ESP_LOGI(TAG, "Changing blink preset..."); + TEST_ASSERT_FALSE(periph_led_blink(led_handle, get_blue_led_gpio(), 500, 200, + false, -1, 0)); + TEST_ASSERT_FALSE(periph_led_blink(led_handle, get_green_led_gpio(), 500, + 1000, true, -1, 0)); + + ESP_LOGI(TAG, "Quit test, release all resources"); + TEST_ASSERT_FALSE(esp_periph_set_stop_all(set)); + TEST_ASSERT_FALSE(esp_periph_set_destroy(set)); } -TEST_CASE ("led test", "[peripherals]") { periph_led_test (); } +TEST_CASE("led test", "[peripherals]") { periph_led_test(); } -static void -periph_sdcard_test (void) -{ - ESP_LOGI (TAG, "Set up peripherals handle"); - esp_periph_config_t periph_cfg = DEFAULT_ESP_PERIPH_SET_CONFIG (); - esp_periph_set_handle_t set = esp_periph_set_init (&periph_cfg); - TEST_ASSERT_NOT_NULL (set); +static void periph_sdcard_test(void) { + ESP_LOGI(TAG, "Set up peripherals handle"); + esp_periph_config_t periph_cfg = DEFAULT_ESP_PERIPH_SET_CONFIG(); + esp_periph_set_handle_t set = esp_periph_set_init(&periph_cfg); + TEST_ASSERT_NOT_NULL(set); #ifdef CONFIG_ESP_LYRAT_MINI_V1_1_BOARD gpio_config_t sdcard_pwr_pin_cfg = { - .pin_bit_mask = 1UL << SDCARD_PWR_CTRL, - .mode = GPIO_MODE_OUTPUT, - .pull_up_en = GPIO_PULLUP_DISABLE, - .pull_down_en = GPIO_PULLDOWN_DISABLE, - .intr_type = GPIO_INTR_DISABLE, + .pin_bit_mask = 1UL << SDCARD_PWR_CTRL, + .mode = GPIO_MODE_OUTPUT, + .pull_up_en = GPIO_PULLUP_DISABLE, + .pull_down_en = GPIO_PULLDOWN_DISABLE, + .intr_type = GPIO_INTR_DISABLE, }; - gpio_config (&sdcard_pwr_pin_cfg); - gpio_set_level (SDCARD_PWR_CTRL, 0); + gpio_config(&sdcard_pwr_pin_cfg); + gpio_set_level(SDCARD_PWR_CTRL, 0); #endif - periph_sdcard_cfg_t sdcard_cfg - = { .card_detect_pin = get_sdcard_intr_gpio (), .root = "/sdcard" }; + periph_sdcard_cfg_t sdcard_cfg = {.card_detect_pin = get_sdcard_intr_gpio(), + .root = "/sdcard"}; - esp_periph_handle_t sdcard_handle = periph_sdcard_init (&sdcard_cfg); - TEST_ASSERT_NOT_NULL (sdcard_handle); - TEST_ASSERT_FALSE (esp_periph_start (set, sdcard_handle)); + esp_periph_handle_t sdcard_handle = periph_sdcard_init(&sdcard_cfg); + TEST_ASSERT_NOT_NULL(sdcard_handle); + TEST_ASSERT_FALSE(esp_periph_start(set, sdcard_handle)); - while (!periph_sdcard_is_mounted (sdcard_handle)) - { - vTaskDelay (500 / portTICK_PERIOD_MS); - } + while (!periph_sdcard_is_mounted(sdcard_handle)) { + vTaskDelay(500 / portTICK_PERIOD_MS); + } - ESP_LOGI (TAG, "Write a string to sdcard"); - FILE *fp = fopen ("/sdcard/test", "w+"); - TEST_ASSERT_NOT_NULL (fp); + ESP_LOGI(TAG, "Wirte a string to sdcard"); + FILE *fp = fopen("/sdcard/test", "w+"); + TEST_ASSERT_NOT_NULL(fp); char test_str[] = "hello, this is sdcard test"; - TEST_ASSERT_EQUAL_INT (strlen (test_str), - fwrite (test_str, 1, strlen (test_str), fp)); - TEST_ASSERT_FALSE (fsync (fileno (fp))); - TEST_ASSERT_FALSE (fclose (fp)); - - ESP_LOGI (TAG, "Read a string from sdcard"); - fp = fopen ("/sdcard/test", "r"); - TEST_ASSERT_NOT_NULL (fp); - char *read_str = audio_calloc (1, strlen (test_str) + 1); - TEST_ASSERT_NOT_NULL (read_str); - TEST_ASSERT_EQUAL_INT (strlen (test_str), - fread (read_str, 1, strlen (test_str), fp)); - ESP_LOGW (TAG, "read string from sdcard file: %s", read_str); - TEST_ASSERT_EQUAL_INT (0, strncmp (read_str, test_str, strlen (test_str))); - - ESP_LOGI (TAG, "Quit test, release all resources"); - TEST_ASSERT_FALSE (esp_periph_set_stop_all (set)); - TEST_ASSERT_FALSE (esp_periph_set_destroy (set)); - free (read_str); - fclose (fp); + TEST_ASSERT_EQUAL_INT(strlen(test_str), + fwrite(test_str, 1, strlen(test_str), fp)); + TEST_ASSERT_FALSE(fsync(fileno(fp))); + TEST_ASSERT_FALSE(fclose(fp)); + + ESP_LOGI(TAG, "Read a string from sdcard"); + fp = fopen("/sdcard/test", "r"); + TEST_ASSERT_NOT_NULL(fp); + char *read_str = audio_calloc(1, strlen(test_str) + 1); + TEST_ASSERT_NOT_NULL(read_str); + TEST_ASSERT_EQUAL_INT(strlen(test_str), + fread(read_str, 1, strlen(test_str), fp)); + ESP_LOGW(TAG, "read string from sdcard file: %s", read_str); + TEST_ASSERT_EQUAL_INT(0, strncmp(read_str, test_str, strlen(test_str))); + + ESP_LOGI(TAG, "Quit test, release all resources"); + TEST_ASSERT_FALSE(esp_periph_set_stop_all(set)); + TEST_ASSERT_FALSE(esp_periph_set_destroy(set)); + free(read_str); + fclose(fp); } -TEST_CASE ("sdcard test", "[peripherals]") { periph_sdcard_test (); } - -static void -periph_spiffs_test (void) -{ - ESP_LOGI (TAG, "Set up peripherals handle"); - esp_periph_config_t periph_cfg = DEFAULT_ESP_PERIPH_SET_CONFIG (); - esp_periph_set_handle_t set = esp_periph_set_init (&periph_cfg); - TEST_ASSERT_NOT_NULL (set); - - periph_spiffs_cfg_t spiffs_cfg = { .root = "/spiffs", - .max_files = 5, - .format_if_mount_failed = true, - .partition_label = NULL }; - esp_periph_handle_t spiffs_handle = periph_spiffs_init (&spiffs_cfg); - TEST_ASSERT_NOT_NULL (spiffs_handle); - TEST_ASSERT_FALSE (esp_periph_start (set, spiffs_handle)); - - while (!periph_spiffs_is_mounted (spiffs_handle)) - { - vTaskDelay (500 / portTICK_PERIOD_MS); - } +TEST_CASE("sdcard test", "[peripherals]") { periph_sdcard_test(); } + +static void periph_spiffs_test(void) { + ESP_LOGI(TAG, "Set up peripherals handle"); + esp_periph_config_t periph_cfg = DEFAULT_ESP_PERIPH_SET_CONFIG(); + esp_periph_set_handle_t set = esp_periph_set_init(&periph_cfg); + TEST_ASSERT_NOT_NULL(set); + + periph_spiffs_cfg_t spiffs_cfg = {.root = "/spiffs", + .max_files = 5, + .format_if_mount_failed = true, + .partition_label = NULL}; + esp_periph_handle_t spiffs_handle = periph_spiffs_init(&spiffs_cfg); + TEST_ASSERT_NOT_NULL(spiffs_handle); + TEST_ASSERT_FALSE(esp_periph_start(set, spiffs_handle)); - FILE *fp = fopen ("/spiffs/test", "w+"); - TEST_ASSERT_NOT_NULL (fp); + while (!periph_spiffs_is_mounted(spiffs_handle)) { + vTaskDelay(500 / portTICK_PERIOD_MS); + } + + FILE *fp = fopen("/spiffs/test", "w+"); + TEST_ASSERT_NOT_NULL(fp); char test_str[] = "hello, this is spiffs test"; - TEST_ASSERT_EQUAL_INT (strlen (test_str), - fwrite (test_str, 1, strlen (test_str), fp)); - TEST_ASSERT_FALSE (fclose (fp)); - - ESP_LOGI (TAG, "Read a string from spiffs"); - fp = fopen ("/spiffs/test", "r"); - TEST_ASSERT_NOT_NULL (fp); - char *read_str = audio_calloc (1, strlen (test_str) + 1); - TEST_ASSERT_NOT_NULL (read_str); - TEST_ASSERT_EQUAL_INT (strlen (test_str), - fread (read_str, 1, strlen (test_str), fp)); - ESP_LOGW (TAG, "read string from spiffs file: %s", read_str); - TEST_ASSERT_EQUAL_INT (0, strncmp (read_str, test_str, strlen (test_str))); - fclose (fp); - - ESP_LOGI (TAG, "Quit test, release all resources"); - TEST_ASSERT_FALSE (esp_periph_set_stop_all (set)); - TEST_ASSERT_FALSE (esp_periph_set_destroy (set)); - free (read_str); + TEST_ASSERT_EQUAL_INT(strlen(test_str), + fwrite(test_str, 1, strlen(test_str), fp)); + TEST_ASSERT_FALSE(fclose(fp)); + + ESP_LOGI(TAG, "Read a string from spiffs"); + fp = fopen("/spiffs/test", "r"); + TEST_ASSERT_NOT_NULL(fp); + char *read_str = audio_calloc(1, strlen(test_str) + 1); + TEST_ASSERT_NOT_NULL(read_str); + TEST_ASSERT_EQUAL_INT(strlen(test_str), + fread(read_str, 1, strlen(test_str), fp)); + ESP_LOGW(TAG, "read string from spiffs file: %s", read_str); + TEST_ASSERT_EQUAL_INT(0, strncmp(read_str, test_str, strlen(test_str))); + fclose(fp); + + ESP_LOGI(TAG, "Quit test, release all resources"); + TEST_ASSERT_FALSE(esp_periph_set_stop_all(set)); + TEST_ASSERT_FALSE(esp_periph_set_destroy(set)); + free(read_str); } -TEST_CASE ("spiffs test", "[peripherals]") { periph_spiffs_test (); } +TEST_CASE("spiffs test", "[peripherals]") { periph_spiffs_test(); } -static void -periph_touch_pad_test (void) -{ - ESP_LOGI (TAG, "Set up peripherals handle"); - esp_periph_config_t periph_cfg = DEFAULT_ESP_PERIPH_SET_CONFIG (); - esp_periph_set_handle_t set = esp_periph_set_init (&periph_cfg); - TEST_ASSERT_NOT_NULL (set); +static void periph_touch_pad_test(void) { + ESP_LOGI(TAG, "Set up peripherals handle"); + esp_periph_config_t periph_cfg = DEFAULT_ESP_PERIPH_SET_CONFIG(); + esp_periph_set_handle_t set = esp_periph_set_init(&periph_cfg); + TEST_ASSERT_NOT_NULL(set); - ESP_LOGI (TAG, "Register touch pad to peripherals"); + ESP_LOGI(TAG, "Register touch pad to peripherals"); periph_touch_cfg_t touch_cfg = { - .touch_mask - = TOUCH_PAD_SEL4 | TOUCH_PAD_SEL7 | TOUCH_PAD_SEL8 | TOUCH_PAD_SEL9, - .tap_threshold_percent = 70, + .touch_mask = + TOUCH_PAD_SEL4 | TOUCH_PAD_SEL7 | TOUCH_PAD_SEL8 | TOUCH_PAD_SEL9, + .tap_threshold_percent = 70, }; - esp_periph_handle_t touch_handle = periph_touch_init (&touch_cfg); - TEST_ASSERT_NOT_NULL (touch_handle); - TEST_ASSERT_FALSE (esp_periph_start (set, touch_handle)); - - ESP_LOGI (TAG, "Set up event listener"); - audio_event_iface_cfg_t evt_cfg = AUDIO_EVENT_IFACE_DEFAULT_CFG (); - audio_event_iface_handle_t evt = audio_event_iface_init (&evt_cfg); - TEST_ASSERT_NOT_NULL (evt); - - ESP_LOGI (TAG, - "Listening event from peripherals, please press the touch pad"); - TEST_ASSERT_FALSE (audio_event_iface_set_listener ( - esp_periph_set_get_event_iface (set), evt)); + esp_periph_handle_t touch_handle = periph_touch_init(&touch_cfg); + TEST_ASSERT_NOT_NULL(touch_handle); + TEST_ASSERT_FALSE(esp_periph_start(set, touch_handle)); + + ESP_LOGI(TAG, "Set up event listener"); + audio_event_iface_cfg_t evt_cfg = AUDIO_EVENT_IFACE_DEFAULT_CFG(); + audio_event_iface_handle_t evt = audio_event_iface_init(&evt_cfg); + TEST_ASSERT_NOT_NULL(evt); + + ESP_LOGI(TAG, "Listening event from peripherals, please press the touch pad"); + TEST_ASSERT_FALSE( + audio_event_iface_set_listener(esp_periph_set_get_event_iface(set), evt)); + + while (1) { + audio_event_iface_msg_t msg; + TEST_ASSERT_FALSE(audio_event_iface_listen(evt, &msg, portMAX_DELAY)); + if ((int)msg.data == get_input_set_id()) { + ESP_LOGI(TAG, "[set] touched, quit test"); + break; + } - while (1) - { - audio_event_iface_msg_t msg; - TEST_ASSERT_FALSE (audio_event_iface_listen (evt, &msg, portMAX_DELAY)); - if ((int)msg.data == get_input_set_id ()) - { - ESP_LOGI (TAG, "[set] touched, quit test"); - break; - } - - if (msg.cmd == PERIPH_TOUCH_TAP) - { - if ((int)msg.data == get_input_play_id ()) - { - ESP_LOGI (TAG, "[play] touched"); - } - if ((int)msg.data == get_input_volup_id ()) - { - ESP_LOGI (TAG, "[vol+] touched"); - } - if ((int)msg.data == get_input_voldown_id ()) - { - ESP_LOGI (TAG, "[vol-] touched"); - } - } - - if (msg.cmd == PERIPH_TOUCH_RELEASE) - { - if ((int)msg.data == get_input_play_id ()) - { - ESP_LOGI (TAG, "[play] released"); - } - if ((int)msg.data == get_input_volup_id ()) - { - ESP_LOGI (TAG, "[vol+] released"); - } - if ((int)msg.data == get_input_voldown_id ()) - { - ESP_LOGI (TAG, "[vol-] released"); - } - } + if (msg.cmd == PERIPH_TOUCH_TAP) { + if ((int)msg.data == get_input_play_id()) { + ESP_LOGI(TAG, "[play] touched"); + } + if ((int)msg.data == get_input_volup_id()) { + ESP_LOGI(TAG, "[vol+] touched"); + } + if ((int)msg.data == get_input_voldown_id()) { + ESP_LOGI(TAG, "[vol-] touched"); + } } - ESP_LOGI (TAG, "Quit test, release all resources"); - TEST_ASSERT_FALSE (esp_periph_set_stop_all (set)); - TEST_ASSERT_FALSE (audio_event_iface_remove_listener ( - esp_periph_set_get_event_iface (set), evt)); - TEST_ASSERT_FALSE (audio_event_iface_destroy (evt)); - TEST_ASSERT_FALSE (esp_periph_set_destroy (set)); + if (msg.cmd == PERIPH_TOUCH_RELEASE) { + if ((int)msg.data == get_input_play_id()) { + ESP_LOGI(TAG, "[play] released"); + } + if ((int)msg.data == get_input_volup_id()) { + ESP_LOGI(TAG, "[vol+] released"); + } + if ((int)msg.data == get_input_voldown_id()) { + ESP_LOGI(TAG, "[vol-] released"); + } + } + } + + ESP_LOGI(TAG, "Quit test, release all resources"); + TEST_ASSERT_FALSE(esp_periph_set_stop_all(set)); + TEST_ASSERT_FALSE(audio_event_iface_remove_listener( + esp_periph_set_get_event_iface(set), evt)); + TEST_ASSERT_FALSE(audio_event_iface_destroy(evt)); + TEST_ASSERT_FALSE(esp_periph_set_destroy(set)); } -static void -periph_ws2812_test (void) -{ - ESP_LOGI (TAG, "Set up peripherals handle"); - esp_periph_config_t periph_cfg = DEFAULT_ESP_PERIPH_SET_CONFIG (); - esp_periph_set_handle_t set = esp_periph_set_init (&periph_cfg); - TEST_ASSERT_NOT_NULL (set); +static void periph_ws2812_test(void) { + ESP_LOGI(TAG, "Set up peripherals handle"); + esp_periph_config_t periph_cfg = DEFAULT_ESP_PERIPH_SET_CONFIG(); + esp_periph_set_handle_t set = esp_periph_set_init(&periph_cfg); + TEST_ASSERT_NOT_NULL(set); periph_ws2812_cfg_t cfg = { - .gpio_num = GPIO_NUM_3, - .led_num = 2, + .gpio_num = GPIO_NUM_3, + .led_num = 2, }; - esp_periph_handle_t handle = periph_ws2812_init (&cfg); - TEST_ASSERT_FALSE (esp_periph_start (set, handle)); + esp_periph_handle_t handle = periph_ws2812_init(&cfg); + TEST_ASSERT_FALSE(esp_periph_start(set, handle)); - periph_ws2812_ctrl_cfg_t *control_cfg - = malloc (sizeof (periph_ws2812_ctrl_cfg_t) * cfg.led_num); + periph_ws2812_ctrl_cfg_t *control_cfg = + malloc(sizeof(periph_ws2812_ctrl_cfg_t) * cfg.led_num); control_cfg[0].color = LED2812_COLOR_RED; control_cfg[0].mode = PERIPH_WS2812_BLINK; @@ -597,159 +540,135 @@ periph_ws2812_test (void) control_cfg[1].time_off_ms = 2000; control_cfg[1].time_on_ms = 2000; - TEST_ASSERT_FALSE (periph_ws2812_control (handle, control_cfg, NULL)); - vTaskDelay (5000 / portTICK_PERIOD_MS); + TEST_ASSERT_FALSE(periph_ws2812_control(handle, control_cfg, NULL)); + vTaskDelay(5000 / portTICK_PERIOD_MS); - ESP_LOGI (TAG, "Quit test, release all resources"); - TEST_ASSERT_FALSE (esp_periph_set_stop_all (set)); - TEST_ASSERT_FALSE (esp_periph_set_destroy (set)); - free (control_cfg); + ESP_LOGI(TAG, "Quit test, release all resources"); + TEST_ASSERT_FALSE(esp_periph_set_stop_all(set)); + TEST_ASSERT_FALSE(esp_periph_set_destroy(set)); + free(control_cfg); } -TEST_CASE ("touch pad test", "[peripherals]") { periph_touch_pad_test (); } - -static void -periph_wifi_test (void) -{ - ESP_LOGI (TAG, "Set up peripherals handle"); - esp_periph_config_t periph_cfg = DEFAULT_ESP_PERIPH_SET_CONFIG (); - esp_periph_set_handle_t set = esp_periph_set_init (&periph_cfg); - TEST_ASSERT_NOT_NULL (set); - - ESP_LOGI (TAG, "Initialize wifi environment"); - esp_err_t ret = nvs_flash_init (); - if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) - { - ESP_ERROR_CHECK (nvs_flash_erase ()); - ret = nvs_flash_init (); - } - ESP_ERROR_CHECK (ret); - tcpip_adapter_init (); - - periph_wifi_cfg_t wifi_cfg = { 0 }; +TEST_CASE("touch pad test", "[peripherals]") { periph_touch_pad_test(); } + +static void periph_wifi_test(void) { + ESP_LOGI(TAG, "Set up peripherals handle"); + esp_periph_config_t periph_cfg = DEFAULT_ESP_PERIPH_SET_CONFIG(); + esp_periph_set_handle_t set = esp_periph_set_init(&periph_cfg); + TEST_ASSERT_NOT_NULL(set); + + ESP_LOGI(TAG, "Initialize wifi environment"); + esp_err_t ret = nvs_flash_init(); + if (ret == ESP_ERR_NVS_NO_FREE_PAGES || + ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { + ESP_ERROR_CHECK(nvs_flash_erase()); + ret = nvs_flash_init(); + } + ESP_ERROR_CHECK(ret); + tcpip_adapter_init(); + + periph_wifi_cfg_t wifi_cfg = {0}; wifi_cfg.ssid = "ESP-Audio"; wifi_cfg.password = "esp123456"; - esp_periph_handle_t wifi_handle = periph_wifi_init (&wifi_cfg); - esp_periph_start (set, wifi_handle); - periph_wifi_wait_for_connected (wifi_handle, portMAX_DELAY); + esp_periph_handle_t wifi_handle = periph_wifi_init(&wifi_cfg); + esp_periph_start(set, wifi_handle); + periph_wifi_wait_for_connected(wifi_handle, portMAX_DELAY); - vTaskDelay (100 / portTICK_PERIOD_MS); + vTaskDelay(100 / portTICK_PERIOD_MS); - ESP_LOGI (TAG, "Quit test, release all resources"); - TEST_ASSERT_FALSE (esp_periph_set_stop_all (set)); - TEST_ASSERT_FALSE (esp_periph_set_destroy (set)); - TEST_ASSERT_FALSE (nvs_flash_deinit ()); + ESP_LOGI(TAG, "Quit test, release all resources"); + TEST_ASSERT_FALSE(esp_periph_set_stop_all(set)); + TEST_ASSERT_FALSE(esp_periph_set_destroy(set)); + TEST_ASSERT_FALSE(nvs_flash_deinit()); } -TEST_CASE ("wifi test", "[peripherals]") { periph_wifi_test (); } +TEST_CASE("wifi test", "[peripherals]") { periph_wifi_test(); } -TEST_CASE ("[memory leak test] [gpio isr]", "[peripherals]") -{ +TEST_CASE("[memory leak test] [gpio isr]", "[peripherals]") { int test_count = TEST_PERIPHERALS_MEMORY_LEAK_TIMES; - while (test_count--) - { - printf ("-------Residual times: %d -------\n", test_count); - periph_gpio_isr_test (); - } + while (test_count--) { + printf("-------Residual times: %d -------\n", test_count); + periph_gpio_isr_test(); + } } -TEST_CASE ("[memory leak test] [adc button]", "[peripherals]") -{ +TEST_CASE("[memory leak test] [adc button]", "[peripherals]") { int test_count = TEST_PERIPHERALS_MEMORY_LEAK_TIMES; - while (test_count--) - { - printf ("-------Residual times: %d -------\n", test_count); - periph_adc_button_test (); - } + while (test_count--) { + printf("-------Residual times: %d -------\n", test_count); + periph_adc_button_test(); + } } -TEST_CASE ("[memory leak test] [console]", "[peripherals]") -{ +TEST_CASE("[memory leak test] [console]", "[peripherals]") { int test_count = TEST_PERIPHERALS_MEMORY_LEAK_TIMES; - while (test_count--) - { - printf ("-------Residual times: %d -------\n", test_count); - periph_console_test (); - } + while (test_count--) { + printf("-------Residual times: %d -------\n", test_count); + periph_console_test(); + } } -TEST_CASE ("[memory leak test] [led]", "[peripherals]") -{ +TEST_CASE("[memory leak test] [led]", "[peripherals]") { int test_count = TEST_PERIPHERALS_MEMORY_LEAK_TIMES; - while (test_count--) - { - printf ("-------Residual times: %d -------\n", test_count); - periph_led_test (); - } + while (test_count--) { + printf("-------Residual times: %d -------\n", test_count); + periph_led_test(); + } } -TEST_CASE ("[memory leak test] [spiffs]", "[peripherals]") -{ +TEST_CASE("[memory leak test] [spiffs]", "[peripherals]") { int test_count = TEST_PERIPHERALS_MEMORY_LEAK_TIMES; - while (test_count--) - { - printf ("-------Residual times: %d -------\n", test_count); - periph_spiffs_test (); - } + while (test_count--) { + printf("-------Residual times: %d -------\n", test_count); + periph_spiffs_test(); + } } -TEST_CASE ("[memory leak test] [wifi]", "[peripherals]") -{ +TEST_CASE("[memory leak test] [wifi]", "[peripherals]") { int test_count = TEST_PERIPHERALS_MEMORY_LEAK_TIMES; - while (test_count--) - { - printf ("-------Residual times: %d -------\n", test_count); - periph_wifi_test (); - } + while (test_count--) { + printf("-------Residual times: %d -------\n", test_count); + periph_wifi_test(); + } } -TEST_CASE ("[memory leak test] [gpio button]", "[peripherals]") -{ +TEST_CASE("[memory leak test] [gpio button]", "[peripherals]") { int test_count = TEST_PERIPHERALS_MEMORY_LEAK_TIMES; - while (test_count--) - { - printf ("-------Residual times: %d -------\n", test_count); - periph_gpio_button_test (); - } + while (test_count--) { + printf("-------Residual times: %d -------\n", test_count); + periph_gpio_button_test(); + } } -TEST_CASE ("[memory leak test] [is31fl3216]", "[peripherals]") -{ +TEST_CASE("[memory leak test] [is31fl3216]", "[peripherals]") { int test_count = TEST_PERIPHERALS_MEMORY_LEAK_TIMES; - while (test_count--) - { - printf ("-------Residual times: %d -------\n", test_count); - periph_is31fl3216_test (); - } + while (test_count--) { + printf("-------Residual times: %d -------\n", test_count); + periph_is31fl3216_test(); + } } -TEST_CASE ("[memory leak test] [sdcard]", "[peripherals]") -{ +TEST_CASE("[memory leak test] [sdcard]", "[peripherals]") { int test_count = TEST_PERIPHERALS_MEMORY_LEAK_TIMES; - while (test_count--) - { - printf ("-------Residual times: %d -------\n", test_count); - periph_sdcard_test (); - } + while (test_count--) { + printf("-------Residual times: %d -------\n", test_count); + periph_sdcard_test(); + } } -TEST_CASE ("[memory leak test] [touch]", "[peripherals]") -{ +TEST_CASE("[memory leak test] [touch]", "[peripherals]") { int test_count = TEST_PERIPHERALS_MEMORY_LEAK_TIMES; - while (test_count--) - { - printf ("-------Residual times: %d -------\n", test_count); - periph_touch_pad_test (); - } + while (test_count--) { + printf("-------Residual times: %d -------\n", test_count); + periph_touch_pad_test(); + } } -TEST_CASE ("[memory leak test] [ws2812]", "[peripherals]") -{ +TEST_CASE("[memory leak test] [ws2812]", "[peripherals]") { int test_count = TEST_PERIPHERALS_MEMORY_LEAK_TIMES; - while (test_count--) - { - printf ("-------Residual times: %d -------\n", test_count); - periph_ws2812_test (); - } + while (test_count--) { + printf("-------Residual times: %d -------\n", test_count); + periph_ws2812_test(); + } } diff --git a/components/eth_interface/CMakeLists.txt b/components/eth_interface/CMakeLists.txt index cd07191e..7bed892b 100644 --- a/components/eth_interface/CMakeLists.txt +++ b/components/eth_interface/CMakeLists.txt @@ -1,11 +1,3 @@ - -if(CONFIG_SNAPCLIENT_ENABLE_ETHERNET) - idf_component_register(SRCS "eth_interface.c" - INCLUDE_DIRS "include") - -else() - -idf_component_register() - -endif() + INCLUDE_DIRS "include" + REQUIRES driver esp_eth esp_netif) diff --git a/components/eth_interface/Kconfig.projbuild b/components/eth_interface/Kconfig.projbuild index f468908c..be5c544e 100644 --- a/components/eth_interface/Kconfig.projbuild +++ b/components/eth_interface/Kconfig.projbuild @@ -1,51 +1,19 @@ menu "Snapclient Ethernet Configuration" - config SNAPCLIENT_ENABLE_ETHERNET - bool "enable Ethernet" - default n - help - Enable Ethernet interface - - config SNAPCLIENT_USE_SPI_ETHERNET - bool - depends on SNAPCLIENT_ENABLE_ETHERNET - - choice SNAPCLIENT_ETHERNET_TYPE - prompt "Ethernet Type" - default SNAPCLIENT_USE_INTERNAL_ETHERNET if IDF_TARGET_ESP32 - default SNAPCLIENT_USE_W5500 - depends on SNAPCLIENT_ENABLE_ETHERNET - help - Select which kind of Ethernet will be used in the example. - - config SNAPCLIENT_USE_INTERNAL_ETHERNET - depends on IDF_TARGET_ESP32 - select ETH_USE_ESP32_EMAC - bool "Internal EMAC" - help - Select internal Ethernet MAC controller. - config SNAPCLIENT_USE_DM9051 - bool "DM9051 Module" - select SNAPCLIENT_USE_SPI_ETHERNET - select ETH_USE_SPI_ETHERNET - select ETH_SPI_ETHERNET_DM9051 - help - Select external SPI-Ethernet module (DM9051). + orsource "$IDF_PATH/examples/common_components/env_caps/$IDF_TARGET/Kconfig.env_caps" - config SNAPCLIENT_USE_W5500 - bool "W5500 Module" - select SNAPCLIENT_USE_SPI_ETHERNET - select ETH_USE_SPI_ETHERNET - select ETH_SPI_ETHERNET_W5500 - help - Select external SPI-Ethernet module (W5500). - endchoice # SNAPCLIENT_ETHERNET_TYPE + config SNAPCLIENT_USE_INTERNAL_ETHERNET + depends on SOC_EMAC_SUPPORTED + select ETH_USE_ESP32_EMAC + default y + bool "Internal EMAC" + help + Use internal Ethernet MAC controller. if SNAPCLIENT_USE_INTERNAL_ETHERNET choice SNAPCLIENT_ETH_PHY_MODEL prompt "Ethernet PHY Device" default SNAPCLIENT_ETH_PHY_IP101 - depends on SNAPCLIENT_ENABLE_ETHERNET help Select the Ethernet PHY device to use in the example. @@ -61,11 +29,18 @@ menu "Snapclient Ethernet Configuration" RTL8201F/SR8201F is a single port 10/100Mb Ethernet Transceiver with auto MDIX. Goto http://www.corechip-sz.com/productsview.asp?id=22 for more information about it. - config SNAPCLIENT_ETH_PHY_LAN8720 - bool "LAN8720" + config SNAPCLIENT_ETH_PHY_LAN87XX + bool "LAN87xx" help + Below chips are supported: + LAN8710A is a small footprint MII/RMII 10/100 Ethernet Transceiver with HP Auto-MDIX and + flexPWR® Technology. LAN8720A is a small footprint RMII 10/100 Ethernet Transceiver with HP Auto-MDIX Support. - Goto https://www.microchip.com/LAN8720A for more information about it. + LAN8740A/LAN8741A is a small footprint MII/RMII 10/100 Energy Efficient Ethernet Transceiver + with HP Auto-MDIX and flexPWR® Technology. + LAN8742A is a small footprint RMII 10/100 Ethernet Transceiver with HP Auto-MDIX and + flexPWR® Technology. + Goto https://www.microchip.com for more information about them. config SNAPCLIENT_ETH_PHY_DP83848 bool "DP83848" @@ -73,98 +48,202 @@ menu "Snapclient Ethernet Configuration" DP83848 is a single port 10/100Mb/s Ethernet Physical Layer Transceiver. Goto http://www.ti.com/product/DP83848J for more information about it. - config SNAPCLIENT_ETH_PHY_KSZ8041 - bool "KSZ8041" + config SNAPCLIENT_ETH_PHY_KSZ80XX + bool "KSZ80xx" help - The KSZ8041 is a single supply 10Base-T/100Base-TX Physical Layer Transceiver. - Goto https://www.microchip.com/wwwproducts/en/KSZ8041 for more information about it. + With the KSZ80xx series, Microchip offers single-chip 10BASE-T/100BASE-TX + Ethernet Physical Layer Tranceivers (PHY). + The following chips are supported: KSZ8001, KSZ8021, KSZ8031, KSZ8041, + KSZ8051, KSZ8061, KSZ8081, KSZ8091 + Goto https://www.microchip.com for more information about them. endchoice # SNAPCLIENT_ETH_PHY_MODEL config SNAPCLIENT_ETH_MDC_GPIO int "SMI MDC GPIO number" + range ENV_GPIO_RANGE_MIN ENV_GPIO_OUT_RANGE_MAX default 23 - depends on SNAPCLIENT_ENABLE_ETHERNET help Set the GPIO number used by SMI MDC. config SNAPCLIENT_ETH_MDIO_GPIO int "SMI MDIO GPIO number" + range ENV_GPIO_RANGE_MIN ENV_GPIO_OUT_RANGE_MAX default 18 - depends on SNAPCLIENT_ENABLE_ETHERNET help Set the GPIO number used by SMI MDIO. + + config SNAPCLIENT_ETH_PHY_RST_GPIO + int "PHY Reset GPIO number" + range -1 ENV_GPIO_OUT_RANGE_MAX + default 17 + help + Set the GPIO number used to reset PHY chip. + Set to -1 to disable PHY chip hardware reset. + + config SNAPCLIENT_ETH_PHY_ADDR + int "PHY Address" + range 0 31 + default 0 + help + Set PHY address according your board schematic. endif # SNAPCLIENT_USE_INTERNAL_ETHERNET + config SNAPCLIENT_USE_SPI_ETHERNET + bool "SPI Ethernet" + default n + select ETH_USE_SPI_ETHERNET + help + Use external SPI-Ethernet module(s). + if SNAPCLIENT_USE_SPI_ETHERNET + config SNAPCLIENT_SPI_ETHERNETS_NUM + int "Number of SPI Ethernet modules to use at a time" + range 1 2 + default 1 + help + Set the number of SPI Ethernet modules you want to use at a time. Multiple SPI modules can be connected + to one SPI interface and can be separately accessed based on state of associated Chip Select (CS). + + choice SNAPCLIENT_ETHERNET_TYPE_SPI + prompt "Ethernet SPI" + default SNAPCLIENT_USE_W5500 + help + Select which kind of Ethernet will be used in the example. + + config SNAPCLIENT_USE_DM9051 + bool "DM9051 Module" + select ETH_SPI_ETHERNET_DM9051 + help + Select external SPI-Ethernet module (DM9051). + + config SNAPCLIENT_USE_KSZ8851SNL + bool "KSZ8851SNL Module" + select ETH_SPI_ETHERNET_KSZ8851SNL + help + Select external SPI-Ethernet module (KSZ8851SNL). + + config SNAPCLIENT_USE_W5500 + bool "W5500 Module" + select ETH_SPI_ETHERNET_W5500 + help + Select external SPI-Ethernet module (W5500). + endchoice + config SNAPCLIENT_ETH_SPI_HOST int "SPI Host Number" range 0 2 default 1 - depends on SNAPCLIENT_ENABLE_ETHERNET help Set the SPI host used to communicate with the SPI Ethernet Controller. config SNAPCLIENT_ETH_SPI_SCLK_GPIO int "SPI SCLK GPIO number" - range 0 33 - default 20 - depends on SNAPCLIENT_ENABLE_ETHERNET + range ENV_GPIO_RANGE_MIN ENV_GPIO_OUT_RANGE_MAX + default 14 if IDF_TARGET_ESP32 + default 12 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 + default 6 if IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32C2 + default 4 if IDF_TARGET_ESP32H2 help Set the GPIO number used by SPI SCLK. config SNAPCLIENT_ETH_SPI_MOSI_GPIO int "SPI MOSI GPIO number" - range 0 33 - default 19 - depends on SNAPCLIENT_ENABLE_ETHERNET + range ENV_GPIO_RANGE_MIN ENV_GPIO_OUT_RANGE_MAX + default 13 if IDF_TARGET_ESP32 + default 11 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 + default 7 if IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32C2 + default 5 if IDF_TARGET_ESP32H2 help Set the GPIO number used by SPI MOSI. config SNAPCLIENT_ETH_SPI_MISO_GPIO int "SPI MISO GPIO number" - range 0 33 - default 18 - depends on SNAPCLIENT_ENABLE_ETHERNET + range ENV_GPIO_RANGE_MIN ENV_GPIO_IN_RANGE_MAX + default 12 if IDF_TARGET_ESP32 + default 13 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 + default 2 if IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32C2 + default 0 if IDF_TARGET_ESP32H2 help Set the GPIO number used by SPI MISO. - config SNAPCLIENT_ETH_SPI_CS_GPIO - int "SPI CS GPIO number" - range 0 33 - default 21 - depends on SNAPCLIENT_ENABLE_ETHERNET - help - Set the GPIO number used by SPI CS. - config SNAPCLIENT_ETH_SPI_CLOCK_MHZ int "SPI clock speed (MHz)" range 5 80 - default 36 - depends on SNAPCLIENT_ENABLE_ETHERNET + default 12 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32C2 || IDF_TARGET_ESP32H2 + default 36 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 help Set the clock speed (MHz) of SPI interface. - config SNAPCLIENT_ETH_SPI_INT_GPIO - int "Interrupt GPIO number" - default 4 - depends on SNAPCLIENT_ENABLE_ETHERNET + config SNAPCLIENT_ETH_SPI_CS0_GPIO + int "SPI CS0 GPIO number for SPI Ethernet module #1" + range ENV_GPIO_RANGE_MIN ENV_GPIO_OUT_RANGE_MAX + default 15 if IDF_TARGET_ESP32 + default 10 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32C2 + default 1 if IDF_TARGET_ESP32H2 help - Set the GPIO number used by the SPI Ethernet module interrupt line. - endif # SNAPCLIENT_USE_SPI_ETHERNET + Set the GPIO number used by SPI CS0, i.e. Chip Select associated with the first SPI Eth module). + + config SNAPCLIENT_ETH_SPI_CS1_GPIO + depends on SNAPCLIENT_SPI_ETHERNETS_NUM > 1 + int "SPI CS1 GPIO number for SPI Ethernet module #2" + range ENV_GPIO_RANGE_MIN ENV_GPIO_OUT_RANGE_MAX + default 32 if IDF_TARGET_ESP32 + default 7 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32S3 + default 8 if IDF_TARGET_ESP32C3 + default 3 if IDF_TARGET_ESP32C2 + default 11 if IDF_TARGET_ESP32H2 + help + Set the GPIO number used by SPI CS1, i.e. Chip Select associated with the second SPI Eth module. + + config SNAPCLIENT_ETH_SPI_INT0_GPIO + int "Interrupt GPIO number SPI Ethernet module #1" + range ENV_GPIO_RANGE_MIN ENV_GPIO_IN_RANGE_MAX + default 4 if IDF_TARGET_ESP32 || IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3 + default 4 if IDF_TARGET_ESP32C2 + default 9 if IDF_TARGET_ESP32H2 + help + Set the GPIO number used by the first SPI Ethernet module interrupt line. + + config SNAPCLIENT_ETH_SPI_INT1_GPIO + depends on SNAPCLIENT_SPI_ETHERNETS_NUM > 1 + int "Interrupt GPIO number SPI Ethernet module #2" + range ENV_GPIO_RANGE_MIN ENV_GPIO_IN_RANGE_MAX + default 33 if IDF_TARGET_ESP32 + default 5 if IDF_TARGET_ESP32S2 || IDF_TARGET_ESP32C3 || IDF_TARGET_ESP32S3 || IDF_TARGET_ESP32C2 + default 10 if IDF_TARGET_ESP32H2 + help + Set the GPIO number used by the second SPI Ethernet module interrupt line. - config SNAPCLIENT_ETH_PHY_RST_GPIO - int "PHY Reset GPIO number" - default 17 - depends on SNAPCLIENT_ENABLE_ETHERNET - help - Set the GPIO number used to reset PHY chip. - Set to -1 to disable PHY chip hardware reset. - - config SNAPCLIENT_ETH_PHY_ADDR - int "PHY Address" - range 0 31 - default 0 - depends on SNAPCLIENT_ENABLE_ETHERNET - help - Set PHY address according your board schematic. + config SNAPCLIENT_ETH_SPI_PHY_RST0_GPIO + int "PHY Reset GPIO number of SPI Ethernet Module #1" + range -1 ENV_GPIO_OUT_RANGE_MAX + default -1 + help + Set the GPIO number used to reset PHY chip on the first SPI Ethernet module. + Set to -1 to disable PHY chip hardware reset. + + config SNAPCLIENT_ETH_SPI_PHY_RST1_GPIO + depends on SNAPCLIENT_SPI_ETHERNETS_NUM > 1 + int "PHY Reset GPIO number of SPI Ethernet Module #2" + range -1 ENV_GPIO_OUT_RANGE_MAX + default -1 + help + Set the GPIO number used to reset PHY chip on the second SPI Ethernet module. + Set to -1 to disable PHY chip hardware reset. + + config SNAPCLIENT_ETH_SPI_PHY_ADDR0 + int "PHY Address of SPI Ethernet Module #1" + range 0 31 + default 1 + help + Set the first SPI Ethernet module PHY address according your board schematic. + + config SNAPCLIENT_ETH_SPI_PHY_ADDR1 + depends on SNAPCLIENT_SPI_ETHERNETS_NUM > 1 + int "PHY Address of SPI Ethernet Module #2" + range 0 31 + default 1 + help + Set the second SPI Ethernet module PHY address according your board schematic. + endif # SNAPCLIENT_USE_SPI_ETHERNET endmenu diff --git a/components/eth_interface/eth_interface.c b/components/eth_interface/eth_interface.c index 66d68145..b2c6ed96 100644 --- a/components/eth_interface/eth_interface.c +++ b/components/eth_interface/eth_interface.c @@ -1,27 +1,30 @@ -/* Ethernet Basic Example +/* + * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Unlicense OR CC0-1.0 + */ +#include "eth_interface.h" - This example code is in the Public Domain (or CC0 licensed, at your option.) - - Unless required by applicable law or agreed to in writing, this - software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR - CONDITIONS OF ANY KIND, either express or implied. -*/ #include #include + #include "driver/gpio.h" +#include "esp_check.h" #include "esp_eth.h" #include "esp_event.h" #include "esp_log.h" +#include "esp_mac.h" #include "esp_netif.h" #include "freertos/FreeRTOS.h" #include "freertos/event_groups.h" #include "freertos/task.h" #include "sdkconfig.h" -#if CONFIG_ETH_USE_SPI_ETHERNET +#if CONFIG_SNAPCLIENT_USE_SPI_ETHERNET #include "driver/spi_master.h" -#endif // CONFIG_ETH_USE_SPI_ETHERNET +#endif + +static const char *TAG = "snapclient_eth_init"; -static const char *TAG = "ETH"; /* The event group allows multiple bits for each event, but we only care about * two events: @@ -32,11 +35,324 @@ static const char *TAG = "ETH"; static EventGroupHandle_t s_eth_event_group; +#if CONFIG_SNAPCLIENT_SPI_ETHERNETS_NUM +#define SPI_ETHERNETS_NUM CONFIG_SNAPCLIENT_SPI_ETHERNETS_NUM +#else +#define SPI_ETHERNETS_NUM 0 +#endif + +#if CONFIG_SNAPCLIENT_USE_INTERNAL_ETHERNET +#define INTERNAL_ETHERNETS_NUM 1 +#else +#define INTERNAL_ETHERNETS_NUM 0 +#endif + +#define INIT_SPI_ETH_MODULE_CONFIG(eth_module_config, num) \ + do { \ + eth_module_config[num].spi_cs_gpio = \ + CONFIG_SNAPCLIENT_ETH_SPI_CS##num##_GPIO; \ + eth_module_config[num].int_gpio = \ + CONFIG_SNAPCLIENT_ETH_SPI_INT##num##_GPIO; \ + eth_module_config[num].phy_reset_gpio = \ + CONFIG_SNAPCLIENT_ETH_SPI_PHY_RST##num##_GPIO; \ + eth_module_config[num].phy_addr = CONFIG_SNAPCLIENT_ETH_SPI_PHY_ADDR##num; \ + } while (0) + +typedef struct { + uint8_t spi_cs_gpio; + uint8_t int_gpio; + int8_t phy_reset_gpio; + uint8_t phy_addr; + uint8_t *mac_addr; +} spi_eth_module_config_t; + +#if CONFIG_SNAPCLIENT_USE_INTERNAL_ETHERNET +/** + * @brief Internal ESP32 Ethernet initialization + * + * @param[out] mac_out optionally returns Ethernet MAC object + * @param[out] phy_out optionally returns Ethernet PHY object + * @return + * - esp_eth_handle_t if init succeeded + * - NULL if init failed + */ +static esp_eth_handle_t eth_init_internal(esp_eth_mac_t **mac_out, + esp_eth_phy_t **phy_out) { + esp_eth_handle_t ret = NULL; + + // Init common MAC and PHY configs to default + eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG(); + eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG(); + + // Update PHY config based on board specific configuration + phy_config.phy_addr = CONFIG_SNAPCLIENT_ETH_PHY_ADDR; + phy_config.reset_gpio_num = CONFIG_SNAPCLIENT_ETH_PHY_RST_GPIO; + + // Init vendor specific MAC config to default + eth_esp32_emac_config_t esp32_emac_config = ETH_ESP32_EMAC_DEFAULT_CONFIG(); + // Update vendor specific MAC config based on board configuration + esp32_emac_config.smi_mdc_gpio_num = CONFIG_SNAPCLIENT_ETH_MDC_GPIO; + esp32_emac_config.smi_mdio_gpio_num = CONFIG_SNAPCLIENT_ETH_MDIO_GPIO; + + // Set clock mode and GPIO +#if CONFIG_ETH_RMII_CLK_INPUT + esp32_emac_config.clock_config.rmii.clock_mode = EMAC_CLK_EXT_IN; +#elif CONFIG_ETH_RMII_CLK_OUTPUT + esp32_emac_config.clock_config.rmii.clock_mode = EMAC_CLK_EXT_OUT; +#else + esp32_emac_config.clock_config.rmii.clock_mode = EMAC_CLK_DEFAULT; +#endif + esp32_emac_config.clock_config.rmii.clock_gpio = CONFIG_ETH_RMII_CLK_IN_GPIO; + + // Create new ESP32 Ethernet MAC instance + esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&esp32_emac_config, &mac_config); + + // Create new PHY instance based on board configuration +#if CONFIG_SNAPCLIENT_ETH_PHY_IP101 + esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config); +#elif CONFIG_SNAPCLIENT_ETH_PHY_RTL8201 + esp_eth_phy_t *phy = esp_eth_phy_new_rtl8201(&phy_config); +#elif CONFIG_SNAPCLIENT_ETH_PHY_LAN87XX + esp_eth_phy_t *phy = esp_eth_phy_new_lan87xx(&phy_config); +#elif CONFIG_SNAPCLIENT_ETH_PHY_DP83848 + esp_eth_phy_t *phy = esp_eth_phy_new_dp83848(&phy_config); +#elif CONFIG_SNAPCLIENT_ETH_PHY_KSZ80XX + esp_eth_phy_t *phy = esp_eth_phy_new_ksz80xx(&phy_config); +#endif + + // Init Ethernet driver to default and install it + esp_eth_handle_t eth_handle = NULL; + esp_eth_config_t config = ETH_DEFAULT_CONFIG(mac, phy); + ESP_GOTO_ON_FALSE(esp_eth_driver_install(&config, ð_handle) == ESP_OK, + NULL, err, TAG, "Ethernet driver install failed"); + + if (mac_out != NULL) { + *mac_out = mac; + } + if (phy_out != NULL) { + *phy_out = phy; + } + return eth_handle; +err: + if (eth_handle != NULL) { + esp_eth_driver_uninstall(eth_handle); + } + if (mac != NULL) { + mac->del(mac); + } + if (phy != NULL) { + phy->del(phy); + } + return ret; +} +#endif // CONFIG_SNAPCLIENT_USE_INTERNAL_ETHERNET + +#if CONFIG_SNAPCLIENT_USE_SPI_ETHERNET +/** + * @brief SPI bus initialization (to be used by Ethernet SPI modules) + * + * @return + * - ESP_OK on success + */ +static esp_err_t spi_bus_init(void) { + esp_err_t ret = ESP_OK; + + // Install GPIO ISR handler to be able to service SPI Eth modules interrupts + ret = gpio_install_isr_service(0); + if (ret != ESP_OK) { + if (ret == ESP_ERR_INVALID_STATE) { + ESP_LOGW(TAG, "GPIO ISR handler has been already installed"); + ret = ESP_OK; // ISR handler has been already installed so no issues + } else { + ESP_LOGE(TAG, "GPIO ISR handler install failed"); + goto err; + } + } + + // Init SPI bus + spi_bus_config_t buscfg = { + .miso_io_num = CONFIG_SNAPCLIENT_ETH_SPI_MISO_GPIO, + .mosi_io_num = CONFIG_SNAPCLIENT_ETH_SPI_MOSI_GPIO, + .sclk_io_num = CONFIG_SNAPCLIENT_ETH_SPI_SCLK_GPIO, + .quadwp_io_num = -1, + .quadhd_io_num = -1, + }; + ESP_GOTO_ON_ERROR(spi_bus_initialize(CONFIG_SNAPCLIENT_ETH_SPI_HOST, &buscfg, + SPI_DMA_CH_AUTO), + err, TAG, "SPI host #%d init failed", + CONFIG_SNAPCLIENT_ETH_SPI_HOST); + +err: + return ret; +} + +/** + * @brief Ethernet SPI modules initialization + * + * @param[in] spi_eth_module_config specific SPI Ethernet module configuration + * @param[out] mac_out optionally returns Ethernet MAC object + * @param[out] phy_out optionally returns Ethernet PHY object + * @return + * - esp_eth_handle_t if init succeeded + * - NULL if init failed + */ +static esp_eth_handle_t eth_init_spi( + spi_eth_module_config_t *spi_eth_module_config, esp_eth_mac_t **mac_out, + esp_eth_phy_t **phy_out) { + esp_eth_handle_t ret = NULL; + + // Init common MAC and PHY configs to default + eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG(); + eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG(); + + // Update PHY config based on board specific configuration + phy_config.phy_addr = spi_eth_module_config->phy_addr; + phy_config.reset_gpio_num = spi_eth_module_config->phy_reset_gpio; + + // Configure SPI interface for specific SPI module + spi_device_interface_config_t spi_devcfg = { + .mode = 0, + .clock_speed_hz = CONFIG_SNAPCLIENT_ETH_SPI_CLOCK_MHZ * 1000 * 1000, + .queue_size = 20, + .spics_io_num = spi_eth_module_config->spi_cs_gpio}; + // Init vendor specific MAC config to default, and create new SPI Ethernet MAC + // instance and new PHY instance based on board configuration +#if CONFIG_SNAPCLIENT_USE_KSZ8851SNL + eth_ksz8851snl_config_t ksz8851snl_config = ETH_KSZ8851SNL_DEFAULT_CONFIG( + CONFIG_SNAPCLIENT_ETH_SPI_HOST, &spi_devcfg); + ksz8851snl_config.int_gpio_num = spi_eth_module_config->int_gpio; + esp_eth_mac_t *mac = + esp_eth_mac_new_ksz8851snl(&ksz8851snl_config, &mac_config); + esp_eth_phy_t *phy = esp_eth_phy_new_ksz8851snl(&phy_config); +#elif CONFIG_SNAPCLIENT_USE_DM9051 + eth_dm9051_config_t dm9051_config = + ETH_DM9051_DEFAULT_CONFIG(CONFIG_SNAPCLIENT_ETH_SPI_HOST, &spi_devcfg); + dm9051_config.int_gpio_num = spi_eth_module_config->int_gpio; + esp_eth_mac_t *mac = esp_eth_mac_new_dm9051(&dm9051_config, &mac_config); + esp_eth_phy_t *phy = esp_eth_phy_new_dm9051(&phy_config); +#elif CONFIG_SNAPCLIENT_USE_W5500 + eth_w5500_config_t w5500_config = + ETH_W5500_DEFAULT_CONFIG(CONFIG_SNAPCLIENT_ETH_SPI_HOST, &spi_devcfg); + w5500_config.int_gpio_num = spi_eth_module_config->int_gpio; + esp_eth_mac_t *mac = esp_eth_mac_new_w5500(&w5500_config, &mac_config); + esp_eth_phy_t *phy = esp_eth_phy_new_w5500(&phy_config); +#endif // CONFIG_SNAPCLIENT_USE_W5500 + // Init Ethernet driver to default and install it + esp_eth_handle_t eth_handle = NULL; + esp_eth_config_t eth_config_spi = ETH_DEFAULT_CONFIG(mac, phy); + ESP_GOTO_ON_FALSE( + esp_eth_driver_install(ð_config_spi, ð_handle) == ESP_OK, NULL, err, + TAG, "SPI Ethernet driver install failed"); + + // The SPI Ethernet module might not have a burned factory MAC address, we can + // set it manually. + if (spi_eth_module_config->mac_addr != NULL) { + ESP_GOTO_ON_FALSE(esp_eth_ioctl(eth_handle, ETH_CMD_S_MAC_ADDR, + spi_eth_module_config->mac_addr) == ESP_OK, + NULL, err, TAG, "SPI Ethernet MAC address config failed"); + } + + if (mac_out != NULL) { + *mac_out = mac; + } + if (phy_out != NULL) { + *phy_out = phy; + } + return eth_handle; +err: + if (eth_handle != NULL) { + esp_eth_driver_uninstall(eth_handle); + } + if (mac != NULL) { + mac->del(mac); + } + if (phy != NULL) { + phy->del(phy); + } + return ret; +} +#endif // CONFIG_SNAPCLIENT_USE_SPI_ETHERNET + +/** Original init function in the example */ +esp_err_t original_eth_init(esp_eth_handle_t *eth_handles_out[], + uint8_t *eth_cnt_out) { + esp_err_t ret = ESP_OK; + esp_eth_handle_t *eth_handles = NULL; + uint8_t eth_cnt = 0; + +#if CONFIG_SNAPCLIENT_USE_INTERNAL_ETHERNET || \ + CONFIG_SNAPCLIENT_USE_SPI_ETHERNET + ESP_GOTO_ON_FALSE( + eth_handles_out != NULL && eth_cnt_out != NULL, ESP_ERR_INVALID_ARG, err, + TAG, + "invalid arguments: initialized handles array or number of interfaces"); + eth_handles = calloc(SPI_ETHERNETS_NUM + INTERNAL_ETHERNETS_NUM, + sizeof(esp_eth_handle_t)); + ESP_GOTO_ON_FALSE(eth_handles != NULL, ESP_ERR_NO_MEM, err, TAG, "no memory"); + +#if CONFIG_SNAPCLIENT_USE_INTERNAL_ETHERNET + eth_handles[eth_cnt] = eth_init_internal(NULL, NULL); + ESP_GOTO_ON_FALSE(eth_handles[eth_cnt], ESP_FAIL, err, TAG, + "internal Ethernet init failed"); + eth_cnt++; +#endif // CONFIG_SNAPCLIENT_USE_INTERNAL_ETHERNET + +#if CONFIG_SNAPCLIENT_USE_SPI_ETHERNET + ESP_GOTO_ON_ERROR(spi_bus_init(), err, TAG, "SPI bus init failed"); + // Init specific SPI Ethernet module configuration from Kconfig (CS GPIO, + // Interrupt GPIO, etc.) + spi_eth_module_config_t + spi_eth_module_config[CONFIG_SNAPCLIENT_SPI_ETHERNETS_NUM] = {0}; + INIT_SPI_ETH_MODULE_CONFIG(spi_eth_module_config, 0); + // The SPI Ethernet module(s) might not have a burned factory MAC address, + // hence use manually configured address(es). In this example, Locally + // Administered MAC address derived from ESP32x base MAC address is used. Note + // that Locally Administered OUI range should be used only when testing on a + // LAN under your control! + uint8_t base_mac_addr[ETH_ADDR_LEN]; + ESP_GOTO_ON_ERROR(esp_efuse_mac_get_default(base_mac_addr), err, TAG, + "get EFUSE MAC failed"); + uint8_t local_mac_1[ETH_ADDR_LEN]; + esp_derive_local_mac(local_mac_1, base_mac_addr); + spi_eth_module_config[0].mac_addr = local_mac_1; +#if CONFIG_SNAPCLIENT_SPI_ETHERNETS_NUM > 1 + INIT_SPI_ETH_MODULE_CONFIG(spi_eth_module_config, 1); + uint8_t local_mac_2[ETH_ADDR_LEN]; + base_mac_addr[ETH_ADDR_LEN - 1] += 1; + esp_derive_local_mac(local_mac_2, base_mac_addr); + spi_eth_module_config[1].mac_addr = local_mac_2; +#endif +#if CONFIG_SNAPCLIENT_SPI_ETHERNETS_NUM > 2 +#error Maximum number of supported SPI Ethernet devices is currently limited to 2 by this example. +#endif + for (int i = 0; i < CONFIG_SNAPCLIENT_SPI_ETHERNETS_NUM; i++) { + eth_handles[eth_cnt] = eth_init_spi(&spi_eth_module_config[i], NULL, NULL); + ESP_GOTO_ON_FALSE(eth_handles[eth_cnt], ESP_FAIL, err, TAG, + "SPI Ethernet init failed"); + eth_cnt++; + } +#endif // CONFIG_ETH_USE_SPI_ETHERNET +#else + ESP_LOGD(TAG, "no Ethernet device selected to init"); +#endif // CONFIG_SNAPCLIENT_USE_INTERNAL_ETHERNET || + // CONFIG_SNAPCLIENT_USE_SPI_ETHERNET + *eth_handles_out = eth_handles; + *eth_cnt_out = eth_cnt; + + return ret; +#if CONFIG_SNAPCLIENT_USE_INTERNAL_ETHERNET || \ + CONFIG_SNAPCLIENT_USE_SPI_ETHERNET +err: + free(eth_handles); + return ret; +#endif +} + /** Event handler for Ethernet events */ static void eth_event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, void *event_data) { uint8_t mac_addr[6] = {0}; - /* we can get the Ethernet driver handle from event data */ + /* we can get the ethernet driver handle from event data */ esp_eth_handle_t eth_handle = *(esp_eth_handle_t *)event_data; switch (event_id) { @@ -46,7 +362,6 @@ static void eth_event_handler(void *arg, esp_event_base_t event_base, ESP_LOGI(TAG, "Ethernet HW Addr %02x:%02x:%02x:%02x:%02x:%02x", mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]); - break; case ETHERNET_EVENT_DISCONNECTED: ESP_LOGI(TAG, "Ethernet Link Down"); @@ -79,106 +394,64 @@ static void got_ip_event_handler(void *arg, esp_event_base_t event_base, xEventGroupSetBits(s_eth_event_group, ETH_CONNECTED_BIT); } +/** Init function that exposes to the main application */ void eth_init(void) { - // Initialize TCP/IP network interface (should be called only once in - // application) + // Initialize Ethernet driver + uint8_t eth_port_cnt = 0; + esp_eth_handle_t *eth_handles; + ESP_ERROR_CHECK(original_eth_init(ð_handles, ð_port_cnt)); + + // Initialize TCP/IP network interface aka the esp-netif (should be called + // only once in application) ESP_ERROR_CHECK(esp_netif_init()); // Create default event loop that running in background ESP_ERROR_CHECK(esp_event_loop_create_default()); - esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH(); - esp_netif_t *eth_netif = esp_netif_new(&cfg); - // Set default handlers to process TCP/IP stuffs - ESP_ERROR_CHECK(esp_eth_set_default_handlers(eth_netif)); + + // Create instance(s) of esp-netif for Ethernet(s) + if (eth_port_cnt == 1) { + // Use ESP_NETIF_DEFAULT_ETH when just one Ethernet interface is used and + // you don't need to modify default esp-netif configuration parameters. + esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH(); + esp_netif_t *eth_netif = esp_netif_new(&cfg); + // Attach Ethernet driver to TCP/IP stack + ESP_ERROR_CHECK( + esp_netif_attach(eth_netif, esp_eth_new_netif_glue(eth_handles[0]))); + } else { + // Use ESP_NETIF_INHERENT_DEFAULT_ETH when multiple Ethernet interfaces are + // used and so you need to modify esp-netif configuration parameters for + // each interface (name, priority, etc.). + esp_netif_inherent_config_t esp_netif_config = + ESP_NETIF_INHERENT_DEFAULT_ETH(); + esp_netif_config_t cfg_spi = {.base = &esp_netif_config, + .stack = ESP_NETIF_NETSTACK_DEFAULT_ETH}; + char if_key_str[10]; + char if_desc_str[10]; + char num_str[3]; + for (int i = 0; i < eth_port_cnt; i++) { + itoa(i, num_str, 10); + strcat(strcpy(if_key_str, "ETH_"), num_str); + strcat(strcpy(if_desc_str, "eth"), num_str); + esp_netif_config.if_key = if_key_str; + esp_netif_config.if_desc = if_desc_str; + esp_netif_config.route_prio -= i * 5; + esp_netif_t *eth_netif = esp_netif_new(&cfg_spi); + + // Attach Ethernet driver to TCP/IP stack + ESP_ERROR_CHECK( + esp_netif_attach(eth_netif, esp_eth_new_netif_glue(eth_handles[i]))); + } + } + // Register user defined event handers ESP_ERROR_CHECK(esp_event_handler_register(ETH_EVENT, ESP_EVENT_ANY_ID, ð_event_handler, NULL)); ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, IP_EVENT_ETH_GOT_IP, &got_ip_event_handler, NULL)); - eth_mac_config_t mac_config = ETH_MAC_DEFAULT_CONFIG(); - eth_phy_config_t phy_config = ETH_PHY_DEFAULT_CONFIG(); - phy_config.phy_addr = CONFIG_SNAPCLIENT_ETH_PHY_ADDR; - phy_config.reset_gpio_num = CONFIG_SNAPCLIENT_ETH_PHY_RST_GPIO; - - // phy_config.reset_timeout_ms = 500; - // mac_config.sw_reset_timeout_ms = 500; - -#if CONFIG_SNAPCLIENT_USE_INTERNAL_ETHERNET - mac_config.smi_mdc_gpio_num = CONFIG_SNAPCLIENT_ETH_MDC_GPIO; - mac_config.smi_mdio_gpio_num = CONFIG_SNAPCLIENT_ETH_MDIO_GPIO; - esp_eth_mac_t *mac = esp_eth_mac_new_esp32(&mac_config); -#if CONFIG_SNAPCLIENT_ETH_PHY_IP101 - esp_eth_phy_t *phy = esp_eth_phy_new_ip101(&phy_config); -#elif CONFIG_SNAPCLIENT_ETH_PHY_RTL8201 - esp_eth_phy_t *phy = esp_eth_phy_new_rtl8201(&phy_config); -#elif CONFIG_SNAPCLIENT_ETH_PHY_LAN8720 - esp_eth_phy_t *phy = esp_eth_phy_new_lan8720(&phy_config); -#elif CONFIG_SNAPCLIENT_ETH_PHY_DP83848 - esp_eth_phy_t *phy = esp_eth_phy_new_dp83848(&phy_config); -#elif CONFIG_SNAPCLIENT_ETH_PHY_KSZ8041 - esp_eth_phy_t *phy = esp_eth_phy_new_ksz8041(&phy_config); -#endif -#elif CONFIG_ETH_USE_SPI_ETHERNET - gpio_install_isr_service(0); - spi_device_handle_t spi_handle = NULL; - spi_bus_config_t buscfg = { - .miso_io_num = CONFIG_SNAPCLIENT_ETH_SPI_MISO_GPIO, - .mosi_io_num = CONFIG_SNAPCLIENT_ETH_SPI_MOSI_GPIO, - .sclk_io_num = CONFIG_SNAPCLIENT_ETH_SPI_SCLK_GPIO, - .quadwp_io_num = -1, - .quadhd_io_num = -1, - }; - ESP_ERROR_CHECK( - spi_bus_initialize(CONFIG_SNAPCLIENT_ETH_SPI_HOST, &buscfg, 1)); -#if CONFIG_SNAPCLIENT_USE_DM9051 - spi_device_interface_config_t devcfg = { - .command_bits = 1, - .address_bits = 7, - .mode = 0, - .clock_speed_hz = CONFIG_SNAPCLIENT_ETH_SPI_CLOCK_MHZ * 1000 * 1000, - .spics_io_num = CONFIG_SNAPCLIENT_ETH_SPI_CS_GPIO, - .queue_size = 20}; - ESP_ERROR_CHECK( - spi_bus_add_device(CONFIG_SNAPCLIENT_ETH_SPI_HOST, &devcfg, &spi_handle)); - /* dm9051 ethernet driver is based on spi driver */ - eth_dm9051_config_t dm9051_config = ETH_DM9051_DEFAULT_CONFIG(spi_handle); - dm9051_config.int_gpio_num = CONFIG_SNAPCLIENT_ETH_SPI_INT_GPIO; - esp_eth_mac_t *mac = esp_eth_mac_new_dm9051(&dm9051_config, &mac_config); - esp_eth_phy_t *phy = esp_eth_phy_new_dm9051(&phy_config); -#elif CONFIG_SNAPCLIENT_USE_W5500 - spi_device_interface_config_t devcfg = { - .command_bits = 16, // Actually it's the address phase in W5500 SPI frame - .address_bits = 8, // Actually it's the control phase in W5500 SPI frame - .mode = 0, - .clock_speed_hz = CONFIG_SNAPCLIENT_ETH_SPI_CLOCK_MHZ * 1000 * 1000, - .spics_io_num = CONFIG_SNAPCLIENT_ETH_SPI_CS_GPIO, - .queue_size = 20}; - ESP_ERROR_CHECK( - spi_bus_add_device(CONFIG_SNAPCLIENT_ETH_SPI_HOST, &devcfg, &spi_handle)); - /* w5500 ethernet driver is based on spi driver */ - eth_w5500_config_t w5500_config = ETH_W5500_DEFAULT_CONFIG(spi_handle); - w5500_config.int_gpio_num = CONFIG_SNAPCLIENT_ETH_SPI_INT_GPIO; - esp_eth_mac_t *mac = esp_eth_mac_new_w5500(&w5500_config, &mac_config); - esp_eth_phy_t *phy = esp_eth_phy_new_w5500(&phy_config); -#endif -#endif // CONFIG_ETH_USE_SPI_ETHERNET - esp_eth_config_t config = ETH_DEFAULT_CONFIG(mac, phy); - esp_eth_handle_t eth_handle = NULL; - ESP_ERROR_CHECK(esp_eth_driver_install(&config, ð_handle)); -#if !CONFIG_SNAPCLIENT_USE_INTERNAL_ETHERNET - /* The SPI Ethernet module might doesn't have a burned factory MAC address, we - cat to set it manually. 02:00:00 is a Locally Administered OUI range so - should not be used except when testing on a LAN under your control. - */ - ESP_ERROR_CHECK( - esp_eth_ioctl(eth_handle, ETH_CMD_S_MAC_ADDR, - (uint8_t[]){0x02, 0x00, 0x00, 0x12, 0x34, 0x56})); -#endif - /* attach Ethernet driver to TCP/IP stack */ - ESP_ERROR_CHECK( - esp_netif_attach(eth_netif, esp_eth_new_netif_glue(eth_handle))); - /* start Ethernet driver state machine */ - ESP_ERROR_CHECK(esp_eth_start(eth_handle)); + // Start Ethernet driver state machine + for (int i = 0; i < eth_port_cnt; i++) { + ESP_ERROR_CHECK(esp_eth_start(eth_handles[i])); + } /* Waiting until either the connection is established (ETH_CONNECTED_BIT) or * connection failed for the maximum number of re-tries (ETH_FAIL_BIT). The diff --git a/components/eth_interface/include/eth_interface.h b/components/eth_interface/include/eth_interface.h index 943e1141..5fc6bcc9 100644 --- a/components/eth_interface/include/eth_interface.h +++ b/components/eth_interface/include/eth_interface.h @@ -1,6 +1,13 @@ -#ifndef _ETH_INTERFACE_H_ -#define _ETH_INTERFACE_H_ +#pragma once + +#include "esp_eth_driver.h" + +#ifdef __cplusplus +extern "C" { +#endif void eth_init(void); -#endif /* _ETH_INTERFACE_H_ */ +#ifdef __cplusplus +} +#endif diff --git a/components/flac/CMakeLists.txt b/components/flac/CMakeLists.txt index 0e609d38..49ecabaa 100644 --- a/components/flac/CMakeLists.txt +++ b/components/flac/CMakeLists.txt @@ -20,4 +20,7 @@ idf_component_register(SRCS "${srcs}" #set_source_files_properties(opus/silk/quant_LTP_gains.c PROPERTIES COMPILE_FLAGS -Wno-maybe-uninitialized) #target_compile_definitions(${COMPONENT_TARGET} PRIVATE "-DHAVE_CONFIG_H") + +set_source_files_properties(flac/src/libFLAC/bitwriter.c PROPERTIES COMPILE_FLAGS -Wno-error=format) +set_source_files_properties(flac/src/libFLAC/bitreader.c PROPERTIES COMPILE_FLAGS -Wno-error=format) target_compile_definitions(${COMPONENT_TARGET} PRIVATE "-DHAVE_CONFIG_H") diff --git a/components/lightsnapcast/CMakeLists.txt b/components/lightsnapcast/CMakeLists.txt index 06d944dd..f5921f3e 100644 --- a/components/lightsnapcast/CMakeLists.txt +++ b/components/lightsnapcast/CMakeLists.txt @@ -1,3 +1,3 @@ idf_component_register(SRCS "snapcast.c" "player.c" INCLUDE_DIRS "include" - REQUIRES custom_driver custom_board libbuffer json libmedian audio_board) + REQUIRES custom_board libbuffer json libmedian audio_board esp_wifi driver esp_timer) diff --git a/components/lightsnapcast/include/player.h b/components/lightsnapcast/include/player.h index 570bcbe8..0e5d0b93 100644 --- a/components/lightsnapcast/include/player.h +++ b/components/lightsnapcast/include/player.h @@ -1,9 +1,9 @@ #ifndef __PLAYER_H__ #define __PLAYER_H__ +#include "driver/i2s.h" #include "esp_types.h" #include "freertos/FreeRTOS.h" -#include "i2s.h" #include "sdkconfig.h" #include "snapcast.h" @@ -49,7 +49,7 @@ typedef struct snapcastSetting_s { codec_type_t codec; int32_t sr; uint8_t ch; - i2s_bits_per_sample_t bits; + i2s_data_bit_width_t bits; bool muted; uint32_t volume; diff --git a/components/lightsnapcast/player.c b/components/lightsnapcast/player.c index 8817e178..d966408b 100644 --- a/components/lightsnapcast/player.c +++ b/components/lightsnapcast/player.c @@ -10,32 +10,47 @@ #include "freertos/semphr.h" #include "freertos/task.h" -//#include "lwip/stats.h" +// #include "lwip/stats.h" #include "esp_log.h" - +#include "esp_timer.h" #include "esp_wifi.h" - #include "soc/rtc.h" -#include "driver/timer.h" +#if SOC_I2S_SUPPORTS_APLL +#include "clk_ctrl_os.h" +#endif + +#include #include "MedianFilter.h" #include "board_pins_config.h" +#include "driver/gptimer.h" +#include "driver/i2s_std.h" #include "player.h" #include "snapcast.h" -#include "i2s.h" // use custom i2s driver instead of IDF version - -#include - -#define USE_SAMPLE_INSERTION 0 // TODO: doesn't work as intended +#define USE_SAMPLE_INSERTION CONFIG_USE_SAMPLE_INSERTION #define SYNC_TASK_PRIORITY (configMAX_PRIORITIES - 1) #define SYNC_TASK_CORE_ID 1 // tskNO_AFFINITY static const char *TAG = "PLAYER"; +#if USE_SAMPLE_INSERTION + +#define INSERT_SAMPLES 1 + +const uint32_t SHORT_OFFSET = 128; +const uint32_t MINI_OFFSET = 64; + +#define USE_BIG_DMA_BUFFER 1 + +#else +const uint32_t SHORT_OFFSET = 2; +const uint32_t MINI_OFFSET = 1; +#endif + /** * @brief Pre define APLL parameters, save compute time. They are calculated in * player_setup_i2s() | bits_per_sample | rate | sdm0 | sdm1 | sdm2 | odir @@ -43,13 +58,16 @@ static const char *TAG = "PLAYER"; * apll_freq = xtal_freq * (4 + sdm2 + sdm1/256 + sdm0/65536)/((o_div + 2) * 2) * I2S bit clock is (apll_freq / 16) */ -static int apll_normal_predefine[6] = {0, 0, 0, 0, 0, 0}; -static int apll_corr_predefine[][6] = {{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}}; +static uint32_t apll_normal_predefine[6] = {0, 0, 0, 0, 0, 0}; +static uint32_t apll_corr_predefine[][6] = {{0, 0, 0, 0, 0, 0}, + {0, 0, 0, 0, 0, 0}}; static SemaphoreHandle_t latencyBufSemaphoreHandle = NULL; static bool latencyBuffFull = 0; +static gptimer_handle_t gptimer = NULL; + static sMedianFilter_t latencyMedianFilter; static sMedianNode_t latencyMedianLong[LATENCY_MEDIAN_FILTER_LEN]; @@ -79,28 +97,61 @@ static snapcastSetting_t currentSnapcastSetting; static void tg0_timer_init(void); static void tg0_timer_deinit(void); + +static bool gpTimerRunning = false; + static void player_task(void *pvParameters); extern esp_err_t audio_set_mute(bool mute); -/* -#define CONFIG_MASTER_I2S_BCK_PIN 5 -#define CONFIG_MASTER_I2S_LRCK_PIN 25 -#define CONFIG_MASTER_I2S_DATAOUT_PIN 26 -#define CONFIG_SLAVE_I2S_BCK_PIN 26 -#define CONFIG_SLAVE_I2S_LRCK_PIN 12 -#define CONFIG_SLAVE_I2S_DATAOUT_PIN 5 -*/ +static i2s_chan_handle_t tx_chan = NULL; // IsavedAge2S tx channel handler +static bool i2sEnabled = false; + +/** + * + */ +esp_err_t my_i2s_channel_disable(i2s_chan_handle_t handle) { + if (tx_chan != NULL) { + if (i2sEnabled == true) { + i2sEnabled = false; + + return i2s_channel_disable(handle); + } + } + + return ESP_OK; +} + +/** + * + */ +esp_err_t my_i2s_channel_enable(i2s_chan_handle_t handle) { + if (tx_chan != NULL) { + if (i2sEnabled == false) { + i2sEnabled = true; + + return i2s_channel_enable(handle); + } + } + + return ESP_OK; +} /** * */ static esp_err_t player_setup_i2s(i2s_port_t i2sNum, snapcastSetting_t *setting) { +#if USE_SAMPLE_INSERTION + +#if USE_BIG_DMA_BUFFER == 0 + i2sDmaBufMaxLen = 12; + i2sDmaBufCnt = CHNK_CTRL_CNT * (setting->chkInFrames / + i2sDmaBufMaxLen); // 288 * CHNK_CTRL_CNT; +#else + const int __dmaBufMaxLen = 1024; int __dmaBufCnt; int __dmaBufLen; - const int __dmaBufMaxLen = 1024; - int m_scale = 8, fi2s_clk; __dmaBufCnt = 1; __dmaBufLen = setting->chkInFrames; @@ -118,20 +169,40 @@ static esp_err_t player_setup_i2s(i2s_port_t i2sNum, i2sDmaBufCnt = __dmaBufCnt * CHNK_CTRL_CNT; i2sDmaBufMaxLen = __dmaBufLen; - -#if USE_SAMPLE_INSERTION - i2sDmaBufCnt = 128; - i2sDmaBufMaxLen = 9; #endif - fi2s_clk = setting->sr * setting->ch * setting->bits * m_scale; +#else + int fi2s_clk; + const int __dmaBufMaxLen = 1024; + int __dmaBufCnt; + int __dmaBufLen; + + __dmaBufCnt = 1; + __dmaBufLen = setting->chkInFrames; + while ((__dmaBufLen >= __dmaBufMaxLen) || (__dmaBufCnt <= 1)) { + if ((__dmaBufLen % 2) == 0) { + __dmaBufCnt *= 2; + __dmaBufLen /= 2; + } else { + ESP_LOGE(TAG, + "player_setup_i2s: Can't setup i2s with this configuration"); + + return -1; + } + } + + i2sDmaBufCnt = __dmaBufCnt * CHNK_CTRL_CNT; + i2sDmaBufMaxLen = __dmaBufLen; + + // check i2s_set_get_apll_freq() how it is done + fi2s_clk = 2 * setting->sr * + I2S_MCLK_MULTIPLE_256; // setting->ch * setting->bits * m_scale; apll_normal_predefine[0] = setting->bits; apll_normal_predefine[1] = setting->sr; - if (i2s_apll_calculate_fi2s( - fi2s_clk, setting->bits, &apll_normal_predefine[2], - &apll_normal_predefine[3], &apll_normal_predefine[4], - &apll_normal_predefine[5]) != ESP_OK) { + if (rtc_clk_apll_coeff_calc( + fi2s_clk, &apll_normal_predefine[5], &apll_normal_predefine[2], + &apll_normal_predefine[3], &apll_normal_predefine[4]) == 0) { ESP_LOGE(TAG, "ERROR, fi2s_clk"); } @@ -140,50 +211,90 @@ static esp_err_t player_setup_i2s(i2s_port_t i2sNum, apll_corr_predefine[0][0] = setting->bits; apll_corr_predefine[0][1] = setting->sr * UPPER_SR_SCALER; - if (i2s_apll_calculate_fi2s( - fi2s_clk * UPPER_SR_SCALER, setting->bits, &apll_corr_predefine[0][2], - &apll_corr_predefine[0][3], &apll_corr_predefine[0][4], - &apll_corr_predefine[0][5]) != ESP_OK) { + if (rtc_clk_apll_coeff_calc( + fi2s_clk * UPPER_SR_SCALER, &apll_corr_predefine[0][5], + &apll_corr_predefine[0][2], &apll_corr_predefine[0][3], + &apll_corr_predefine[0][4]) == 0) { ESP_LOGE(TAG, "ERROR, fi2s_clk * %f", UPPER_SR_SCALER); } apll_corr_predefine[1][0] = setting->bits; apll_corr_predefine[1][1] = setting->sr * LOWER_SR_SCALER; - if (i2s_apll_calculate_fi2s( - fi2s_clk * LOWER_SR_SCALER, setting->bits, &apll_corr_predefine[1][2], - &apll_corr_predefine[1][3], &apll_corr_predefine[1][4], - &apll_corr_predefine[1][5]) != ESP_OK) { + if (rtc_clk_apll_coeff_calc( + fi2s_clk * LOWER_SR_SCALER, &apll_corr_predefine[1][5], + &apll_corr_predefine[1][2], &apll_corr_predefine[1][3], + &apll_corr_predefine[1][4]) == 0) { ESP_LOGE(TAG, "ERROR, fi2s_clk * %f", LOWER_SR_SCALER); } +#endif - ESP_LOGI(TAG, "player_setup_i2s: dma_buf_len is %d, dma_buf_count is %d", + ESP_LOGI(TAG, "player_setup_i2s: dma_buf_len is %ld, dma_buf_count is %ld", i2sDmaBufMaxLen, i2sDmaBufCnt); - i2s_config_t i2s_config0 = { - .mode = I2S_MODE_MASTER | I2S_MODE_TX, // Only TX - .sample_rate = setting->sr, - .bits_per_sample = setting->bits, - .channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT, // 2-channels - .communication_format = I2S_COMM_FORMAT_STAND_I2S, - .dma_buf_count = i2sDmaBufCnt, - .dma_buf_len = i2sDmaBufMaxLen, - .intr_alloc_flags = 1, // Default interrupt priority - .use_apll = true, - .fixed_mclk = 0, - .tx_desc_auto_clear = true // Auto clear tx descriptor on underflow + if (tx_chan) { + my_i2s_channel_disable(tx_chan); + i2s_del_channel(tx_chan); + tx_chan = NULL; + + // periph_rtc_apll_release(); + } + + i2s_chan_config_t tx_chan_cfg = { + .id = i2sNum, + .role = I2S_ROLE_MASTER, + .dma_desc_num = i2sDmaBufCnt, + .dma_frame_num = i2sDmaBufMaxLen, + .auto_clear = false, }; + ESP_ERROR_CHECK(i2s_new_channel(&tx_chan_cfg, &tx_chan, NULL)); - i2s_pin_config_t pin_config0; + board_i2s_pin_t pin_config0; get_i2s_pins(i2sNum, &pin_config0); - i2s_custom_driver_uninstall(i2sNum); - i2s_custom_driver_install(i2sNum, &i2s_config0, 0, NULL); - i2s_custom_set_pin(i2sNum, &pin_config0); - -#if CONFIG_AUDIO_BOARD_CUSTOM - i2s_mclk_gpio_select(i2sNum, CONFIG_MASTER_I2S_MCLK_PIN); + i2s_std_clk_config_t i2s_clkcfg = { + .sample_rate_hz = setting->sr, + .clk_src = I2S_CLK_SRC_APLL, + .mclk_multiple = I2S_MCLK_MULTIPLE_256, + }; + i2s_std_config_t tx_std_cfg = { + .clk_cfg = i2s_clkcfg, +#if CONFIG_I2S_USE_MSB_FORMAT + .slot_cfg = + I2S_STD_MSB_SLOT_DEFAULT_CONFIG(setting->bits, I2S_SLOT_MODE_STEREO), +#else + .slot_cfg = I2S_STD_PHILIPS_SLOT_DEFAULT_CONFIG(setting->bits, + I2S_SLOT_MODE_STEREO), +#endif + .gpio_cfg = + { + .mclk = pin_config0.mck_io_num, + .bclk = pin_config0.bck_io_num, + .ws = pin_config0.ws_io_num, + .dout = pin_config0.data_out_num, + .din = pin_config0.data_in_num, + .invert_flags = + { +#if CONFIG_INVERT_MCLK_LEVEL + .mclk_inv = true, +#else + .mclk_inv = false, +#endif +#if CONFIG_INVERT_BCLK_LEVEL + .bclk_inv = true, #else - i2s_mclk_gpio_select(i2sNum, GPIO_NUM_0); + .bclk_inv = false, #endif +#if CONFIG_INVERT_WORD_SELECT_LEVEL + .ws_inv = true, +#else + .ws_inv = false, +#endif + }, + }, + }; + + ESP_ERROR_CHECK(i2s_channel_init_std_mode(tx_chan, &tx_std_cfg)); + + // my_i2s_channel_enable(tx_chan); return 0; } @@ -274,7 +385,7 @@ int init_player(void) { currentSnapcastSetting.sr = 48000; currentSnapcastSetting.ch = 2; currentSnapcastSetting.bits = 16; - currentSnapcastSetting.muted = false; + currentSnapcastSetting.muted = true; currentSnapcastSetting.volume = 70; if (snapcastSettingsMux == NULL) { @@ -287,13 +398,6 @@ int init_player(void) { xSemaphoreGive(playerPcmQueueMux); } - ret = player_setup_i2s(I2S_NUM_0, ¤tSnapcastSetting); - if (ret < 0) { - ESP_LOGE(TAG, "player_setup_i2s failed: %d", ret); - - return -1; - } - // create semaphore for time diff buffer to server if (latencyBufSemaphoreHandle == NULL) { latencyBufSemaphoreHandle = xSemaphoreCreateMutex(); @@ -515,8 +619,8 @@ int32_t get_diff_to_server(int64_t *tDiff) { if (xSemaphoreTake(latencyBufSemaphoreHandle, 0) == pdFALSE) { *tDiff = lastDiff; - ESP_LOGW(TAG, - "get_diff_to_server: can't take semaphore. Old diff retrieved"); + // ESP_LOGW(TAG, + // "get_diff_to_server: can't take semaphore. Old diff retrieved"); return -1; } @@ -543,8 +647,9 @@ int32_t server_now(int64_t *sNow, int64_t *diff2Server) { now = esp_timer_get_time(); if (get_diff_to_server(&diff) == -1) { - ESP_LOGW(TAG, - "server_now: can't get current diff to server. Retrieved old one"); + // ESP_LOGW(TAG, + // "server_now: can't get current diff to server. Retrieved old + // one"); } if (diff == 0) { @@ -575,71 +680,102 @@ int32_t server_now(int64_t *sNow, int64_t *diff2Server) { * flash cache is disabled, we can allocate this interrupt without the * ESP_INTR_FLAG_IRAM flag and use the normal API. */ -void IRAM_ATTR timer_group0_isr(void *para) { - timer_spinlock_take(TIMER_GROUP_1); +static bool IRAM_ATTR timer_group0_alarm_cb( + gptimer_handle_t timer, const gptimer_alarm_event_data_t *edata, + void *user_data) { + // timer_spinlock_take(TIMER_GROUP_1); BaseType_t xHigherPriorityTaskWoken = pdFALSE; - // Retrieve the interrupt status and the counter value - // from the timer that reported the interrupt - uint32_t timer_intr = timer_group_get_intr_status_in_isr(TIMER_GROUP_1); + uint64_t timer_counter_value = edata->count_value; + + // Notify the task in the task's notification value. + xTaskNotifyFromISR(playerTaskHandle, (uint32_t)timer_counter_value, + eSetValueWithOverwrite, &xHigherPriorityTaskWoken); - // Clear the interrupt - // and update the alarm time for the timer with without reload - if (timer_intr & TIMER_INTR_T1) { - timer_group_clr_intr_status_in_isr(TIMER_GROUP_1, TIMER_1); + return xHigherPriorityTaskWoken == pdTRUE; +} - uint64_t timer_counter_value = - timer_group_get_counter_value_in_isr(TIMER_GROUP_1, TIMER_1); +/** + * + */ +esp_err_t my_gptimer_stop(gptimer_handle_t timer) { + if (gpTimerRunning == true) { + gpTimerRunning = false; - // Notify the task in the task's notification value. - xTaskNotifyFromISR(playerTaskHandle, (uint32_t)timer_counter_value, - eSetValueWithOverwrite, &xHigherPriorityTaskWoken); + return gptimer_stop(timer); } - timer_spinlock_give(TIMER_GROUP_1); + return ESP_OK; +} + +/** + * + */ +esp_err_t my_gptimer_start(gptimer_handle_t timer) { + if (gpTimerRunning == false) { + gpTimerRunning = true; - if (xHigherPriorityTaskWoken) { - portYIELD_FROM_ISR(); + return gptimer_start(timer); } + + return ESP_OK; } -static void tg0_timer_deinit(void) { timer_deinit(TIMER_GROUP_1, TIMER_1); } +static void tg0_timer_deinit(void) { + // timer_deinit(TIMER_GROUP_1, TIMER_1); + if (gptimer) { + ESP_ERROR_CHECK(my_gptimer_stop(gptimer)); + ESP_ERROR_CHECK(gptimer_disable(gptimer)); + ESP_ERROR_CHECK(gptimer_del_timer(gptimer)); + gptimer = NULL; + } +} /* * */ static void tg0_timer_init(void) { + tg0_timer_deinit(); + // Select and initialize basic parameters of the timer - timer_config_t config = { - //.divider = 8, // 100ns ticks - .divider = 80, // 80, // 1µs ticks - .counter_dir = TIMER_COUNT_UP, - .counter_en = TIMER_PAUSE, - .alarm_en = TIMER_ALARM_EN, - .auto_reload = TIMER_AUTORELOAD_DIS, - }; // default clock source is APB - timer_init(TIMER_GROUP_1, TIMER_1, &config); - - // Configure the alarm value and the interrupt on alarm. - // timer_set_alarm_value(TIMER_GROUP_1, TIMER_1, 0); - timer_enable_intr(TIMER_GROUP_1, TIMER_1); - if (timer_isr_register(TIMER_GROUP_1, TIMER_1, timer_group0_isr, NULL, - ESP_INTR_FLAG_IRAM | ESP_INTR_FLAG_LEVEL3, - NULL) != ESP_OK) { - ESP_LOGE(TAG, "unable to register timer 1 callback"); - } + gptimer_config_t timer_config = { + .clk_src = GPTIMER_CLK_SRC_DEFAULT, + .direction = GPTIMER_COUNT_UP, + .resolution_hz = 1000000, // 1MHz, 1 tick=1us + }; + ESP_ERROR_CHECK(gptimer_new_timer(&timer_config, &gptimer)); + + gptimer_event_callbacks_t cbs = { + .on_alarm = timer_group0_alarm_cb, + }; + ESP_ERROR_CHECK(gptimer_register_event_callbacks(gptimer, &cbs, NULL)); + + ESP_LOGI(TAG, "enable initial sync timer"); + ESP_ERROR_CHECK(gptimer_enable(gptimer)); } /** * */ static void tg0_timer1_start(uint64_t alarm_value) { - timer_pause(TIMER_GROUP_1, TIMER_1); - timer_set_alarm_value(TIMER_GROUP_1, TIMER_1, alarm_value); - timer_set_counter_value(TIMER_GROUP_1, TIMER_1, 0); - timer_set_alarm(TIMER_GROUP_1, TIMER_1, TIMER_ALARM_EN); - timer_start(TIMER_GROUP_1, TIMER_1); + // timer_pause(TIMER_GROUP_1, TIMER_1); + // timer_set_alarm_value(TIMER_GROUP_1, TIMER_1, alarm_value); + // timer_set_counter_value(TIMER_GROUP_1, TIMER_1, 0); + // timer_set_alarm(TIMER_GROUP_1, TIMER_1, TIMER_ALARM_EN); + // timer_start(TIMER_GROUP_1, TIMER_1); + + if (gptimer) { + my_gptimer_stop(gptimer); + ESP_ERROR_CHECK(gptimer_set_raw_count(gptimer, 0)); + gptimer_alarm_config_t alarm_config1 = { + .alarm_count = alarm_value, // period + .reload_count = 0, + .flags.auto_reload_on_alarm = false, + }; + ESP_ERROR_CHECK(gptimer_set_alarm_action(gptimer, &alarm_config1)); + ESP_ERROR_CHECK(my_gptimer_start(gptimer)); + } // ESP_LOGI(TAG, "started age timer"); } @@ -678,7 +814,9 @@ void adjust_apll(int8_t direction) { direction = 0; } - rtc_clk_apll_enable(1, sdm0, sdm1, sdm2, o_div); + // periph_rtc_apll_acquire(); + rtc_clk_apll_coeff_set(o_div, sdm0, sdm1, sdm2); + // rtc_clk_apll_enable(1, sdm0, sdm1, sdm2, o_div); currentDir = direction; } @@ -750,7 +888,7 @@ int32_t allocate_pcm_chunk_memory_caps(pcm_chunk_message_t *pcmChunk, if (pcmChunk->fragment->payload == NULL) { ESP_LOGE( TAG, - "Failed to heap_caps_malloc(%d, %d) memory for pcm chunk payload", + "Failed to heap_caps_malloc(%u, %ld) memory for pcm chunk payload", bytes, caps); ret = -2; @@ -1042,6 +1180,7 @@ static void player_task(void *pvParameters) { pcm_chunk_message_t *chnk = NULL; int64_t serverNow = 0; int64_t age; + int64_t savedAge = 0; BaseType_t ret; int64_t chkDur_us = 24000; char *p_payload = NULL; @@ -1053,13 +1192,14 @@ static void player_task(void *pvParameters) { int initialSync = 0; int64_t avg = 0; int dir = 0; - uint32_t dir_insert_sample = 0; + int32_t dir_insert_sample = 0; + int32_t insertedSamplesCounter = 0; int64_t buf_us = 0; pcm_chunk_fragment_t *fragment = NULL; size_t written; bool gotSnapserverConfig = false; int64_t clientDacLatency_us = 0; - int64_t diff2Server; + int64_t diff2Server = 0; int64_t outputBufferDacTime = 0; memset(&scSet, 0, sizeof(snapcastSetting_t)); @@ -1104,22 +1244,22 @@ static void player_task(void *pvParameters) { if ((scSet.sr != __scSet.sr) || (scSet.bits != __scSet.bits) || (scSet.ch != __scSet.ch)) { - i2s_custom_start(I2S_NUM_0); + my_i2s_channel_enable(tx_chan); audio_set_mute(true); - i2s_custom_stop(I2S_NUM_0); + my_i2s_channel_disable(tx_chan); - ret = player_setup_i2s(I2S_NUM_0, ¤tSnapcastSetting); + ret = player_setup_i2s(I2S_NUM_0, &__scSet); if (ret < 0) { ESP_LOGE(TAG, "player_setup_i2s failed: %d", ret); return; } +#if !USE_SAMPLE_INSERTION // force adjust_apll() to set playback speed currentDir = 1; adjust_apll(0); - - i2s_custom_set_clk(I2S_NUM_0, __scSet.sr, __scSet.bits, __scSet.ch); +#endif initialSync = 0; } @@ -1129,8 +1269,6 @@ static void player_task(void *pvParameters) { destroy_pcm_queue(&pcmChkQHdl); } - // xSemaphoreTake(playerPcmQueueMux, portMAX_DELAY); - if (pcmChkQHdl == NULL) { int entries = ceil(((float)__scSet.sr / (float)__scSet.chkInFrames) * ((float)__scSet.buf_ms / 1000)); @@ -1144,11 +1282,9 @@ static void player_task(void *pvParameters) { ESP_LOGI(TAG, "created new queue with %d", entries); } - // xSemaphoreGive(playerPcmQueueMux); - ESP_LOGI(TAG, - "snapserver config changed, buffer %dms, chunk %d frames, " - "sample rate %d, ch %d, bits %d mute %d latency %d", + "snapserver config changed, buffer %ldms, chunk %ld frames, " + "sample rate %ld, ch %d, bits %d mute %d latency %ld", __scSet.buf_ms, __scSet.chkInFrames, __scSet.sr, __scSet.ch, __scSet.bits, __scSet.muted, __scSet.cDacLat_ms); @@ -1181,16 +1317,11 @@ static void player_task(void *pvParameters) { } if (chnk == NULL) { - // xSemaphoreTake(playerPcmQueueMux, portMAX_DELAY); if (pcmChkQHdl != NULL) { ret = xQueueReceive(pcmChkQHdl, &chnk, pdMS_TO_TICKS(2000)); - - // xSemaphoreGive(playerPcmQueueMux); } else { // ESP_LOGE (TAG, "Couldn't get PCM chunk, pcm queue not created"); - // xSemaphoreGive(playerPcmQueueMux); - vTaskDelay(pdMS_TO_TICKS(100)); continue; @@ -1210,8 +1341,20 @@ static void player_task(void *pvParameters) { (int64_t)chnk->timestamp.usec; age = serverNow - chunkStart - buf_us + clientDacLatency_us; +#if USE_BIG_DMA_BUFFER + savedAge = age; + if (insertedSamplesCounter > 0) { + age -= (((1 + insertedSamplesCounter / i2sDmaBufMaxLen) * chkDur_us / + 2) - + (insertedSamplesCounter * 1000000UL / scSet.sr)); + } else if (insertedSamplesCounter < 0) { + age += + (((-insertedSamplesCounter / i2sDmaBufMaxLen) * chkDur_us / 2) - + (-insertedSamplesCounter * 1000000UL / scSet.sr)); + } +#endif - // ESP_LOGE(TAG,"age: %lld, serverNow %lld, chunkStart %lld, + // ESP_LOGE(TAG,"age: %lld, serverNow %lld, chunkStart %lld, // buf_us %lld", age, serverNow, chunkStart, buf_us); if (initialSync == 1) { @@ -1237,33 +1380,31 @@ static void player_task(void *pvParameters) { MEDIANFILTER_Init(&shortMedianFilter); MEDIANFILTER_Init(&miniMedianFilter); - timer_set_auto_reload(TIMER_GROUP_1, TIMER_1, TIMER_AUTORELOAD_DIS); tg0_timer1_start(-age); // timer with 1µs ticks - i2s_custom_stop(I2S_NUM_0); - i2s_custom_zero_dma_buffer(I2S_NUM_0); + my_i2s_channel_disable(tx_chan); +#if !USE_SAMPLE_INSERTION adjust_apll(0); // reset to normal playback speed - - uint32_t currentDescriptor = 0, currentDescriptorOffset = 0; +#endif uint32_t tmpCnt = CHNK_CTRL_CNT; - - // xSemaphoreTake(playerPcmQueueMux, portMAX_DELAY); while (tmpCnt) { if (chnk == NULL) { if (pcmChkQHdl != NULL) { ret = xQueueReceive(pcmChkQHdl, &chnk, portMAX_DELAY); } } - // xSemaphoreGive(playerPcmQueueMux); fragment = chnk->fragment; p_payload = fragment->payload; size = fragment->size; - i2s_custom_init_dma_tx_queues(I2S_NUM_0, (uint8_t *)p_payload, size, - &written, ¤tDescriptor, - ¤tDescriptorOffset); + ESP_ERROR_CHECK( + i2s_channel_preload_data(tx_chan, p_payload, size, &written)); + // ESP_LOGE(TAG, "preload %d bytes", written); + + // TODO: do error check if DMA is full here + size -= written; p_payload += written; @@ -1281,19 +1422,17 @@ static void player_task(void *pvParameters) { tmpCnt--; } - // xTaskNotifyStateClear(playerTaskHandle); - // Wait to be notified of a timer interrupt. xTaskNotifyWait(pdFALSE, // Don't clear bits on entry. pdFALSE, // Don't clear bits on exit. ¬ifiedValue, // Stores the notified value. portMAX_DELAY); // or use simple task delay for this - // vTaskDelay( pdMS_TO_TICKS(-age / 1000) ); + // vTaskDelay( pdMS_TO_TICKS(-age / 1000) ); - timer_pause(TIMER_GROUP_1, TIMER_1); + my_gptimer_stop(gptimer); - i2s_custom_start(I2S_NUM_0); + my_i2s_channel_enable(tx_chan); // get timer value so we can get the real age timer_val = (int64_t)notifiedValue; @@ -1301,37 +1440,6 @@ static void player_task(void *pvParameters) { // get actual age after alarm age = (int64_t)timer_val - (-age); - // check if we need to write remaining data - if (size != 0) { - do { - written = 0; - if (i2s_custom_write(I2S_NUM_0, p_payload, (size_t)size, &written, - portMAX_DELAY) != ESP_OK) { - ESP_LOGE(TAG, "i2s_playback_task: I2S write error"); - } - if (written < size) { - ESP_LOGE(TAG, - "i2s_playback_task: I2S didn't " - "write all data"); - } - size -= written; - p_payload += written; - - if (size == 0) { - if (fragment->nextFragment != NULL) { - fragment = fragment->nextFragment; - p_payload = fragment->payload; - size = fragment->size; - } else { - free_pcm_chunk(chnk); - chnk = NULL; - - break; - } - } - } while (1); - } - initialSync = 1; // TODO: use a timer to un-mute non blocking @@ -1351,11 +1459,10 @@ static void player_task(void *pvParameters) { // get count of chunks we are late for uint32_t c = ceil((float)age / (float)chkDur_us); // round up + // now clear all those chunks which are probably late too while (c--) { - // xSemaphoreTake(playerPcmQueueMux, portMAX_DELAY); ret = xQueueReceive(pcmChkQHdl, &chnk, pdMS_TO_TICKS(1)); - // xSemaphoreGive(playerPcmQueueMux); if (ret == pdPASS) { free_pcm_chunk(chnk); chnk = NULL; @@ -1367,18 +1474,7 @@ static void player_task(void *pvParameters) { wifi_ap_record_t ap; esp_wifi_sta_get_ap_info(&ap); - timer_pause(TIMER_GROUP_1, TIMER_1); - timer_set_auto_reload(TIMER_GROUP_1, TIMER_1, TIMER_AUTORELOAD_DIS); - - // xSemaphoreTake(playerPcmQueueMux, portMAX_DELAY); - // ESP_LOGW(TAG, - // "RESYNCING HARD 1: age %lldus, latency %lldus, free - // %d, " "largest block %d, %d, rssi: %d", age, - // diff2Server, - // heap_caps_get_free_size(MALLOC_CAP_32BIT), - // heap_caps_get_largest_free_block(MALLOC_CAP_32BIT), - // uxQueueMessagesWaiting(pcmChkQHdl), ap.rssi); - // xSemaphoreGive(playerPcmQueueMux); + my_gptimer_stop(gptimer); ESP_LOGW(TAG, "RESYNCING HARD 1: age %lldus, latency %lldus, free %d, " @@ -1390,18 +1486,20 @@ static void player_task(void *pvParameters) { initialSync = 0; + insertedSamplesCounter = 0; + audio_set_mute(true); - i2s_custom_stop(I2S_NUM_0); + my_i2s_channel_disable(tx_chan); continue; } const bool enableControlLoop = true; - const int64_t shortOffset = 2; //µs, softsync - const int64_t miniOffset = 1; //µs, softsync - const int64_t hardResyncThreshold = 10000; //µs, hard sync + const int64_t shortOffset = SHORT_OFFSET; // µs, softsync + const int64_t miniOffset = MINI_OFFSET; // µs, softsync + const int64_t hardResyncThreshold = 5000; // µs, hard sync if (initialSync == 1) { avg = age; @@ -1411,16 +1509,12 @@ static void player_task(void *pvParameters) { shortMedian = MEDIANFILTER_Insert(&shortMedianFilter, avg); miniMedian = MEDIANFILTER_Insert(&miniMedianFilter, avg); - // xSemaphoreTake(playerPcmQueueMux, portMAX_DELAY); int msgWaiting = uxQueueMessagesWaiting(pcmChkQHdl); - // xSemaphoreGive(playerPcmQueueMux); // resync hard if we are getting very late / early. // rest gets tuned in through apll speed control - if ((msgWaiting == 0) || (MEDIANFILTER_isFull(&shortMedianFilter,0) && - (abs(shortMedian) > hardResyncThreshold))) - // if (msgWaiting == 0) - { + if ((msgWaiting == 0) || (MEDIANFILTER_isFull(&shortMedianFilter, 0) && + (abs(shortMedian) > hardResyncThreshold))) { if (chnk != NULL) { free_pcm_chunk(chnk); chnk = NULL; @@ -1429,7 +1523,6 @@ static void player_task(void *pvParameters) { wifi_ap_record_t ap; esp_wifi_sta_get_ap_info(&ap); - // xSemaphoreTake(playerPcmQueueMux, portMAX_DELAY); ESP_LOGW(TAG, "RESYNCING HARD 2: age %lldus, latency %lldus, free " "%d, largest block %d, %d, rssi: %d", @@ -1437,48 +1530,37 @@ static void player_task(void *pvParameters) { heap_caps_get_largest_free_block(MALLOC_CAP_32BIT), msgWaiting, ap.rssi); - // // get count of chunks we are late for - // uint32_t c = ceil((float)age / (float)chkDur_us); // - // round up - // // now clear all those chunks which are probably late too - // while (c--) { - // ret = xQueueReceive(pcmChkQHdl, &chnk, - // pdMS_TO_TICKS(1)); if (ret == pdPASS) { - // free_pcm_chunk(chnk); - // chnk = NULL; - // } else { - // break; - // } - // } - - // xSemaphoreGive(playerPcmQueueMux); - - timer_pause(TIMER_GROUP_1, TIMER_1); - timer_set_auto_reload(TIMER_GROUP_1, TIMER_1, TIMER_AUTORELOAD_DIS); + my_gptimer_stop(gptimer); audio_set_mute(true); - i2s_custom_stop(I2S_NUM_0); + my_i2s_channel_disable(tx_chan); initialSync = 0; + insertedSamplesCounter = 0; + continue; } -#if USE_SAMPLE_INSERTION // WIP: insert samples to adjust sync +#if USE_SAMPLE_INSERTION // insert samples to adjust sync if ((enableControlLoop == true) && - (MEDIANFILTER_isFull(&shortMedianFilter,0))) { - if (avg < -miniOffset) { // we are early + (MEDIANFILTER_isFull(&shortMedianFilter, 0))) { + if ((shortMedian < -shortOffset) && (miniMedian < -miniOffset) && + (avg < -miniOffset)) { // we are early dir = -1; dir_insert_sample = -1; - } else if (avg > miniOffset) { // we are late + insertedSamplesCounter += INSERT_SAMPLES; + } else if ((shortMedian > shortOffset) && (miniMedian > miniOffset) && + (avg > miniOffset)) { // we are late dir = 1; dir_insert_sample = 1; + insertedSamplesCounter -= INSERT_SAMPLES; } } #else // use APLL to adjust sync if ((enableControlLoop == true) && - (MEDIANFILTER_isFull(&shortMedianFilter,0))) { + (MEDIANFILTER_isFull(&shortMedianFilter, 0))) { if ((shortMedian < -shortOffset) && (miniMedian < -miniOffset) && (avg < -miniOffset)) { // we are early dir = -1; @@ -1493,7 +1575,7 @@ static void player_task(void *pvParameters) { const uint32_t tmpCntInit = 1; // 250 // every 6s static uint32_t tmpcnt = 1; - if (tmpcnt-- == 0) { + if (--tmpcnt == 0) { int64_t sec, msec, usec; tmpcnt = tmpCntInit; @@ -1502,28 +1584,6 @@ static void player_task(void *pvParameters) { usec = diff2Server - sec * 1000000; msec = usec / 1000; usec = usec % 1000; - - // xSemaphoreTake(playerPcmQueueMux, portMAX_DELAY); - - //ESP_LOGI (TAG, "%d, %lldus, q %d", dir, avg, uxQueueMessagesWaiting(pcmChkQHdl)); - - // ESP_LOGI (TAG, "%d, %lldus, %lldus %llds, - // %lld.%lldms", dir, age, avg, sec, msec, usec); - - // ESP_LOGI(TAG, "%d, %lldus, %lldus, %lldus, q:%d", dir, - // avg, shortMedian, miniMedian, - // uxQueueMessagesWaiting(pcmChkQHdl)); - - // ESP_LOGI( TAG, "8b f - // %d b %d", heap_caps_get_free_size(MALLOC_CAP_8BIT | - // MALLOC_CAP_INTERNAL), - // heap_caps_get_largest_free_block(MALLOC_CAP_8BIT | - // MALLOC_CAP_INTERNAL)); ESP_LOGI( TAG, "32b f %d b %d", - // heap_caps_get_free_size(MALLOC_CAP_32BIT | - // MALLOC_CAP_EXEC), heap_caps_get_largest_free_block - // (MALLOC_CAP_32BIT | MALLOC_CAP_EXEC)); - - // xSemaphoreGive(playerPcmQueueMux); } dir = 0; @@ -1537,23 +1597,23 @@ static void player_task(void *pvParameters) { written = 0; #if USE_SAMPLE_INSERTION - uint32_t sampleSizeInBytes = 4 * 3; + uint32_t sampleSizeInBytes = + (scSet.bits / 8) * scSet.ch * INSERT_SAMPLES; - if (dir_insert_sample == -1) { - if (i2s_custom_write(I2S_NUM_0, p_payload, - (size_t)sampleSizeInBytes, &written, - portMAX_DELAY) != ESP_OK) { + if (dir_insert_sample < 0) { + if (i2s_channel_write(tx_chan, p_payload, sampleSizeInBytes, + &written, portMAX_DELAY) != ESP_OK) { ESP_LOGE(TAG, "i2s_playback_task: I2S write error %d", 1); } - } else if (dir_insert_sample == 1) { + } else if (dir_insert_sample > 0) { size -= sampleSizeInBytes; } dir_insert_sample = 0; #endif - if (i2s_custom_write(I2S_NUM_0, p_payload, (size_t)size, &written, - portMAX_DELAY) != ESP_OK) { + if (i2s_channel_write(tx_chan, p_payload, size, &written, + portMAX_DELAY) != ESP_OK) { ESP_LOGE(TAG, "i2s_playback_task: I2S write error %d", size); } @@ -1573,7 +1633,7 @@ static void player_task(void *pvParameters) { } else { free_pcm_chunk(chnk); chnk = NULL; - + dir = 0; break; } } @@ -1588,8 +1648,8 @@ static void player_task(void *pvParameters) { memset(tmpBuf, 0, sizeof(tmpBuf)); do { - if (i2s_custom_write(I2S_NUM_0, tmpBuf, (size_t)write_size, - &written, portMAX_DELAY) != ESP_OK) { + if (i2s_channel_write(tx_chan, tmpBuf, write_size, &written, + portMAX_DELAY) != ESP_OK) { ESP_LOGE(TAG, "i2s_playback_task: I2S write error %d", size); } @@ -1608,14 +1668,12 @@ static void player_task(void *pvParameters) { msec = usec / 1000; usec = usec % 1000; - // xSemaphoreTake(playerPcmQueueMux, portMAX_DELAY); if (pcmChkQHdl != NULL) { ESP_LOGE(TAG, "Couldn't get PCM chunk, recv: messages waiting %d, " "diff2Server: %llds, %lld.%lldms", uxQueueMessagesWaiting(pcmChkQHdl), sec, msec, usec); } - // xSemaphoreGive(playerPcmQueueMux); dir = 0; @@ -1623,7 +1681,7 @@ static void player_task(void *pvParameters) { audio_set_mute(true); - i2s_custom_stop(I2S_NUM_0); + my_i2s_channel_disable(tx_chan); } } } diff --git a/components/net_functions/CMakeLists.txt b/components/net_functions/CMakeLists.txt index 33c2270c..64011a13 100644 --- a/components/net_functions/CMakeLists.txt +++ b/components/net_functions/CMakeLists.txt @@ -1,3 +1,3 @@ idf_component_register(SRCS "net_functions.c" INCLUDE_DIRS "include" - REQUIRES mdns wifi_interface) + REQUIRES mdns wifi_interface driver) diff --git a/components/net_functions/net_functions.c b/components/net_functions/net_functions.c index f1209b2c..31dabfcd 100644 --- a/components/net_functions/net_functions.c +++ b/components/net_functions/net_functions.c @@ -24,136 +24,113 @@ static const char *TAG = "NETF"; extern EventGroupHandle_t s_wifi_event_group; -static const char *if_str[] = { "STA", "AP", "ETH", "MAX" }; -static const char *ip_protocol_str[] = { "V4", "V6", "MAX" }; +static const char *if_str[] = {"STA", "AP", "ETH", "MAX"}; +static const char *ip_protocol_str[] = {"V4", "V6", "MAX"}; -void -net_mdns_register (const char *clientname) -{ - ESP_LOGI (TAG, "Setup mdns"); - ESP_ERROR_CHECK (mdns_init ()); - ESP_ERROR_CHECK (mdns_hostname_set (clientname)); - ESP_ERROR_CHECK (mdns_instance_name_set ("ESP32 SNAPcast client OTA")); - ESP_ERROR_CHECK (mdns_service_add (NULL, "_http", "_tcp", 8032, NULL, 0)); +void net_mdns_register(const char *clientname) { + ESP_LOGI(TAG, "Setup mdns"); + ESP_ERROR_CHECK(mdns_init()); + ESP_ERROR_CHECK(mdns_hostname_set(clientname)); + ESP_ERROR_CHECK(mdns_instance_name_set("ESP32 SNAPcast client OTA")); + ESP_ERROR_CHECK(mdns_service_add(NULL, "_http", "_tcp", 8032, NULL, 0)); } -void -mdns_print_results (mdns_result_t *results) -{ +void mdns_print_results(mdns_result_t *results) { mdns_result_t *r = results; mdns_ip_addr_t *a = NULL; int i = 1, t; - while (r) - { - printf ("%d: Interface: %s, Type: %s\n", i++, if_str[r->tcpip_if], - ip_protocol_str[r->ip_protocol]); - if (r->instance_name) - { - printf (" PTR : %s\n", r->instance_name); - } - if (r->hostname) - { - printf (" SRV : %s.local:%u\n", r->hostname, r->port); - } - if (r->txt_count) - { - printf (" TXT : [%u] ", r->txt_count); - for (t = 0; t < r->txt_count; t++) - { - printf ("%s=%s; ", r->txt[t].key, r->txt[t].value); - } - printf ("\n"); - } - a = r->addr; - while (a) - { - if (a->addr.type == IPADDR_TYPE_V6) - { - printf (" AAAA: " IPV6STR "\n", IPV62STR (a->addr.u_addr.ip6)); - } - else - { - printf (" A : " IPSTR "\n", IP2STR (&(a->addr.u_addr.ip4))); - } - a = a->next; - } - r = r->next; + while (r) { + // printf ("%d: Interface: %s, Type: %s\n", i++, if_str[r->tcpip_if], + // ip_protocol_str[r->ip_protocol]); + printf("%d: Type: %s\n", i++, ip_protocol_str[r->ip_protocol]); + if (r->instance_name) { + printf(" PTR : %s\n", r->instance_name); } + if (r->hostname) { + printf(" SRV : %s.local:%u\n", r->hostname, r->port); + } + if (r->txt_count) { + printf(" TXT : [%u] ", r->txt_count); + for (t = 0; t < r->txt_count; t++) { + printf("%s=%s; ", r->txt[t].key, r->txt[t].value); + } + printf("\n"); + } + a = r->addr; + while (a) { + if (a->addr.type == IPADDR_TYPE_V6) { + printf(" AAAA: " IPV6STR "\n", IPV62STR(a->addr.u_addr.ip6)); + } else { + printf(" A : " IPSTR "\n", IP2STR(&(a->addr.u_addr.ip4))); + } + a = a->next; + } + r = r->next; + } } -uint32_t -find_mdns_service (const char *service_name, const char *proto) -{ - ESP_LOGI (TAG, "Query PTR: %s.%s.local", service_name, proto); +uint32_t find_mdns_service(const char *service_name, const char *proto) { + ESP_LOGI(TAG, "Query PTR: %s.%s.local", service_name, proto); mdns_result_t *r = NULL; - esp_err_t err = mdns_query_ptr (service_name, proto, 3000, 20, &r); - if (err) - { - ESP_LOGE (TAG, "Query Failed"); - return -1; - } - if (!r) - { - ESP_LOGW (TAG, "No results found!"); - return -1; - } + esp_err_t err = mdns_query_ptr(service_name, proto, 3000, 20, &r); + if (err) { + ESP_LOGE(TAG, "Query Failed"); + return -1; + } + if (!r) { + ESP_LOGW(TAG, "No results found!"); + return -1; + } - if (r->instance_name) - { - printf (" PTR : %s\n", r->instance_name); - } - if (r->hostname) - { - printf (" SRV : %s.local:%u\n", r->hostname, r->port); - return r->port; - } - mdns_query_results_free (r); + if (r->instance_name) { + printf(" PTR : %s\n", r->instance_name); + } + if (r->hostname) { + printf(" SRV : %s.local:%u\n", r->hostname, r->port); + return r->port; + } + mdns_query_results_free(r); return 0; } /** * */ -void -sntp_cb (struct timeval *tv) -{ - struct tm timeinfo = { 0 }; +void sntp_cb(struct timeval *tv) { + struct tm timeinfo = {0}; time_t now = tv->tv_sec; - localtime_r (&now, &timeinfo); + localtime_r(&now, &timeinfo); char strftime_buf[64]; - strftime (strftime_buf, sizeof (strftime_buf), "%c", &timeinfo); - ESP_LOGI (TAG, "sntp_cb called :%s", strftime_buf); + strftime(strftime_buf, sizeof(strftime_buf), "%c", &timeinfo); + ESP_LOGI(TAG, "sntp_cb called :%s", strftime_buf); } -void -set_time_from_sntp () -{ - xEventGroupWaitBits (s_wifi_event_group, WIFI_CONNECTED_BIT, false, true, - portMAX_DELAY); +void set_time_from_sntp() { + xEventGroupWaitBits(s_wifi_event_group, WIFI_CONNECTED_BIT, false, true, + portMAX_DELAY); // ESP_LOGI(TAG, "clock %"); - ESP_LOGI (TAG, "Initializing SNTP"); - sntp_setoperatingmode (SNTP_OPMODE_POLL); - sntp_setservername (0, CONFIG_SNTP_SERVER); - sntp_init (); + ESP_LOGI(TAG, "Initializing SNTP"); + sntp_setoperatingmode(SNTP_OPMODE_POLL); + sntp_setservername(0, CONFIG_SNTP_SERVER); + sntp_init(); // sntp_set_time_sync_notification_cb(sntp_cb); - setenv ("TZ", SNTP_TIMEZONE, 1); - tzset (); + setenv("TZ", SNTP_TIMEZONE, 1); + tzset(); time_t now = 0; - struct tm timeinfo = { 0 }; + struct tm timeinfo = {0}; int retry = 0; const int retry_count = 10; - while (timeinfo.tm_year < (2016 - 1900) && ++retry < retry_count) - { - ESP_LOGI (TAG, "Waiting for system time to be set... (%d/%d)", retry, - retry_count); - vTaskDelay (2000 / portTICK_PERIOD_MS); - time (&now); - localtime_r (&now, &timeinfo); - } + while (timeinfo.tm_year < (2016 - 1900) && ++retry < retry_count) { + ESP_LOGI(TAG, "Waiting for system time to be set... (%d/%d)", retry, + retry_count); + vTaskDelay(2000 / portTICK_PERIOD_MS); + time(&now); + localtime_r(&now, &timeinfo); + } char strftime_buf[64]; - strftime (strftime_buf, sizeof (strftime_buf), "%c", &timeinfo); - ESP_LOGI (TAG, "The current date/time in UTC is: %s", strftime_buf); + strftime(strftime_buf, sizeof(strftime_buf), "%c", &timeinfo); + ESP_LOGI(TAG, "The current date/time in UTC is: %s", strftime_buf); } diff --git a/components/opus/CMakeLists.txt b/components/opus/CMakeLists.txt index 6ddb221a..cd9c2bdb 100644 --- a/components/opus/CMakeLists.txt +++ b/components/opus/CMakeLists.txt @@ -15,4 +15,6 @@ idf_component_register(SRCS "${srcs}" "${silk}" "${celt}" "${fixed}" "${float}" ) set_source_files_properties(opus/silk/quant_LTP_gains.c PROPERTIES COMPILE_FLAGS -Wno-maybe-uninitialized) +set_source_files_properties(opus/silk/NLSF2A.c PROPERTIES COMPILE_FLAGS -Wno-maybe-uninitialized) +set_source_files_properties(opus/silk/enc_API.c PROPERTIES COMPILE_FLAGS -Wno-stringop-overflow) target_compile_definitions(${COMPONENT_TARGET} PRIVATE "-DHAVE_CONFIG_H") diff --git a/components/ota_server/ota_server.c b/components/ota_server/ota_server.c index 6bc1a178..e64676a2 100644 --- a/components/ota_server/ota_server.c +++ b/components/ota_server/ota_server.c @@ -5,7 +5,6 @@ #include #include "esp_event.h" - #include "freertos/FreeRTOS.h" #include "freertos/event_groups.h" #include "freertos/task.h" @@ -18,9 +17,8 @@ #include "esp_system.h" #include "esp_wifi.h" #include "lwip/sockets.h" -#include "player.h" - #include "ota_server.h" +#include "player.h" extern xTaskHandle t_http_get_task; @@ -162,7 +160,7 @@ void ota_server_start_my(void) { const esp_partition_t *update_partition = esp_ota_get_next_update_partition(NULL); - ESP_LOGI(TAG, "Writing to partition subtype %d at offset 0x%x", + ESP_LOGI(TAG, "Writing to partition subtype %d at offset 0x%lx", update_partition->subtype, update_partition->address); // https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/system/log.html @@ -243,7 +241,7 @@ void ota_server_start_my(void) { ESP_LOGI(TAG, "***********************************************************"); ESP_LOGI(TAG, "OTA Successful"); - ESP_LOGI(TAG, "Next Boot Partition Subtype %d At Offset 0x%x", + ESP_LOGI(TAG, "Next Boot Partition Subtype %d At Offset 0x%lx", boot_partition->subtype, boot_partition->address); ESP_LOGI(TAG, "***********************************************************"); diff --git a/components/protocol/CMakeLists.txt b/components/protocol/CMakeLists.txt index ba8ee8e4..d590bd10 100644 --- a/components/protocol/CMakeLists.txt +++ b/components/protocol/CMakeLists.txt @@ -1,3 +1,3 @@ -idf_component_register(SRCS "protocol.c" - INCLUDE_DIRS "include" - REQUIRES custom_driver custom_board rtprx dsp_processor) +#idf_component_register(SRCS "protocol.c" +# INCLUDE_DIRS "include" +# REQUIRES custom_driver custom_board rtprx dsp_processor) diff --git a/components/rtprx/CMakeLists.txt b/components/rtprx/CMakeLists.txt index 90e12fe2..9e671a13 100644 --- a/components/rtprx/CMakeLists.txt +++ b/components/rtprx/CMakeLists.txt @@ -1,3 +1,3 @@ -idf_component_register(SRCS "rtprx.c" - INCLUDE_DIRS "include" - REQUIRES opus custom_driver) +#idf_component_register(SRCS "rtprx.c" +# INCLUDE_DIRS "include" +# REQUIRES opus custom_driver) diff --git a/components/ui_http_server/CMakeLists.txt b/components/ui_http_server/CMakeLists.txt index 9b27304a..6068edb5 100644 --- a/components/ui_http_server/CMakeLists.txt +++ b/components/ui_http_server/CMakeLists.txt @@ -1,6 +1,6 @@ idf_component_register(SRCS "ui_http_server.c" INCLUDE_DIRS "include" - REQUIRES spiffs esp_http_server mbedtls dsp_processor) + REQUIRES spiffs esp_http_server mbedtls dsp_processor vfs esp_wifi) # Create a SPIFFS image from the contents of the 'html' directory # that fits the partition named 'storage'. FLASH_IN_PROJECT indicates that diff --git a/components/websocket_if/CMakeLists.txt b/components/websocket_if/CMakeLists.txt index 6f3a4c2e..dd970ce8 100644 --- a/components/websocket_if/CMakeLists.txt +++ b/components/websocket_if/CMakeLists.txt @@ -1,4 +1,3 @@ -idf_component_register(SRCS "websocket_if.c" - INCLUDE_DIRS include - REQUIRES websocket protocol) - \ No newline at end of file +#idf_component_register(SRCS "websocket_if.c" +# INCLUDE_DIRS include +# REQUIRES websocket protocol) diff --git a/components/websocket_if/websocket_if.c b/components/websocket_if/websocket_if.c index a91ab0c7..9614610b 100644 --- a/components/websocket_if/websocket_if.c +++ b/components/websocket_if/websocket_if.c @@ -1,126 +1,125 @@ -#include +#include "websocket_if.h" + #include +#include #include + #include "esp_log.h" #include "freertos/FreeRTOS.h" -#include "freertos/task.h" #include "freertos/queue.h" - -#include "websocket_server.h" +#include "freertos/task.h" #include "websocket.h" -#include "websocket_if.h" +#include "websocket_server.h" -#include "protocol.h" +// #include "protocol.h" static QueueHandle_t client_queue; const static int client_queue_size = 10; -int websocket_if_start(void) -{ int ws_res = ws_server_start(); - if (ws_res == 0) - { printf("Websocket error\n"); +int websocket_if_start(void) { + int ws_res = ws_server_start(); + if (ws_res == 0) { + printf("Websocket error\n"); } - xTaskCreate(&server_task,"server_task",8*1024,NULL,6,NULL); - xTaskCreate(&server_handle_task,"server_handle_task",8*1024,NULL,9,NULL); + xTaskCreate(&server_task, "server_task", 8 * 1024, NULL, 6, NULL); + xTaskCreate(&server_handle_task, "server_handle_task", 8 * 1024, NULL, 9, + NULL); return 1; } -int websocket_if_stop(void) -{ return 1; - -} +int websocket_if_stop(void) { return 1; } // Handles websocket events - Pass on to protocol handler using queue -void websocket_callback(uint8_t num,WEBSOCKET_TYPE_t type,char* msg,uint64_t len) { +void websocket_callback(uint8_t num, WEBSOCKET_TYPE_t type, char* msg, + uint64_t len) { const static char* TAG = "websocket_callback"; int value; - switch(type) { + switch (type) { case WEBSOCKET_CONNECT: - ESP_LOGI(TAG,"client %i connected!",num); + ESP_LOGI(TAG, "client %i connected!", num); break; case WEBSOCKET_DISCONNECT_EXTERNAL: - ESP_LOGI(TAG,"client %i sent a disconnect message",num); + ESP_LOGI(TAG, "client %i sent a disconnect message", num); break; case WEBSOCKET_DISCONNECT_INTERNAL: - ESP_LOGI(TAG,"client %i was disconnected",num); + ESP_LOGI(TAG, "client %i was disconnected", num); break; case WEBSOCKET_DISCONNECT_ERROR: - ESP_LOGI(TAG,"client %i was disconnected due to an error",num); + ESP_LOGI(TAG, "client %i was disconnected due to an error", num); break; case WEBSOCKET_TEXT: - if(len) { // if the message length was greater than zero - switch(msg[0]) { + if (len) { // if the message length was greater than zero + switch (msg[0]) { case 'L': - if(sscanf(msg,"L%i",&value)) { - ESP_LOGI(TAG,"LED value: %i",value); - ws_server_send_text_all_from_callback(msg,len); // broadcast it! + if (sscanf(msg, "L%i", &value)) { + ESP_LOGI(TAG, "LED value: %i", value); + ws_server_send_text_all_from_callback(msg, len); // broadcast it! } break; case 'M': - ESP_LOGI(TAG, "got message length %i: %s", (int)len-1, &(msg[1])); + ESP_LOGI(TAG, "got message length %i: %s", (int)len - 1, &(msg[1])); break; default: - ESP_LOGI(TAG, "got an unknown message with length %i", (int)len); - break; + ESP_LOGI(TAG, "got an unknown message with length %i", (int)len); + break; } } break; - case WEBSOCKET_BIN: - { - //ESP_LOGI(TAG,"client %i sent binary message of size %i:\n",num,(uint32_t)len); - uint8_t (*protmsg)[] = malloc(len); - memcpy(protmsg,msg,len); - xQueueSendToBack(prot_queue,&protmsg,portMAX_DELAY); + case WEBSOCKET_BIN: { + // ESP_LOGI(TAG,"client %i sent binary message of size + // %i:\n",num,(uint32_t)len); + uint8_t(*protmsg)[] = malloc(len); + memcpy(protmsg, msg, len); + xQueueSendToBack(prot_queue, &protmsg, portMAX_DELAY); break; - } + } case WEBSOCKET_PING: - ESP_LOGI(TAG,"client %i pinged us with message of size %i:\n%s",num,(uint32_t)len,msg); + ESP_LOGI(TAG, "client %i pinged us with message of size %i:\n%s", num, + (uint32_t)len, msg); break; case WEBSOCKET_PONG: - ESP_LOGI(TAG,"client %i responded to the ping",num); + ESP_LOGI(TAG, "client %i responded to the ping", num); break; } } // serves any clients -void http_serve(struct netconn *conn) { +void http_serve(struct netconn* conn) { const static char* TAG = "http_server"; struct netbuf* inbuf; static char* buf; static uint16_t buflen; static err_t err; - netconn_set_recvtimeout(conn,2000); // allow a connection timeout of 1 second - ESP_LOGI(TAG,"reading from client..."); + netconn_set_recvtimeout(conn, + 2000); // allow a connection timeout of 1 second + ESP_LOGI(TAG, "reading from client..."); err = netconn_recv(conn, &inbuf); - ESP_LOGI(TAG,"read from client"); - if(err==ERR_OK) { + ESP_LOGI(TAG, "read from client"); + if (err == ERR_OK) { netbuf_data(inbuf, (void**)&buf, &buflen); - if(buf) { - if(strstr(buf,"GET / ") - && strstr(buf,"Upgrade: websocket")) { - ESP_LOGI(TAG,"Requesting websocket on /"); - ws_server_add_client(conn,buf,buflen,"/",websocket_callback); + if (buf) { + if (strstr(buf, "GET / ") && strstr(buf, "Upgrade: websocket")) { + ESP_LOGI(TAG, "Requesting websocket on /"); + ws_server_add_client(conn, buf, buflen, "/", websocket_callback); netbuf_delete(inbuf); } else { - ESP_LOGI(TAG,"Unknown request"); + ESP_LOGI(TAG, "Unknown request"); netconn_close(conn); netconn_delete(conn); netbuf_delete(inbuf); } - } - else { - ESP_LOGI(TAG,"Unknown request (empty?...)"); + } else { + ESP_LOGI(TAG, "Unknown request (empty?...)"); netconn_close(conn); netconn_delete(conn); netbuf_delete(inbuf); } - } - else { // if err==ERR_OK - ESP_LOGI(TAG,"error on read, closing connection"); + } else { // if err==ERR_OK + ESP_LOGI(TAG, "error on read, closing connection"); netconn_close(conn); netconn_delete(conn); netbuf_delete(inbuf); @@ -132,23 +131,23 @@ void server_task(void* pvParameters) { const static char* TAG = "server_task"; struct netconn *conn, *newconn; static err_t err; - client_queue = xQueueCreate(client_queue_size,sizeof(struct netconn*)); + client_queue = xQueueCreate(client_queue_size, sizeof(struct netconn*)); conn = netconn_new(NETCONN_TCP); - netconn_bind(conn,NULL,8088); + netconn_bind(conn, NULL, 8088); netconn_listen(conn); - ESP_LOGI(TAG,"server listening"); + ESP_LOGI(TAG, "server listening"); do { err = netconn_accept(conn, &newconn); - ESP_LOGI(TAG,"new client"); - if(err == ERR_OK) { - xQueueSendToBack(client_queue,&newconn,portMAX_DELAY); - //http_serve(newconn); + ESP_LOGI(TAG, "new client"); + if (err == ERR_OK) { + xQueueSendToBack(client_queue, &newconn, portMAX_DELAY); + // http_serve(newconn); } - } while(err == ERR_OK); + } while (err == ERR_OK); netconn_close(conn); netconn_delete(conn); - ESP_LOGE(TAG,"task ending, rebooting board"); + ESP_LOGE(TAG, "task ending, rebooting board"); esp_restart(); } @@ -156,10 +155,10 @@ void server_task(void* pvParameters) { void server_handle_task(void* pvParameters) { const static char* TAG = "server_handle_task"; struct netconn* conn; - ESP_LOGI(TAG,"task starting"); - for(;;) { - xQueueReceive(client_queue,&conn,portMAX_DELAY); - if(!conn) continue; + ESP_LOGI(TAG, "task starting"); + for (;;) { + xQueueReceive(client_queue, &conn, portMAX_DELAY); + if (!conn) continue; http_serve(conn); } vTaskDelete(NULL); diff --git a/components/wifi_interface/CMakeLists.txt b/components/wifi_interface/CMakeLists.txt index c45efed5..b0977c1e 100644 --- a/components/wifi_interface/CMakeLists.txt +++ b/components/wifi_interface/CMakeLists.txt @@ -1,3 +1,3 @@ idf_component_register(SRCS "wifi_interface.c" INCLUDE_DIRS "include" - REQUIRES wifi_provisioning) + REQUIRES wifi_provisioning esp_event esp_wifi esp_hw_support nvs_flash) diff --git a/components/wifi_interface/include/wifi_interface.h b/components/wifi_interface/include/wifi_interface.h index d1571c30..5cf12e14 100644 --- a/components/wifi_interface/include/wifi_interface.h +++ b/components/wifi_interface/include/wifi_interface.h @@ -2,7 +2,9 @@ #define _WIFI_INTERFACE_H_ #include "esp_netif_types.h" +#include "freertos/FreeRTOS.h" #include "freertos/event_groups.h" +#include "freertos/task.h" // use wifi provisioning #define ENABLE_WIFI_PROVISIONING CONFIG_ENABLE_WIFI_PROVISIONING @@ -24,7 +26,7 @@ #define WIFI_CONNECTED_BIT BIT0 #define WIFI_FAIL_BIT BIT1 -void wifi_init (void); -esp_netif_t *get_current_netif (void); +void wifi_init(void); +esp_netif_t *get_current_netif(void); #endif /* _WIFI_INTERFACE_H_ */ diff --git a/components/wifi_interface/wifi_interface.c b/components/wifi_interface/wifi_interface.c index 174a37d1..bc6e5756 100644 --- a/components/wifi_interface/wifi_interface.c +++ b/components/wifi_interface/wifi_interface.c @@ -4,38 +4,71 @@ Must be taken over/merge with wifi provision */ +#include "wifi_interface.h" -//#include "esp_event.h" +// #include "esp_event.h" +#include "esp_event.h" #include "esp_log.h" +#include "esp_mac.h" +#include "esp_timer.h" #include "esp_wifi.h" -#include "freertos/FreeRTOS.h" -#include "freertos/event_groups.h" -#include "freertos/task.h" - -#include "wifi_interface.h" +#include "nvs_flash.h" #if ENABLE_WIFI_PROVISIONING #include // for memcpy #include #include -#endif -#if ENABLE_WIFI_PROVISIONING static const char *provPwd = CONFIG_WIFI_PROVISIONING_PASSWORD; static const char *provSsid = CONFIG_WIFI_PROVISIONING_SSID; #endif static const char *TAG = "WIFI"; +static void reset_reason_timer_counter_cb(void *); + static char mac_address[18]; EventGroupHandle_t s_wifi_event_group; static int s_retry_num = 0; -static wifi_config_t wifi_config; static esp_netif_t *esp_wifi_netif = NULL; +#if ENABLE_WIFI_PROVISIONING +static wifi_config_t wifi_config; + +static esp_timer_handle_t resetReasonTimerHandle = NULL; +static const esp_timer_create_args_t resetReasonTimerArgs = { + .callback = &reset_reason_timer_counter_cb, + .dispatch_method = ESP_TIMER_TASK, + .name = "rstCnt", + .skip_unhandled_events = false}; + +static uint8_t resetReasonCounter = 0; + +static void reset_reason_timer_counter_cb(void *args) { + nvs_handle_t nvs_handle; + esp_err_t err = nvs_open("storage", NVS_READWRITE, &nvs_handle); + if (err != ESP_OK) { + ESP_LOGE(TAG, "%s: Error (%s) opening NVS handle!", __func__, + esp_err_to_name(err)); + } else { + ESP_LOGI(TAG, "resetting POR reset counter ..."); + + resetReasonCounter = 0; + + err |= nvs_set_u8(nvs_handle, "restart_counter", resetReasonCounter); + err |= nvs_commit(nvs_handle); + ESP_LOGI(TAG, "%s", (err != ESP_OK) ? "Failed!" : "Done"); + + nvs_close(nvs_handle); + } + + esp_timer_delete(resetReasonTimerHandle); +} +#endif + /* FreeRTOS event group to signal when we are connected & ready to make a * request */ // static EventGroupHandle_t wifi_event_group; @@ -129,10 +162,11 @@ void wifi_init(void) { ESP_ERROR_CHECK(esp_event_loop_create_default()); - ESP_ERROR_CHECK(esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, - &event_handler, NULL)); - ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, IP_EVENT_STA_GOT_IP, - &event_handler, NULL)); + ESP_ERROR_CHECK(esp_event_handler_register( + WIFI_EVENT, ESP_EVENT_ANY_ID, (esp_event_handler_t)&event_handler, NULL)); + ESP_ERROR_CHECK( + esp_event_handler_register(IP_EVENT, IP_EVENT_STA_GOT_IP, + (esp_event_handler_t)&event_handler, NULL)); #if ENABLE_WIFI_PROVISIONING ESP_ERROR_CHECK(esp_event_handler_register(WIFI_PROV_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL)); @@ -167,6 +201,43 @@ void wifi_init(void) { // configuration parameters set above ESP_ERROR_CHECK(wifi_prov_mgr_init(config)); + esp_reset_reason_t resetReason = esp_reset_reason(); + ESP_LOGI(TAG, "reset reason was: %d", resetReason); + esp_timer_create(&resetReasonTimerArgs, &resetReasonTimerHandle); + esp_timer_start_once(resetReasonTimerHandle, 5000000); + if (resetReason == ESP_RST_POWERON) { + nvs_handle_t nvs_handle; + esp_err_t err = nvs_open("storage", NVS_READWRITE, &nvs_handle); + if (err != ESP_OK) { + ESP_LOGE(TAG, "%s: Error (%s) opening NVS handle!", __func__, + esp_err_to_name(err)); + } else { + ESP_LOGI(TAG, "get POR reset counter ..."); + err |= nvs_get_u8(nvs_handle, "restart_counter", &resetReasonCounter); + + ESP_LOGE(TAG, "counter %d", resetReasonCounter); + + resetReasonCounter++; + + if (resetReasonCounter > 3) { + ESP_LOGW(TAG, "resetting WIFI credentials!"); + + resetReasonCounter = 0; + + wifi_prov_mgr_reset_provisioning(); + + esp_timer_stop(resetReasonTimerHandle); + esp_timer_delete(resetReasonTimerHandle); + } + + err |= nvs_set_u8(nvs_handle, "restart_counter", resetReasonCounter); + err |= nvs_commit(nvs_handle); + ESP_LOGI(TAG, "%s", (err != ESP_OK) ? "Failed!" : "Done"); + + nvs_close(nvs_handle); + } + } + bool provisioned = false; /* Let's find out if the device is provisioned */ ESP_ERROR_CHECK(wifi_prov_mgr_is_provisioned(&provisioned)); diff --git a/dependencies.lock b/dependencies.lock new file mode 100644 index 00000000..10b226d5 --- /dev/null +++ b/dependencies.lock @@ -0,0 +1,21 @@ +dependencies: + espressif/esp-dsp: + component_hash: 3e7bbd487f1357a1d4944d0c85966d049501ea281b8a4c7f93f7cfedd5b7f23d + source: + service_url: https://api.components.espressif.com/ + type: service + version: 1.4.12 + espressif/mdns: + component_hash: 9ff9c578fc3a5ea3c68e807233e47f2ce6b2492a92d7a9356ae5c29ab45f0fde + source: + service_url: https://api.components.espressif.com/ + type: service + version: 1.3.0 + idf: + component_hash: null + source: + type: idf + version: 5.1.1 +manifest_hash: d6b434b4ae9e215619e0dfb1b731739d5799f7570a1fdee428100c9146c752e2 +target: esp32 +version: 1.0.0 diff --git a/doc/docker_build.md b/doc/docker_build.md index edb65be6..c0f46d97 100644 --- a/doc/docker_build.md +++ b/doc/docker_build.md @@ -12,7 +12,7 @@ No need to install ESP-IDF or anything else. All commands should be run in proje ### Start an interactive IDF environnement In this interactive shell you can run menuconfig, build, flash and monitor command. ``` -docker run --rm -it -v .:/project -w /project -v /dev:/dev --privileged espressif/idf:v4.3.5 +docker run --rm -it -v .:/project -w /project -v /dev:/dev --privileged espressif/idf:v5.1.1 ``` ### Configure @@ -37,12 +37,12 @@ Exit docker interactive shell: `exit` If you want to execute a specific command or to generate a reusable .bin file. ### menuconfig ``` -docker run --rm -it -v .:/project -w /project espressif/idf:v4.3.5 idf.py menuconfig +docker run --rm -it -v .:/project -w /project -v /dev:/dev --privileged espressif/idf:v5.1.1 idf.py menuconfig ``` ### Build ``` -docker run --rm -it -v .:/project -w /project espressif/idf:v4.3.5 idf.py build +docker run --rm -it -v .:/project -w /project -v /dev:/dev --privileged espressif/idf:v5.1.1 idf.py build ``` ### Flash @@ -50,9 +50,24 @@ Mapping of serial port to container is not simple in windows but you can merge a - [ESP Tool web flasher](https://espressif.github.io/esptool-js/) - [ESP32 Flash Download tool](https://www.espressif.com/en/support/download/other-tools) +On MacOS / Linux you need to install a small python package, make sure that pip is installed on your machine: + +``` +pip install esptool +``` +After installation you can start the SerialServer with this command: +``` +esp_rfc2217_server.py -v -p 4000 dev/serialDevice +``` + +Create now a new terminal run the docker container and flash it using this command: +``` +idf.py --port 'rfc2217://host.docker.internal:4000?ign_set_control' flash monitor +``` + #### Merge bins into single firmware bin file ``` -docker run --rm -it -v .:/project -w /project/build espressif/idf:v4.3.1 //runs terminal in idf container +docker run --rm -it -v .:/project -w /project -v /dev:/dev --privileged espressif/idf:v5.1.1 //runs terminal in idf container esptool.py --chip esp32 merge_bin --output firmware.bin @flash_args // merges all bin files into firmware.bin ``` diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 8a9d914e..4aa7443d 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -1,2 +1,5 @@ idf_component_register(SRCS "main.c" - INCLUDE_DIRS ".") + INCLUDE_DIRS "." + PRIV_REQUIRES esp_timer esp_wifi eth_interface nvs_flash wifi_interface audio_board audio_hal audio_sal net_functions opus flac ota_server + ui_http_server + ) diff --git a/main/Kconfig.projbuild b/main/Kconfig.projbuild index abf4fbb0..24cab051 100644 --- a/main/Kconfig.projbuild +++ b/main/Kconfig.projbuild @@ -33,4 +33,15 @@ menu "Snapclient Configuration" HTTP server port to use. endmenu + config USE_SAMPLE_INSERTION + bool "Use sample insertion" + default true + help + There are two syncronization implementations. + + 1. APLL tuning (ONLY use with DACs having MCLK input) + 2. sample insertion (duplicates a sample now and then to keep up sync) + + Both approaches have similar performance keeping clients in sync <= 500µs + endmenu diff --git a/main/idf_component.yml b/main/idf_component.yml new file mode 100644 index 00000000..2b396730 --- /dev/null +++ b/main/idf_component.yml @@ -0,0 +1,18 @@ +## IDF Component Manager Manifest File +dependencies: + espressif/esp-dsp: "*" + ## Required IDF version + idf: + version: ">=5.0" + # # Put list of dependencies here + # # For components maintained by Espressif: + # component: "~1.0.0" + espressif/mdns: ">=1.2.3" + # # For 3rd party components: + # username/component: ">=1.0.0,<2.0.0" + # username2/component2: + # version: "~1.0.0" + # # For transient dependencies `public` flag can be set. + # # `public` flag doesn't have an effect dependencies of the `main` component. + # # All dependencies of `main` are public by default. + # public: true diff --git a/main/main.c b/main/main.c index b6f2adbb..5d68fd70 100644 --- a/main/main.c +++ b/main/main.c @@ -10,14 +10,18 @@ #include "esp_event.h" #include "esp_log.h" +#include "esp_mac.h" #include "esp_system.h" +#include "esp_timer.h" #include "esp_wifi.h" -#if CONFIG_SNAPCLIENT_ENABLE_ETHERNET -#include "eth_interface.h" -#endif #include "freertos/FreeRTOS.h" #include "freertos/event_groups.h" #include "freertos/task.h" +#if CONFIG_SNAPCLIENT_USE_INTERNAL_ETHERNET || \ + CONFIG_SNAPCLIENT_USE_SPI_ETHERNET +#include "eth_interface.h" +#endif + #include "nvs_flash.h" #include "wifi_interface.h" @@ -35,12 +39,12 @@ #include "net_functions.h" // Web socket server -#include "websocket_if.h" -//#include "websocket_server.h" +// #include "websocket_if.h" +// #include "websocket_server.h" #include -#include "driver/i2s.h" +#include "driver/i2s_std.h" #if CONFIG_USE_DSP_PROCESSOR #include "dsp_processor.h" #endif @@ -53,7 +57,6 @@ #include "ota_server.h" #include "player.h" #include "snapcast.h" - #include "ui_http_server.h" static FLAC__StreamDecoderReadStatus read_callback( @@ -69,7 +72,7 @@ static void error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data); -//#include "ma120.h" +// #include "ma120.h" static FLAC__StreamDecoder *flacDecoder = NULL; static QueueHandle_t decoderReadQHdl = NULL; @@ -99,10 +102,10 @@ const char *VERSION_STRING = "0.0.2"; // 1 // tskNO_AFFINITY -xTaskHandle t_ota_task = NULL; -xTaskHandle t_http_get_task = NULL; -xTaskHandle t_flac_decoder_task = NULL; -xTaskHandle dec_task_handle = NULL; +TaskHandle_t t_ota_task = NULL; +TaskHandle_t t_http_get_task = NULL; +TaskHandle_t t_flac_decoder_task = NULL; +TaskHandle_t dec_task_handle = NULL; #define FAST_SYNC_LATENCY_BUF 10000 // in µs #define NORMAL_SYNC_LATENCY_BUF 1000000 // in µs @@ -156,7 +159,8 @@ static char time_message_serialized[TIME_MESSAGE_SIZE]; static const esp_timer_create_args_t tSyncArgs = { .callback = &time_sync_msg_cb, .dispatch_method = ESP_TIMER_TASK, - .name = "tSyncMsg"}; + .name = "tSyncMsg", + .skip_unhandled_events = false}; struct netconn *lwipNetconn; @@ -336,14 +340,14 @@ static FLAC__StreamDecoderWriteStatus write_callback( if (frame->header.channels != scSet->ch) { ESP_LOGE(TAG, - "ERROR: frame header reports different channel count %d than " + "ERROR: frame header reports different channel count %ld than " "previous metadata block %d", frame->header.channels, scSet->ch); return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; } if (frame->header.bits_per_sample != scSet->bits) { ESP_LOGE(TAG, - "ERROR: frame header reports different bps %d than previous " + "ERROR: frame header reports different bps %ld than previous " "metadata block %d", frame->header.bits_per_sample, scSet->bits); return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; @@ -396,7 +400,7 @@ static FLAC__StreamDecoderWriteStatus write_callback( if (fragment != NULL) { volatile uint32_t *test = (volatile uint32_t *)(&(fragment->payload[fragmentCnt])); - *test = (volatile uint32_t *)tmpData; + *test = (volatile uint32_t)tmpData; } fragmentCnt += 4; @@ -451,7 +455,7 @@ void metadata_callback(const FLAC__StreamDecoder *decoder, scSet->ch = metadata->data.stream_info.channels; scSet->bits = metadata->data.stream_info.bits_per_sample; - ESP_LOGI(TAG, "fLaC sampleformat: %d:%d:%d", scSet->sr, scSet->bits, + ESP_LOGI(TAG, "fLaC sampleformat: %ld:%d:%d", scSet->sr, scSet->bits, scSet->ch); xQueueSend(decoderWriteQHdl, &flacData, portMAX_DELAY); @@ -636,7 +640,7 @@ void opus_decoder_task(void *pvParameters) { size_t bytes = samples_per_frame * scSet->ch * scSet->bits / 8; if (samples_per_frame > 480) { - ESP_LOGE(TAG, "samples_per_frame: %d, pOpusData->bytes %d, bytes %d", + ESP_LOGE(TAG, "samples_per_frame: %d, pOpusData->bytes %ld, bytes %u", samples_per_frame, pOpusData->bytes, bytes); } @@ -899,7 +903,8 @@ static void http_get_task(void *pvParameters) { char mac_address[18]; uint8_t base_mac[6]; // Get MAC address for WiFi station -#if CONFIG_SNAPCLIENT_ENABLE_ETHERNET +#if CONFIG_SNAPCLIENT_USE_INTERNAL_ETHERNET || \ + CONFIG_SNAPCLIENT_USE_SPI_ETHERNET esp_read_mac(base_mac, ESP_MAC_ETH); #else esp_read_mac(base_mac, ESP_MAC_WIFI_STA); @@ -977,7 +982,7 @@ static void http_get_task(void *pvParameters) { scSet.muted = true; uint64_t startTime, endTime; - char *tmp; + char *p_tmp = NULL; int32_t remainderSize = 0; size_t currentPos = 0; size_t typedMsgCurrentPos = 0; @@ -1381,12 +1386,12 @@ static void http_get_task(void *pvParameters) { } case 12: { - size_t tmp; + size_t tmp_size; if ((base_message_rx.size - typedMsgCurrentPos) <= len) { - tmp = base_message_rx.size - typedMsgCurrentPos; + tmp_size = base_message_rx.size - typedMsgCurrentPos; } else { - tmp = len; + tmp_size = len; } // static double lastChunkTimestamp = @@ -1418,8 +1423,8 @@ static void http_get_task(void *pvParameters) { payloadOffset = 0; } - memcpy(&opusData[payloadOffset], start, tmp); - payloadOffset += tmp; + memcpy(&opusData[payloadOffset], start, tmp_size); + payloadOffset += tmp_size; // ESP_LOGE(TAG,"payloadOffset // %d, wire_chnk.size @@ -1467,7 +1472,7 @@ static void http_get_task(void *pvParameters) { } } - pDecData->bytes = tmp; + pDecData->bytes = tmp_size; // store timestamp for // later use @@ -1485,7 +1490,7 @@ static void http_get_task(void *pvParameters) { } if (pDecData->inData) { - memcpy(pDecData->inData, start, tmp); + memcpy(pDecData->inData, start, tmp_size); pDecData->outData = NULL; pDecData->type = SNAPCAST_MESSAGE_WIRE_CHUNK; @@ -1495,7 +1500,7 @@ static void http_get_task(void *pvParameters) { portMAX_DELAY); } #else - flacData.bytes = tmp; + flacData.bytes = tmp_size; flacData.timestamp = wire_chnk.timestamp; // store timestamp for // later use @@ -1537,7 +1542,7 @@ static void http_get_task(void *pvParameters) { } case PCM: { - size_t _tmp = tmp; + size_t _tmp = tmp_size; offset = 0; @@ -1607,10 +1612,10 @@ static void http_get_task(void *pvParameters) { } } - typedMsgCurrentPos += tmp; - start += tmp; - currentPos += tmp; - len -= tmp; + typedMsgCurrentPos += tmp_size; + start += tmp_size; + currentPos += tmp_size; + len -= tmp_size; if (typedMsgCurrentPos >= base_message_rx.size) { if (received_header == true) { @@ -1810,9 +1815,9 @@ static void http_get_task(void *pvParameters) { case 3: { typedMsgLen |= (*start & 0xFF) << 24; - tmp = malloc(typedMsgLen + 1); // allocate memory for - // codec string - if (tmp == NULL) { + p_tmp = malloc(typedMsgLen + 1); // allocate memory for + // codec string + if (p_tmp == NULL) { ESP_LOGE(TAG, "couldn't get memory " "for codec string"); @@ -1837,7 +1842,7 @@ static void http_get_task(void *pvParameters) { case 4: { if (len >= typedMsgLen) { - memcpy(&tmp[offset], start, typedMsgLen); + memcpy(&p_tmp[offset], start, typedMsgLen); offset += typedMsgLen; @@ -1846,7 +1851,7 @@ static void http_get_task(void *pvParameters) { currentPos += typedMsgLen; len -= typedMsgLen; } else { - memcpy(&tmp[offset], start, typedMsgLen); + memcpy(&p_tmp[offset], start, typedMsgLen); offset += len; @@ -1858,20 +1863,20 @@ static void http_get_task(void *pvParameters) { if (offset == typedMsgLen) { // NULL terminate string - tmp[typedMsgLen] = 0; + p_tmp[typedMsgLen] = 0; // ESP_LOGI (TAG, "got codec string: %s", tmp); - if (strcmp(tmp, "opus") == 0) { + if (strcmp(p_tmp, "opus") == 0) { codec = OPUS; - } else if (strcmp(tmp, "flac") == 0) { + } else if (strcmp(p_tmp, "flac") == 0) { codec = FLAC; - } else if (strcmp(tmp, "pcm") == 0) { + } else if (strcmp(p_tmp, "pcm") == 0) { codec = PCM; } else { codec = NONE; - ESP_LOGI(TAG, "Codec : %s not supported", tmp); + ESP_LOGI(TAG, "Codec : %s not supported", p_tmp); ESP_LOGI(TAG, "Change encoder codec to " "opus, flac or pcm in " @@ -1881,8 +1886,8 @@ static void http_get_task(void *pvParameters) { return; } - free(tmp); - tmp = NULL; + free(p_tmp); + p_tmp = NULL; internalState++; } @@ -1932,9 +1937,9 @@ static void http_get_task(void *pvParameters) { case 8: { typedMsgLen |= (*start & 0xFF) << 24; - tmp = malloc(typedMsgLen); // allocate memory for - // codec string - if (tmp == NULL) { + p_tmp = malloc(typedMsgLen); // allocate memory for + // codec string + if (p_tmp == NULL) { ESP_LOGE(TAG, "couldn't get memory " "for codec string"); @@ -1956,7 +1961,7 @@ static void http_get_task(void *pvParameters) { case 9: { if (len >= typedMsgLen) { - memcpy(&tmp[offset], start, typedMsgLen); + memcpy(&p_tmp[offset], start, typedMsgLen); offset += typedMsgLen; @@ -1965,7 +1970,7 @@ static void http_get_task(void *pvParameters) { currentPos += typedMsgLen; len -= typedMsgLen; } else { - memcpy(&tmp[offset], start, typedMsgLen); + memcpy(&p_tmp[offset], start, typedMsgLen); offset += len; @@ -2029,16 +2034,16 @@ static void http_get_task(void *pvParameters) { uint32_t rate; uint16_t bits; - memcpy(&rate, tmp + 4, sizeof(rate)); - memcpy(&bits, tmp + 8, sizeof(bits)); - memcpy(&channels, tmp + 10, sizeof(channels)); + memcpy(&rate, p_tmp + 4, sizeof(rate)); + memcpy(&bits, p_tmp + 8, sizeof(bits)); + memcpy(&channels, p_tmp + 10, sizeof(channels)); scSet.codec = codec; scSet.bits = bits; scSet.ch = channels; scSet.sr = rate; - ESP_LOGI(TAG, "Opus sample format: %d:%d:%d\n", rate, + ESP_LOGI(TAG, "Opus sample format: %ld:%d:%d\n", rate, bits, channels); int error = 0; @@ -2102,7 +2107,7 @@ static void http_get_task(void *pvParameters) { pDecData->bytes = typedMsgLen; pDecData->inData = (uint8_t *)malloc(typedMsgLen); - memcpy(pDecData->inData, tmp, typedMsgLen); + memcpy(pDecData->inData, p_tmp, typedMsgLen); pDecData->outData = NULL; pDecData->type = SNAPCAST_MESSAGE_CODEC_HEADER; @@ -2130,7 +2135,7 @@ static void http_get_task(void *pvParameters) { } flacData.bytes = typedMsgLen; - flacData.inData = tmp; + flacData.inData = p_tmp; pDecData = &flacData; // TODO: find a smarter way for @@ -2161,16 +2166,16 @@ static void http_get_task(void *pvParameters) { uint32_t rate; uint16_t bits; - memcpy(&channels, tmp + 22, sizeof(channels)); - memcpy(&rate, tmp + 24, sizeof(rate)); - memcpy(&bits, tmp + 34, sizeof(bits)); + memcpy(&channels, p_tmp + 22, sizeof(channels)); + memcpy(&rate, p_tmp + 24, sizeof(rate)); + memcpy(&bits, p_tmp + 34, sizeof(bits)); scSet.codec = codec; scSet.bits = bits; scSet.ch = channels; scSet.sr = rate; - ESP_LOGI(TAG, "pcm sampleformat: %d:%d:%d", scSet.sr, + ESP_LOGI(TAG, "pcm sampleformat: %ld:%d:%d", scSet.sr, scSet.bits, scSet.ch); } else { ESP_LOGE(TAG, @@ -2181,8 +2186,8 @@ static void http_get_task(void *pvParameters) { return; } - free(tmp); - tmp = NULL; + free(p_tmp); + p_tmp = NULL; // ESP_LOGI(TAG, "done codec header msg"); @@ -2308,23 +2313,23 @@ static void http_get_task(void *pvParameters) { // string at this point there is still // plenty of RAM available, so we use // malloc and netbuf_copy() here - tmp = malloc(typedMsgLen + 1); + p_tmp = malloc(typedMsgLen + 1); - if (tmp == NULL) { + if (p_tmp == NULL) { ESP_LOGE(TAG, "couldn't get memory for " "server settings string"); } else { - netbuf_copy_partial(firstNetBuf, tmp, typedMsgLen, + netbuf_copy_partial(firstNetBuf, p_tmp, typedMsgLen, currentPos); - tmp[typedMsgLen] = 0; // NULL terminate string + p_tmp[typedMsgLen] = 0; // NULL terminate string // ESP_LOGI //(TAG, "got string: %s", tmp); result = server_settings_message_deserialize( - &server_settings_message, tmp); + &server_settings_message, p_tmp); if (result) { ESP_LOGE(TAG, "Failed to read server " @@ -2332,13 +2337,13 @@ static void http_get_task(void *pvParameters) { result); } else { // log mute state, buffer, latency - ESP_LOGI(TAG, "Buffer length: %d", + ESP_LOGI(TAG, "Buffer length: %ld", server_settings_message.buffer_ms); - ESP_LOGI(TAG, "Latency: %d", + ESP_LOGI(TAG, "Latency: %ld", server_settings_message.latency); ESP_LOGI(TAG, "Mute: %d", server_settings_message.muted); - ESP_LOGI(TAG, "Setting volume: %d", + ESP_LOGI(TAG, "Setting volume: %ld", server_settings_message.volume); } @@ -2346,24 +2351,23 @@ static void http_get_task(void *pvParameters) { // abstraction if (scSet.muted != server_settings_message.muted) { #if SNAPCAST_USE_SOFT_VOL - if (server_settings_message.muted) { - dsp_processor_set_volome(0.0); - } - else { - dsp_processor_set_volome( - (double)server_settings_message.volume / 100); - } + if (server_settings_message.muted) { + dsp_processor_set_volome(0.0); + } else { + dsp_processor_set_volome( + (double)server_settings_message.volume / 100); + } #endif audio_hal_set_mute(board_handle->audio_hal, server_settings_message.muted); } - + if (scSet.volume != server_settings_message.volume) { #if SNAPCAST_USE_SOFT_VOL - if (!server_settings_message.muted) { - dsp_processor_set_volome( + if (!server_settings_message.muted) { + dsp_processor_set_volome( (double)server_settings_message.volume / 100); - } + } #else audio_hal_set_volume(board_handle->audio_hal, server_settings_message.volume); @@ -2383,8 +2387,8 @@ static void http_get_task(void *pvParameters) { return; } - free(tmp); - tmp = NULL; + free(p_tmp); + p_tmp = NULL; } internalState++; @@ -2640,9 +2644,8 @@ static void http_get_task(void *pvParameters) { esp_timer_start_periodic(timeSyncMessageTimer, timeout); - } - else if ((is_full == false) && - (timeout > FAST_SYNC_LATENCY_BUF)){ + } else if ((is_full == false) && + (timeout > FAST_SYNC_LATENCY_BUF)) { timeout = FAST_SYNC_LATENCY_BUF; ESP_LOGI(TAG, "latency buffer not full"); @@ -2658,7 +2661,7 @@ static void http_get_task(void *pvParameters) { } else { ESP_LOGE(TAG, "error time message, this " - "shouldn't happen! %d %d", + "shouldn't happen! %d %ld", typedMsgCurrentPos, base_message_rx.size); typedMsgCurrentPos = 0; @@ -2673,7 +2676,7 @@ static void http_get_task(void *pvParameters) { default: { ESP_LOGE(TAG, "time message decoder shouldn't " - "get here %d %d %d", + "get here %d %ld %ld", typedMsgCurrentPos, base_message_rx.size, internalState); @@ -2707,7 +2710,9 @@ static void http_get_task(void *pvParameters) { break; } - default: { break; } + default: { + break; + } } if (rc1 != ERR_OK) { @@ -2747,8 +2752,14 @@ void app_main(void) { // if enabled these cause a timer srv stack overflow esp_log_level_set("HEADPHONE", ESP_LOG_NONE); esp_log_level_set("gpio", ESP_LOG_NONE); + // esp_log_level_set("i2s_std", ESP_LOG_DEBUG); + // esp_log_level_set("i2s_common", ESP_LOG_DEBUG); -#if CONFIG_SNAPCLIENT_ENABLE_ETHERNET + esp_log_level_set("wifi", ESP_LOG_WARN); + esp_log_level_set("wifi_init", ESP_LOG_WARN); + +#if CONFIG_SNAPCLIENT_USE_INTERNAL_ETHERNET || \ + CONFIG_SNAPCLIENT_USE_SPI_ETHERNET // clang-format off // nINT/REFCLKO Function Select Configuration Strap // • When nINTSEL is floated or pulled to @@ -2774,29 +2785,51 @@ void app_main(void) { gpio_config(&cfg); #endif -#if CONFIG_AUDIO_BOARD_CUSTOM +#if CONFIG_AUDIO_BOARD_CUSTOM && CONFIG_DAC_ADAU1961 // some codecs need i2s mclk for initialization - i2s_config_t i2s_config0 = { - .mode = I2S_MODE_MASTER | I2S_MODE_TX, // Only TX - .sample_rate = 44100, - .bits_per_sample = 16, - .channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT, // 2-channels - .communication_format = I2S_COMM_FORMAT_STAND_I2S, - .dma_buf_count = 2, - .dma_buf_len = 128, - .intr_alloc_flags = 1, // Default interrupt priority - .use_apll = true, - .fixed_mclk = 0, - .tx_desc_auto_clear = true // Auto clear tx descriptor on underflow + + i2s_chan_handle_t tx_chan; + + i2s_chan_config_t tx_chan_cfg = { + .id = I2S_NUM_0, + .role = I2S_ROLE_MASTER, + .dma_desc_num = 2, + .dma_frame_num = 128, + .auto_clear = true, }; - i2s_pin_config_t pin_config0; - get_i2s_pins(I2S_NUM_0, &pin_config0); + ESP_ERROR_CHECK(i2s_new_channel(&tx_chan_cfg, &tx_chan, NULL)); - i2s_custom_driver_uninstall(I2S_NUM_0); - i2s_custom_driver_install(I2S_NUM_0, &i2s_config0, 0, NULL); - i2s_custom_set_pin(I2S_NUM_0, &pin_config0); + board_i2s_pin_t pin_config0; + get_i2s_pins(I2S_NUM_0, &pin_config0); - i2s_mclk_gpio_select(I2S_NUM_0, CONFIG_MASTER_I2S_MCLK_PIN); + i2s_std_clk_config_t i2s_clkcfg = { + .sample_rate_hz = 44100, + .clk_src = I2S_CLK_SRC_APLL, + .mclk_multiple = I2S_MCLK_MULTIPLE_256, + }; + i2s_std_config_t tx_std_cfg = { + .clk_cfg = i2s_clkcfg, + .slot_cfg = I2S_STD_PHILIPS_SLOT_DEFAULT_CONFIG(I2S_DATA_BIT_WIDTH_16BIT, + I2S_SLOT_MODE_STEREO), + .gpio_cfg = + { + .mclk = pin_config0 + .mck_io_num, // some codecs may require mclk signal, + // this example doesn't need it + .bclk = pin_config0.bck_io_num, + .ws = pin_config0.ws_io_num, + .dout = pin_config0.data_out_num, + .din = pin_config0.data_in_num, + .invert_flags = + { + .mclk_inv = false, + .bclk_inv = false, + .ws_inv = false, + }, + }, + }; + ESP_ERROR_CHECK(i2s_channel_init_std_mode(tx_chan, &tx_std_cfg)); + i2s_channel_enable(tx_chan); #endif ESP_LOGI(TAG, "Start codec chip"); @@ -2811,16 +2844,47 @@ void app_main(void) { vTaskDelay(portMAX_DELAY); } - audio_hal_ctrl_codec(board_handle->audio_hal, AUDIO_HAL_CODEC_MODE_BOTH, + audio_hal_ctrl_codec(board_handle->audio_hal, AUDIO_HAL_CODEC_MODE_DECODE, AUDIO_HAL_CTRL_START); audio_hal_set_mute(board_handle->audio_hal, true); // ensure no noise is sent after firmware crash +#if CONFIG_AUDIO_BOARD_CUSTOM && CONFIG_DAC_ADAU1961 + if (tx_chan) { + i2s_channel_disable(tx_chan); + i2s_del_channel(tx_chan); + tx_chan = NULL; + } +#endif + ESP_LOGI(TAG, "init player"); init_player(); - // setup_ma120(); -#if CONFIG_SNAPCLIENT_ENABLE_ETHERNET + // ensure there is no noise from DAC + { + board_i2s_pin_t pin_config0; + get_i2s_pins(I2S_NUM_0, &pin_config0); + + gpio_config_t gpioCfg = { + .pin_bit_mask = + BIT64(pin_config0.mck_io_num) | BIT64(pin_config0.data_out_num) | + BIT64(pin_config0.bck_io_num) | BIT64(pin_config0.ws_io_num) | + BIT64(pin_config0.data_in_num), + .mode = GPIO_MODE_OUTPUT, + .pull_up_en = GPIO_PULLUP_DISABLE, + .pull_down_en = GPIO_PULLDOWN_DISABLE, + .intr_type = GPIO_INTR_DISABLE, + }; + gpio_config(&gpioCfg); + gpio_set_level(pin_config0.mck_io_num, 0); + gpio_set_level(pin_config0.data_out_num, 0); + gpio_set_level(pin_config0.data_in_num, 0); + gpio_set_level(pin_config0.bck_io_num, 0); + gpio_set_level(pin_config0.ws_io_num, 0); + } + +#if CONFIG_SNAPCLIENT_USE_INTERNAL_ETHERNET || \ + CONFIG_SNAPCLIENT_USE_SPI_ETHERNET eth_init(); // pass "WIFI_STA_DEF", "WIFI_AP_DEF", "ETH_DEF" init_http_server_task("ETH_DEF"); @@ -2848,7 +2912,7 @@ void app_main(void) { #endif xTaskCreatePinnedToCore(&ota_server_task, "ota", 14 * 256, NULL, - OTA_TASK_PRIORITY, t_ota_task, OTA_TASK_CORE_ID); + OTA_TASK_PRIORITY, &t_ota_task, OTA_TASK_CORE_ID); xTaskCreatePinnedToCore(&http_get_task, "http", 4 * 1024, NULL, HTTP_TASK_PRIORITY, &t_http_get_task, diff --git a/partitions.csv b/partitions.csv index ebe0e81b..7042c888 100644 --- a/partitions.csv +++ b/partitions.csv @@ -2,7 +2,6 @@ nvs, data, nvs, 0x9000, 16K, otadata, data, ota, 0xd000, 8K, phy_init, data, phy, 0xf000, 4K, -factory, app, factory, 0x10000, 1152K, -ota_0, app, ota_0, 0x130000, 1152K, -ota_1, app, ota_1, 0x250000, 1152K, +ota_0, app, ota_0, 0x10000, 1728K, +ota_1, app, ota_1, 0x1C0000, 1728K, storage, data, spiffs, 0x370000, 576K, diff --git a/sdkconfig b/sdkconfig index 83e6a7e0..20244099 100644 --- a/sdkconfig +++ b/sdkconfig @@ -1,40 +1,237 @@ # # Automatically generated file. DO NOT EDIT. -# Espressif IoT Development Framework (ESP-IDF) Project Configuration -# +# Espressif IoT Development Framework (ESP-IDF) 5.1.1 Project Configuration +# +CONFIG_SOC_BROWNOUT_RESET_SUPPORTED="Not determined" +CONFIG_SOC_TWAI_BRP_DIV_SUPPORTED="Not determined" +CONFIG_SOC_DPORT_WORKAROUND="Not determined" +CONFIG_SOC_CAPS_ECO_VER_MAX=301 +CONFIG_SOC_ADC_SUPPORTED=y +CONFIG_SOC_DAC_SUPPORTED=y +CONFIG_SOC_UART_SUPPORTED=y +CONFIG_SOC_MCPWM_SUPPORTED=y +CONFIG_SOC_GPTIMER_SUPPORTED=y +CONFIG_SOC_SDMMC_HOST_SUPPORTED=y +CONFIG_SOC_BT_SUPPORTED=y +CONFIG_SOC_PCNT_SUPPORTED=y +CONFIG_SOC_WIFI_SUPPORTED=y +CONFIG_SOC_SDIO_SLAVE_SUPPORTED=y +CONFIG_SOC_TWAI_SUPPORTED=y +CONFIG_SOC_EMAC_SUPPORTED=y +CONFIG_SOC_ULP_SUPPORTED=y +CONFIG_SOC_CCOMP_TIMER_SUPPORTED=y +CONFIG_SOC_RTC_FAST_MEM_SUPPORTED=y +CONFIG_SOC_RTC_SLOW_MEM_SUPPORTED=y +CONFIG_SOC_RTC_MEM_SUPPORTED=y +CONFIG_SOC_I2S_SUPPORTED=y +CONFIG_SOC_RMT_SUPPORTED=y +CONFIG_SOC_SDM_SUPPORTED=y +CONFIG_SOC_GPSPI_SUPPORTED=y +CONFIG_SOC_LEDC_SUPPORTED=y +CONFIG_SOC_I2C_SUPPORTED=y +CONFIG_SOC_SUPPORT_COEXISTENCE=y +CONFIG_SOC_AES_SUPPORTED=y +CONFIG_SOC_MPI_SUPPORTED=y +CONFIG_SOC_SHA_SUPPORTED=y +CONFIG_SOC_FLASH_ENC_SUPPORTED=y +CONFIG_SOC_SECURE_BOOT_SUPPORTED=y +CONFIG_SOC_TOUCH_SENSOR_SUPPORTED=y +CONFIG_SOC_BOD_SUPPORTED=y +CONFIG_SOC_ULP_FSM_SUPPORTED=y +CONFIG_SOC_DPORT_WORKAROUND_DIS_INTERRUPT_LVL=5 +CONFIG_SOC_XTAL_SUPPORT_26M=y +CONFIG_SOC_XTAL_SUPPORT_40M=y +CONFIG_SOC_XTAL_SUPPORT_AUTO_DETECT=y +CONFIG_SOC_ADC_RTC_CTRL_SUPPORTED=y +CONFIG_SOC_ADC_DIG_CTRL_SUPPORTED=y +CONFIG_SOC_ADC_DMA_SUPPORTED=y +CONFIG_SOC_ADC_PERIPH_NUM=2 +CONFIG_SOC_ADC_MAX_CHANNEL_NUM=10 +CONFIG_SOC_ADC_ATTEN_NUM=4 +CONFIG_SOC_ADC_DIGI_CONTROLLER_NUM=2 +CONFIG_SOC_ADC_PATT_LEN_MAX=16 +CONFIG_SOC_ADC_DIGI_MIN_BITWIDTH=9 +CONFIG_SOC_ADC_DIGI_MAX_BITWIDTH=12 +CONFIG_SOC_ADC_DIGI_RESULT_BYTES=2 +CONFIG_SOC_ADC_DIGI_DATA_BYTES_PER_CONV=4 +CONFIG_SOC_ADC_SAMPLE_FREQ_THRES_HIGH=2 +CONFIG_SOC_ADC_SAMPLE_FREQ_THRES_LOW=20 +CONFIG_SOC_ADC_RTC_MIN_BITWIDTH=9 +CONFIG_SOC_ADC_RTC_MAX_BITWIDTH=12 +CONFIG_SOC_SHARED_IDCACHE_SUPPORTED=y +CONFIG_SOC_IDCACHE_PER_CORE=y +CONFIG_SOC_CPU_CORES_NUM=2 +CONFIG_SOC_CPU_INTR_NUM=32 +CONFIG_SOC_CPU_HAS_FPU=y +CONFIG_SOC_CPU_BREAKPOINTS_NUM=2 +CONFIG_SOC_CPU_WATCHPOINTS_NUM=2 +CONFIG_SOC_CPU_WATCHPOINT_SIZE=64 +CONFIG_SOC_DAC_CHAN_NUM=2 +CONFIG_SOC_DAC_RESOLUTION=8 +CONFIG_SOC_DAC_DMA_16BIT_ALIGN=y +CONFIG_SOC_GPIO_PORT=1 +CONFIG_SOC_GPIO_PIN_COUNT=40 +CONFIG_SOC_GPIO_VALID_GPIO_MASK=0xFFFFFFFFFF +CONFIG_SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK=0xEF0FEA +CONFIG_SOC_I2C_NUM=2 +CONFIG_SOC_I2C_FIFO_LEN=32 +CONFIG_SOC_I2C_CMD_REG_NUM=16 +CONFIG_SOC_I2C_SUPPORT_SLAVE=y +CONFIG_SOC_I2C_SUPPORT_APB=y +CONFIG_SOC_I2S_NUM=2 +CONFIG_SOC_I2S_HW_VERSION_1=y +CONFIG_SOC_I2S_SUPPORTS_APLL=y +CONFIG_SOC_I2S_SUPPORTS_PLL_F160M=y +CONFIG_SOC_I2S_SUPPORTS_PDM=y +CONFIG_SOC_I2S_SUPPORTS_PDM_TX=y +CONFIG_SOC_I2S_PDM_MAX_TX_LINES=1 +CONFIG_SOC_I2S_SUPPORTS_PDM_RX=y +CONFIG_SOC_I2S_PDM_MAX_RX_LINES=1 +CONFIG_SOC_I2S_SUPPORTS_ADC_DAC=y +CONFIG_SOC_I2S_SUPPORTS_ADC=y +CONFIG_SOC_I2S_SUPPORTS_DAC=y +CONFIG_SOC_I2S_SUPPORTS_LCD_CAMERA=y +CONFIG_SOC_I2S_TRANS_SIZE_ALIGN_WORD=y +CONFIG_SOC_I2S_LCD_I80_VARIANT=y +CONFIG_SOC_LCD_I80_SUPPORTED=y +CONFIG_SOC_LCD_I80_BUSES=2 +CONFIG_SOC_LCD_I80_BUS_WIDTH=24 +CONFIG_SOC_LEDC_HAS_TIMER_SPECIFIC_MUX=y +CONFIG_SOC_LEDC_SUPPORT_APB_CLOCK=y +CONFIG_SOC_LEDC_SUPPORT_REF_TICK=y +CONFIG_SOC_LEDC_SUPPORT_HS_MODE=y +CONFIG_SOC_LEDC_CHANNEL_NUM=8 +CONFIG_SOC_LEDC_TIMER_BIT_WIDTH=20 +CONFIG_SOC_MCPWM_GROUPS=2 +CONFIG_SOC_MCPWM_TIMERS_PER_GROUP=3 +CONFIG_SOC_MCPWM_OPERATORS_PER_GROUP=3 +CONFIG_SOC_MCPWM_COMPARATORS_PER_OPERATOR=2 +CONFIG_SOC_MCPWM_GENERATORS_PER_OPERATOR=2 +CONFIG_SOC_MCPWM_TRIGGERS_PER_OPERATOR=2 +CONFIG_SOC_MCPWM_GPIO_FAULTS_PER_GROUP=3 +CONFIG_SOC_MCPWM_CAPTURE_TIMERS_PER_GROUP=y +CONFIG_SOC_MCPWM_CAPTURE_CHANNELS_PER_TIMER=3 +CONFIG_SOC_MCPWM_GPIO_SYNCHROS_PER_GROUP=3 +CONFIG_SOC_MMU_PERIPH_NUM=2 +CONFIG_SOC_MMU_LINEAR_ADDRESS_REGION_NUM=3 +CONFIG_SOC_MPU_MIN_REGION_SIZE=0x20000000 +CONFIG_SOC_MPU_REGIONS_MAX_NUM=8 +CONFIG_SOC_PCNT_GROUPS=1 +CONFIG_SOC_PCNT_UNITS_PER_GROUP=8 +CONFIG_SOC_PCNT_CHANNELS_PER_UNIT=2 +CONFIG_SOC_PCNT_THRES_POINT_PER_UNIT=2 +CONFIG_SOC_RMT_GROUPS=1 +CONFIG_SOC_RMT_TX_CANDIDATES_PER_GROUP=8 +CONFIG_SOC_RMT_RX_CANDIDATES_PER_GROUP=8 +CONFIG_SOC_RMT_CHANNELS_PER_GROUP=8 +CONFIG_SOC_RMT_MEM_WORDS_PER_CHANNEL=64 +CONFIG_SOC_RMT_SUPPORT_REF_TICK=y +CONFIG_SOC_RMT_SUPPORT_APB=y +CONFIG_SOC_RMT_CHANNEL_CLK_INDEPENDENT=y +CONFIG_SOC_RTCIO_PIN_COUNT=18 +CONFIG_SOC_RTCIO_INPUT_OUTPUT_SUPPORTED=y +CONFIG_SOC_RTCIO_HOLD_SUPPORTED=y +CONFIG_SOC_RTCIO_WAKE_SUPPORTED=y +CONFIG_SOC_SDM_GROUPS=1 +CONFIG_SOC_SDM_CHANNELS_PER_GROUP=8 +CONFIG_SOC_SDM_CLK_SUPPORT_APB=y +CONFIG_SOC_SPI_HD_BOTH_INOUT_SUPPORTED=y +CONFIG_SOC_SPI_AS_CS_SUPPORTED=y +CONFIG_SOC_SPI_PERIPH_NUM=3 +CONFIG_SOC_SPI_DMA_CHAN_NUM=2 +CONFIG_SOC_SPI_MAX_CS_NUM=3 +CONFIG_SOC_SPI_SUPPORT_CLK_APB=y +CONFIG_SOC_SPI_MAXIMUM_BUFFER_SIZE=64 +CONFIG_SOC_SPI_MAX_PRE_DIVIDER=8192 +CONFIG_SOC_MEMSPI_SRC_FREQ_80M_SUPPORTED=y +CONFIG_SOC_MEMSPI_SRC_FREQ_40M_SUPPORTED=y +CONFIG_SOC_MEMSPI_SRC_FREQ_26M_SUPPORTED=y +CONFIG_SOC_MEMSPI_SRC_FREQ_20M_SUPPORTED=y +CONFIG_SOC_TIMER_GROUPS=2 +CONFIG_SOC_TIMER_GROUP_TIMERS_PER_GROUP=2 +CONFIG_SOC_TIMER_GROUP_COUNTER_BIT_WIDTH=64 +CONFIG_SOC_TIMER_GROUP_TOTAL_TIMERS=4 +CONFIG_SOC_TIMER_GROUP_SUPPORT_APB=y +CONFIG_SOC_TOUCH_VERSION_1=y +CONFIG_SOC_TOUCH_SENSOR_NUM=10 +CONFIG_SOC_TOUCH_PAD_MEASURE_WAIT_MAX=0xFF +CONFIG_SOC_TWAI_CONTROLLER_NUM=1 +CONFIG_SOC_TWAI_BRP_MIN=2 +CONFIG_SOC_TWAI_CLK_SUPPORT_APB=y +CONFIG_SOC_TWAI_SUPPORT_MULTI_ADDRESS_LAYOUT=y +CONFIG_SOC_UART_NUM=3 +CONFIG_SOC_UART_SUPPORT_APB_CLK=y +CONFIG_SOC_UART_SUPPORT_REF_TICK=y +CONFIG_SOC_UART_FIFO_LEN=128 +CONFIG_SOC_UART_BITRATE_MAX=5000000 +CONFIG_SOC_SPIRAM_SUPPORTED=y +CONFIG_SOC_SPI_MEM_SUPPORT_CONFIG_GPIO_BY_EFUSE=y +CONFIG_SOC_SHA_SUPPORT_PARALLEL_ENG=y +CONFIG_SOC_SHA_SUPPORT_SHA1=y +CONFIG_SOC_SHA_SUPPORT_SHA256=y +CONFIG_SOC_SHA_SUPPORT_SHA384=y +CONFIG_SOC_SHA_SUPPORT_SHA512=y +CONFIG_SOC_RSA_MAX_BIT_LEN=4096 +CONFIG_SOC_AES_SUPPORT_AES_128=y +CONFIG_SOC_AES_SUPPORT_AES_192=y +CONFIG_SOC_AES_SUPPORT_AES_256=y +CONFIG_SOC_SECURE_BOOT_V1=y +CONFIG_SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS=y +CONFIG_SOC_FLASH_ENCRYPTED_XTS_AES_BLOCK_MAX=32 +CONFIG_SOC_PHY_DIG_REGS_MEM_SIZE=21 +CONFIG_SOC_PM_SUPPORT_EXT0_WAKEUP=y +CONFIG_SOC_PM_SUPPORT_EXT1_WAKEUP=y +CONFIG_SOC_PM_SUPPORT_EXT_WAKEUP=y +CONFIG_SOC_PM_SUPPORT_TOUCH_SENSOR_WAKEUP=y +CONFIG_SOC_PM_SUPPORT_RTC_PERIPH_PD=y +CONFIG_SOC_PM_SUPPORT_RTC_FAST_MEM_PD=y +CONFIG_SOC_PM_SUPPORT_RTC_SLOW_MEM_PD=y +CONFIG_SOC_PM_SUPPORT_RC_FAST_PD=y +CONFIG_SOC_PM_SUPPORT_VDDSDIO_PD=y +CONFIG_SOC_PM_SUPPORT_MODEM_PD=y +CONFIG_SOC_CONFIGURABLE_VDDSDIO_SUPPORTED=y +CONFIG_SOC_CLK_APLL_SUPPORTED=y +CONFIG_SOC_APLL_MULTIPLIER_OUT_MIN_HZ=350000000 +CONFIG_SOC_APLL_MULTIPLIER_OUT_MAX_HZ=500000000 +CONFIG_SOC_APLL_MIN_HZ=5303031 +CONFIG_SOC_APLL_MAX_HZ=125000000 +CONFIG_SOC_CLK_RC_FAST_D256_SUPPORTED=y +CONFIG_SOC_RTC_SLOW_CLK_SUPPORT_RC_FAST_D256=y +CONFIG_SOC_CLK_RC_FAST_SUPPORT_CALIBRATION=y +CONFIG_SOC_CLK_XTAL32K_SUPPORTED=y +CONFIG_SOC_SDMMC_USE_IOMUX=y +CONFIG_SOC_SDMMC_NUM_SLOTS=2 +CONFIG_SOC_WIFI_WAPI_SUPPORT=y +CONFIG_SOC_WIFI_CSI_SUPPORT=y +CONFIG_SOC_WIFI_MESH_SUPPORT=y +CONFIG_SOC_WIFI_SUPPORT_VARIABLE_BEACON_WINDOW=y +CONFIG_SOC_WIFI_NAN_SUPPORT=y +CONFIG_SOC_BLE_SUPPORTED=y +CONFIG_SOC_BLE_MESH_SUPPORTED=y +CONFIG_SOC_BT_CLASSIC_SUPPORTED=y +CONFIG_SOC_BLUFI_SUPPORTED=y +CONFIG_SOC_ULP_HAS_ADC=y CONFIG_IDF_CMAKE=y CONFIG_IDF_TARGET_ARCH_XTENSA=y +CONFIG_IDF_TARGET_ARCH="xtensa" CONFIG_IDF_TARGET="esp32" CONFIG_IDF_TARGET_ESP32=y CONFIG_IDF_FIRMWARE_CHIP_ID=0x0000 -# -# SDK tool configuration -# -CONFIG_SDK_TOOLPREFIX="xtensa-esp32-elf-" -# CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS is not set -# end of SDK tool configuration - # # Build type # CONFIG_APP_BUILD_TYPE_APP_2NDBOOT=y -# CONFIG_APP_BUILD_TYPE_ELF_RAM is not set +# CONFIG_APP_BUILD_TYPE_RAM is not set CONFIG_APP_BUILD_GENERATE_BINARIES=y CONFIG_APP_BUILD_BOOTLOADER=y CONFIG_APP_BUILD_USE_FLASH_SECTIONS=y +# CONFIG_APP_REPRODUCIBLE_BUILD is not set +# CONFIG_APP_NO_BLOBS is not set +# CONFIG_APP_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set +# CONFIG_APP_COMPATIBLE_PRE_V3_1_BOOTLOADERS is not set # end of Build type -# -# Application manager -# -CONFIG_APP_COMPILE_TIME_DATE=y -# CONFIG_APP_EXCLUDE_PROJECT_VER_VAR is not set -# CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR is not set -# CONFIG_APP_PROJECT_VER_FROM_CONFIG is not set -CONFIG_APP_RETRIEVE_LEN_ELF_SHA=16 -# end of Application manager - # # Bootloader config # @@ -44,17 +241,18 @@ CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE is not set # CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set +CONFIG_BOOTLOADER_LOG_LEVEL_ERROR=y # CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set -CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y +# CONFIG_BOOTLOADER_LOG_LEVEL_INFO is not set # CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set # CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set -CONFIG_BOOTLOADER_LOG_LEVEL=3 +CONFIG_BOOTLOADER_LOG_LEVEL=1 # CONFIG_BOOTLOADER_SPI_CUSTOM_WP_PIN is not set CONFIG_BOOTLOADER_SPI_WP_PIN=7 CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y # CONFIG_BOOTLOADER_FACTORY_RESET is not set # CONFIG_BOOTLOADER_APP_TEST is not set +CONFIG_BOOTLOADER_REGION_PROTECTION_ENABLE=y CONFIG_BOOTLOADER_WDT_ENABLE=y # CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE is not set CONFIG_BOOTLOADER_WDT_TIME_MS=9000 @@ -71,20 +269,39 @@ CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT=y # # Security features # +CONFIG_SECURE_BOOT_V1_SUPPORTED=y # CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT is not set # CONFIG_SECURE_BOOT is not set # CONFIG_SECURE_FLASH_ENC_ENABLED is not set # end of Security features +# +# Application manager +# +CONFIG_APP_COMPILE_TIME_DATE=y +# CONFIG_APP_EXCLUDE_PROJECT_VER_VAR is not set +# CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR is not set +# CONFIG_APP_PROJECT_VER_FROM_CONFIG is not set +CONFIG_APP_RETRIEVE_LEN_ELF_SHA=16 +# end of Application manager + +CONFIG_ESP_ROM_HAS_CRC_LE=y +CONFIG_ESP_ROM_HAS_CRC_BE=y +CONFIG_ESP_ROM_HAS_MZ_CRC32=y +CONFIG_ESP_ROM_HAS_JPEG_DECODE=y +CONFIG_ESP_ROM_HAS_UART_BUF_SWITCH=y +CONFIG_ESP_ROM_NEEDS_SWSETUP_WORKAROUND=y +CONFIG_ESP_ROM_HAS_NEWLIB_NANO_FORMAT=y + # # Serial flasher config # -CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200 # CONFIG_ESPTOOLPY_NO_STUB is not set CONFIG_ESPTOOLPY_FLASHMODE_QIO=y # CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set # CONFIG_ESPTOOLPY_FLASHMODE_DIO is not set # CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set +CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR=y CONFIG_ESPTOOLPY_FLASHMODE="dio" CONFIG_ESPTOOLPY_FLASHFREQ_80M=y # CONFIG_ESPTOOLPY_FLASHFREQ_40M is not set @@ -96,23 +313,17 @@ CONFIG_ESPTOOLPY_FLASHFREQ="80m" CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y # CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set CONFIG_ESPTOOLPY_FLASHSIZE="4MB" -CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y +# CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE is not set CONFIG_ESPTOOLPY_BEFORE_RESET=y # CONFIG_ESPTOOLPY_BEFORE_NORESET is not set CONFIG_ESPTOOLPY_BEFORE="default_reset" CONFIG_ESPTOOLPY_AFTER_RESET=y # CONFIG_ESPTOOLPY_AFTER_NORESET is not set CONFIG_ESPTOOLPY_AFTER="hard_reset" -# CONFIG_ESPTOOLPY_MONITOR_BAUD_CONSOLE is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_9600B is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_57600B is not set -CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y -# CONFIG_ESPTOOLPY_MONITOR_BAUD_230400B is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_921600B is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_2MB is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER is not set -CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER_VAL=115200 CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 # end of Serial flasher config @@ -120,6 +331,7 @@ CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 # Partition Table # # CONFIG_PARTITION_TABLE_SINGLE_APP is not set +# CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set # CONFIG_PARTITION_TABLE_TWO_OTA is not set CONFIG_PARTITION_TABLE_CUSTOM=y CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" @@ -129,17 +341,33 @@ CONFIG_PARTITION_TABLE_MD5=y # end of Partition Table # -# Audio HAL +# Snapclient Configuration +# +CONFIG_SNAPSERVER_USE_MDNS=y +CONFIG_SNAPCLIENT_NAME="esp-snapclient" + +# +# HTTP Server Setting +# +CONFIG_WEB_PORT=8000 +# end of HTTP Server Setting + +CONFIG_USE_SAMPLE_INSERTION=y +# end of Snapclient Configuration + +# +# Audio Board # # CONFIG_AUDIO_BOARD_CUSTOM is not set -# CONFIG_ESP_LYRAT_V4_3_BOARD is not set +CONFIG_ESP_LYRAT_V4_3_BOARD=y # CONFIG_ESP_LYRAT_V4_2_BOARD is not set # CONFIG_ESP_LYRATD_MSC_V2_1_BOARD is not set # CONFIG_ESP_LYRATD_MSC_V2_2_BOARD is not set -CONFIG_ESP_LYRAT_MINI_V1_1_BOARD=y +# CONFIG_ESP_LYRAT_MINI_V1_1_BOARD is not set # CONFIG_ESP32_KORVO_DU1906_BOARD is not set # CONFIG_ESP32_S2_KALUGA_1_V1_2_BOARD is not set -# end of Audio HAL +# CONFIG_ESP_AI_THINKER_ES8388_BOARD is not set +# end of Audio Board # # ESP32 DSP processor config @@ -163,25 +391,12 @@ CONFIG_SNTP_SERVER="pool.ntp.org" # # Wifi Configuration # -# CONFIG_ENABLE_WIFI_PROVISIONING is not set -CONFIG_WIFI_SSID="test" -CONFIG_WIFI_PASSWORD="12345678" +CONFIG_ENABLE_WIFI_PROVISIONING=y +CONFIG_WIFI_PROVISIONING_SSID="prov_snapclient" +CONFIG_WIFI_PROVISIONING_PASSWORD="12345678" CONFIG_WIFI_MAXIMUM_RETRY=0 # end of Wifi Configuration -# -# Snapclient Configuration -# -CONFIG_SNAPSERVER_USE_MDNS=y -CONFIG_SNAPCLIENT_NAME="esp-snapclient" - -# -# HTTP Server Setting -# -CONFIG_WEB_PORT=8000 -# end of HTTP Server Setting -# end of Snapclient Configuration - # # Compiler options # @@ -192,6 +407,10 @@ CONFIG_COMPILER_OPTIMIZATION_PERF=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y # CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT is not set # CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE is not set +CONFIG_COMPILER_FLOAT_LIB_FROM_GCCLIB=y +CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2 +# CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT is not set +CONFIG_COMPILER_HIDE_PATHS_MACROS=y # CONFIG_COMPILER_CXX_EXCEPTIONS is not set # CONFIG_COMPILER_CXX_RTTI is not set CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y @@ -199,7 +418,7 @@ CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y # CONFIG_COMPILER_STACK_CHECK_MODE_STRONG is not set # CONFIG_COMPILER_STACK_CHECK_MODE_ALL is not set # CONFIG_COMPILER_WARN_WRITE_STRINGS is not set -# CONFIG_COMPILER_DISABLE_GCC8_WARNINGS is not set +# CONFIG_COMPILER_DISABLE_GCC12_WARNINGS is not set # CONFIG_COMPILER_DUMP_RTL_FILES is not set # end of Compiler options @@ -212,15 +431,13 @@ CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y # # CONFIG_APPTRACE_DEST_JTAG is not set CONFIG_APPTRACE_DEST_NONE=y +# CONFIG_APPTRACE_DEST_UART1 is not set +# CONFIG_APPTRACE_DEST_UART2 is not set +CONFIG_APPTRACE_DEST_UART_NONE=y +CONFIG_APPTRACE_UART_TASK_PRIO=1 CONFIG_APPTRACE_LOCK_ENABLE=y # end of Application Level Tracing -# -# ESP-ASIO -# -# CONFIG_ASIO_SSL_SUPPORT is not set -# end of ESP-ASIO - # # Bluetooth # @@ -228,36 +445,35 @@ CONFIG_APPTRACE_LOCK_ENABLE=y # end of Bluetooth # -# CoAP Configuration +# Driver Configurations # -CONFIG_COAP_MBEDTLS_PSK=y -# CONFIG_COAP_MBEDTLS_PKI is not set -# CONFIG_COAP_MBEDTLS_DEBUG is not set -CONFIG_COAP_LOG_DEFAULT_LEVEL=0 -# end of CoAP Configuration # -# Driver configurations +# Legacy ADC Configuration # +CONFIG_ADC_DISABLE_DAC=y +# CONFIG_ADC_SUPPRESS_DEPRECATE_WARN is not set # -# ADC configuration +# Legacy ADC Calibration Configuration # -# CONFIG_ADC_FORCE_XPD_FSM is not set -CONFIG_ADC_DISABLE_DAC=y -# end of ADC configuration +CONFIG_ADC_CAL_EFUSE_TP_ENABLE=y +CONFIG_ADC_CAL_EFUSE_VREF_ENABLE=y +CONFIG_ADC_CAL_LUT_ENABLE=y +# CONFIG_ADC_CALI_SUPPRESS_DEPRECATE_WARN is not set +# end of Legacy ADC Calibration Configuration +# end of Legacy ADC Configuration # -# SPI configuration +# SPI Configuration # -# CONFIG_SPI_MASTER_IN_IRAM is not set CONFIG_SPI_MASTER_ISR_IN_IRAM=y # CONFIG_SPI_SLAVE_IN_IRAM is not set # CONFIG_SPI_SLAVE_ISR_IN_IRAM is not set -# end of SPI configuration +# end of SPI Configuration # -# TWAI configuration +# TWAI Configuration # # CONFIG_TWAI_ISR_IN_IRAM is not set # CONFIG_TWAI_ERRATA_FIX_BUS_OFF_REC is not set @@ -265,26 +481,82 @@ CONFIG_SPI_MASTER_ISR_IN_IRAM=y # CONFIG_TWAI_ERRATA_FIX_RX_FRAME_INVALID is not set # CONFIG_TWAI_ERRATA_FIX_RX_FIFO_CORRUPT is not set # CONFIG_TWAI_ERRATA_FIX_LISTEN_ONLY_DOM is not set -# end of TWAI configuration +# end of TWAI Configuration # -# UART configuration +# UART Configuration # # CONFIG_UART_ISR_IN_IRAM is not set -# end of UART configuration - -# -# RTCIO configuration -# -# CONFIG_RTCIO_SUPPORT_RTC_GPIO_DESC is not set -# end of RTCIO configuration +# end of UART Configuration # # GPIO Configuration # # CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL is not set +# CONFIG_GPIO_CTRL_FUNC_IN_IRAM is not set # end of GPIO Configuration -# end of Driver configurations + +# +# Sigma Delta Modulator Configuration +# +# CONFIG_SDM_CTRL_FUNC_IN_IRAM is not set +# CONFIG_SDM_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_SDM_ENABLE_DEBUG_LOG is not set +# end of Sigma Delta Modulator Configuration + +# +# GPTimer Configuration +# +# CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM is not set +# CONFIG_GPTIMER_ISR_IRAM_SAFE is not set +# CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_GPTIMER_ENABLE_DEBUG_LOG is not set +# end of GPTimer Configuration + +# +# PCNT Configuration +# +# CONFIG_PCNT_CTRL_FUNC_IN_IRAM is not set +# CONFIG_PCNT_ISR_IRAM_SAFE is not set +# CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_PCNT_ENABLE_DEBUG_LOG is not set +# end of PCNT Configuration + +# +# RMT Configuration +# +# CONFIG_RMT_ISR_IRAM_SAFE is not set +# CONFIG_RMT_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_RMT_ENABLE_DEBUG_LOG is not set +# end of RMT Configuration + +# +# MCPWM Configuration +# +# CONFIG_MCPWM_ISR_IRAM_SAFE is not set +# CONFIG_MCPWM_CTRL_FUNC_IN_IRAM is not set +# CONFIG_MCPWM_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_MCPWM_ENABLE_DEBUG_LOG is not set +# end of MCPWM Configuration + +# +# I2S Configuration +# +# CONFIG_I2S_ISR_IRAM_SAFE is not set +# CONFIG_I2S_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_I2S_ENABLE_DEBUG_LOG is not set +# end of I2S Configuration + +# +# DAC Configuration +# +# CONFIG_DAC_CTRL_FUNC_IN_IRAM is not set +# CONFIG_DAC_ISR_IRAM_SAFE is not set +# CONFIG_DAC_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_DAC_ENABLE_DEBUG_LOG is not set +CONFIG_DAC_DMA_AUTO_16BIT_ALIGN=y +# end of DAC Configuration +# end of Driver Configurations # # eFuse Bit Manager @@ -302,111 +574,38 @@ CONFIG_EFUSE_MAX_BLK_LEN=192 # CONFIG_ESP_TLS_USING_MBEDTLS=y # CONFIG_ESP_TLS_USE_SECURE_ELEMENT is not set +# CONFIG_ESP_TLS_CLIENT_SESSION_TICKETS is not set # CONFIG_ESP_TLS_SERVER is not set # CONFIG_ESP_TLS_PSK_VERIFICATION is not set # CONFIG_ESP_TLS_INSECURE is not set # end of ESP-TLS # -# ESP32-specific +# ADC and ADC Calibration # -CONFIG_ESP32_REV_MIN_0=y -# CONFIG_ESP32_REV_MIN_1 is not set -# CONFIG_ESP32_REV_MIN_1_1 is not set -# CONFIG_ESP32_REV_MIN_2 is not set -# CONFIG_ESP32_REV_MIN_3 is not set -# CONFIG_ESP32_REV_MIN_3_1 is not set -CONFIG_ESP32_REV_MIN=0 -CONFIG_ESP32_REV_MIN_FULL=0 -CONFIG_ESP_REV_MIN_FULL=0 -CONFIG_ESP32_REV_MAX_FULL_STR_OPT=y -CONFIG_ESP32_REV_MAX_FULL=399 -CONFIG_ESP_REV_MAX_FULL=399 -CONFIG_ESP32_DPORT_WORKAROUND=y -# CONFIG_ESP32_DEFAULT_CPU_FREQ_80 is not set -# CONFIG_ESP32_DEFAULT_CPU_FREQ_160 is not set -CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y -CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240 -# CONFIG_ESP32_SPIRAM_SUPPORT is not set -# CONFIG_ESP32_TRAX is not set -CONFIG_ESP32_TRACEMEM_RESERVE_DRAM=0x0 -# CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_TWO is not set -CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR=y -CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES=4 -# CONFIG_ESP32_ULP_COPROC_ENABLED is not set -CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=0 -CONFIG_ESP32_DEBUG_OCDAWARE=y -CONFIG_ESP32_BROWNOUT_DET=y -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_0 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_1 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_2 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_3 is not set -CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_4=y -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_5 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_6 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_7 is not set -CONFIG_ESP32_BROWNOUT_DET_LVL=4 -CONFIG_ESP32_REDUCE_PHY_TX_POWER=y -CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1=y -# CONFIG_ESP32_TIME_SYSCALL_USE_RTC is not set -# CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 is not set -# CONFIG_ESP32_TIME_SYSCALL_USE_NONE is not set -CONFIG_ESP32_RTC_CLK_SRC_INT_RC=y -# CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS is not set -# CONFIG_ESP32_RTC_CLK_SRC_EXT_OSC is not set -# CONFIG_ESP32_RTC_CLK_SRC_INT_8MD256 is not set -CONFIG_ESP32_RTC_CLK_CAL_CYCLES=1024 -CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY=2000 -CONFIG_ESP32_XTAL_FREQ_40=y -# CONFIG_ESP32_XTAL_FREQ_26 is not set -# CONFIG_ESP32_XTAL_FREQ_AUTO is not set -CONFIG_ESP32_XTAL_FREQ=40 -# CONFIG_ESP32_DISABLE_BASIC_ROM_CONSOLE is not set -# CONFIG_ESP32_NO_BLOBS is not set -# CONFIG_ESP32_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set -# CONFIG_ESP32_COMPATIBLE_PRE_V3_1_BOOTLOADERS is not set -# CONFIG_ESP32_USE_FIXED_STATIC_RAM_SIZE is not set -CONFIG_ESP32_DPORT_DIS_INTERRUPT_LVL=5 -# end of ESP32-specific +# CONFIG_ADC_ONESHOT_CTRL_FUNC_IN_IRAM is not set +# CONFIG_ADC_CONTINUOUS_ISR_IRAM_SAFE is not set # -# ADC-Calibration +# ADC Calibration Configurations # -CONFIG_ADC_CAL_EFUSE_TP_ENABLE=y -CONFIG_ADC_CAL_EFUSE_VREF_ENABLE=y -CONFIG_ADC_CAL_LUT_ENABLE=y -# end of ADC-Calibration +CONFIG_ADC_CALI_EFUSE_TP_ENABLE=y +CONFIG_ADC_CALI_EFUSE_VREF_ENABLE=y +CONFIG_ADC_CALI_LUT_ENABLE=y +# end of ADC Calibration Configurations + +CONFIG_ADC_DISABLE_DAC_OUTPUT=y +# end of ADC and ADC Calibration + +# +# Wireless Coexistence +# +# end of Wireless Coexistence # # Common ESP-related # CONFIG_ESP_ERR_TO_NAME_LOOKUP=y -CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32 -CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=2560 -CONFIG_ESP_IPC_TASK_STACK_SIZE=1024 -CONFIG_ESP_IPC_USES_CALLERS_PRIORITY=y -CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE=2048 -CONFIG_ESP_CONSOLE_UART_DEFAULT=y -# CONFIG_ESP_CONSOLE_UART_CUSTOM is not set -# CONFIG_ESP_CONSOLE_NONE is not set -CONFIG_ESP_CONSOLE_UART=y -CONFIG_ESP_CONSOLE_MULTIPLE_UART=y -CONFIG_ESP_CONSOLE_UART_NUM=0 -CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -CONFIG_ESP_INT_WDT=y -CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 -CONFIG_ESP_INT_WDT_CHECK_CPU1=y -CONFIG_ESP_TASK_WDT=y -# CONFIG_ESP_TASK_WDT_PANIC is not set -CONFIG_ESP_TASK_WDT_TIMEOUT_S=5 -CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y -CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=y -# CONFIG_ESP_PANIC_HANDLER_IRAM is not set -CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA=y -CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP=y -CONFIG_ESP_MAC_ADDR_UNIVERSE_BT=y -CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y # end of Common ESP-related # @@ -415,7 +614,6 @@ CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y CONFIG_ETH_ENABLED=y CONFIG_ETH_USE_ESP32_EMAC=y CONFIG_ETH_PHY_INTERFACE_RMII=y -# CONFIG_ETH_PHY_INTERFACE_MII is not set CONFIG_ETH_RMII_CLK_INPUT=y # CONFIG_ETH_RMII_CLK_OUTPUT is not set CONFIG_ETH_RMII_CLK_IN_GPIO=0 @@ -426,7 +624,9 @@ CONFIG_ETH_DMA_TX_BUFFER_NUM=5 CONFIG_ETH_USE_SPI_ETHERNET=y # CONFIG_ETH_SPI_ETHERNET_DM9051 is not set # CONFIG_ETH_SPI_ETHERNET_W5500 is not set +# CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL is not set # CONFIG_ETH_USE_OPENETH is not set +# CONFIG_ETH_TRANSMIT_MUTEX is not set # end of Ethernet # @@ -447,6 +647,7 @@ CONFIG_ESP_EVENT_POST_FROM_ISR=y # CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=y # CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set +# CONFIG_ESP_HTTP_CLIENT_ENABLE_DIGEST_AUTH is not set # end of ESP HTTP client # @@ -458,12 +659,14 @@ CONFIG_HTTPD_ERR_RESP_NO_DELAY=y CONFIG_HTTPD_PURGE_BUF_LEN=32 # CONFIG_HTTPD_LOG_PURGE_DATA is not set # CONFIG_HTTPD_WS_SUPPORT is not set +# CONFIG_HTTPD_QUEUE_WORK_BLOCKING is not set # end of HTTP Server # # ESP HTTPS OTA # -# CONFIG_OTA_ALLOW_HTTP is not set +# CONFIG_ESP_HTTPS_OTA_DECRYPT_CB is not set +# CONFIG_ESP_HTTPS_OTA_ALLOW_HTTP is not set # end of ESP HTTPS OTA # @@ -472,41 +675,239 @@ CONFIG_HTTPD_PURGE_BUF_LEN=32 # CONFIG_ESP_HTTPS_SERVER_ENABLE is not set # end of ESP HTTPS server +# +# Hardware Settings +# + +# +# Chip revision +# +CONFIG_ESP32_REV_MIN_0=y +# CONFIG_ESP32_REV_MIN_1 is not set +# CONFIG_ESP32_REV_MIN_1_1 is not set +# CONFIG_ESP32_REV_MIN_2 is not set +# CONFIG_ESP32_REV_MIN_3 is not set +# CONFIG_ESP32_REV_MIN_3_1 is not set +CONFIG_ESP32_REV_MIN=0 +CONFIG_ESP32_REV_MIN_FULL=0 +CONFIG_ESP_REV_MIN_FULL=0 + +# +# Maximum Supported ESP32 Revision (Rev v3.99) +# +CONFIG_ESP32_REV_MAX_FULL=399 +CONFIG_ESP_REV_MAX_FULL=399 +# end of Chip revision + +# +# MAC Config +# +CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA=y +CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP=y +CONFIG_ESP_MAC_ADDR_UNIVERSE_BT=y +CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y +CONFIG_ESP_MAC_UNIVERSAL_MAC_ADDRESSES_FOUR=y +# CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_TWO is not set +CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR=y +CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES=4 +# CONFIG_ESP_MAC_IGNORE_MAC_CRC_ERROR is not set +# end of MAC Config + +# +# Sleep Config +# +CONFIG_ESP_SLEEP_POWER_DOWN_FLASH=y +CONFIG_ESP_SLEEP_RTC_BUS_ISO_WORKAROUND=y +# CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set +CONFIG_ESP_SLEEP_DEEP_SLEEP_WAKEUP_DELAY=2000 +# end of Sleep Config + +# +# RTC Clock Config +# +CONFIG_RTC_CLK_SRC_INT_RC=y +# CONFIG_RTC_CLK_SRC_EXT_CRYS is not set +# CONFIG_RTC_CLK_SRC_EXT_OSC is not set +# CONFIG_RTC_CLK_SRC_INT_8MD256 is not set +CONFIG_RTC_CLK_CAL_CYCLES=1024 +# end of RTC Clock Config + +# +# Peripheral Control +# +CONFIG_PERIPH_CTRL_FUNC_IN_IRAM=y +# end of Peripheral Control + +# +# Main XTAL Config +# +# CONFIG_XTAL_FREQ_26 is not set +CONFIG_XTAL_FREQ_40=y +# CONFIG_XTAL_FREQ_AUTO is not set +CONFIG_XTAL_FREQ=40 +# end of Main XTAL Config +# end of Hardware Settings + +# +# LCD and Touch Panel +# + +# +# LCD Touch Drivers are maintained in the IDF Component Registry +# + +# +# LCD Peripheral Configuration +# +CONFIG_LCD_PANEL_IO_FORMAT_BUF_SIZE=32 +# CONFIG_LCD_ENABLE_DEBUG_LOG is not set +# end of LCD Peripheral Configuration +# end of LCD and Touch Panel + # # ESP NETIF Adapter # CONFIG_ESP_NETIF_IP_LOST_TIMER_INTERVAL=120 CONFIG_ESP_NETIF_TCPIP_LWIP=y # CONFIG_ESP_NETIF_LOOPBACK is not set -CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=y +CONFIG_ESP_NETIF_USES_TCPIP_WITH_BSD_API=y +# CONFIG_ESP_NETIF_RECEIVE_REPORT_ERRORS is not set +# CONFIG_ESP_NETIF_L2_TAP is not set +# CONFIG_ESP_NETIF_BRIDGE_EN is not set # end of ESP NETIF Adapter +# +# Partition API Configuration +# +# end of Partition API Configuration + +# +# PHY +# +CONFIG_ESP_PHY_CALIBRATION_AND_DATA_STORAGE=y +# CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION is not set +CONFIG_ESP_PHY_MAX_WIFI_TX_POWER=20 +CONFIG_ESP_PHY_MAX_TX_POWER=20 +CONFIG_ESP_PHY_REDUCE_TX_POWER=y +CONFIG_ESP_PHY_RF_CAL_PARTIAL=y +# CONFIG_ESP_PHY_RF_CAL_NONE is not set +# CONFIG_ESP_PHY_RF_CAL_FULL is not set +CONFIG_ESP_PHY_CALIBRATION_MODE=0 +# end of PHY + # # Power Management # # CONFIG_PM_ENABLE is not set # end of Power Management +# +# ESP PSRAM +# +# CONFIG_SPIRAM is not set +# end of ESP PSRAM + +# +# ESP Ringbuf +# +# CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH is not set +# end of ESP Ringbuf + # # ESP System Settings # +# CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_80 is not set +# CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_160 is not set +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ=240 + +# +# Memory +# +# CONFIG_ESP32_USE_FIXED_STATIC_RAM_SIZE is not set + +# +# Non-backward compatible options +# +# CONFIG_ESP_SYSTEM_ESP32_SRAM1_REGION_AS_IRAM is not set +# end of Non-backward compatible options +# end of Memory + +# +# Trace memory +# +# CONFIG_ESP32_TRAX is not set +CONFIG_ESP32_TRACEMEM_RESERVE_DRAM=0x0 +# end of Trace memory + # CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT is not set CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set # CONFIG_ESP_SYSTEM_PANIC_GDBSTUB is not set -CONFIG_ESP_SYSTEM_PD_FLASH=y -# CONFIG_ESP_SYSTEM_FLASH_LEAKAGE_WORKAROUND is not set +# CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME is not set +CONFIG_ESP_SYSTEM_PANIC_REBOOT_DELAY_SECONDS=0 # -# RTC Clock Config +# Memory protection # -# end of RTC Clock Config +# end of Memory protection + +CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32 +CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=3072 +CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0=y +# CONFIG_ESP_MAIN_TASK_AFFINITY_CPU1 is not set +# CONFIG_ESP_MAIN_TASK_AFFINITY_NO_AFFINITY is not set +CONFIG_ESP_MAIN_TASK_AFFINITY=0x0 +CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE=2048 +CONFIG_ESP_CONSOLE_UART_DEFAULT=y +# CONFIG_ESP_CONSOLE_UART_CUSTOM is not set +# CONFIG_ESP_CONSOLE_NONE is not set +CONFIG_ESP_CONSOLE_UART=y +CONFIG_ESP_CONSOLE_MULTIPLE_UART=y +CONFIG_ESP_CONSOLE_UART_NUM=0 +CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 +CONFIG_ESP_INT_WDT=y +CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 +CONFIG_ESP_INT_WDT_CHECK_CPU1=y +CONFIG_ESP_TASK_WDT_EN=y +CONFIG_ESP_TASK_WDT_INIT=y +# CONFIG_ESP_TASK_WDT_PANIC is not set +CONFIG_ESP_TASK_WDT_TIMEOUT_S=5 +CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y +CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=y +# CONFIG_ESP_PANIC_HANDLER_IRAM is not set +# CONFIG_ESP_DEBUG_STUBS_ENABLE is not set +CONFIG_ESP_DEBUG_OCDAWARE=y +# CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set +CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_4=y + +# +# Brownout Detector +# +CONFIG_ESP_BROWNOUT_DET=y +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_0 is not set +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_1 is not set +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_2 is not set +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_3 is not set +CONFIG_ESP_BROWNOUT_DET_LVL_SEL_4=y +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_5 is not set +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_6 is not set +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_7 is not set +CONFIG_ESP_BROWNOUT_DET_LVL=4 +# end of Brownout Detector + +# CONFIG_ESP32_DISABLE_BASIC_ROM_CONSOLE is not set +CONFIG_ESP_SYSTEM_BROWNOUT_INTR=y +# end of ESP System Settings # -# Memory protection +# IPC (Inter-Processor Call) # -# end of Memory protection -# end of ESP System Settings +CONFIG_ESP_IPC_TASK_STACK_SIZE=1024 +CONFIG_ESP_IPC_USES_CALLERS_PRIORITY=y +CONFIG_ESP_IPC_ISR_ENABLE=y +# end of IPC (Inter-Processor Call) # # High resolution timer (esp_timer) @@ -515,52 +916,70 @@ CONFIG_ESP_SYSTEM_PD_FLASH=y CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER=y CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER=y CONFIG_ESP_TIMER_TASK_STACK_SIZE=2048 -# CONFIG_ESP_TIMER_IMPL_FRC2 is not set +CONFIG_ESP_TIMER_INTERRUPT_LEVEL=1 +# CONFIG_ESP_TIMER_SHOW_EXPERIMENTAL is not set +CONFIG_ESP_TIMER_TASK_AFFINITY=0x0 +CONFIG_ESP_TIMER_TASK_AFFINITY_CPU0=y +CONFIG_ESP_TIMER_ISR_AFFINITY=0x1 +CONFIG_ESP_TIMER_ISR_AFFINITY_CPU0=y +# CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD is not set CONFIG_ESP_TIMER_IMPL_TG0_LAC=y # end of High resolution timer (esp_timer) # # Wi-Fi # -CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=8 -CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=64 -CONFIG_ESP32_WIFI_STATIC_TX_BUFFER=y -# CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER is not set -CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=0 -CONFIG_ESP32_WIFI_STATIC_TX_BUFFER_NUM=8 -# CONFIG_ESP32_WIFI_CSI_ENABLED is not set -CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y -CONFIG_ESP32_WIFI_TX_BA_WIN=8 -CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y -CONFIG_ESP32_WIFI_RX_BA_WIN=16 -CONFIG_ESP32_WIFI_NVS_ENABLED=y -CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y -# CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1 is not set -CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752 -CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32 -# CONFIG_WIFI_LOG_DEFAULT_LEVEL_NONE is not set -# CONFIG_WIFI_LOG_DEFAULT_LEVEL_ERROR is not set -# CONFIG_WIFI_LOG_DEFAULT_LEVEL_WARN is not set -CONFIG_WIFI_LOG_DEFAULT_LEVEL_INFO=y -# CONFIG_WIFI_LOG_DEFAULT_LEVEL_DEBUG is not set -# CONFIG_WIFI_LOG_DEFAULT_LEVEL_VERBOSE is not set -# CONFIG_ESP32_WIFI_IRAM_OPT is not set -CONFIG_ESP32_WIFI_RX_IRAM_OPT=y -CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=y +CONFIG_ESP_WIFI_ENABLED=y +CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=8 +CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=64 +CONFIG_ESP_WIFI_STATIC_TX_BUFFER=y +# CONFIG_ESP_WIFI_DYNAMIC_TX_BUFFER is not set +CONFIG_ESP_WIFI_TX_BUFFER_TYPE=0 +CONFIG_ESP_WIFI_STATIC_TX_BUFFER_NUM=8 +# CONFIG_ESP_WIFI_CSI_ENABLED is not set +CONFIG_ESP_WIFI_AMPDU_TX_ENABLED=y +CONFIG_ESP_WIFI_TX_BA_WIN=8 +CONFIG_ESP_WIFI_AMPDU_RX_ENABLED=y +CONFIG_ESP_WIFI_RX_BA_WIN=16 +CONFIG_ESP_WIFI_NVS_ENABLED=y +CONFIG_ESP_WIFI_TASK_PINNED_TO_CORE_0=y +# CONFIG_ESP_WIFI_TASK_PINNED_TO_CORE_1 is not set +CONFIG_ESP_WIFI_SOFTAP_BEACON_MAX_LEN=752 +CONFIG_ESP_WIFI_MGMT_SBUF_NUM=32 +# CONFIG_ESP_WIFI_IRAM_OPT is not set +CONFIG_ESP_WIFI_RX_IRAM_OPT=y +CONFIG_ESP_WIFI_ENABLE_WPA3_SAE=y +CONFIG_ESP_WIFI_ENABLE_SAE_PK=y +CONFIG_ESP_WIFI_SOFTAP_SAE_SUPPORT=y +CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_STA=y # CONFIG_ESP_WIFI_SLP_IRAM_OPT is not set # CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE is not set +# CONFIG_ESP_WIFI_GMAC_SUPPORT is not set +CONFIG_ESP_WIFI_SOFTAP_SUPPORT=y # CONFIG_ESP_WIFI_SLP_BEACON_LOST_OPT is not set +CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=7 +# CONFIG_ESP_WIFI_NAN_ENABLE is not set +CONFIG_ESP_WIFI_MBEDTLS_CRYPTO=y +CONFIG_ESP_WIFI_MBEDTLS_TLS_CLIENT=y +# CONFIG_ESP_WIFI_WAPI_PSK is not set +# CONFIG_ESP_WIFI_SUITE_B_192 is not set +# CONFIG_ESP_WIFI_11KV_SUPPORT is not set +# CONFIG_ESP_WIFI_MBO_SUPPORT is not set +# CONFIG_ESP_WIFI_DPP_SUPPORT is not set +# CONFIG_ESP_WIFI_11R_SUPPORT is not set +# CONFIG_ESP_WIFI_WPS_SOFTAP_REGISTRAR is not set + +# +# WPS Configuration Options +# +# CONFIG_ESP_WIFI_WPS_STRICT is not set +# CONFIG_ESP_WIFI_WPS_PASSPHRASE is not set +# end of WPS Configuration Options + +# CONFIG_ESP_WIFI_DEBUG_PRINT is not set +# CONFIG_ESP_WIFI_TESTING_OPTIONS is not set # end of Wi-Fi -# -# PHY -# -CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y -# CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set -CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20 -CONFIG_ESP32_PHY_MAX_TX_POWER=20 -# end of PHY - # # Core dump # @@ -572,6 +991,12 @@ CONFIG_ESP_COREDUMP_ENABLE_TO_NONE=y # # FAT Filesystem support # +CONFIG_FATFS_VOLUME_COUNT=2 +CONFIG_FATFS_LFN_NONE=y +# CONFIG_FATFS_LFN_HEAP is not set +# CONFIG_FATFS_LFN_STACK is not set +# CONFIG_FATFS_SECTOR_512 is not set +CONFIG_FATFS_SECTOR_4096=y # CONFIG_FATFS_CODEPAGE_DYNAMIC is not set CONFIG_FATFS_CODEPAGE_437=y # CONFIG_FATFS_CODEPAGE_720 is not set @@ -595,87 +1020,77 @@ CONFIG_FATFS_CODEPAGE_437=y # CONFIG_FATFS_CODEPAGE_949 is not set # CONFIG_FATFS_CODEPAGE_950 is not set CONFIG_FATFS_CODEPAGE=437 -CONFIG_FATFS_LFN_NONE=y -# CONFIG_FATFS_LFN_HEAP is not set -# CONFIG_FATFS_LFN_STACK is not set CONFIG_FATFS_FS_LOCK=0 CONFIG_FATFS_TIMEOUT_MS=10000 CONFIG_FATFS_PER_FILE_CACHE=y # CONFIG_FATFS_USE_FASTSEEK is not set +CONFIG_FATFS_VFS_FSTAT_BLKSIZE=0 # end of FAT Filesystem support # -# Modbus configuration -# -CONFIG_FMB_COMM_MODE_TCP_EN=y -CONFIG_FMB_TCP_PORT_DEFAULT=502 -CONFIG_FMB_TCP_PORT_MAX_CONN=5 -CONFIG_FMB_TCP_CONNECTION_TOUT_SEC=20 -CONFIG_FMB_COMM_MODE_RTU_EN=y -CONFIG_FMB_COMM_MODE_ASCII_EN=y -CONFIG_FMB_MASTER_TIMEOUT_MS_RESPOND=150 -CONFIG_FMB_MASTER_DELAY_MS_CONVERT=200 -CONFIG_FMB_QUEUE_LENGTH=20 -CONFIG_FMB_PORT_TASK_STACK_SIZE=4096 -CONFIG_FMB_SERIAL_BUF_SIZE=256 -CONFIG_FMB_SERIAL_ASCII_BITS_PER_SYMB=8 -CONFIG_FMB_SERIAL_ASCII_TIMEOUT_RESPOND_MS=1000 -CONFIG_FMB_PORT_TASK_PRIO=10 -# CONFIG_FMB_PORT_TASK_AFFINITY_NO_AFFINITY is not set -CONFIG_FMB_PORT_TASK_AFFINITY_CPU0=y -# CONFIG_FMB_PORT_TASK_AFFINITY_CPU1 is not set -CONFIG_FMB_PORT_TASK_AFFINITY=0x0 -CONFIG_FMB_CONTROLLER_SLAVE_ID_SUPPORT=y -CONFIG_FMB_CONTROLLER_SLAVE_ID=0x00112233 -CONFIG_FMB_CONTROLLER_NOTIFY_TIMEOUT=20 -CONFIG_FMB_CONTROLLER_NOTIFY_QUEUE_SIZE=20 -CONFIG_FMB_CONTROLLER_STACK_SIZE=4096 -CONFIG_FMB_EVENT_QUEUE_TIMEOUT=20 -CONFIG_FMB_TIMER_PORT_ENABLED=y -CONFIG_FMB_TIMER_GROUP=0 -CONFIG_FMB_TIMER_INDEX=0 -CONFIG_FMB_MASTER_TIMER_GROUP=0 -CONFIG_FMB_MASTER_TIMER_INDEX=0 -# CONFIG_FMB_TIMER_ISR_IN_IRAM is not set -# end of Modbus configuration +# FreeRTOS +# # -# FreeRTOS +# Kernel # +# CONFIG_FREERTOS_SMP is not set # CONFIG_FREERTOS_UNICORE is not set -CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF -CONFIG_FREERTOS_CORETIMER_0=y -# CONFIG_FREERTOS_CORETIMER_1 is not set CONFIG_FREERTOS_HZ=1000 -CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION=y # CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE is not set # CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL is not set CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY=y -# CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK is not set -CONFIG_FREERTOS_INTERRUPT_BACKTRACE=y CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 -# CONFIG_FREERTOS_ASSERT_FAIL_ABORT is not set -# CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE is not set -CONFIG_FREERTOS_ASSERT_DISABLE=y CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=768 -CONFIG_FREERTOS_ISR_STACKSIZE=1536 -# CONFIG_FREERTOS_LEGACY_HOOKS is not set +# CONFIG_FREERTOS_USE_IDLE_HOOK is not set +# CONFIG_FREERTOS_USE_TICK_HOOK is not set CONFIG_FREERTOS_MAX_TASK_NAME_LEN=10 -CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y -# CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP is not set +CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY=y CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=1536 CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=5 CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 +CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=1 # CONFIG_FREERTOS_USE_TRACE_FACILITY is not set # CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set +# end of Kernel + +# +# Port +# +# CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK is not set +CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS=y +# CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP is not set CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y -# CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set +CONFIG_FREERTOS_ISR_STACKSIZE=1536 +CONFIG_FREERTOS_INTERRUPT_BACKTRACE=y +# CONFIG_FREERTOS_FPU_IN_ISR is not set +CONFIG_FREERTOS_TICK_SUPPORT_CORETIMER=y +CONFIG_FREERTOS_CORETIMER_0=y +# CONFIG_FREERTOS_CORETIMER_1 is not set +CONFIG_FREERTOS_SYSTICK_USES_CCOUNT=y CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y +# CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH is not set +# CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set +CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT=y +# end of Port + +CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF +CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y CONFIG_FREERTOS_DEBUG_OCDAWARE=y -# CONFIG_FREERTOS_FPU_IN_ISR is not set # end of FreeRTOS +# +# Hardware Abstraction Layer (HAL) and Low Level (LL) +# +CONFIG_HAL_ASSERTION_EQUALS_SYSTEM=y +# CONFIG_HAL_ASSERTION_DISABLE is not set +# CONFIG_HAL_ASSERTION_SILENT is not set +# CONFIG_HAL_ASSERTION_ENABLE is not set +CONFIG_HAL_DEFAULT_ASSERTION_LEVEL=2 +CONFIG_HAL_SPI_MASTER_FUNC_IN_IRAM=y +# end of Hardware Abstraction Layer (HAL) and Low Level (LL) + # # Heap memory debugging # @@ -685,20 +1100,13 @@ CONFIG_HEAP_POISONING_DISABLED=y CONFIG_HEAP_TRACING_OFF=y # CONFIG_HEAP_TRACING_STANDALONE is not set # CONFIG_HEAP_TRACING_TOHOST is not set +# CONFIG_HEAP_USE_HOOKS is not set # CONFIG_HEAP_ABORT_WHEN_ALLOCATION_FAILS is not set +# CONFIG_HEAP_PLACE_FUNCTION_INTO_FLASH is not set # end of Heap memory debugging -# -# jsmn -# -# CONFIG_JSMN_PARENT_LINKS is not set -# CONFIG_JSMN_STRICT is not set -# end of jsmn - -# -# libsodium -# -# end of libsodium +CONFIG_IEEE802154_CCA_THRESHOLD=-60 +CONFIG_IEEE802154_PENDING_TABLE_SIZE=20 # # Log output @@ -710,6 +1118,10 @@ CONFIG_LOG_DEFAULT_LEVEL_INFO=y # CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set # CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set CONFIG_LOG_DEFAULT_LEVEL=3 +CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y +# CONFIG_LOG_MAXIMUM_LEVEL_DEBUG is not set +# CONFIG_LOG_MAXIMUM_LEVEL_VERBOSE is not set +CONFIG_LOG_MAXIMUM_LEVEL=3 CONFIG_LOG_COLORS=y CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y # CONFIG_LOG_TIMESTAMP_SOURCE_SYSTEM is not set @@ -719,6 +1131,9 @@ CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif" +# CONFIG_LWIP_NETIF_API is not set +# CONFIG_LWIP_TCPIP_CORE_LOCKING is not set +# CONFIG_LWIP_CHECK_THREAD_SAFETY is not set CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y # CONFIG_LWIP_L2_TO_L3_COPY is not set # CONFIG_LWIP_IRAM_OPTIMIZATION is not set @@ -734,15 +1149,20 @@ CONFIG_LWIP_IP4_FRAG=y CONFIG_LWIP_IP6_FRAG=y # CONFIG_LWIP_IP4_REASSEMBLY is not set # CONFIG_LWIP_IP6_REASSEMBLY is not set +CONFIG_LWIP_IP_REASS_MAX_PBUFS=10 # CONFIG_LWIP_IP_FORWARD is not set # CONFIG_LWIP_STATS is not set -# CONFIG_LWIP_ETHARP_TRUST_IP_MAC is not set CONFIG_LWIP_ESP_GRATUITOUS_ARP=y CONFIG_LWIP_GARP_TMR_INTERVAL=60 +CONFIG_LWIP_ESP_MLDV6_REPORT=y +CONFIG_LWIP_MLDV6_TMR_INTERVAL=40 CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32 CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y # CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set +CONFIG_LWIP_DHCP_DISABLE_VENDOR_CLASS_ID=y # CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set +CONFIG_LWIP_DHCP_OPTIONS_LEN=68 +CONFIG_LWIP_NUM_NETIF_CLIENT_DATA=0 CONFIG_LWIP_DHCP_COARSE_TIMER_SECS=1 # @@ -754,8 +1174,12 @@ CONFIG_LWIP_DHCPS_MAX_STATION_NUM=8 # end of DHCP server # CONFIG_LWIP_AUTOIP is not set +CONFIG_LWIP_IPV4=y CONFIG_LWIP_IPV6=y # CONFIG_LWIP_IPV6_AUTOCONFIG is not set +CONFIG_LWIP_IPV6_NUM_ADDRESSES=3 +# CONFIG_LWIP_IPV6_FORWARD is not set +# CONFIG_LWIP_NETIF_STATUS_CALLBACK is not set CONFIG_LWIP_NETIF_LOOPBACK=y CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 @@ -776,7 +1200,6 @@ CONFIG_LWIP_TCP_WND_DEFAULT=11680 CONFIG_LWIP_TCP_RECVMBOX_SIZE=10 CONFIG_LWIP_TCP_QUEUE_OOSEQ=y CONFIG_LWIP_TCP_SACK_OUT=y -# CONFIG_LWIP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set CONFIG_LWIP_TCP_OVERSIZE_MSS=y # CONFIG_LWIP_TCP_OVERSIZE_QUARTER_MSS is not set # CONFIG_LWIP_TCP_OVERSIZE_DISABLE is not set @@ -825,10 +1248,12 @@ CONFIG_LWIP_MAX_RAW_PCBS=16 # # SNTP # -CONFIG_LWIP_DHCP_MAX_NTP_SERVERS=1 +CONFIG_LWIP_SNTP_MAX_SERVERS=1 +# CONFIG_LWIP_DHCP_GET_NTP_SRV is not set CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000 # end of SNTP +CONFIG_LWIP_BRIDGEIF_MAX_PORTS=7 CONFIG_LWIP_ESP_LWIP_ASSERT=y # @@ -840,9 +1265,18 @@ CONFIG_LWIP_HOOK_TCP_ISN_DEFAULT=y CONFIG_LWIP_HOOK_IP6_ROUTE_NONE=y # CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT is not set # CONFIG_LWIP_HOOK_IP6_ROUTE_CUSTOM is not set +CONFIG_LWIP_HOOK_ND6_GET_GW_NONE=y +# CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT is not set +# CONFIG_LWIP_HOOK_ND6_GET_GW_CUSTOM is not set +CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_NONE=y +# CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_DEFAULT is not set +# CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_CUSTOM is not set CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_NONE=y # CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_DEFAULT is not set # CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_CUSTOM is not set +CONFIG_LWIP_HOOK_IP6_INPUT_NONE=y +# CONFIG_LWIP_HOOK_IP6_INPUT_DEFAULT is not set +# CONFIG_LWIP_HOOK_IP6_INPUT_CUSTOM is not set # end of Hooks # CONFIG_LWIP_DEBUG is not set @@ -861,13 +1295,15 @@ CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096 # CONFIG_MBEDTLS_DEBUG is not set # -# mbedTLS v2.28.x related +# mbedTLS v3.x related # +# CONFIG_MBEDTLS_SSL_PROTO_TLS1_3 is not set # CONFIG_MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH is not set # CONFIG_MBEDTLS_X509_TRUSTED_CERT_CALLBACK is not set # CONFIG_MBEDTLS_SSL_CONTEXT_SERIALIZATION is not set CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE=y -# end of mbedTLS v2.28.x related +CONFIG_MBEDTLS_PKCS7_C=y +# end of mbedTLS v3.x related # # Certificate Bundle @@ -884,6 +1320,7 @@ CONFIG_MBEDTLS_ROM_MD5=y # CONFIG_MBEDTLS_ATCA_HW_ECDSA_SIGN is not set # CONFIG_MBEDTLS_ATCA_HW_ECDSA_VERIFY is not set CONFIG_MBEDTLS_HAVE_TIME=y +# CONFIG_MBEDTLS_PLATFORM_TIME_ALT is not set # CONFIG_MBEDTLS_HAVE_TIME_DATE is not set CONFIG_MBEDTLS_ECDSA_DETERMINISTIC=y CONFIG_MBEDTLS_SHA512_C=y @@ -900,7 +1337,6 @@ CONFIG_MBEDTLS_TLS_ENABLED=y # # CONFIG_MBEDTLS_PSK_MODES is not set CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA=y CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE=y CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA=y CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA=y @@ -909,15 +1345,11 @@ CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA=y # end of TLS Key Exchange Methods CONFIG_MBEDTLS_SSL_RENEGOTIATION=y -# CONFIG_MBEDTLS_SSL_PROTO_SSL3 is not set -CONFIG_MBEDTLS_SSL_PROTO_TLS1=y -CONFIG_MBEDTLS_SSL_PROTO_TLS1_1=y CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y +# CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set # CONFIG_MBEDTLS_SSL_PROTO_DTLS is not set CONFIG_MBEDTLS_SSL_ALPN=y CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS=y -CONFIG_MBEDTLS_X509_CHECK_KEY_USAGE=y -CONFIG_MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE=y CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS=y # @@ -926,9 +1358,6 @@ CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS=y CONFIG_MBEDTLS_AES_C=y # CONFIG_MBEDTLS_CAMELLIA_C is not set # CONFIG_MBEDTLS_DES_C is not set -CONFIG_MBEDTLS_RC4_DISABLED=y -# CONFIG_MBEDTLS_RC4_ENABLED_NO_DEFAULT is not set -# CONFIG_MBEDTLS_RC4_ENABLED is not set # CONFIG_MBEDTLS_BLOWFISH_C is not set # CONFIG_MBEDTLS_XTEA_C is not set CONFIG_MBEDTLS_CCM_C=y @@ -948,6 +1377,7 @@ CONFIG_MBEDTLS_X509_CSR_PARSE_C=y # end of Certificates CONFIG_MBEDTLS_ECP_C=y +# CONFIG_MBEDTLS_DHM_C is not set CONFIG_MBEDTLS_ECDH_C=y CONFIG_MBEDTLS_ECDSA_C=y # CONFIG_MBEDTLS_ECJPAKE_C is not set @@ -972,25 +1402,11 @@ CONFIG_MBEDTLS_ECP_NIST_OPTIM=y # CONFIG_MBEDTLS_SECURITY_RISKS is not set # end of mbedTLS -# -# mDNS -# -CONFIG_MDNS_MAX_SERVICES=10 -CONFIG_MDNS_TASK_PRIORITY=1 -CONFIG_MDNS_TASK_STACK_SIZE=2816 -CONFIG_MDNS_TASK_AFFINITY_NO_AFFINITY=y -# CONFIG_MDNS_TASK_AFFINITY_CPU0 is not set -# CONFIG_MDNS_TASK_AFFINITY_CPU1 is not set -CONFIG_MDNS_TASK_AFFINITY=0x7FFFFFFF -CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS=2000 -# CONFIG_MDNS_STRICT_MODE is not set -CONFIG_MDNS_TIMER_PERIOD_MS=100 -# end of mDNS - # # ESP-MQTT Configurations # CONFIG_MQTT_PROTOCOL_311=y +# CONFIG_MQTT_PROTOCOL_5 is not set CONFIG_MQTT_TRANSPORT_SSL=y CONFIG_MQTT_TRANSPORT_WEBSOCKET=y CONFIG_MQTT_TRANSPORT_WEBSOCKET_SECURE=y @@ -1012,21 +1428,42 @@ CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF=y # CONFIG_NEWLIB_STDIN_LINE_ENDING_LF is not set CONFIG_NEWLIB_STDIN_LINE_ENDING_CR=y # CONFIG_NEWLIB_NANO_FORMAT is not set +CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC_HRT=y +# CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC is not set +# CONFIG_NEWLIB_TIME_SYSCALL_USE_HRT is not set +# CONFIG_NEWLIB_TIME_SYSCALL_USE_NONE is not set # end of Newlib # # NVS # +# CONFIG_NVS_ASSERT_ERROR_CHECK is not set # end of NVS # -# OpenSSL +# OpenThread +# +# CONFIG_OPENTHREAD_ENABLED is not set + +# +# Thread Operational Dataset +# +CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread-ESP" +CONFIG_OPENTHREAD_NETWORK_CHANNEL=15 +CONFIG_OPENTHREAD_NETWORK_PANID=0x1234 +CONFIG_OPENTHREAD_NETWORK_EXTPANID="dead00beef00cafe" +CONFIG_OPENTHREAD_NETWORK_MASTERKEY="00112233445566778899aabbccddeeff" +CONFIG_OPENTHREAD_NETWORK_PSKC="104810e2315100afd6bc9215a6bfac53" +# end of Thread Operational Dataset +# end of OpenThread + +# +# Protocomm # -# CONFIG_OPENSSL_DEBUG is not set -CONFIG_OPENSSL_ERROR_STACK=y -# CONFIG_OPENSSL_ASSERT_DO_NOTHING is not set -CONFIG_OPENSSL_ASSERT_EXIT=y -# end of OpenSSL +CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_0=y +CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_1=y +CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_2=y +# end of Protocomm # # PThreads @@ -1041,6 +1478,14 @@ CONFIG_PTHREAD_TASK_CORE_DEFAULT=-1 CONFIG_PTHREAD_TASK_NAME_DEFAULT="pthread" # end of PThreads +# +# MMU Config +# +CONFIG_MMU_PAGE_SIZE_64KB=y +CONFIG_MMU_PAGE_MODE="64KB" +CONFIG_MMU_PAGE_SIZE=0x10000 +# end of MMU Config + # # SPI Flash driver # @@ -1050,7 +1495,6 @@ CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS=y # CONFIG_SPI_FLASH_DANGEROUS_WRITE_FAILS is not set # CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED is not set -# CONFIG_SPI_FLASH_USE_LEGACY_IMPL is not set # CONFIG_SPI_FLASH_SHARE_SPI1_BUS is not set # CONFIG_SPI_FLASH_BYPASS_BLOCK_ERASE is not set CONFIG_SPI_FLASH_YIELD_DURING_ERASE=y @@ -1059,10 +1503,23 @@ CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=1 CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=8192 # CONFIG_SPI_FLASH_SIZE_OVERRIDE is not set # CONFIG_SPI_FLASH_CHECK_ERASE_TIMEOUT_DISABLED is not set +# CONFIG_SPI_FLASH_OVERRIDE_CHIP_DRIVER_LIST is not set + +# +# SPI Flash behavior when brownout +# +CONFIG_SPI_FLASH_BROWNOUT_RESET_XMC=y +CONFIG_SPI_FLASH_BROWNOUT_RESET=y +# end of SPI Flash behavior when brownout # # Auto-detect flash chips # +CONFIG_SPI_FLASH_VENDOR_XMC_SUPPORTED=y +CONFIG_SPI_FLASH_VENDOR_GD_SUPPORTED=y +CONFIG_SPI_FLASH_VENDOR_ISSI_SUPPORTED=y +CONFIG_SPI_FLASH_VENDOR_MXIC_SUPPORTED=y +CONFIG_SPI_FLASH_VENDOR_WINBOND_SUPPORTED=y CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP=y CONFIG_SPI_FLASH_SUPPORT_MXIC_CHIP=y CONFIG_SPI_FLASH_SUPPORT_GD_CHIP=y @@ -1119,25 +1576,33 @@ CONFIG_SPIFFS_USE_MTIME=y # CONFIG_WS_TRANSPORT=y CONFIG_WS_BUFFER_SIZE=1024 +# CONFIG_WS_DYNAMIC_BUFFER is not set # end of Websocket # end of TCP Transport # -# TinyUSB +# Ultra Low Power (ULP) Co-processor # -# end of TinyUSB +# CONFIG_ULP_COPROC_ENABLED is not set +# end of Ultra Low Power (ULP) Co-processor # # Unity unit testing library # CONFIG_UNITY_ENABLE_FLOAT=y CONFIG_UNITY_ENABLE_DOUBLE=y +# CONFIG_UNITY_ENABLE_64BIT is not set # CONFIG_UNITY_ENABLE_COLOR is not set CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=y # CONFIG_UNITY_ENABLE_FIXTURE is not set # CONFIG_UNITY_ENABLE_BACKTRACE_ON_FAIL is not set # end of Unity unit testing library +# +# Root Hub configuration +# +# end of Root Hub configuration + # # Virtual file system # @@ -1146,12 +1611,12 @@ CONFIG_VFS_SUPPORT_DIR=y CONFIG_VFS_SUPPORT_SELECT=y CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT=y CONFIG_VFS_SUPPORT_TERMIOS=y +CONFIG_VFS_MAX_COUNT=8 # # Host File System I/O (Semihosting) # CONFIG_VFS_SEMIHOSTFS_MAX_MOUNT_POINTS=1 -CONFIG_VFS_SEMIHOSTFS_HOST_PATH_MAX_LEN=128 # end of Host File System I/O (Semihosting) # end of Virtual file system @@ -1168,23 +1633,26 @@ CONFIG_WL_SECTOR_SIZE=4096 # CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16 CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT=30 +# CONFIG_WIFI_PROV_BLE_FORCE_ENCRYPTION is not set +CONFIG_WIFI_PROV_STA_ALL_CHANNEL_SCAN=y +# CONFIG_WIFI_PROV_STA_FAST_SCAN is not set # end of Wi-Fi Provisioning Manager # -# Supplicant +# WebSocket Server # -CONFIG_WPA_MBEDTLS_CRYPTO=y -# CONFIG_WPA_WAPI_PSK is not set -# CONFIG_WPA_DEBUG_PRINT is not set -# CONFIG_WPA_TESTING_OPTIONS is not set -# CONFIG_WPA_WPS_STRICT is not set -# CONFIG_WPA_11KV_SUPPORT is not set -# CONFIG_WPA_DPP_SUPPORT is not set -# end of Supplicant +CONFIG_WEBSOCKET_SERVER_MAX_CLIENTS=1 +CONFIG_WEBSOCKET_SERVER_QUEUE_SIZE=2 +CONFIG_WEBSOCKET_SERVER_QUEUE_TIMEOUT=30 +CONFIG_WEBSOCKET_SERVER_TASK_STACK_DEPTH=3000 +CONFIG_WEBSOCKET_SERVER_TASK_PRIORITY=5 +# CONFIG_WEBSOCKET_SERVER_PINNED is not set +# end of WebSocket Server # # DSP Library # +CONFIG_DSP_OPTIMIZATIONS_SUPPORTED=y # CONFIG_DSP_ANSI is not set CONFIG_DSP_OPTIMIZED=y CONFIG_DSP_OPTIMIZATION=1 @@ -1199,32 +1667,51 @@ CONFIG_DSP_MAX_FFT_SIZE=4096 # end of DSP Library # -# WebSocket Server +# mDNS # -CONFIG_WEBSOCKET_SERVER_MAX_CLIENTS=1 -CONFIG_WEBSOCKET_SERVER_QUEUE_SIZE=2 -CONFIG_WEBSOCKET_SERVER_QUEUE_TIMEOUT=30 -CONFIG_WEBSOCKET_SERVER_TASK_STACK_DEPTH=3000 -CONFIG_WEBSOCKET_SERVER_TASK_PRIORITY=5 -# CONFIG_WEBSOCKET_SERVER_PINNED is not set -# end of WebSocket Server -# end of Component config +CONFIG_MDNS_MAX_INTERFACES=3 +CONFIG_MDNS_MAX_SERVICES=10 +CONFIG_MDNS_TASK_PRIORITY=1 +CONFIG_MDNS_ACTION_QUEUE_LEN=16 +CONFIG_MDNS_TASK_STACK_SIZE=2816 +CONFIG_MDNS_TASK_AFFINITY_NO_AFFINITY=y +# CONFIG_MDNS_TASK_AFFINITY_CPU0 is not set +# CONFIG_MDNS_TASK_AFFINITY_CPU1 is not set +CONFIG_MDNS_TASK_AFFINITY=0x7FFFFFFF +CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS=2000 +CONFIG_MDNS_TIMER_PERIOD_MS=100 +# CONFIG_MDNS_NETWORKING_SOCKET is not set +# CONFIG_MDNS_SKIP_SUPPRESSING_OWN_QUERIES is not set +# CONFIG_MDNS_ENABLE_DEBUG_PRINTS is not set +CONFIG_MDNS_ENABLE_CONSOLE_CLI=y +# CONFIG_MDNS_RESPOND_REVERSE_QUERIES is not set +CONFIG_MDNS_MULTIPLE_INSTANCE=y # -# Compatibility options +# MDNS Predefined interfaces # -# CONFIG_LEGACY_INCLUDE_COMMON_HEADERS is not set -# end of Compatibility options +CONFIG_MDNS_PREDEF_NETIF_STA=y +CONFIG_MDNS_PREDEF_NETIF_AP=y +CONFIG_MDNS_PREDEF_NETIF_ETH=y +# end of MDNS Predefined interfaces +# end of mDNS +# end of Component config + +# CONFIG_IDF_EXPERIMENTAL_FEATURES is not set # Deprecated options for backward compatibility -CONFIG_TOOLPREFIX="xtensa-esp32-elf-" +# CONFIG_APP_BUILD_TYPE_ELF_RAM is not set +# CONFIG_NO_BLOBS is not set +# CONFIG_ESP32_NO_BLOBS is not set +# CONFIG_ESP32_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set +# CONFIG_ESP32_COMPATIBLE_PRE_V3_1_BOOTLOADERS is not set # CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set +CONFIG_LOG_BOOTLOADER_LEVEL_ERROR=y # CONFIG_LOG_BOOTLOADER_LEVEL_WARN is not set -CONFIG_LOG_BOOTLOADER_LEVEL_INFO=y +# CONFIG_LOG_BOOTLOADER_LEVEL_INFO is not set # CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set # CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set -CONFIG_LOG_BOOTLOADER_LEVEL=3 +CONFIG_LOG_BOOTLOADER_LEVEL=1 CONFIG_APP_ROLLBACK_ENABLE=y # CONFIG_APP_ANTI_ROLLBACK is not set # CONFIG_FLASH_ENCRYPTION_ENABLED is not set @@ -1232,62 +1719,71 @@ CONFIG_FLASHMODE_QIO=y # CONFIG_FLASHMODE_QOUT is not set # CONFIG_FLASHMODE_DIO is not set # CONFIG_FLASHMODE_DOUT is not set -# CONFIG_MONITOR_BAUD_9600B is not set -# CONFIG_MONITOR_BAUD_57600B is not set -CONFIG_MONITOR_BAUD_115200B=y -# CONFIG_MONITOR_BAUD_230400B is not set -# CONFIG_MONITOR_BAUD_921600B is not set -# CONFIG_MONITOR_BAUD_2MB is not set -# CONFIG_MONITOR_BAUD_OTHER is not set -CONFIG_MONITOR_BAUD_OTHER_VAL=115200 CONFIG_MONITOR_BAUD=115200 +# CONFIG_OPTIMIZATION_LEVEL_DEBUG is not set # CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG is not set +# CONFIG_OPTIMIZATION_LEVEL_RELEASE is not set # CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE is not set CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED=y # CONFIG_OPTIMIZATION_ASSERTIONS_SILENT is not set # CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED is not set +CONFIG_OPTIMIZATION_ASSERTION_LEVEL=2 # CONFIG_CXX_EXCEPTIONS is not set CONFIG_STACK_CHECK_NONE=y # CONFIG_STACK_CHECK_NORM is not set # CONFIG_STACK_CHECK_STRONG is not set # CONFIG_STACK_CHECK_ALL is not set # CONFIG_WARN_WRITE_STRINGS is not set -# CONFIG_DISABLE_GCC8_WARNINGS is not set # CONFIG_ESP32_APPTRACE_DEST_TRAX is not set CONFIG_ESP32_APPTRACE_DEST_NONE=y CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y CONFIG_ADC2_DISABLE_DAC=y -# CONFIG_SPIRAM_SUPPORT is not set -CONFIG_TRACEMEM_RESERVE_DRAM=0x0 +# CONFIG_MCPWM_ISR_IN_IRAM is not set +# CONFIG_EVENT_LOOP_PROFILING is not set +CONFIG_POST_EVENTS_FROM_ISR=y +# CONFIG_POST_EVENTS_FROM_IRAM_ISR is not set +# CONFIG_OTA_ALLOW_HTTP is not set # CONFIG_TWO_UNIVERSAL_MAC_ADDRESS is not set CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4 -# CONFIG_ULP_COPROC_ENABLED is not set -CONFIG_ULP_COPROC_RESERVE_MEM=0 -CONFIG_BROWNOUT_DET=y -# CONFIG_BROWNOUT_DET_LVL_SEL_0 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_1 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_2 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_3 is not set -CONFIG_BROWNOUT_DET_LVL_SEL_4=y -# CONFIG_BROWNOUT_DET_LVL_SEL_5 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_6 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_7 is not set -CONFIG_BROWNOUT_DET_LVL=4 -CONFIG_REDUCE_PHY_TX_POWER=y +CONFIG_ESP_SYSTEM_PD_FLASH=y +CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY=2000 +CONFIG_ESP32_RTC_CLK_SRC_INT_RC=y CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC=y +# CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS is not set # CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL is not set +# CONFIG_ESP32_RTC_CLK_SRC_EXT_OSC is not set # CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_OSC is not set +# CONFIG_ESP32_RTC_CLK_SRC_INT_8MD256 is not set # CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_8MD256 is not set -# CONFIG_DISABLE_BASIC_ROM_CONSOLE is not set -# CONFIG_NO_BLOBS is not set -# CONFIG_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set +CONFIG_ESP32_RTC_CLK_CAL_CYCLES=1024 +# CONFIG_ESP32_XTAL_FREQ_26 is not set +CONFIG_ESP32_XTAL_FREQ_40=y +# CONFIG_ESP32_XTAL_FREQ_AUTO is not set +CONFIG_ESP32_XTAL_FREQ=40 +CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y +# CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set +CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20 +CONFIG_ESP32_PHY_MAX_TX_POWER=20 +CONFIG_REDUCE_PHY_TX_POWER=y +CONFIG_ESP32_REDUCE_PHY_TX_POWER=y +# CONFIG_SPIRAM_SUPPORT is not set +# CONFIG_ESP32_SPIRAM_SUPPORT is not set +# CONFIG_ESP32_DEFAULT_CPU_FREQ_80 is not set +# CONFIG_ESP32_DEFAULT_CPU_FREQ_160 is not set +CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y +CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240 +CONFIG_TRACEMEM_RESERVE_DRAM=0x0 +# CONFIG_ESP32_PANIC_PRINT_HALT is not set +CONFIG_ESP32_PANIC_PRINT_REBOOT=y +# CONFIG_ESP32_PANIC_SILENT_REBOOT is not set +# CONFIG_ESP32_PANIC_GDBSTUB is not set CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32 CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=2304 -CONFIG_MAIN_TASK_STACK_SIZE=2560 -CONFIG_IPC_TASK_STACK_SIZE=1024 +CONFIG_MAIN_TASK_STACK_SIZE=3072 CONFIG_CONSOLE_UART_DEFAULT=y # CONFIG_CONSOLE_UART_CUSTOM is not set +# CONFIG_CONSOLE_UART_NONE is not set # CONFIG_ESP_CONSOLE_UART_NONE is not set CONFIG_CONSOLE_UART=y CONFIG_CONSOLE_UART_NUM=0 @@ -1296,42 +1792,80 @@ CONFIG_INT_WDT=y CONFIG_INT_WDT_TIMEOUT_MS=300 CONFIG_INT_WDT_CHECK_CPU1=y CONFIG_TASK_WDT=y +CONFIG_ESP_TASK_WDT=y # CONFIG_TASK_WDT_PANIC is not set CONFIG_TASK_WDT_TIMEOUT_S=5 CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1=y -# CONFIG_EVENT_LOOP_PROFILING is not set -CONFIG_POST_EVENTS_FROM_ISR=y -# CONFIG_POST_EVENTS_FROM_IRAM_ISR is not set -# CONFIG_ESP32S2_PANIC_PRINT_HALT is not set -CONFIG_ESP32S2_PANIC_PRINT_REBOOT=y -# CONFIG_ESP32S2_PANIC_SILENT_REBOOT is not set -# CONFIG_ESP32S2_PANIC_GDBSTUB is not set +# CONFIG_ESP32_DEBUG_STUBS_ENABLE is not set +CONFIG_ESP32_DEBUG_OCDAWARE=y +CONFIG_BROWNOUT_DET=y +CONFIG_ESP32_BROWNOUT_DET=y +# CONFIG_BROWNOUT_DET_LVL_SEL_0 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_0 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_1 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_1 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_2 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_2 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_3 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_3 is not set +CONFIG_BROWNOUT_DET_LVL_SEL_4=y +CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_4=y +# CONFIG_BROWNOUT_DET_LVL_SEL_5 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_5 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_6 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_6 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_7 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_7 is not set +CONFIG_BROWNOUT_DET_LVL=4 +CONFIG_ESP32_BROWNOUT_DET_LVL=4 +# CONFIG_DISABLE_BASIC_ROM_CONSOLE is not set +CONFIG_IPC_TASK_STACK_SIZE=1024 CONFIG_TIMER_TASK_STACK_SIZE=2048 +CONFIG_ESP32_WIFI_ENABLED=y +CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=8 +CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=64 +CONFIG_ESP32_WIFI_STATIC_TX_BUFFER=y +# CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER is not set +CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=0 +CONFIG_ESP32_WIFI_STATIC_TX_BUFFER_NUM=8 +# CONFIG_ESP32_WIFI_CSI_ENABLED is not set +CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y +CONFIG_ESP32_WIFI_TX_BA_WIN=8 +CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y +CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y +CONFIG_ESP32_WIFI_RX_BA_WIN=16 +CONFIG_ESP32_WIFI_RX_BA_WIN=16 +CONFIG_ESP32_WIFI_NVS_ENABLED=y +CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y +# CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1 is not set +CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752 +CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32 +# CONFIG_ESP32_WIFI_IRAM_OPT is not set +CONFIG_ESP32_WIFI_RX_IRAM_OPT=y +CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=y +CONFIG_ESP32_WIFI_ENABLE_WPA3_OWE_STA=y +CONFIG_WPA_MBEDTLS_CRYPTO=y +CONFIG_WPA_MBEDTLS_TLS_CLIENT=y +# CONFIG_WPA_WAPI_PSK is not set +# CONFIG_WPA_SUITE_B_192 is not set +# CONFIG_WPA_11KV_SUPPORT is not set +# CONFIG_WPA_MBO_SUPPORT is not set +# CONFIG_WPA_DPP_SUPPORT is not set +# CONFIG_WPA_11R_SUPPORT is not set +# CONFIG_WPA_WPS_SOFTAP_REGISTRAR is not set +# CONFIG_WPA_WPS_STRICT is not set +# CONFIG_WPA_DEBUG_PRINT is not set +# CONFIG_WPA_TESTING_OPTIONS is not set # CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set # CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y -CONFIG_MB_MASTER_TIMEOUT_MS_RESPOND=150 -CONFIG_MB_MASTER_DELAY_MS_CONVERT=200 -CONFIG_MB_QUEUE_LENGTH=20 -CONFIG_MB_SERIAL_TASK_STACK_SIZE=4096 -CONFIG_MB_SERIAL_BUF_SIZE=256 -CONFIG_MB_SERIAL_TASK_PRIO=10 -CONFIG_MB_CONTROLLER_SLAVE_ID_SUPPORT=y -CONFIG_MB_CONTROLLER_SLAVE_ID=0x00112233 -CONFIG_MB_CONTROLLER_NOTIFY_TIMEOUT=20 -CONFIG_MB_CONTROLLER_NOTIFY_QUEUE_SIZE=20 -CONFIG_MB_CONTROLLER_STACK_SIZE=4096 -CONFIG_MB_EVENT_QUEUE_TIMEOUT=20 -CONFIG_MB_TIMER_PORT_ENABLED=y -CONFIG_MB_TIMER_GROUP=0 -CONFIG_MB_TIMER_INDEX=0 -# CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK is not set CONFIG_TIMER_TASK_PRIORITY=1 CONFIG_TIMER_TASK_STACK_DEPTH=1536 CONFIG_TIMER_QUEUE_LENGTH=5 +# CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK is not set +# CONFIG_HAL_ASSERTION_SILIENT is not set # CONFIG_L2_TO_L3_COPY is not set -# CONFIG_USE_ONLY_LWIP_SELECT is not set CONFIG_ESP_GRATUITOUS_ARP=y CONFIG_GARP_TMR_INTERVAL=60 CONFIG_TCPIP_RECVMBOX_SIZE=32 @@ -1343,7 +1877,6 @@ CONFIG_TCP_SND_BUF_DEFAULT=11680 CONFIG_TCP_WND_DEFAULT=11680 CONFIG_TCP_RECVMBOX_SIZE=10 CONFIG_TCP_QUEUE_OOSEQ=y -# CONFIG_ESP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set CONFIG_TCP_OVERSIZE_MSS=y # CONFIG_TCP_OVERSIZE_QUARTER_MSS is not set # CONFIG_TCP_OVERSIZE_DISABLE is not set @@ -1354,6 +1887,12 @@ CONFIG_TCPIP_TASK_AFFINITY_CPU0=y # CONFIG_TCPIP_TASK_AFFINITY_CPU1 is not set CONFIG_TCPIP_TASK_AFFINITY=0x0 # CONFIG_PPP_SUPPORT is not set +CONFIG_ESP32_TIME_SYSCALL_USE_RTC_HRT=y +CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1=y +# CONFIG_ESP32_TIME_SYSCALL_USE_RTC is not set +# CONFIG_ESP32_TIME_SYSCALL_USE_HRT is not set +# CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 is not set +# CONFIG_ESP32_TIME_SYSCALL_USE_NONE is not set CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT=5 CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072 CONFIG_ESP32_PTHREAD_STACK_MIN=768 @@ -1365,8 +1904,8 @@ CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT="pthread" CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS=y # CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS is not set # CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED is not set +# CONFIG_ESP32_ULP_COPROC_ENABLED is not set CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT=y CONFIG_SUPPORT_TERMIOS=y CONFIG_SEMIHOSTFS_MAX_MOUNT_POINTS=1 -CONFIG_SEMIHOSTFS_HOST_PATH_MAX_LEN=128 # End of deprecated options diff --git a/sdkconfig.old b/sdkconfig.old index 2d1a612b..9dd97b27 100644 --- a/sdkconfig.old +++ b/sdkconfig.old @@ -1,40 +1,237 @@ # # Automatically generated file. DO NOT EDIT. -# Espressif IoT Development Framework (ESP-IDF) Project Configuration -# +# Espressif IoT Development Framework (ESP-IDF) 5.1.1 Project Configuration +# +CONFIG_SOC_BROWNOUT_RESET_SUPPORTED="Not determined" +CONFIG_SOC_TWAI_BRP_DIV_SUPPORTED="Not determined" +CONFIG_SOC_DPORT_WORKAROUND="Not determined" +CONFIG_SOC_CAPS_ECO_VER_MAX=301 +CONFIG_SOC_ADC_SUPPORTED=y +CONFIG_SOC_DAC_SUPPORTED=y +CONFIG_SOC_UART_SUPPORTED=y +CONFIG_SOC_MCPWM_SUPPORTED=y +CONFIG_SOC_GPTIMER_SUPPORTED=y +CONFIG_SOC_SDMMC_HOST_SUPPORTED=y +CONFIG_SOC_BT_SUPPORTED=y +CONFIG_SOC_PCNT_SUPPORTED=y +CONFIG_SOC_WIFI_SUPPORTED=y +CONFIG_SOC_SDIO_SLAVE_SUPPORTED=y +CONFIG_SOC_TWAI_SUPPORTED=y +CONFIG_SOC_EMAC_SUPPORTED=y +CONFIG_SOC_ULP_SUPPORTED=y +CONFIG_SOC_CCOMP_TIMER_SUPPORTED=y +CONFIG_SOC_RTC_FAST_MEM_SUPPORTED=y +CONFIG_SOC_RTC_SLOW_MEM_SUPPORTED=y +CONFIG_SOC_RTC_MEM_SUPPORTED=y +CONFIG_SOC_I2S_SUPPORTED=y +CONFIG_SOC_RMT_SUPPORTED=y +CONFIG_SOC_SDM_SUPPORTED=y +CONFIG_SOC_GPSPI_SUPPORTED=y +CONFIG_SOC_LEDC_SUPPORTED=y +CONFIG_SOC_I2C_SUPPORTED=y +CONFIG_SOC_SUPPORT_COEXISTENCE=y +CONFIG_SOC_AES_SUPPORTED=y +CONFIG_SOC_MPI_SUPPORTED=y +CONFIG_SOC_SHA_SUPPORTED=y +CONFIG_SOC_FLASH_ENC_SUPPORTED=y +CONFIG_SOC_SECURE_BOOT_SUPPORTED=y +CONFIG_SOC_TOUCH_SENSOR_SUPPORTED=y +CONFIG_SOC_BOD_SUPPORTED=y +CONFIG_SOC_ULP_FSM_SUPPORTED=y +CONFIG_SOC_DPORT_WORKAROUND_DIS_INTERRUPT_LVL=5 +CONFIG_SOC_XTAL_SUPPORT_26M=y +CONFIG_SOC_XTAL_SUPPORT_40M=y +CONFIG_SOC_XTAL_SUPPORT_AUTO_DETECT=y +CONFIG_SOC_ADC_RTC_CTRL_SUPPORTED=y +CONFIG_SOC_ADC_DIG_CTRL_SUPPORTED=y +CONFIG_SOC_ADC_DMA_SUPPORTED=y +CONFIG_SOC_ADC_PERIPH_NUM=2 +CONFIG_SOC_ADC_MAX_CHANNEL_NUM=10 +CONFIG_SOC_ADC_ATTEN_NUM=4 +CONFIG_SOC_ADC_DIGI_CONTROLLER_NUM=2 +CONFIG_SOC_ADC_PATT_LEN_MAX=16 +CONFIG_SOC_ADC_DIGI_MIN_BITWIDTH=9 +CONFIG_SOC_ADC_DIGI_MAX_BITWIDTH=12 +CONFIG_SOC_ADC_DIGI_RESULT_BYTES=2 +CONFIG_SOC_ADC_DIGI_DATA_BYTES_PER_CONV=4 +CONFIG_SOC_ADC_SAMPLE_FREQ_THRES_HIGH=2 +CONFIG_SOC_ADC_SAMPLE_FREQ_THRES_LOW=20 +CONFIG_SOC_ADC_RTC_MIN_BITWIDTH=9 +CONFIG_SOC_ADC_RTC_MAX_BITWIDTH=12 +CONFIG_SOC_SHARED_IDCACHE_SUPPORTED=y +CONFIG_SOC_IDCACHE_PER_CORE=y +CONFIG_SOC_CPU_CORES_NUM=2 +CONFIG_SOC_CPU_INTR_NUM=32 +CONFIG_SOC_CPU_HAS_FPU=y +CONFIG_SOC_CPU_BREAKPOINTS_NUM=2 +CONFIG_SOC_CPU_WATCHPOINTS_NUM=2 +CONFIG_SOC_CPU_WATCHPOINT_SIZE=64 +CONFIG_SOC_DAC_CHAN_NUM=2 +CONFIG_SOC_DAC_RESOLUTION=8 +CONFIG_SOC_DAC_DMA_16BIT_ALIGN=y +CONFIG_SOC_GPIO_PORT=1 +CONFIG_SOC_GPIO_PIN_COUNT=40 +CONFIG_SOC_GPIO_VALID_GPIO_MASK=0xFFFFFFFFFF +CONFIG_SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK=0xEF0FEA +CONFIG_SOC_I2C_NUM=2 +CONFIG_SOC_I2C_FIFO_LEN=32 +CONFIG_SOC_I2C_CMD_REG_NUM=16 +CONFIG_SOC_I2C_SUPPORT_SLAVE=y +CONFIG_SOC_I2C_SUPPORT_APB=y +CONFIG_SOC_I2S_NUM=2 +CONFIG_SOC_I2S_HW_VERSION_1=y +CONFIG_SOC_I2S_SUPPORTS_APLL=y +CONFIG_SOC_I2S_SUPPORTS_PLL_F160M=y +CONFIG_SOC_I2S_SUPPORTS_PDM=y +CONFIG_SOC_I2S_SUPPORTS_PDM_TX=y +CONFIG_SOC_I2S_PDM_MAX_TX_LINES=1 +CONFIG_SOC_I2S_SUPPORTS_PDM_RX=y +CONFIG_SOC_I2S_PDM_MAX_RX_LINES=1 +CONFIG_SOC_I2S_SUPPORTS_ADC_DAC=y +CONFIG_SOC_I2S_SUPPORTS_ADC=y +CONFIG_SOC_I2S_SUPPORTS_DAC=y +CONFIG_SOC_I2S_SUPPORTS_LCD_CAMERA=y +CONFIG_SOC_I2S_TRANS_SIZE_ALIGN_WORD=y +CONFIG_SOC_I2S_LCD_I80_VARIANT=y +CONFIG_SOC_LCD_I80_SUPPORTED=y +CONFIG_SOC_LCD_I80_BUSES=2 +CONFIG_SOC_LCD_I80_BUS_WIDTH=24 +CONFIG_SOC_LEDC_HAS_TIMER_SPECIFIC_MUX=y +CONFIG_SOC_LEDC_SUPPORT_APB_CLOCK=y +CONFIG_SOC_LEDC_SUPPORT_REF_TICK=y +CONFIG_SOC_LEDC_SUPPORT_HS_MODE=y +CONFIG_SOC_LEDC_CHANNEL_NUM=8 +CONFIG_SOC_LEDC_TIMER_BIT_WIDTH=20 +CONFIG_SOC_MCPWM_GROUPS=2 +CONFIG_SOC_MCPWM_TIMERS_PER_GROUP=3 +CONFIG_SOC_MCPWM_OPERATORS_PER_GROUP=3 +CONFIG_SOC_MCPWM_COMPARATORS_PER_OPERATOR=2 +CONFIG_SOC_MCPWM_GENERATORS_PER_OPERATOR=2 +CONFIG_SOC_MCPWM_TRIGGERS_PER_OPERATOR=2 +CONFIG_SOC_MCPWM_GPIO_FAULTS_PER_GROUP=3 +CONFIG_SOC_MCPWM_CAPTURE_TIMERS_PER_GROUP=y +CONFIG_SOC_MCPWM_CAPTURE_CHANNELS_PER_TIMER=3 +CONFIG_SOC_MCPWM_GPIO_SYNCHROS_PER_GROUP=3 +CONFIG_SOC_MMU_PERIPH_NUM=2 +CONFIG_SOC_MMU_LINEAR_ADDRESS_REGION_NUM=3 +CONFIG_SOC_MPU_MIN_REGION_SIZE=0x20000000 +CONFIG_SOC_MPU_REGIONS_MAX_NUM=8 +CONFIG_SOC_PCNT_GROUPS=1 +CONFIG_SOC_PCNT_UNITS_PER_GROUP=8 +CONFIG_SOC_PCNT_CHANNELS_PER_UNIT=2 +CONFIG_SOC_PCNT_THRES_POINT_PER_UNIT=2 +CONFIG_SOC_RMT_GROUPS=1 +CONFIG_SOC_RMT_TX_CANDIDATES_PER_GROUP=8 +CONFIG_SOC_RMT_RX_CANDIDATES_PER_GROUP=8 +CONFIG_SOC_RMT_CHANNELS_PER_GROUP=8 +CONFIG_SOC_RMT_MEM_WORDS_PER_CHANNEL=64 +CONFIG_SOC_RMT_SUPPORT_REF_TICK=y +CONFIG_SOC_RMT_SUPPORT_APB=y +CONFIG_SOC_RMT_CHANNEL_CLK_INDEPENDENT=y +CONFIG_SOC_RTCIO_PIN_COUNT=18 +CONFIG_SOC_RTCIO_INPUT_OUTPUT_SUPPORTED=y +CONFIG_SOC_RTCIO_HOLD_SUPPORTED=y +CONFIG_SOC_RTCIO_WAKE_SUPPORTED=y +CONFIG_SOC_SDM_GROUPS=1 +CONFIG_SOC_SDM_CHANNELS_PER_GROUP=8 +CONFIG_SOC_SDM_CLK_SUPPORT_APB=y +CONFIG_SOC_SPI_HD_BOTH_INOUT_SUPPORTED=y +CONFIG_SOC_SPI_AS_CS_SUPPORTED=y +CONFIG_SOC_SPI_PERIPH_NUM=3 +CONFIG_SOC_SPI_DMA_CHAN_NUM=2 +CONFIG_SOC_SPI_MAX_CS_NUM=3 +CONFIG_SOC_SPI_SUPPORT_CLK_APB=y +CONFIG_SOC_SPI_MAXIMUM_BUFFER_SIZE=64 +CONFIG_SOC_SPI_MAX_PRE_DIVIDER=8192 +CONFIG_SOC_MEMSPI_SRC_FREQ_80M_SUPPORTED=y +CONFIG_SOC_MEMSPI_SRC_FREQ_40M_SUPPORTED=y +CONFIG_SOC_MEMSPI_SRC_FREQ_26M_SUPPORTED=y +CONFIG_SOC_MEMSPI_SRC_FREQ_20M_SUPPORTED=y +CONFIG_SOC_TIMER_GROUPS=2 +CONFIG_SOC_TIMER_GROUP_TIMERS_PER_GROUP=2 +CONFIG_SOC_TIMER_GROUP_COUNTER_BIT_WIDTH=64 +CONFIG_SOC_TIMER_GROUP_TOTAL_TIMERS=4 +CONFIG_SOC_TIMER_GROUP_SUPPORT_APB=y +CONFIG_SOC_TOUCH_VERSION_1=y +CONFIG_SOC_TOUCH_SENSOR_NUM=10 +CONFIG_SOC_TOUCH_PAD_MEASURE_WAIT_MAX=0xFF +CONFIG_SOC_TWAI_CONTROLLER_NUM=1 +CONFIG_SOC_TWAI_BRP_MIN=2 +CONFIG_SOC_TWAI_CLK_SUPPORT_APB=y +CONFIG_SOC_TWAI_SUPPORT_MULTI_ADDRESS_LAYOUT=y +CONFIG_SOC_UART_NUM=3 +CONFIG_SOC_UART_SUPPORT_APB_CLK=y +CONFIG_SOC_UART_SUPPORT_REF_TICK=y +CONFIG_SOC_UART_FIFO_LEN=128 +CONFIG_SOC_UART_BITRATE_MAX=5000000 +CONFIG_SOC_SPIRAM_SUPPORTED=y +CONFIG_SOC_SPI_MEM_SUPPORT_CONFIG_GPIO_BY_EFUSE=y +CONFIG_SOC_SHA_SUPPORT_PARALLEL_ENG=y +CONFIG_SOC_SHA_SUPPORT_SHA1=y +CONFIG_SOC_SHA_SUPPORT_SHA256=y +CONFIG_SOC_SHA_SUPPORT_SHA384=y +CONFIG_SOC_SHA_SUPPORT_SHA512=y +CONFIG_SOC_RSA_MAX_BIT_LEN=4096 +CONFIG_SOC_AES_SUPPORT_AES_128=y +CONFIG_SOC_AES_SUPPORT_AES_192=y +CONFIG_SOC_AES_SUPPORT_AES_256=y +CONFIG_SOC_SECURE_BOOT_V1=y +CONFIG_SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS=y +CONFIG_SOC_FLASH_ENCRYPTED_XTS_AES_BLOCK_MAX=32 +CONFIG_SOC_PHY_DIG_REGS_MEM_SIZE=21 +CONFIG_SOC_PM_SUPPORT_EXT0_WAKEUP=y +CONFIG_SOC_PM_SUPPORT_EXT1_WAKEUP=y +CONFIG_SOC_PM_SUPPORT_EXT_WAKEUP=y +CONFIG_SOC_PM_SUPPORT_TOUCH_SENSOR_WAKEUP=y +CONFIG_SOC_PM_SUPPORT_RTC_PERIPH_PD=y +CONFIG_SOC_PM_SUPPORT_RTC_FAST_MEM_PD=y +CONFIG_SOC_PM_SUPPORT_RTC_SLOW_MEM_PD=y +CONFIG_SOC_PM_SUPPORT_RC_FAST_PD=y +CONFIG_SOC_PM_SUPPORT_VDDSDIO_PD=y +CONFIG_SOC_PM_SUPPORT_MODEM_PD=y +CONFIG_SOC_CONFIGURABLE_VDDSDIO_SUPPORTED=y +CONFIG_SOC_CLK_APLL_SUPPORTED=y +CONFIG_SOC_APLL_MULTIPLIER_OUT_MIN_HZ=350000000 +CONFIG_SOC_APLL_MULTIPLIER_OUT_MAX_HZ=500000000 +CONFIG_SOC_APLL_MIN_HZ=5303031 +CONFIG_SOC_APLL_MAX_HZ=125000000 +CONFIG_SOC_CLK_RC_FAST_D256_SUPPORTED=y +CONFIG_SOC_RTC_SLOW_CLK_SUPPORT_RC_FAST_D256=y +CONFIG_SOC_CLK_RC_FAST_SUPPORT_CALIBRATION=y +CONFIG_SOC_CLK_XTAL32K_SUPPORTED=y +CONFIG_SOC_SDMMC_USE_IOMUX=y +CONFIG_SOC_SDMMC_NUM_SLOTS=2 +CONFIG_SOC_WIFI_WAPI_SUPPORT=y +CONFIG_SOC_WIFI_CSI_SUPPORT=y +CONFIG_SOC_WIFI_MESH_SUPPORT=y +CONFIG_SOC_WIFI_SUPPORT_VARIABLE_BEACON_WINDOW=y +CONFIG_SOC_WIFI_NAN_SUPPORT=y +CONFIG_SOC_BLE_SUPPORTED=y +CONFIG_SOC_BLE_MESH_SUPPORTED=y +CONFIG_SOC_BT_CLASSIC_SUPPORTED=y +CONFIG_SOC_BLUFI_SUPPORTED=y +CONFIG_SOC_ULP_HAS_ADC=y CONFIG_IDF_CMAKE=y CONFIG_IDF_TARGET_ARCH_XTENSA=y +CONFIG_IDF_TARGET_ARCH="xtensa" CONFIG_IDF_TARGET="esp32" CONFIG_IDF_TARGET_ESP32=y CONFIG_IDF_FIRMWARE_CHIP_ID=0x0000 -# -# SDK tool configuration -# -CONFIG_SDK_TOOLPREFIX="xtensa-esp32-elf-" -# CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS is not set -# end of SDK tool configuration - # # Build type # CONFIG_APP_BUILD_TYPE_APP_2NDBOOT=y -# CONFIG_APP_BUILD_TYPE_ELF_RAM is not set +# CONFIG_APP_BUILD_TYPE_RAM is not set CONFIG_APP_BUILD_GENERATE_BINARIES=y CONFIG_APP_BUILD_BOOTLOADER=y CONFIG_APP_BUILD_USE_FLASH_SECTIONS=y +# CONFIG_APP_REPRODUCIBLE_BUILD is not set +# CONFIG_APP_NO_BLOBS is not set +# CONFIG_APP_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set +# CONFIG_APP_COMPATIBLE_PRE_V3_1_BOOTLOADERS is not set # end of Build type -# -# Application manager -# -CONFIG_APP_COMPILE_TIME_DATE=y -# CONFIG_APP_EXCLUDE_PROJECT_VER_VAR is not set -# CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR is not set -# CONFIG_APP_PROJECT_VER_FROM_CONFIG is not set -CONFIG_APP_RETRIEVE_LEN_ELF_SHA=16 -# end of Application manager - # # Bootloader config # @@ -44,17 +241,18 @@ CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE is not set # CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set +CONFIG_BOOTLOADER_LOG_LEVEL_ERROR=y # CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set -CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y +# CONFIG_BOOTLOADER_LOG_LEVEL_INFO is not set # CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set # CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set -CONFIG_BOOTLOADER_LOG_LEVEL=3 +CONFIG_BOOTLOADER_LOG_LEVEL=1 # CONFIG_BOOTLOADER_SPI_CUSTOM_WP_PIN is not set CONFIG_BOOTLOADER_SPI_WP_PIN=7 CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y # CONFIG_BOOTLOADER_FACTORY_RESET is not set # CONFIG_BOOTLOADER_APP_TEST is not set +CONFIG_BOOTLOADER_REGION_PROTECTION_ENABLE=y CONFIG_BOOTLOADER_WDT_ENABLE=y # CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE is not set CONFIG_BOOTLOADER_WDT_TIME_MS=9000 @@ -71,20 +269,39 @@ CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT=y # # Security features # +CONFIG_SECURE_BOOT_V1_SUPPORTED=y # CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT is not set # CONFIG_SECURE_BOOT is not set # CONFIG_SECURE_FLASH_ENC_ENABLED is not set # end of Security features +# +# Application manager +# +CONFIG_APP_COMPILE_TIME_DATE=y +# CONFIG_APP_EXCLUDE_PROJECT_VER_VAR is not set +# CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR is not set +# CONFIG_APP_PROJECT_VER_FROM_CONFIG is not set +CONFIG_APP_RETRIEVE_LEN_ELF_SHA=16 +# end of Application manager + +CONFIG_ESP_ROM_HAS_CRC_LE=y +CONFIG_ESP_ROM_HAS_CRC_BE=y +CONFIG_ESP_ROM_HAS_MZ_CRC32=y +CONFIG_ESP_ROM_HAS_JPEG_DECODE=y +CONFIG_ESP_ROM_HAS_UART_BUF_SWITCH=y +CONFIG_ESP_ROM_NEEDS_SWSETUP_WORKAROUND=y +CONFIG_ESP_ROM_HAS_NEWLIB_NANO_FORMAT=y + # # Serial flasher config # -CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200 # CONFIG_ESPTOOLPY_NO_STUB is not set CONFIG_ESPTOOLPY_FLASHMODE_QIO=y # CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set # CONFIG_ESPTOOLPY_FLASHMODE_DIO is not set # CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set +CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR=y CONFIG_ESPTOOLPY_FLASHMODE="dio" CONFIG_ESPTOOLPY_FLASHFREQ_80M=y # CONFIG_ESPTOOLPY_FLASHFREQ_40M is not set @@ -96,23 +313,17 @@ CONFIG_ESPTOOLPY_FLASHFREQ="80m" CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y # CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set CONFIG_ESPTOOLPY_FLASHSIZE="4MB" -CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y +# CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE is not set CONFIG_ESPTOOLPY_BEFORE_RESET=y # CONFIG_ESPTOOLPY_BEFORE_NORESET is not set CONFIG_ESPTOOLPY_BEFORE="default_reset" CONFIG_ESPTOOLPY_AFTER_RESET=y # CONFIG_ESPTOOLPY_AFTER_NORESET is not set CONFIG_ESPTOOLPY_AFTER="hard_reset" -# CONFIG_ESPTOOLPY_MONITOR_BAUD_CONSOLE is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_9600B is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_57600B is not set -CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y -# CONFIG_ESPTOOLPY_MONITOR_BAUD_230400B is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_921600B is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_2MB is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER is not set -CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER_VAL=115200 CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 # end of Serial flasher config @@ -120,6 +331,7 @@ CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 # Partition Table # # CONFIG_PARTITION_TABLE_SINGLE_APP is not set +# CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set # CONFIG_PARTITION_TABLE_TWO_OTA is not set CONFIG_PARTITION_TABLE_CUSTOM=y CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" @@ -129,7 +341,22 @@ CONFIG_PARTITION_TABLE_MD5=y # end of Partition Table # -# Audio HAL +# Snapclient Configuration +# +CONFIG_SNAPSERVER_USE_MDNS=y +CONFIG_SNAPCLIENT_NAME="esp-snapclient" + +# +# HTTP Server Setting +# +CONFIG_WEB_PORT=8000 +# end of HTTP Server Setting + +CONFIG_USE_SAMPLE_INSERTION=y +# end of Snapclient Configuration + +# +# Audio Board # # CONFIG_AUDIO_BOARD_CUSTOM is not set CONFIG_ESP_LYRAT_V4_3_BOARD=y @@ -139,7 +366,8 @@ CONFIG_ESP_LYRAT_V4_3_BOARD=y # CONFIG_ESP_LYRAT_MINI_V1_1_BOARD is not set # CONFIG_ESP32_KORVO_DU1906_BOARD is not set # CONFIG_ESP32_S2_KALUGA_1_V1_2_BOARD is not set -# end of Audio HAL +# CONFIG_ESP_AI_THINKER_ES8388_BOARD is not set +# end of Audio Board # # ESP32 DSP processor config @@ -163,25 +391,12 @@ CONFIG_SNTP_SERVER="pool.ntp.org" # # Wifi Configuration # -# CONFIG_ENABLE_WIFI_PROVISIONING is not set -CONFIG_WIFI_SSID="test" -CONFIG_WIFI_PASSWORD="12345678" +CONFIG_ENABLE_WIFI_PROVISIONING=y +CONFIG_WIFI_PROVISIONING_SSID="prov_snapclient" +CONFIG_WIFI_PROVISIONING_PASSWORD="12345678" CONFIG_WIFI_MAXIMUM_RETRY=0 # end of Wifi Configuration -# -# Snapclient Configuration -# -CONFIG_SNAPSERVER_USE_MDNS=y -CONFIG_SNAPCLIENT_NAME="esp-snapclient" - -# -# HTTP Server Setting -# -CONFIG_WEB_PORT=8000 -# end of HTTP Server Setting -# end of Snapclient Configuration - # # Compiler options # @@ -192,6 +407,10 @@ CONFIG_COMPILER_OPTIMIZATION_PERF=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y # CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT is not set # CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE is not set +CONFIG_COMPILER_FLOAT_LIB_FROM_GCCLIB=y +CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2 +# CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT is not set +CONFIG_COMPILER_HIDE_PATHS_MACROS=y # CONFIG_COMPILER_CXX_EXCEPTIONS is not set # CONFIG_COMPILER_CXX_RTTI is not set CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y @@ -199,7 +418,7 @@ CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y # CONFIG_COMPILER_STACK_CHECK_MODE_STRONG is not set # CONFIG_COMPILER_STACK_CHECK_MODE_ALL is not set # CONFIG_COMPILER_WARN_WRITE_STRINGS is not set -# CONFIG_COMPILER_DISABLE_GCC8_WARNINGS is not set +# CONFIG_COMPILER_DISABLE_GCC12_WARNINGS is not set # CONFIG_COMPILER_DUMP_RTL_FILES is not set # end of Compiler options @@ -212,15 +431,13 @@ CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y # # CONFIG_APPTRACE_DEST_JTAG is not set CONFIG_APPTRACE_DEST_NONE=y +# CONFIG_APPTRACE_DEST_UART1 is not set +# CONFIG_APPTRACE_DEST_UART2 is not set +CONFIG_APPTRACE_DEST_UART_NONE=y +CONFIG_APPTRACE_UART_TASK_PRIO=1 CONFIG_APPTRACE_LOCK_ENABLE=y # end of Application Level Tracing -# -# ESP-ASIO -# -# CONFIG_ASIO_SSL_SUPPORT is not set -# end of ESP-ASIO - # # Bluetooth # @@ -228,36 +445,35 @@ CONFIG_APPTRACE_LOCK_ENABLE=y # end of Bluetooth # -# CoAP Configuration +# Driver Configurations # -CONFIG_COAP_MBEDTLS_PSK=y -# CONFIG_COAP_MBEDTLS_PKI is not set -# CONFIG_COAP_MBEDTLS_DEBUG is not set -CONFIG_COAP_LOG_DEFAULT_LEVEL=0 -# end of CoAP Configuration # -# Driver configurations +# Legacy ADC Configuration # +CONFIG_ADC_DISABLE_DAC=y +# CONFIG_ADC_SUPPRESS_DEPRECATE_WARN is not set # -# ADC configuration +# Legacy ADC Calibration Configuration # -# CONFIG_ADC_FORCE_XPD_FSM is not set -CONFIG_ADC_DISABLE_DAC=y -# end of ADC configuration +CONFIG_ADC_CAL_EFUSE_TP_ENABLE=y +CONFIG_ADC_CAL_EFUSE_VREF_ENABLE=y +CONFIG_ADC_CAL_LUT_ENABLE=y +# CONFIG_ADC_CALI_SUPPRESS_DEPRECATE_WARN is not set +# end of Legacy ADC Calibration Configuration +# end of Legacy ADC Configuration # -# SPI configuration +# SPI Configuration # -# CONFIG_SPI_MASTER_IN_IRAM is not set CONFIG_SPI_MASTER_ISR_IN_IRAM=y # CONFIG_SPI_SLAVE_IN_IRAM is not set # CONFIG_SPI_SLAVE_ISR_IN_IRAM is not set -# end of SPI configuration +# end of SPI Configuration # -# TWAI configuration +# TWAI Configuration # # CONFIG_TWAI_ISR_IN_IRAM is not set # CONFIG_TWAI_ERRATA_FIX_BUS_OFF_REC is not set @@ -265,26 +481,82 @@ CONFIG_SPI_MASTER_ISR_IN_IRAM=y # CONFIG_TWAI_ERRATA_FIX_RX_FRAME_INVALID is not set # CONFIG_TWAI_ERRATA_FIX_RX_FIFO_CORRUPT is not set # CONFIG_TWAI_ERRATA_FIX_LISTEN_ONLY_DOM is not set -# end of TWAI configuration +# end of TWAI Configuration # -# UART configuration +# UART Configuration # # CONFIG_UART_ISR_IN_IRAM is not set -# end of UART configuration - -# -# RTCIO configuration -# -# CONFIG_RTCIO_SUPPORT_RTC_GPIO_DESC is not set -# end of RTCIO configuration +# end of UART Configuration # # GPIO Configuration # # CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL is not set +# CONFIG_GPIO_CTRL_FUNC_IN_IRAM is not set # end of GPIO Configuration -# end of Driver configurations + +# +# Sigma Delta Modulator Configuration +# +# CONFIG_SDM_CTRL_FUNC_IN_IRAM is not set +# CONFIG_SDM_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_SDM_ENABLE_DEBUG_LOG is not set +# end of Sigma Delta Modulator Configuration + +# +# GPTimer Configuration +# +# CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM is not set +# CONFIG_GPTIMER_ISR_IRAM_SAFE is not set +# CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_GPTIMER_ENABLE_DEBUG_LOG is not set +# end of GPTimer Configuration + +# +# PCNT Configuration +# +# CONFIG_PCNT_CTRL_FUNC_IN_IRAM is not set +# CONFIG_PCNT_ISR_IRAM_SAFE is not set +# CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_PCNT_ENABLE_DEBUG_LOG is not set +# end of PCNT Configuration + +# +# RMT Configuration +# +# CONFIG_RMT_ISR_IRAM_SAFE is not set +# CONFIG_RMT_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_RMT_ENABLE_DEBUG_LOG is not set +# end of RMT Configuration + +# +# MCPWM Configuration +# +# CONFIG_MCPWM_ISR_IRAM_SAFE is not set +# CONFIG_MCPWM_CTRL_FUNC_IN_IRAM is not set +# CONFIG_MCPWM_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_MCPWM_ENABLE_DEBUG_LOG is not set +# end of MCPWM Configuration + +# +# I2S Configuration +# +# CONFIG_I2S_ISR_IRAM_SAFE is not set +# CONFIG_I2S_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_I2S_ENABLE_DEBUG_LOG is not set +# end of I2S Configuration + +# +# DAC Configuration +# +# CONFIG_DAC_CTRL_FUNC_IN_IRAM is not set +# CONFIG_DAC_ISR_IRAM_SAFE is not set +# CONFIG_DAC_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_DAC_ENABLE_DEBUG_LOG is not set +CONFIG_DAC_DMA_AUTO_16BIT_ALIGN=y +# end of DAC Configuration +# end of Driver Configurations # # eFuse Bit Manager @@ -302,111 +574,38 @@ CONFIG_EFUSE_MAX_BLK_LEN=192 # CONFIG_ESP_TLS_USING_MBEDTLS=y # CONFIG_ESP_TLS_USE_SECURE_ELEMENT is not set +# CONFIG_ESP_TLS_CLIENT_SESSION_TICKETS is not set # CONFIG_ESP_TLS_SERVER is not set # CONFIG_ESP_TLS_PSK_VERIFICATION is not set # CONFIG_ESP_TLS_INSECURE is not set # end of ESP-TLS # -# ESP32-specific +# ADC and ADC Calibration # -CONFIG_ESP32_REV_MIN_0=y -# CONFIG_ESP32_REV_MIN_1 is not set -# CONFIG_ESP32_REV_MIN_1_1 is not set -# CONFIG_ESP32_REV_MIN_2 is not set -# CONFIG_ESP32_REV_MIN_3 is not set -# CONFIG_ESP32_REV_MIN_3_1 is not set -CONFIG_ESP32_REV_MIN=0 -CONFIG_ESP32_REV_MIN_FULL=0 -CONFIG_ESP_REV_MIN_FULL=0 -CONFIG_ESP32_REV_MAX_FULL_STR_OPT=y -CONFIG_ESP32_REV_MAX_FULL=399 -CONFIG_ESP_REV_MAX_FULL=399 -CONFIG_ESP32_DPORT_WORKAROUND=y -# CONFIG_ESP32_DEFAULT_CPU_FREQ_80 is not set -# CONFIG_ESP32_DEFAULT_CPU_FREQ_160 is not set -CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y -CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240 -# CONFIG_ESP32_SPIRAM_SUPPORT is not set -# CONFIG_ESP32_TRAX is not set -CONFIG_ESP32_TRACEMEM_RESERVE_DRAM=0x0 -# CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_TWO is not set -CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR=y -CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES=4 -# CONFIG_ESP32_ULP_COPROC_ENABLED is not set -CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=0 -CONFIG_ESP32_DEBUG_OCDAWARE=y -CONFIG_ESP32_BROWNOUT_DET=y -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_0 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_1 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_2 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_3 is not set -CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_4=y -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_5 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_6 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_7 is not set -CONFIG_ESP32_BROWNOUT_DET_LVL=4 -CONFIG_ESP32_REDUCE_PHY_TX_POWER=y -CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1=y -# CONFIG_ESP32_TIME_SYSCALL_USE_RTC is not set -# CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 is not set -# CONFIG_ESP32_TIME_SYSCALL_USE_NONE is not set -CONFIG_ESP32_RTC_CLK_SRC_INT_RC=y -# CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS is not set -# CONFIG_ESP32_RTC_CLK_SRC_EXT_OSC is not set -# CONFIG_ESP32_RTC_CLK_SRC_INT_8MD256 is not set -CONFIG_ESP32_RTC_CLK_CAL_CYCLES=1024 -CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY=2000 -CONFIG_ESP32_XTAL_FREQ_40=y -# CONFIG_ESP32_XTAL_FREQ_26 is not set -# CONFIG_ESP32_XTAL_FREQ_AUTO is not set -CONFIG_ESP32_XTAL_FREQ=40 -# CONFIG_ESP32_DISABLE_BASIC_ROM_CONSOLE is not set -# CONFIG_ESP32_NO_BLOBS is not set -# CONFIG_ESP32_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set -# CONFIG_ESP32_COMPATIBLE_PRE_V3_1_BOOTLOADERS is not set -# CONFIG_ESP32_USE_FIXED_STATIC_RAM_SIZE is not set -CONFIG_ESP32_DPORT_DIS_INTERRUPT_LVL=5 -# end of ESP32-specific +# CONFIG_ADC_ONESHOT_CTRL_FUNC_IN_IRAM is not set +# CONFIG_ADC_CONTINUOUS_ISR_IRAM_SAFE is not set # -# ADC-Calibration +# ADC Calibration Configurations # -CONFIG_ADC_CAL_EFUSE_TP_ENABLE=y -CONFIG_ADC_CAL_EFUSE_VREF_ENABLE=y -CONFIG_ADC_CAL_LUT_ENABLE=y -# end of ADC-Calibration +CONFIG_ADC_CALI_EFUSE_TP_ENABLE=y +CONFIG_ADC_CALI_EFUSE_VREF_ENABLE=y +CONFIG_ADC_CALI_LUT_ENABLE=y +# end of ADC Calibration Configurations + +CONFIG_ADC_DISABLE_DAC_OUTPUT=y +# end of ADC and ADC Calibration + +# +# Wireless Coexistence +# +# end of Wireless Coexistence # # Common ESP-related # CONFIG_ESP_ERR_TO_NAME_LOOKUP=y -CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32 -CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=2560 -CONFIG_ESP_IPC_TASK_STACK_SIZE=1024 -CONFIG_ESP_IPC_USES_CALLERS_PRIORITY=y -CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE=2048 -CONFIG_ESP_CONSOLE_UART_DEFAULT=y -# CONFIG_ESP_CONSOLE_UART_CUSTOM is not set -# CONFIG_ESP_CONSOLE_NONE is not set -CONFIG_ESP_CONSOLE_UART=y -CONFIG_ESP_CONSOLE_MULTIPLE_UART=y -CONFIG_ESP_CONSOLE_UART_NUM=0 -CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -CONFIG_ESP_INT_WDT=y -CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 -CONFIG_ESP_INT_WDT_CHECK_CPU1=y -CONFIG_ESP_TASK_WDT=y -# CONFIG_ESP_TASK_WDT_PANIC is not set -CONFIG_ESP_TASK_WDT_TIMEOUT_S=5 -CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y -CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=y -# CONFIG_ESP_PANIC_HANDLER_IRAM is not set -CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA=y -CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP=y -CONFIG_ESP_MAC_ADDR_UNIVERSE_BT=y -CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y # end of Common ESP-related # @@ -415,7 +614,6 @@ CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y CONFIG_ETH_ENABLED=y CONFIG_ETH_USE_ESP32_EMAC=y CONFIG_ETH_PHY_INTERFACE_RMII=y -# CONFIG_ETH_PHY_INTERFACE_MII is not set CONFIG_ETH_RMII_CLK_INPUT=y # CONFIG_ETH_RMII_CLK_OUTPUT is not set CONFIG_ETH_RMII_CLK_IN_GPIO=0 @@ -426,7 +624,9 @@ CONFIG_ETH_DMA_TX_BUFFER_NUM=5 CONFIG_ETH_USE_SPI_ETHERNET=y # CONFIG_ETH_SPI_ETHERNET_DM9051 is not set # CONFIG_ETH_SPI_ETHERNET_W5500 is not set +# CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL is not set # CONFIG_ETH_USE_OPENETH is not set +# CONFIG_ETH_TRANSMIT_MUTEX is not set # end of Ethernet # @@ -447,6 +647,7 @@ CONFIG_ESP_EVENT_POST_FROM_ISR=y # CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=y # CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set +# CONFIG_ESP_HTTP_CLIENT_ENABLE_DIGEST_AUTH is not set # end of ESP HTTP client # @@ -458,12 +659,14 @@ CONFIG_HTTPD_ERR_RESP_NO_DELAY=y CONFIG_HTTPD_PURGE_BUF_LEN=32 # CONFIG_HTTPD_LOG_PURGE_DATA is not set # CONFIG_HTTPD_WS_SUPPORT is not set +# CONFIG_HTTPD_QUEUE_WORK_BLOCKING is not set # end of HTTP Server # # ESP HTTPS OTA # -# CONFIG_OTA_ALLOW_HTTP is not set +# CONFIG_ESP_HTTPS_OTA_DECRYPT_CB is not set +# CONFIG_ESP_HTTPS_OTA_ALLOW_HTTP is not set # end of ESP HTTPS OTA # @@ -472,41 +675,321 @@ CONFIG_HTTPD_PURGE_BUF_LEN=32 # CONFIG_ESP_HTTPS_SERVER_ENABLE is not set # end of ESP HTTPS server +# +# Hardware Settings +# + +# +# Chip revision +# +CONFIG_ESP32_REV_MIN_0=y +# CONFIG_ESP32_REV_MIN_1 is not set +# CONFIG_ESP32_REV_MIN_1_1 is not set +# CONFIG_ESP32_REV_MIN_2 is not set +# CONFIG_ESP32_REV_MIN_3 is not set +# CONFIG_ESP32_REV_MIN_3_1 is not set +CONFIG_ESP32_REV_MIN=0 +CONFIG_ESP32_REV_MIN_FULL=0 +CONFIG_ESP_REV_MIN_FULL=0 + +# +# Maximum Supported ESP32 Revision (Rev v3.99) +# +CONFIG_ESP32_REV_MAX_FULL=399 +CONFIG_ESP_REV_MAX_FULL=399 +# end of Chip revision + +# +# MAC Config +# +CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA=y +CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP=y +CONFIG_ESP_MAC_ADDR_UNIVERSE_BT=y +CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y +CONFIG_ESP_MAC_UNIVERSAL_MAC_ADDRESSES_FOUR=y +# CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_TWO is not set +CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR=y +CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES=4 +# CONFIG_ESP_MAC_IGNORE_MAC_CRC_ERROR is not set +# end of MAC Config + +# +# Sleep Config +# +CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND=y +CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND=y +# CONFIG_ESP_SLEEP_MSPI_NEED_ALL_IO_PU is not set +CONFIG_ESP_SLEEP_RTC_BUS_ISO_WORKAROUND=y +# CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set +CONFIG_ESP_SLEEP_DEEP_SLEEP_WAKEUP_DELAY=2000 +# end of Sleep Config + +# +# RTC Clock Config +# +CONFIG_RTC_CLK_SRC_INT_RC=y +# CONFIG_RTC_CLK_SRC_EXT_CRYS is not set +# CONFIG_RTC_CLK_SRC_EXT_OSC is not set +# CONFIG_RTC_CLK_SRC_INT_8MD256 is not set +CONFIG_RTC_CLK_CAL_CYCLES=1024 +# end of RTC Clock Config + +# +# Peripheral Control +# +CONFIG_PERIPH_CTRL_FUNC_IN_IRAM=y +# end of Peripheral Control + +# +# Main XTAL Config +# +# CONFIG_XTAL_FREQ_26 is not set +CONFIG_XTAL_FREQ_40=y +# CONFIG_XTAL_FREQ_AUTO is not set +CONFIG_XTAL_FREQ=40 +# end of Main XTAL Config +# end of Hardware Settings + +# +# LCD and Touch Panel +# + +# +# LCD Touch Drivers are maintained in the IDF Component Registry +# + +# +# LCD Peripheral Configuration +# +CONFIG_LCD_PANEL_IO_FORMAT_BUF_SIZE=32 +# CONFIG_LCD_ENABLE_DEBUG_LOG is not set +# end of LCD Peripheral Configuration +# end of LCD and Touch Panel + # # ESP NETIF Adapter # CONFIG_ESP_NETIF_IP_LOST_TIMER_INTERVAL=120 CONFIG_ESP_NETIF_TCPIP_LWIP=y # CONFIG_ESP_NETIF_LOOPBACK is not set -CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=y +CONFIG_ESP_NETIF_USES_TCPIP_WITH_BSD_API=y +# CONFIG_ESP_NETIF_RECEIVE_REPORT_ERRORS is not set +# CONFIG_ESP_NETIF_L2_TAP is not set +# CONFIG_ESP_NETIF_BRIDGE_EN is not set # end of ESP NETIF Adapter +# +# Partition API Configuration +# +# end of Partition API Configuration + +# +# PHY +# +CONFIG_ESP_PHY_CALIBRATION_AND_DATA_STORAGE=y +# CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION is not set +CONFIG_ESP_PHY_MAX_WIFI_TX_POWER=20 +CONFIG_ESP_PHY_MAX_TX_POWER=20 +CONFIG_ESP_PHY_REDUCE_TX_POWER=y +CONFIG_ESP_PHY_RF_CAL_PARTIAL=y +# CONFIG_ESP_PHY_RF_CAL_NONE is not set +# CONFIG_ESP_PHY_RF_CAL_FULL is not set +CONFIG_ESP_PHY_CALIBRATION_MODE=0 +# end of PHY + # # Power Management # # CONFIG_PM_ENABLE is not set # end of Power Management +# +# ESP PSRAM +# +CONFIG_SPIRAM=y + +# +# SPI RAM config +# +CONFIG_SPIRAM_MODE_QUAD=y +CONFIG_SPIRAM_TYPE_AUTO=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM_SPEED_80M=y +CONFIG_SPIRAM_SPEED=80 +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +# CONFIG_SPIRAM_USE_MEMMAP is not set +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +CONFIG_SPIRAM_USE_MALLOC=y +CONFIG_SPIRAM_MEMTEST=y +CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=2048 +# CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is not set +CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768 +# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set +CONFIG_SPIRAM_CACHE_WORKAROUND=y + +# +# SPIRAM cache workaround debugging +# +CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_MEMW=y +# CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_DUPLDST is not set +# CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_NOPS is not set +# end of SPIRAM cache workaround debugging + +# +# SPIRAM workaround libraries placement +# +CONFIG_SPIRAM_CACHE_LIBJMP_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBMATH_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBNUMPARSER_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBIO_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBTIME_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBCHAR_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBMEM_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBSTR_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBRAND_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBENV_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBFILE_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBMISC_IN_IRAM=y +# end of SPIRAM workaround libraries placement + +CONFIG_SPIRAM_BANKSWITCH_ENABLE=y +CONFIG_SPIRAM_BANKSWITCH_RESERVE=8 +# CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY is not set +# CONFIG_SPIRAM_OCCUPY_HSPI_HOST is not set +CONFIG_SPIRAM_OCCUPY_VSPI_HOST=y +# CONFIG_SPIRAM_OCCUPY_NO_HOST is not set + +# +# PSRAM clock and cs IO for ESP32-DOWD +# +CONFIG_D0WD_PSRAM_CLK_IO=17 +CONFIG_D0WD_PSRAM_CS_IO=16 +# end of PSRAM clock and cs IO for ESP32-DOWD + +# +# PSRAM clock and cs IO for ESP32-D2WD +# +CONFIG_D2WD_PSRAM_CLK_IO=9 +CONFIG_D2WD_PSRAM_CS_IO=10 +# end of PSRAM clock and cs IO for ESP32-D2WD + +# +# PSRAM clock and cs IO for ESP32-PICO +# +CONFIG_PICO_PSRAM_CS_IO=10 +# end of PSRAM clock and cs IO for ESP32-PICO + +# CONFIG_SPIRAM_2T_MODE is not set +# end of SPI RAM config +# end of ESP PSRAM + +# +# ESP Ringbuf +# +# CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH is not set +# end of ESP Ringbuf + # # ESP System Settings # +# CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_80 is not set +# CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_160 is not set +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ=240 + +# +# Memory +# +# CONFIG_ESP32_USE_FIXED_STATIC_RAM_SIZE is not set + +# +# Non-backward compatible options +# +# CONFIG_ESP_SYSTEM_ESP32_SRAM1_REGION_AS_IRAM is not set +# end of Non-backward compatible options +# end of Memory + +# +# Trace memory +# +# CONFIG_ESP32_TRAX is not set +CONFIG_ESP32_TRACEMEM_RESERVE_DRAM=0x0 +# end of Trace memory + # CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT is not set CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y # CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set # CONFIG_ESP_SYSTEM_PANIC_GDBSTUB is not set -CONFIG_ESP_SYSTEM_PD_FLASH=y -# CONFIG_ESP_SYSTEM_FLASH_LEAKAGE_WORKAROUND is not set +# CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME is not set +CONFIG_ESP_SYSTEM_PANIC_REBOOT_DELAY_SECONDS=0 + +# +# Memory protection +# +# end of Memory protection + +CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32 +CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=3072 +CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0=y +# CONFIG_ESP_MAIN_TASK_AFFINITY_CPU1 is not set +# CONFIG_ESP_MAIN_TASK_AFFINITY_NO_AFFINITY is not set +CONFIG_ESP_MAIN_TASK_AFFINITY=0x0 +CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE=2048 +CONFIG_ESP_CONSOLE_UART_DEFAULT=y +# CONFIG_ESP_CONSOLE_UART_CUSTOM is not set +# CONFIG_ESP_CONSOLE_NONE is not set +CONFIG_ESP_CONSOLE_UART=y +CONFIG_ESP_CONSOLE_MULTIPLE_UART=y +CONFIG_ESP_CONSOLE_UART_NUM=0 +CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 +CONFIG_ESP_INT_WDT=y +CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 +CONFIG_ESP_INT_WDT_CHECK_CPU1=y +CONFIG_ESP_TASK_WDT_EN=y +CONFIG_ESP_TASK_WDT_INIT=y +# CONFIG_ESP_TASK_WDT_PANIC is not set +CONFIG_ESP_TASK_WDT_TIMEOUT_S=5 +CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y +CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=y +# CONFIG_ESP_PANIC_HANDLER_IRAM is not set +# CONFIG_ESP_DEBUG_STUBS_ENABLE is not set +CONFIG_ESP_DEBUG_OCDAWARE=y +# CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set +CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_4=y + +# +# Brownout Detector +# +CONFIG_ESP_BROWNOUT_DET=y +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_0 is not set +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_1 is not set +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_2 is not set +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_3 is not set +CONFIG_ESP_BROWNOUT_DET_LVL_SEL_4=y +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_5 is not set +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_6 is not set +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_7 is not set +CONFIG_ESP_BROWNOUT_DET_LVL=4 +# end of Brownout Detector -# -# RTC Clock Config -# -# end of RTC Clock Config +# CONFIG_ESP32_DISABLE_BASIC_ROM_CONSOLE is not set +CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y +CONFIG_ESP_SYSTEM_BROWNOUT_INTR=y +# end of ESP System Settings # -# Memory protection +# IPC (Inter-Processor Call) # -# end of Memory protection -# end of ESP System Settings +CONFIG_ESP_IPC_TASK_STACK_SIZE=1024 +CONFIG_ESP_IPC_USES_CALLERS_PRIORITY=y +CONFIG_ESP_IPC_ISR_ENABLE=y +# end of IPC (Inter-Processor Call) # # High resolution timer (esp_timer) @@ -515,52 +998,71 @@ CONFIG_ESP_SYSTEM_PD_FLASH=y CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER=y CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER=y CONFIG_ESP_TIMER_TASK_STACK_SIZE=2048 -# CONFIG_ESP_TIMER_IMPL_FRC2 is not set +CONFIG_ESP_TIMER_INTERRUPT_LEVEL=1 +# CONFIG_ESP_TIMER_SHOW_EXPERIMENTAL is not set +CONFIG_ESP_TIMER_TASK_AFFINITY=0x0 +CONFIG_ESP_TIMER_TASK_AFFINITY_CPU0=y +CONFIG_ESP_TIMER_ISR_AFFINITY=0x1 +CONFIG_ESP_TIMER_ISR_AFFINITY_CPU0=y +# CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD is not set CONFIG_ESP_TIMER_IMPL_TG0_LAC=y # end of High resolution timer (esp_timer) # # Wi-Fi # -CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=8 -CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=64 -CONFIG_ESP32_WIFI_STATIC_TX_BUFFER=y -# CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER is not set -CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=0 -CONFIG_ESP32_WIFI_STATIC_TX_BUFFER_NUM=8 -# CONFIG_ESP32_WIFI_CSI_ENABLED is not set -CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y -CONFIG_ESP32_WIFI_TX_BA_WIN=8 -CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y -CONFIG_ESP32_WIFI_RX_BA_WIN=16 -CONFIG_ESP32_WIFI_NVS_ENABLED=y -CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y -# CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1 is not set -CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752 -CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32 -# CONFIG_WIFI_LOG_DEFAULT_LEVEL_NONE is not set -# CONFIG_WIFI_LOG_DEFAULT_LEVEL_ERROR is not set -# CONFIG_WIFI_LOG_DEFAULT_LEVEL_WARN is not set -CONFIG_WIFI_LOG_DEFAULT_LEVEL_INFO=y -# CONFIG_WIFI_LOG_DEFAULT_LEVEL_DEBUG is not set -# CONFIG_WIFI_LOG_DEFAULT_LEVEL_VERBOSE is not set -# CONFIG_ESP32_WIFI_IRAM_OPT is not set -CONFIG_ESP32_WIFI_RX_IRAM_OPT=y -CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=y +CONFIG_ESP_WIFI_ENABLED=y +CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=8 +CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=64 +CONFIG_ESP_WIFI_STATIC_TX_BUFFER=y +CONFIG_ESP_WIFI_TX_BUFFER_TYPE=0 +CONFIG_ESP_WIFI_STATIC_TX_BUFFER_NUM=8 +CONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM=32 +# CONFIG_ESP_WIFI_CSI_ENABLED is not set +CONFIG_ESP_WIFI_AMPDU_TX_ENABLED=y +CONFIG_ESP_WIFI_TX_BA_WIN=8 +CONFIG_ESP_WIFI_AMPDU_RX_ENABLED=y +CONFIG_ESP_WIFI_RX_BA_WIN=16 +# CONFIG_ESP_WIFI_AMSDU_TX_ENABLED is not set +CONFIG_ESP_WIFI_NVS_ENABLED=y +CONFIG_ESP_WIFI_TASK_PINNED_TO_CORE_0=y +# CONFIG_ESP_WIFI_TASK_PINNED_TO_CORE_1 is not set +CONFIG_ESP_WIFI_SOFTAP_BEACON_MAX_LEN=752 +CONFIG_ESP_WIFI_MGMT_SBUF_NUM=32 +# CONFIG_ESP_WIFI_IRAM_OPT is not set +CONFIG_ESP_WIFI_RX_IRAM_OPT=y +CONFIG_ESP_WIFI_ENABLE_WPA3_SAE=y +CONFIG_ESP_WIFI_ENABLE_SAE_PK=y +CONFIG_ESP_WIFI_SOFTAP_SAE_SUPPORT=y +CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_STA=y # CONFIG_ESP_WIFI_SLP_IRAM_OPT is not set # CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE is not set +# CONFIG_ESP_WIFI_GMAC_SUPPORT is not set +CONFIG_ESP_WIFI_SOFTAP_SUPPORT=y # CONFIG_ESP_WIFI_SLP_BEACON_LOST_OPT is not set +CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=7 +# CONFIG_ESP_WIFI_NAN_ENABLE is not set +CONFIG_ESP_WIFI_MBEDTLS_CRYPTO=y +CONFIG_ESP_WIFI_MBEDTLS_TLS_CLIENT=y +# CONFIG_ESP_WIFI_WAPI_PSK is not set +# CONFIG_ESP_WIFI_SUITE_B_192 is not set +# CONFIG_ESP_WIFI_11KV_SUPPORT is not set +# CONFIG_ESP_WIFI_MBO_SUPPORT is not set +# CONFIG_ESP_WIFI_DPP_SUPPORT is not set +# CONFIG_ESP_WIFI_11R_SUPPORT is not set +# CONFIG_ESP_WIFI_WPS_SOFTAP_REGISTRAR is not set + +# +# WPS Configuration Options +# +# CONFIG_ESP_WIFI_WPS_STRICT is not set +# CONFIG_ESP_WIFI_WPS_PASSPHRASE is not set +# end of WPS Configuration Options + +# CONFIG_ESP_WIFI_DEBUG_PRINT is not set +# CONFIG_ESP_WIFI_TESTING_OPTIONS is not set # end of Wi-Fi -# -# PHY -# -CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y -# CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set -CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20 -CONFIG_ESP32_PHY_MAX_TX_POWER=20 -# end of PHY - # # Core dump # @@ -572,6 +1074,12 @@ CONFIG_ESP_COREDUMP_ENABLE_TO_NONE=y # # FAT Filesystem support # +CONFIG_FATFS_VOLUME_COUNT=2 +CONFIG_FATFS_LFN_NONE=y +# CONFIG_FATFS_LFN_HEAP is not set +# CONFIG_FATFS_LFN_STACK is not set +# CONFIG_FATFS_SECTOR_512 is not set +CONFIG_FATFS_SECTOR_4096=y # CONFIG_FATFS_CODEPAGE_DYNAMIC is not set CONFIG_FATFS_CODEPAGE_437=y # CONFIG_FATFS_CODEPAGE_720 is not set @@ -595,87 +1103,78 @@ CONFIG_FATFS_CODEPAGE_437=y # CONFIG_FATFS_CODEPAGE_949 is not set # CONFIG_FATFS_CODEPAGE_950 is not set CONFIG_FATFS_CODEPAGE=437 -CONFIG_FATFS_LFN_NONE=y -# CONFIG_FATFS_LFN_HEAP is not set -# CONFIG_FATFS_LFN_STACK is not set CONFIG_FATFS_FS_LOCK=0 CONFIG_FATFS_TIMEOUT_MS=10000 CONFIG_FATFS_PER_FILE_CACHE=y +CONFIG_FATFS_ALLOC_PREFER_EXTRAM=y # CONFIG_FATFS_USE_FASTSEEK is not set +CONFIG_FATFS_VFS_FSTAT_BLKSIZE=0 # end of FAT Filesystem support # -# Modbus configuration -# -CONFIG_FMB_COMM_MODE_TCP_EN=y -CONFIG_FMB_TCP_PORT_DEFAULT=502 -CONFIG_FMB_TCP_PORT_MAX_CONN=5 -CONFIG_FMB_TCP_CONNECTION_TOUT_SEC=20 -CONFIG_FMB_COMM_MODE_RTU_EN=y -CONFIG_FMB_COMM_MODE_ASCII_EN=y -CONFIG_FMB_MASTER_TIMEOUT_MS_RESPOND=150 -CONFIG_FMB_MASTER_DELAY_MS_CONVERT=200 -CONFIG_FMB_QUEUE_LENGTH=20 -CONFIG_FMB_PORT_TASK_STACK_SIZE=4096 -CONFIG_FMB_SERIAL_BUF_SIZE=256 -CONFIG_FMB_SERIAL_ASCII_BITS_PER_SYMB=8 -CONFIG_FMB_SERIAL_ASCII_TIMEOUT_RESPOND_MS=1000 -CONFIG_FMB_PORT_TASK_PRIO=10 -# CONFIG_FMB_PORT_TASK_AFFINITY_NO_AFFINITY is not set -CONFIG_FMB_PORT_TASK_AFFINITY_CPU0=y -# CONFIG_FMB_PORT_TASK_AFFINITY_CPU1 is not set -CONFIG_FMB_PORT_TASK_AFFINITY=0x0 -CONFIG_FMB_CONTROLLER_SLAVE_ID_SUPPORT=y -CONFIG_FMB_CONTROLLER_SLAVE_ID=0x00112233 -CONFIG_FMB_CONTROLLER_NOTIFY_TIMEOUT=20 -CONFIG_FMB_CONTROLLER_NOTIFY_QUEUE_SIZE=20 -CONFIG_FMB_CONTROLLER_STACK_SIZE=4096 -CONFIG_FMB_EVENT_QUEUE_TIMEOUT=20 -CONFIG_FMB_TIMER_PORT_ENABLED=y -CONFIG_FMB_TIMER_GROUP=0 -CONFIG_FMB_TIMER_INDEX=0 -CONFIG_FMB_MASTER_TIMER_GROUP=0 -CONFIG_FMB_MASTER_TIMER_INDEX=0 -# CONFIG_FMB_TIMER_ISR_IN_IRAM is not set -# end of Modbus configuration +# FreeRTOS +# # -# FreeRTOS +# Kernel # +# CONFIG_FREERTOS_SMP is not set # CONFIG_FREERTOS_UNICORE is not set -CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF -CONFIG_FREERTOS_CORETIMER_0=y -# CONFIG_FREERTOS_CORETIMER_1 is not set CONFIG_FREERTOS_HZ=1000 -CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION=y # CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE is not set # CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL is not set CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY=y -# CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK is not set -CONFIG_FREERTOS_INTERRUPT_BACKTRACE=y CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 -# CONFIG_FREERTOS_ASSERT_FAIL_ABORT is not set -# CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE is not set -CONFIG_FREERTOS_ASSERT_DISABLE=y CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=768 -CONFIG_FREERTOS_ISR_STACKSIZE=1536 -# CONFIG_FREERTOS_LEGACY_HOOKS is not set +# CONFIG_FREERTOS_USE_IDLE_HOOK is not set +# CONFIG_FREERTOS_USE_TICK_HOOK is not set CONFIG_FREERTOS_MAX_TASK_NAME_LEN=10 -CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y -# CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP is not set +CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY=y CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=1536 CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=5 CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 +CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=1 # CONFIG_FREERTOS_USE_TRACE_FACILITY is not set # CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set +# end of Kernel + +# +# Port +# +# CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK is not set +CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS=y +# CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP is not set CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y -# CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set +CONFIG_FREERTOS_ISR_STACKSIZE=1536 +CONFIG_FREERTOS_INTERRUPT_BACKTRACE=y +# CONFIG_FREERTOS_FPU_IN_ISR is not set +CONFIG_FREERTOS_TICK_SUPPORT_CORETIMER=y +CONFIG_FREERTOS_CORETIMER_0=y +# CONFIG_FREERTOS_CORETIMER_1 is not set +CONFIG_FREERTOS_SYSTICK_USES_CCOUNT=y CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y +# CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH is not set +# CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set +CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT=y +# end of Port + +CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF +CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y CONFIG_FREERTOS_DEBUG_OCDAWARE=y -# CONFIG_FREERTOS_FPU_IN_ISR is not set # end of FreeRTOS +# +# Hardware Abstraction Layer (HAL) and Low Level (LL) +# +CONFIG_HAL_ASSERTION_EQUALS_SYSTEM=y +# CONFIG_HAL_ASSERTION_DISABLE is not set +# CONFIG_HAL_ASSERTION_SILENT is not set +# CONFIG_HAL_ASSERTION_ENABLE is not set +CONFIG_HAL_DEFAULT_ASSERTION_LEVEL=2 +CONFIG_HAL_SPI_MASTER_FUNC_IN_IRAM=y +# end of Hardware Abstraction Layer (HAL) and Low Level (LL) + # # Heap memory debugging # @@ -685,20 +1184,13 @@ CONFIG_HEAP_POISONING_DISABLED=y CONFIG_HEAP_TRACING_OFF=y # CONFIG_HEAP_TRACING_STANDALONE is not set # CONFIG_HEAP_TRACING_TOHOST is not set +# CONFIG_HEAP_USE_HOOKS is not set # CONFIG_HEAP_ABORT_WHEN_ALLOCATION_FAILS is not set +# CONFIG_HEAP_PLACE_FUNCTION_INTO_FLASH is not set # end of Heap memory debugging -# -# jsmn -# -# CONFIG_JSMN_PARENT_LINKS is not set -# CONFIG_JSMN_STRICT is not set -# end of jsmn - -# -# libsodium -# -# end of libsodium +CONFIG_IEEE802154_CCA_THRESHOLD=-60 +CONFIG_IEEE802154_PENDING_TABLE_SIZE=20 # # Log output @@ -710,6 +1202,10 @@ CONFIG_LOG_DEFAULT_LEVEL_INFO=y # CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set # CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set CONFIG_LOG_DEFAULT_LEVEL=3 +CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y +# CONFIG_LOG_MAXIMUM_LEVEL_DEBUG is not set +# CONFIG_LOG_MAXIMUM_LEVEL_VERBOSE is not set +CONFIG_LOG_MAXIMUM_LEVEL=3 CONFIG_LOG_COLORS=y CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y # CONFIG_LOG_TIMESTAMP_SOURCE_SYSTEM is not set @@ -719,6 +1215,9 @@ CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif" +# CONFIG_LWIP_NETIF_API is not set +# CONFIG_LWIP_TCPIP_CORE_LOCKING is not set +# CONFIG_LWIP_CHECK_THREAD_SAFETY is not set CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y # CONFIG_LWIP_L2_TO_L3_COPY is not set # CONFIG_LWIP_IRAM_OPTIMIZATION is not set @@ -734,15 +1233,20 @@ CONFIG_LWIP_IP4_FRAG=y CONFIG_LWIP_IP6_FRAG=y # CONFIG_LWIP_IP4_REASSEMBLY is not set # CONFIG_LWIP_IP6_REASSEMBLY is not set +CONFIG_LWIP_IP_REASS_MAX_PBUFS=10 # CONFIG_LWIP_IP_FORWARD is not set # CONFIG_LWIP_STATS is not set -# CONFIG_LWIP_ETHARP_TRUST_IP_MAC is not set CONFIG_LWIP_ESP_GRATUITOUS_ARP=y CONFIG_LWIP_GARP_TMR_INTERVAL=60 +CONFIG_LWIP_ESP_MLDV6_REPORT=y +CONFIG_LWIP_MLDV6_TMR_INTERVAL=40 CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32 CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y # CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set +CONFIG_LWIP_DHCP_DISABLE_VENDOR_CLASS_ID=y # CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set +CONFIG_LWIP_DHCP_OPTIONS_LEN=68 +CONFIG_LWIP_NUM_NETIF_CLIENT_DATA=0 CONFIG_LWIP_DHCP_COARSE_TIMER_SECS=1 # @@ -754,8 +1258,12 @@ CONFIG_LWIP_DHCPS_MAX_STATION_NUM=8 # end of DHCP server # CONFIG_LWIP_AUTOIP is not set +CONFIG_LWIP_IPV4=y CONFIG_LWIP_IPV6=y # CONFIG_LWIP_IPV6_AUTOCONFIG is not set +CONFIG_LWIP_IPV6_NUM_ADDRESSES=3 +# CONFIG_LWIP_IPV6_FORWARD is not set +# CONFIG_LWIP_NETIF_STATUS_CALLBACK is not set CONFIG_LWIP_NETIF_LOOPBACK=y CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 @@ -776,7 +1284,6 @@ CONFIG_LWIP_TCP_WND_DEFAULT=11680 CONFIG_LWIP_TCP_RECVMBOX_SIZE=10 CONFIG_LWIP_TCP_QUEUE_OOSEQ=y CONFIG_LWIP_TCP_SACK_OUT=y -# CONFIG_LWIP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set CONFIG_LWIP_TCP_OVERSIZE_MSS=y # CONFIG_LWIP_TCP_OVERSIZE_QUARTER_MSS is not set # CONFIG_LWIP_TCP_OVERSIZE_DISABLE is not set @@ -825,10 +1332,12 @@ CONFIG_LWIP_MAX_RAW_PCBS=16 # # SNTP # -CONFIG_LWIP_DHCP_MAX_NTP_SERVERS=1 +CONFIG_LWIP_SNTP_MAX_SERVERS=1 +# CONFIG_LWIP_DHCP_GET_NTP_SRV is not set CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000 # end of SNTP +CONFIG_LWIP_BRIDGEIF_MAX_PORTS=7 CONFIG_LWIP_ESP_LWIP_ASSERT=y # @@ -840,9 +1349,18 @@ CONFIG_LWIP_HOOK_TCP_ISN_DEFAULT=y CONFIG_LWIP_HOOK_IP6_ROUTE_NONE=y # CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT is not set # CONFIG_LWIP_HOOK_IP6_ROUTE_CUSTOM is not set +CONFIG_LWIP_HOOK_ND6_GET_GW_NONE=y +# CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT is not set +# CONFIG_LWIP_HOOK_ND6_GET_GW_CUSTOM is not set +CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_NONE=y +# CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_DEFAULT is not set +# CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_CUSTOM is not set CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_NONE=y # CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_DEFAULT is not set # CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_CUSTOM is not set +CONFIG_LWIP_HOOK_IP6_INPUT_NONE=y +# CONFIG_LWIP_HOOK_IP6_INPUT_DEFAULT is not set +# CONFIG_LWIP_HOOK_IP6_INPUT_CUSTOM is not set # end of Hooks # CONFIG_LWIP_DEBUG is not set @@ -852,6 +1370,7 @@ CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_NONE=y # mbedTLS # CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y +# CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC is not set # CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC is not set # CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC is not set CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y @@ -861,13 +1380,15 @@ CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096 # CONFIG_MBEDTLS_DEBUG is not set # -# mbedTLS v2.28.x related +# mbedTLS v3.x related # +# CONFIG_MBEDTLS_SSL_PROTO_TLS1_3 is not set # CONFIG_MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH is not set # CONFIG_MBEDTLS_X509_TRUSTED_CERT_CALLBACK is not set # CONFIG_MBEDTLS_SSL_CONTEXT_SERIALIZATION is not set CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE=y -# end of mbedTLS v2.28.x related +CONFIG_MBEDTLS_PKCS7_C=y +# end of mbedTLS v3.x related # # Certificate Bundle @@ -884,6 +1405,7 @@ CONFIG_MBEDTLS_ROM_MD5=y # CONFIG_MBEDTLS_ATCA_HW_ECDSA_SIGN is not set # CONFIG_MBEDTLS_ATCA_HW_ECDSA_VERIFY is not set CONFIG_MBEDTLS_HAVE_TIME=y +# CONFIG_MBEDTLS_PLATFORM_TIME_ALT is not set # CONFIG_MBEDTLS_HAVE_TIME_DATE is not set CONFIG_MBEDTLS_ECDSA_DETERMINISTIC=y CONFIG_MBEDTLS_SHA512_C=y @@ -900,7 +1422,6 @@ CONFIG_MBEDTLS_TLS_ENABLED=y # # CONFIG_MBEDTLS_PSK_MODES is not set CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA=y CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE=y CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA=y CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA=y @@ -909,15 +1430,11 @@ CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA=y # end of TLS Key Exchange Methods CONFIG_MBEDTLS_SSL_RENEGOTIATION=y -# CONFIG_MBEDTLS_SSL_PROTO_SSL3 is not set -CONFIG_MBEDTLS_SSL_PROTO_TLS1=y -CONFIG_MBEDTLS_SSL_PROTO_TLS1_1=y CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y +# CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set # CONFIG_MBEDTLS_SSL_PROTO_DTLS is not set CONFIG_MBEDTLS_SSL_ALPN=y CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS=y -CONFIG_MBEDTLS_X509_CHECK_KEY_USAGE=y -CONFIG_MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE=y CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS=y # @@ -926,9 +1443,6 @@ CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS=y CONFIG_MBEDTLS_AES_C=y # CONFIG_MBEDTLS_CAMELLIA_C is not set # CONFIG_MBEDTLS_DES_C is not set -CONFIG_MBEDTLS_RC4_DISABLED=y -# CONFIG_MBEDTLS_RC4_ENABLED_NO_DEFAULT is not set -# CONFIG_MBEDTLS_RC4_ENABLED is not set # CONFIG_MBEDTLS_BLOWFISH_C is not set # CONFIG_MBEDTLS_XTEA_C is not set CONFIG_MBEDTLS_CCM_C=y @@ -948,6 +1462,7 @@ CONFIG_MBEDTLS_X509_CSR_PARSE_C=y # end of Certificates CONFIG_MBEDTLS_ECP_C=y +# CONFIG_MBEDTLS_DHM_C is not set CONFIG_MBEDTLS_ECDH_C=y CONFIG_MBEDTLS_ECDSA_C=y # CONFIG_MBEDTLS_ECJPAKE_C is not set @@ -972,25 +1487,11 @@ CONFIG_MBEDTLS_ECP_NIST_OPTIM=y # CONFIG_MBEDTLS_SECURITY_RISKS is not set # end of mbedTLS -# -# mDNS -# -CONFIG_MDNS_MAX_SERVICES=10 -CONFIG_MDNS_TASK_PRIORITY=1 -CONFIG_MDNS_TASK_STACK_SIZE=2816 -CONFIG_MDNS_TASK_AFFINITY_NO_AFFINITY=y -# CONFIG_MDNS_TASK_AFFINITY_CPU0 is not set -# CONFIG_MDNS_TASK_AFFINITY_CPU1 is not set -CONFIG_MDNS_TASK_AFFINITY=0x7FFFFFFF -CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS=2000 -# CONFIG_MDNS_STRICT_MODE is not set -CONFIG_MDNS_TIMER_PERIOD_MS=100 -# end of mDNS - # # ESP-MQTT Configurations # CONFIG_MQTT_PROTOCOL_311=y +# CONFIG_MQTT_PROTOCOL_5 is not set CONFIG_MQTT_TRANSPORT_SSL=y CONFIG_MQTT_TRANSPORT_WEBSOCKET=y CONFIG_MQTT_TRANSPORT_WEBSOCKET_SECURE=y @@ -1012,21 +1513,42 @@ CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF=y # CONFIG_NEWLIB_STDIN_LINE_ENDING_LF is not set CONFIG_NEWLIB_STDIN_LINE_ENDING_CR=y # CONFIG_NEWLIB_NANO_FORMAT is not set +CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC_HRT=y +# CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC is not set +# CONFIG_NEWLIB_TIME_SYSCALL_USE_HRT is not set +# CONFIG_NEWLIB_TIME_SYSCALL_USE_NONE is not set # end of Newlib # # NVS # +# CONFIG_NVS_ASSERT_ERROR_CHECK is not set # end of NVS # -# OpenSSL +# OpenThread # -# CONFIG_OPENSSL_DEBUG is not set -CONFIG_OPENSSL_ERROR_STACK=y -# CONFIG_OPENSSL_ASSERT_DO_NOTHING is not set -CONFIG_OPENSSL_ASSERT_EXIT=y -# end of OpenSSL +# CONFIG_OPENTHREAD_ENABLED is not set + +# +# Thread Operational Dataset +# +CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread-ESP" +CONFIG_OPENTHREAD_NETWORK_CHANNEL=15 +CONFIG_OPENTHREAD_NETWORK_PANID=0x1234 +CONFIG_OPENTHREAD_NETWORK_EXTPANID="dead00beef00cafe" +CONFIG_OPENTHREAD_NETWORK_MASTERKEY="00112233445566778899aabbccddeeff" +CONFIG_OPENTHREAD_NETWORK_PSKC="104810e2315100afd6bc9215a6bfac53" +# end of Thread Operational Dataset +# end of OpenThread + +# +# Protocomm +# +CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_0=y +CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_1=y +CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_2=y +# end of Protocomm # # PThreads @@ -1041,6 +1563,14 @@ CONFIG_PTHREAD_TASK_CORE_DEFAULT=-1 CONFIG_PTHREAD_TASK_NAME_DEFAULT="pthread" # end of PThreads +# +# MMU Config +# +CONFIG_MMU_PAGE_SIZE_64KB=y +CONFIG_MMU_PAGE_MODE="64KB" +CONFIG_MMU_PAGE_SIZE=0x10000 +# end of MMU Config + # # SPI Flash driver # @@ -1050,7 +1580,6 @@ CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS=y # CONFIG_SPI_FLASH_DANGEROUS_WRITE_FAILS is not set # CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED is not set -# CONFIG_SPI_FLASH_USE_LEGACY_IMPL is not set # CONFIG_SPI_FLASH_SHARE_SPI1_BUS is not set # CONFIG_SPI_FLASH_BYPASS_BLOCK_ERASE is not set CONFIG_SPI_FLASH_YIELD_DURING_ERASE=y @@ -1059,10 +1588,23 @@ CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=1 CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=8192 # CONFIG_SPI_FLASH_SIZE_OVERRIDE is not set # CONFIG_SPI_FLASH_CHECK_ERASE_TIMEOUT_DISABLED is not set +# CONFIG_SPI_FLASH_OVERRIDE_CHIP_DRIVER_LIST is not set + +# +# SPI Flash behavior when brownout +# +CONFIG_SPI_FLASH_BROWNOUT_RESET_XMC=y +CONFIG_SPI_FLASH_BROWNOUT_RESET=y +# end of SPI Flash behavior when brownout # # Auto-detect flash chips # +CONFIG_SPI_FLASH_VENDOR_XMC_SUPPORTED=y +CONFIG_SPI_FLASH_VENDOR_GD_SUPPORTED=y +CONFIG_SPI_FLASH_VENDOR_ISSI_SUPPORTED=y +CONFIG_SPI_FLASH_VENDOR_MXIC_SUPPORTED=y +CONFIG_SPI_FLASH_VENDOR_WINBOND_SUPPORTED=y CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP=y CONFIG_SPI_FLASH_SUPPORT_MXIC_CHIP=y CONFIG_SPI_FLASH_SUPPORT_GD_CHIP=y @@ -1119,25 +1661,33 @@ CONFIG_SPIFFS_USE_MTIME=y # CONFIG_WS_TRANSPORT=y CONFIG_WS_BUFFER_SIZE=1024 +# CONFIG_WS_DYNAMIC_BUFFER is not set # end of Websocket # end of TCP Transport # -# TinyUSB +# Ultra Low Power (ULP) Co-processor # -# end of TinyUSB +# CONFIG_ULP_COPROC_ENABLED is not set +# end of Ultra Low Power (ULP) Co-processor # # Unity unit testing library # CONFIG_UNITY_ENABLE_FLOAT=y CONFIG_UNITY_ENABLE_DOUBLE=y +# CONFIG_UNITY_ENABLE_64BIT is not set # CONFIG_UNITY_ENABLE_COLOR is not set CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=y # CONFIG_UNITY_ENABLE_FIXTURE is not set # CONFIG_UNITY_ENABLE_BACKTRACE_ON_FAIL is not set # end of Unity unit testing library +# +# Root Hub configuration +# +# end of Root Hub configuration + # # Virtual file system # @@ -1146,12 +1696,12 @@ CONFIG_VFS_SUPPORT_DIR=y CONFIG_VFS_SUPPORT_SELECT=y CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT=y CONFIG_VFS_SUPPORT_TERMIOS=y +CONFIG_VFS_MAX_COUNT=8 # # Host File System I/O (Semihosting) # CONFIG_VFS_SEMIHOSTFS_MAX_MOUNT_POINTS=1 -CONFIG_VFS_SEMIHOSTFS_HOST_PATH_MAX_LEN=128 # end of Host File System I/O (Semihosting) # end of Virtual file system @@ -1168,23 +1718,26 @@ CONFIG_WL_SECTOR_SIZE=4096 # CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16 CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT=30 +# CONFIG_WIFI_PROV_BLE_FORCE_ENCRYPTION is not set +CONFIG_WIFI_PROV_STA_ALL_CHANNEL_SCAN=y +# CONFIG_WIFI_PROV_STA_FAST_SCAN is not set # end of Wi-Fi Provisioning Manager # -# Supplicant +# WebSocket Server # -CONFIG_WPA_MBEDTLS_CRYPTO=y -# CONFIG_WPA_WAPI_PSK is not set -# CONFIG_WPA_DEBUG_PRINT is not set -# CONFIG_WPA_TESTING_OPTIONS is not set -# CONFIG_WPA_WPS_STRICT is not set -# CONFIG_WPA_11KV_SUPPORT is not set -# CONFIG_WPA_DPP_SUPPORT is not set -# end of Supplicant +CONFIG_WEBSOCKET_SERVER_MAX_CLIENTS=1 +CONFIG_WEBSOCKET_SERVER_QUEUE_SIZE=2 +CONFIG_WEBSOCKET_SERVER_QUEUE_TIMEOUT=30 +CONFIG_WEBSOCKET_SERVER_TASK_STACK_DEPTH=3000 +CONFIG_WEBSOCKET_SERVER_TASK_PRIORITY=5 +# CONFIG_WEBSOCKET_SERVER_PINNED is not set +# end of WebSocket Server # # DSP Library # +CONFIG_DSP_OPTIMIZATIONS_SUPPORTED=y # CONFIG_DSP_ANSI is not set CONFIG_DSP_OPTIMIZED=y CONFIG_DSP_OPTIMIZATION=1 @@ -1199,32 +1752,51 @@ CONFIG_DSP_MAX_FFT_SIZE=4096 # end of DSP Library # -# WebSocket Server +# mDNS # -CONFIG_WEBSOCKET_SERVER_MAX_CLIENTS=1 -CONFIG_WEBSOCKET_SERVER_QUEUE_SIZE=2 -CONFIG_WEBSOCKET_SERVER_QUEUE_TIMEOUT=30 -CONFIG_WEBSOCKET_SERVER_TASK_STACK_DEPTH=3000 -CONFIG_WEBSOCKET_SERVER_TASK_PRIORITY=5 -# CONFIG_WEBSOCKET_SERVER_PINNED is not set -# end of WebSocket Server -# end of Component config +CONFIG_MDNS_MAX_INTERFACES=3 +CONFIG_MDNS_MAX_SERVICES=10 +CONFIG_MDNS_TASK_PRIORITY=1 +CONFIG_MDNS_ACTION_QUEUE_LEN=16 +CONFIG_MDNS_TASK_STACK_SIZE=2816 +CONFIG_MDNS_TASK_AFFINITY_NO_AFFINITY=y +# CONFIG_MDNS_TASK_AFFINITY_CPU0 is not set +# CONFIG_MDNS_TASK_AFFINITY_CPU1 is not set +CONFIG_MDNS_TASK_AFFINITY=0x7FFFFFFF +CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS=2000 +CONFIG_MDNS_TIMER_PERIOD_MS=100 +# CONFIG_MDNS_NETWORKING_SOCKET is not set +# CONFIG_MDNS_SKIP_SUPPRESSING_OWN_QUERIES is not set +# CONFIG_MDNS_ENABLE_DEBUG_PRINTS is not set +CONFIG_MDNS_ENABLE_CONSOLE_CLI=y +# CONFIG_MDNS_RESPOND_REVERSE_QUERIES is not set +CONFIG_MDNS_MULTIPLE_INSTANCE=y # -# Compatibility options +# MDNS Predefined interfaces # -# CONFIG_LEGACY_INCLUDE_COMMON_HEADERS is not set -# end of Compatibility options +CONFIG_MDNS_PREDEF_NETIF_STA=y +CONFIG_MDNS_PREDEF_NETIF_AP=y +CONFIG_MDNS_PREDEF_NETIF_ETH=y +# end of MDNS Predefined interfaces +# end of mDNS +# end of Component config + +# CONFIG_IDF_EXPERIMENTAL_FEATURES is not set # Deprecated options for backward compatibility -CONFIG_TOOLPREFIX="xtensa-esp32-elf-" +# CONFIG_APP_BUILD_TYPE_ELF_RAM is not set +# CONFIG_NO_BLOBS is not set +# CONFIG_ESP32_NO_BLOBS is not set +# CONFIG_ESP32_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set +# CONFIG_ESP32_COMPATIBLE_PRE_V3_1_BOOTLOADERS is not set # CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set +CONFIG_LOG_BOOTLOADER_LEVEL_ERROR=y # CONFIG_LOG_BOOTLOADER_LEVEL_WARN is not set -CONFIG_LOG_BOOTLOADER_LEVEL_INFO=y +# CONFIG_LOG_BOOTLOADER_LEVEL_INFO is not set # CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set # CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set -CONFIG_LOG_BOOTLOADER_LEVEL=3 +CONFIG_LOG_BOOTLOADER_LEVEL=1 CONFIG_APP_ROLLBACK_ENABLE=y # CONFIG_APP_ANTI_ROLLBACK is not set # CONFIG_FLASH_ENCRYPTION_ENABLED is not set @@ -1232,62 +1804,71 @@ CONFIG_FLASHMODE_QIO=y # CONFIG_FLASHMODE_QOUT is not set # CONFIG_FLASHMODE_DIO is not set # CONFIG_FLASHMODE_DOUT is not set -# CONFIG_MONITOR_BAUD_9600B is not set -# CONFIG_MONITOR_BAUD_57600B is not set -CONFIG_MONITOR_BAUD_115200B=y -# CONFIG_MONITOR_BAUD_230400B is not set -# CONFIG_MONITOR_BAUD_921600B is not set -# CONFIG_MONITOR_BAUD_2MB is not set -# CONFIG_MONITOR_BAUD_OTHER is not set -CONFIG_MONITOR_BAUD_OTHER_VAL=115200 CONFIG_MONITOR_BAUD=115200 +# CONFIG_OPTIMIZATION_LEVEL_DEBUG is not set # CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG is not set +# CONFIG_OPTIMIZATION_LEVEL_RELEASE is not set # CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE is not set CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED=y # CONFIG_OPTIMIZATION_ASSERTIONS_SILENT is not set # CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED is not set +CONFIG_OPTIMIZATION_ASSERTION_LEVEL=2 # CONFIG_CXX_EXCEPTIONS is not set CONFIG_STACK_CHECK_NONE=y # CONFIG_STACK_CHECK_NORM is not set # CONFIG_STACK_CHECK_STRONG is not set # CONFIG_STACK_CHECK_ALL is not set # CONFIG_WARN_WRITE_STRINGS is not set -# CONFIG_DISABLE_GCC8_WARNINGS is not set # CONFIG_ESP32_APPTRACE_DEST_TRAX is not set CONFIG_ESP32_APPTRACE_DEST_NONE=y CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y CONFIG_ADC2_DISABLE_DAC=y -# CONFIG_SPIRAM_SUPPORT is not set -CONFIG_TRACEMEM_RESERVE_DRAM=0x0 +# CONFIG_MCPWM_ISR_IN_IRAM is not set +# CONFIG_EVENT_LOOP_PROFILING is not set +CONFIG_POST_EVENTS_FROM_ISR=y +# CONFIG_POST_EVENTS_FROM_IRAM_ISR is not set +# CONFIG_OTA_ALLOW_HTTP is not set # CONFIG_TWO_UNIVERSAL_MAC_ADDRESS is not set CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4 -# CONFIG_ULP_COPROC_ENABLED is not set -CONFIG_ULP_COPROC_RESERVE_MEM=0 -CONFIG_BROWNOUT_DET=y -# CONFIG_BROWNOUT_DET_LVL_SEL_0 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_1 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_2 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_3 is not set -CONFIG_BROWNOUT_DET_LVL_SEL_4=y -# CONFIG_BROWNOUT_DET_LVL_SEL_5 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_6 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_7 is not set -CONFIG_BROWNOUT_DET_LVL=4 -CONFIG_REDUCE_PHY_TX_POWER=y +CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY=2000 +CONFIG_ESP32_RTC_CLK_SRC_INT_RC=y CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC=y +# CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS is not set # CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL is not set +# CONFIG_ESP32_RTC_CLK_SRC_EXT_OSC is not set # CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_OSC is not set +# CONFIG_ESP32_RTC_CLK_SRC_INT_8MD256 is not set # CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_8MD256 is not set -# CONFIG_DISABLE_BASIC_ROM_CONSOLE is not set -# CONFIG_NO_BLOBS is not set -# CONFIG_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set +CONFIG_ESP32_RTC_CLK_CAL_CYCLES=1024 +# CONFIG_ESP32_XTAL_FREQ_26 is not set +CONFIG_ESP32_XTAL_FREQ_40=y +# CONFIG_ESP32_XTAL_FREQ_AUTO is not set +CONFIG_ESP32_XTAL_FREQ=40 +CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y +# CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set +CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20 +CONFIG_ESP32_PHY_MAX_TX_POWER=20 +CONFIG_REDUCE_PHY_TX_POWER=y +CONFIG_ESP32_REDUCE_PHY_TX_POWER=y +CONFIG_SPIRAM_SUPPORT=y +CONFIG_ESP32_SPIRAM_SUPPORT=y +# CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST is not set +# CONFIG_ESP32_DEFAULT_CPU_FREQ_80 is not set +# CONFIG_ESP32_DEFAULT_CPU_FREQ_160 is not set +CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y +CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240 +CONFIG_TRACEMEM_RESERVE_DRAM=0x0 +# CONFIG_ESP32_PANIC_PRINT_HALT is not set +CONFIG_ESP32_PANIC_PRINT_REBOOT=y +# CONFIG_ESP32_PANIC_SILENT_REBOOT is not set +# CONFIG_ESP32_PANIC_GDBSTUB is not set CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32 CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=2304 -CONFIG_MAIN_TASK_STACK_SIZE=2560 -CONFIG_IPC_TASK_STACK_SIZE=1024 +CONFIG_MAIN_TASK_STACK_SIZE=3072 CONFIG_CONSOLE_UART_DEFAULT=y # CONFIG_CONSOLE_UART_CUSTOM is not set +# CONFIG_CONSOLE_UART_NONE is not set # CONFIG_ESP_CONSOLE_UART_NONE is not set CONFIG_CONSOLE_UART=y CONFIG_CONSOLE_UART_NUM=0 @@ -1296,42 +1877,81 @@ CONFIG_INT_WDT=y CONFIG_INT_WDT_TIMEOUT_MS=300 CONFIG_INT_WDT_CHECK_CPU1=y CONFIG_TASK_WDT=y +CONFIG_ESP_TASK_WDT=y # CONFIG_TASK_WDT_PANIC is not set CONFIG_TASK_WDT_TIMEOUT_S=5 CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1=y -# CONFIG_EVENT_LOOP_PROFILING is not set -CONFIG_POST_EVENTS_FROM_ISR=y -# CONFIG_POST_EVENTS_FROM_IRAM_ISR is not set -# CONFIG_ESP32S2_PANIC_PRINT_HALT is not set -CONFIG_ESP32S2_PANIC_PRINT_REBOOT=y -# CONFIG_ESP32S2_PANIC_SILENT_REBOOT is not set -# CONFIG_ESP32S2_PANIC_GDBSTUB is not set +# CONFIG_ESP32_DEBUG_STUBS_ENABLE is not set +CONFIG_ESP32_DEBUG_OCDAWARE=y +CONFIG_BROWNOUT_DET=y +CONFIG_ESP32_BROWNOUT_DET=y +# CONFIG_BROWNOUT_DET_LVL_SEL_0 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_0 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_1 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_1 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_2 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_2 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_3 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_3 is not set +CONFIG_BROWNOUT_DET_LVL_SEL_4=y +CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_4=y +# CONFIG_BROWNOUT_DET_LVL_SEL_5 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_5 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_6 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_6 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_7 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_7 is not set +CONFIG_BROWNOUT_DET_LVL=4 +CONFIG_ESP32_BROWNOUT_DET_LVL=4 +# CONFIG_DISABLE_BASIC_ROM_CONSOLE is not set +CONFIG_IPC_TASK_STACK_SIZE=1024 CONFIG_TIMER_TASK_STACK_SIZE=2048 +CONFIG_ESP32_WIFI_ENABLED=y +CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=8 +CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=64 +CONFIG_ESP32_WIFI_STATIC_TX_BUFFER=y +CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=0 +CONFIG_ESP32_WIFI_STATIC_TX_BUFFER_NUM=8 +CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM=32 +# CONFIG_ESP32_WIFI_CSI_ENABLED is not set +CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y +CONFIG_ESP32_WIFI_TX_BA_WIN=8 +CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y +CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y +CONFIG_ESP32_WIFI_RX_BA_WIN=16 +CONFIG_ESP32_WIFI_RX_BA_WIN=16 +# CONFIG_ESP32_WIFI_AMSDU_TX_ENABLED is not set +CONFIG_ESP32_WIFI_NVS_ENABLED=y +CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y +# CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1 is not set +CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752 +CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32 +# CONFIG_ESP32_WIFI_IRAM_OPT is not set +CONFIG_ESP32_WIFI_RX_IRAM_OPT=y +CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=y +CONFIG_ESP32_WIFI_ENABLE_WPA3_OWE_STA=y +CONFIG_WPA_MBEDTLS_CRYPTO=y +CONFIG_WPA_MBEDTLS_TLS_CLIENT=y +# CONFIG_WPA_WAPI_PSK is not set +# CONFIG_WPA_SUITE_B_192 is not set +# CONFIG_WPA_11KV_SUPPORT is not set +# CONFIG_WPA_MBO_SUPPORT is not set +# CONFIG_WPA_DPP_SUPPORT is not set +# CONFIG_WPA_11R_SUPPORT is not set +# CONFIG_WPA_WPS_SOFTAP_REGISTRAR is not set +# CONFIG_WPA_WPS_STRICT is not set +# CONFIG_WPA_DEBUG_PRINT is not set +# CONFIG_WPA_TESTING_OPTIONS is not set # CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set # CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y -CONFIG_MB_MASTER_TIMEOUT_MS_RESPOND=150 -CONFIG_MB_MASTER_DELAY_MS_CONVERT=200 -CONFIG_MB_QUEUE_LENGTH=20 -CONFIG_MB_SERIAL_TASK_STACK_SIZE=4096 -CONFIG_MB_SERIAL_BUF_SIZE=256 -CONFIG_MB_SERIAL_TASK_PRIO=10 -CONFIG_MB_CONTROLLER_SLAVE_ID_SUPPORT=y -CONFIG_MB_CONTROLLER_SLAVE_ID=0x00112233 -CONFIG_MB_CONTROLLER_NOTIFY_TIMEOUT=20 -CONFIG_MB_CONTROLLER_NOTIFY_QUEUE_SIZE=20 -CONFIG_MB_CONTROLLER_STACK_SIZE=4096 -CONFIG_MB_EVENT_QUEUE_TIMEOUT=20 -CONFIG_MB_TIMER_PORT_ENABLED=y -CONFIG_MB_TIMER_GROUP=0 -CONFIG_MB_TIMER_INDEX=0 -# CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK is not set CONFIG_TIMER_TASK_PRIORITY=1 CONFIG_TIMER_TASK_STACK_DEPTH=1536 CONFIG_TIMER_QUEUE_LENGTH=5 +# CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK is not set +# CONFIG_HAL_ASSERTION_SILIENT is not set # CONFIG_L2_TO_L3_COPY is not set -# CONFIG_USE_ONLY_LWIP_SELECT is not set CONFIG_ESP_GRATUITOUS_ARP=y CONFIG_GARP_TMR_INTERVAL=60 CONFIG_TCPIP_RECVMBOX_SIZE=32 @@ -1343,7 +1963,6 @@ CONFIG_TCP_SND_BUF_DEFAULT=11680 CONFIG_TCP_WND_DEFAULT=11680 CONFIG_TCP_RECVMBOX_SIZE=10 CONFIG_TCP_QUEUE_OOSEQ=y -# CONFIG_ESP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set CONFIG_TCP_OVERSIZE_MSS=y # CONFIG_TCP_OVERSIZE_QUARTER_MSS is not set # CONFIG_TCP_OVERSIZE_DISABLE is not set @@ -1354,6 +1973,12 @@ CONFIG_TCPIP_TASK_AFFINITY_CPU0=y # CONFIG_TCPIP_TASK_AFFINITY_CPU1 is not set CONFIG_TCPIP_TASK_AFFINITY=0x0 # CONFIG_PPP_SUPPORT is not set +CONFIG_ESP32_TIME_SYSCALL_USE_RTC_HRT=y +CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1=y +# CONFIG_ESP32_TIME_SYSCALL_USE_RTC is not set +# CONFIG_ESP32_TIME_SYSCALL_USE_HRT is not set +# CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 is not set +# CONFIG_ESP32_TIME_SYSCALL_USE_NONE is not set CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT=5 CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072 CONFIG_ESP32_PTHREAD_STACK_MIN=768 @@ -1365,8 +1990,8 @@ CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT="pthread" CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS=y # CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS is not set # CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED is not set +# CONFIG_ESP32_ULP_COPROC_ENABLED is not set CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT=y CONFIG_SUPPORT_TERMIOS=y CONFIG_SEMIHOSTFS_MAX_MOUNT_POINTS=1 -CONFIG_SEMIHOSTFS_HOST_PATH_MAX_LEN=128 # End of deprecated options diff --git a/sdkconfig_PSRAM_lyrat_v4.3 b/sdkconfig_PSRAM_lyrat_v4.3 index 11178dd6..34a40dfa 100644 --- a/sdkconfig_PSRAM_lyrat_v4.3 +++ b/sdkconfig_PSRAM_lyrat_v4.3 @@ -1,40 +1,237 @@ # # Automatically generated file. DO NOT EDIT. -# Espressif IoT Development Framework (ESP-IDF) Project Configuration -# +# Espressif IoT Development Framework (ESP-IDF) 5.1.1 Project Configuration +# +CONFIG_SOC_BROWNOUT_RESET_SUPPORTED="Not determined" +CONFIG_SOC_TWAI_BRP_DIV_SUPPORTED="Not determined" +CONFIG_SOC_DPORT_WORKAROUND="Not determined" +CONFIG_SOC_CAPS_ECO_VER_MAX=301 +CONFIG_SOC_ADC_SUPPORTED=y +CONFIG_SOC_DAC_SUPPORTED=y +CONFIG_SOC_UART_SUPPORTED=y +CONFIG_SOC_MCPWM_SUPPORTED=y +CONFIG_SOC_GPTIMER_SUPPORTED=y +CONFIG_SOC_SDMMC_HOST_SUPPORTED=y +CONFIG_SOC_BT_SUPPORTED=y +CONFIG_SOC_PCNT_SUPPORTED=y +CONFIG_SOC_WIFI_SUPPORTED=y +CONFIG_SOC_SDIO_SLAVE_SUPPORTED=y +CONFIG_SOC_TWAI_SUPPORTED=y +CONFIG_SOC_EMAC_SUPPORTED=y +CONFIG_SOC_ULP_SUPPORTED=y +CONFIG_SOC_CCOMP_TIMER_SUPPORTED=y +CONFIG_SOC_RTC_FAST_MEM_SUPPORTED=y +CONFIG_SOC_RTC_SLOW_MEM_SUPPORTED=y +CONFIG_SOC_RTC_MEM_SUPPORTED=y +CONFIG_SOC_I2S_SUPPORTED=y +CONFIG_SOC_RMT_SUPPORTED=y +CONFIG_SOC_SDM_SUPPORTED=y +CONFIG_SOC_GPSPI_SUPPORTED=y +CONFIG_SOC_LEDC_SUPPORTED=y +CONFIG_SOC_I2C_SUPPORTED=y +CONFIG_SOC_SUPPORT_COEXISTENCE=y +CONFIG_SOC_AES_SUPPORTED=y +CONFIG_SOC_MPI_SUPPORTED=y +CONFIG_SOC_SHA_SUPPORTED=y +CONFIG_SOC_FLASH_ENC_SUPPORTED=y +CONFIG_SOC_SECURE_BOOT_SUPPORTED=y +CONFIG_SOC_TOUCH_SENSOR_SUPPORTED=y +CONFIG_SOC_BOD_SUPPORTED=y +CONFIG_SOC_ULP_FSM_SUPPORTED=y +CONFIG_SOC_DPORT_WORKAROUND_DIS_INTERRUPT_LVL=5 +CONFIG_SOC_XTAL_SUPPORT_26M=y +CONFIG_SOC_XTAL_SUPPORT_40M=y +CONFIG_SOC_XTAL_SUPPORT_AUTO_DETECT=y +CONFIG_SOC_ADC_RTC_CTRL_SUPPORTED=y +CONFIG_SOC_ADC_DIG_CTRL_SUPPORTED=y +CONFIG_SOC_ADC_DMA_SUPPORTED=y +CONFIG_SOC_ADC_PERIPH_NUM=2 +CONFIG_SOC_ADC_MAX_CHANNEL_NUM=10 +CONFIG_SOC_ADC_ATTEN_NUM=4 +CONFIG_SOC_ADC_DIGI_CONTROLLER_NUM=2 +CONFIG_SOC_ADC_PATT_LEN_MAX=16 +CONFIG_SOC_ADC_DIGI_MIN_BITWIDTH=9 +CONFIG_SOC_ADC_DIGI_MAX_BITWIDTH=12 +CONFIG_SOC_ADC_DIGI_RESULT_BYTES=2 +CONFIG_SOC_ADC_DIGI_DATA_BYTES_PER_CONV=4 +CONFIG_SOC_ADC_SAMPLE_FREQ_THRES_HIGH=2 +CONFIG_SOC_ADC_SAMPLE_FREQ_THRES_LOW=20 +CONFIG_SOC_ADC_RTC_MIN_BITWIDTH=9 +CONFIG_SOC_ADC_RTC_MAX_BITWIDTH=12 +CONFIG_SOC_SHARED_IDCACHE_SUPPORTED=y +CONFIG_SOC_IDCACHE_PER_CORE=y +CONFIG_SOC_CPU_CORES_NUM=2 +CONFIG_SOC_CPU_INTR_NUM=32 +CONFIG_SOC_CPU_HAS_FPU=y +CONFIG_SOC_CPU_BREAKPOINTS_NUM=2 +CONFIG_SOC_CPU_WATCHPOINTS_NUM=2 +CONFIG_SOC_CPU_WATCHPOINT_SIZE=64 +CONFIG_SOC_DAC_CHAN_NUM=2 +CONFIG_SOC_DAC_RESOLUTION=8 +CONFIG_SOC_DAC_DMA_16BIT_ALIGN=y +CONFIG_SOC_GPIO_PORT=1 +CONFIG_SOC_GPIO_PIN_COUNT=40 +CONFIG_SOC_GPIO_VALID_GPIO_MASK=0xFFFFFFFFFF +CONFIG_SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK=0xEF0FEA +CONFIG_SOC_I2C_NUM=2 +CONFIG_SOC_I2C_FIFO_LEN=32 +CONFIG_SOC_I2C_CMD_REG_NUM=16 +CONFIG_SOC_I2C_SUPPORT_SLAVE=y +CONFIG_SOC_I2C_SUPPORT_APB=y +CONFIG_SOC_I2S_NUM=2 +CONFIG_SOC_I2S_HW_VERSION_1=y +CONFIG_SOC_I2S_SUPPORTS_APLL=y +CONFIG_SOC_I2S_SUPPORTS_PLL_F160M=y +CONFIG_SOC_I2S_SUPPORTS_PDM=y +CONFIG_SOC_I2S_SUPPORTS_PDM_TX=y +CONFIG_SOC_I2S_PDM_MAX_TX_LINES=1 +CONFIG_SOC_I2S_SUPPORTS_PDM_RX=y +CONFIG_SOC_I2S_PDM_MAX_RX_LINES=1 +CONFIG_SOC_I2S_SUPPORTS_ADC_DAC=y +CONFIG_SOC_I2S_SUPPORTS_ADC=y +CONFIG_SOC_I2S_SUPPORTS_DAC=y +CONFIG_SOC_I2S_SUPPORTS_LCD_CAMERA=y +CONFIG_SOC_I2S_TRANS_SIZE_ALIGN_WORD=y +CONFIG_SOC_I2S_LCD_I80_VARIANT=y +CONFIG_SOC_LCD_I80_SUPPORTED=y +CONFIG_SOC_LCD_I80_BUSES=2 +CONFIG_SOC_LCD_I80_BUS_WIDTH=24 +CONFIG_SOC_LEDC_HAS_TIMER_SPECIFIC_MUX=y +CONFIG_SOC_LEDC_SUPPORT_APB_CLOCK=y +CONFIG_SOC_LEDC_SUPPORT_REF_TICK=y +CONFIG_SOC_LEDC_SUPPORT_HS_MODE=y +CONFIG_SOC_LEDC_CHANNEL_NUM=8 +CONFIG_SOC_LEDC_TIMER_BIT_WIDTH=20 +CONFIG_SOC_MCPWM_GROUPS=2 +CONFIG_SOC_MCPWM_TIMERS_PER_GROUP=3 +CONFIG_SOC_MCPWM_OPERATORS_PER_GROUP=3 +CONFIG_SOC_MCPWM_COMPARATORS_PER_OPERATOR=2 +CONFIG_SOC_MCPWM_GENERATORS_PER_OPERATOR=2 +CONFIG_SOC_MCPWM_TRIGGERS_PER_OPERATOR=2 +CONFIG_SOC_MCPWM_GPIO_FAULTS_PER_GROUP=3 +CONFIG_SOC_MCPWM_CAPTURE_TIMERS_PER_GROUP=y +CONFIG_SOC_MCPWM_CAPTURE_CHANNELS_PER_TIMER=3 +CONFIG_SOC_MCPWM_GPIO_SYNCHROS_PER_GROUP=3 +CONFIG_SOC_MMU_PERIPH_NUM=2 +CONFIG_SOC_MMU_LINEAR_ADDRESS_REGION_NUM=3 +CONFIG_SOC_MPU_MIN_REGION_SIZE=0x20000000 +CONFIG_SOC_MPU_REGIONS_MAX_NUM=8 +CONFIG_SOC_PCNT_GROUPS=1 +CONFIG_SOC_PCNT_UNITS_PER_GROUP=8 +CONFIG_SOC_PCNT_CHANNELS_PER_UNIT=2 +CONFIG_SOC_PCNT_THRES_POINT_PER_UNIT=2 +CONFIG_SOC_RMT_GROUPS=1 +CONFIG_SOC_RMT_TX_CANDIDATES_PER_GROUP=8 +CONFIG_SOC_RMT_RX_CANDIDATES_PER_GROUP=8 +CONFIG_SOC_RMT_CHANNELS_PER_GROUP=8 +CONFIG_SOC_RMT_MEM_WORDS_PER_CHANNEL=64 +CONFIG_SOC_RMT_SUPPORT_REF_TICK=y +CONFIG_SOC_RMT_SUPPORT_APB=y +CONFIG_SOC_RMT_CHANNEL_CLK_INDEPENDENT=y +CONFIG_SOC_RTCIO_PIN_COUNT=18 +CONFIG_SOC_RTCIO_INPUT_OUTPUT_SUPPORTED=y +CONFIG_SOC_RTCIO_HOLD_SUPPORTED=y +CONFIG_SOC_RTCIO_WAKE_SUPPORTED=y +CONFIG_SOC_SDM_GROUPS=1 +CONFIG_SOC_SDM_CHANNELS_PER_GROUP=8 +CONFIG_SOC_SDM_CLK_SUPPORT_APB=y +CONFIG_SOC_SPI_HD_BOTH_INOUT_SUPPORTED=y +CONFIG_SOC_SPI_AS_CS_SUPPORTED=y +CONFIG_SOC_SPI_PERIPH_NUM=3 +CONFIG_SOC_SPI_DMA_CHAN_NUM=2 +CONFIG_SOC_SPI_MAX_CS_NUM=3 +CONFIG_SOC_SPI_SUPPORT_CLK_APB=y +CONFIG_SOC_SPI_MAXIMUM_BUFFER_SIZE=64 +CONFIG_SOC_SPI_MAX_PRE_DIVIDER=8192 +CONFIG_SOC_MEMSPI_SRC_FREQ_80M_SUPPORTED=y +CONFIG_SOC_MEMSPI_SRC_FREQ_40M_SUPPORTED=y +CONFIG_SOC_MEMSPI_SRC_FREQ_26M_SUPPORTED=y +CONFIG_SOC_MEMSPI_SRC_FREQ_20M_SUPPORTED=y +CONFIG_SOC_TIMER_GROUPS=2 +CONFIG_SOC_TIMER_GROUP_TIMERS_PER_GROUP=2 +CONFIG_SOC_TIMER_GROUP_COUNTER_BIT_WIDTH=64 +CONFIG_SOC_TIMER_GROUP_TOTAL_TIMERS=4 +CONFIG_SOC_TIMER_GROUP_SUPPORT_APB=y +CONFIG_SOC_TOUCH_VERSION_1=y +CONFIG_SOC_TOUCH_SENSOR_NUM=10 +CONFIG_SOC_TOUCH_PAD_MEASURE_WAIT_MAX=0xFF +CONFIG_SOC_TWAI_CONTROLLER_NUM=1 +CONFIG_SOC_TWAI_BRP_MIN=2 +CONFIG_SOC_TWAI_CLK_SUPPORT_APB=y +CONFIG_SOC_TWAI_SUPPORT_MULTI_ADDRESS_LAYOUT=y +CONFIG_SOC_UART_NUM=3 +CONFIG_SOC_UART_SUPPORT_APB_CLK=y +CONFIG_SOC_UART_SUPPORT_REF_TICK=y +CONFIG_SOC_UART_FIFO_LEN=128 +CONFIG_SOC_UART_BITRATE_MAX=5000000 +CONFIG_SOC_SPIRAM_SUPPORTED=y +CONFIG_SOC_SPI_MEM_SUPPORT_CONFIG_GPIO_BY_EFUSE=y +CONFIG_SOC_SHA_SUPPORT_PARALLEL_ENG=y +CONFIG_SOC_SHA_SUPPORT_SHA1=y +CONFIG_SOC_SHA_SUPPORT_SHA256=y +CONFIG_SOC_SHA_SUPPORT_SHA384=y +CONFIG_SOC_SHA_SUPPORT_SHA512=y +CONFIG_SOC_RSA_MAX_BIT_LEN=4096 +CONFIG_SOC_AES_SUPPORT_AES_128=y +CONFIG_SOC_AES_SUPPORT_AES_192=y +CONFIG_SOC_AES_SUPPORT_AES_256=y +CONFIG_SOC_SECURE_BOOT_V1=y +CONFIG_SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS=y +CONFIG_SOC_FLASH_ENCRYPTED_XTS_AES_BLOCK_MAX=32 +CONFIG_SOC_PHY_DIG_REGS_MEM_SIZE=21 +CONFIG_SOC_PM_SUPPORT_EXT0_WAKEUP=y +CONFIG_SOC_PM_SUPPORT_EXT1_WAKEUP=y +CONFIG_SOC_PM_SUPPORT_EXT_WAKEUP=y +CONFIG_SOC_PM_SUPPORT_TOUCH_SENSOR_WAKEUP=y +CONFIG_SOC_PM_SUPPORT_RTC_PERIPH_PD=y +CONFIG_SOC_PM_SUPPORT_RTC_FAST_MEM_PD=y +CONFIG_SOC_PM_SUPPORT_RTC_SLOW_MEM_PD=y +CONFIG_SOC_PM_SUPPORT_RC_FAST_PD=y +CONFIG_SOC_PM_SUPPORT_VDDSDIO_PD=y +CONFIG_SOC_PM_SUPPORT_MODEM_PD=y +CONFIG_SOC_CONFIGURABLE_VDDSDIO_SUPPORTED=y +CONFIG_SOC_CLK_APLL_SUPPORTED=y +CONFIG_SOC_APLL_MULTIPLIER_OUT_MIN_HZ=350000000 +CONFIG_SOC_APLL_MULTIPLIER_OUT_MAX_HZ=500000000 +CONFIG_SOC_APLL_MIN_HZ=5303031 +CONFIG_SOC_APLL_MAX_HZ=125000000 +CONFIG_SOC_CLK_RC_FAST_D256_SUPPORTED=y +CONFIG_SOC_RTC_SLOW_CLK_SUPPORT_RC_FAST_D256=y +CONFIG_SOC_CLK_RC_FAST_SUPPORT_CALIBRATION=y +CONFIG_SOC_CLK_XTAL32K_SUPPORTED=y +CONFIG_SOC_SDMMC_USE_IOMUX=y +CONFIG_SOC_SDMMC_NUM_SLOTS=2 +CONFIG_SOC_WIFI_WAPI_SUPPORT=y +CONFIG_SOC_WIFI_CSI_SUPPORT=y +CONFIG_SOC_WIFI_MESH_SUPPORT=y +CONFIG_SOC_WIFI_SUPPORT_VARIABLE_BEACON_WINDOW=y +CONFIG_SOC_WIFI_NAN_SUPPORT=y +CONFIG_SOC_BLE_SUPPORTED=y +CONFIG_SOC_BLE_MESH_SUPPORTED=y +CONFIG_SOC_BT_CLASSIC_SUPPORTED=y +CONFIG_SOC_BLUFI_SUPPORTED=y +CONFIG_SOC_ULP_HAS_ADC=y CONFIG_IDF_CMAKE=y CONFIG_IDF_TARGET_ARCH_XTENSA=y +CONFIG_IDF_TARGET_ARCH="xtensa" CONFIG_IDF_TARGET="esp32" CONFIG_IDF_TARGET_ESP32=y CONFIG_IDF_FIRMWARE_CHIP_ID=0x0000 -# -# SDK tool configuration -# -CONFIG_SDK_TOOLPREFIX="xtensa-esp32-elf-" -# CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS is not set -# end of SDK tool configuration - # # Build type # CONFIG_APP_BUILD_TYPE_APP_2NDBOOT=y -# CONFIG_APP_BUILD_TYPE_ELF_RAM is not set +# CONFIG_APP_BUILD_TYPE_RAM is not set CONFIG_APP_BUILD_GENERATE_BINARIES=y CONFIG_APP_BUILD_BOOTLOADER=y CONFIG_APP_BUILD_USE_FLASH_SECTIONS=y +# CONFIG_APP_REPRODUCIBLE_BUILD is not set +# CONFIG_APP_NO_BLOBS is not set +# CONFIG_APP_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set +# CONFIG_APP_COMPATIBLE_PRE_V3_1_BOOTLOADERS is not set # end of Build type -# -# Application manager -# -CONFIG_APP_COMPILE_TIME_DATE=y -# CONFIG_APP_EXCLUDE_PROJECT_VER_VAR is not set -# CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR is not set -# CONFIG_APP_PROJECT_VER_FROM_CONFIG is not set -CONFIG_APP_RETRIEVE_LEN_ELF_SHA=16 -# end of Application manager - # # Bootloader config # @@ -44,17 +241,18 @@ CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set # CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE is not set # CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set -# CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set +CONFIG_BOOTLOADER_LOG_LEVEL_ERROR=y # CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set -CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y +# CONFIG_BOOTLOADER_LOG_LEVEL_INFO is not set # CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set # CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set -CONFIG_BOOTLOADER_LOG_LEVEL=3 +CONFIG_BOOTLOADER_LOG_LEVEL=1 # CONFIG_BOOTLOADER_SPI_CUSTOM_WP_PIN is not set CONFIG_BOOTLOADER_SPI_WP_PIN=7 CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y # CONFIG_BOOTLOADER_FACTORY_RESET is not set # CONFIG_BOOTLOADER_APP_TEST is not set +CONFIG_BOOTLOADER_REGION_PROTECTION_ENABLE=y CONFIG_BOOTLOADER_WDT_ENABLE=y # CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE is not set CONFIG_BOOTLOADER_WDT_TIME_MS=9000 @@ -71,20 +269,39 @@ CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT=y # # Security features # +CONFIG_SECURE_BOOT_V1_SUPPORTED=y # CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT is not set # CONFIG_SECURE_BOOT is not set # CONFIG_SECURE_FLASH_ENC_ENABLED is not set # end of Security features +# +# Application manager +# +CONFIG_APP_COMPILE_TIME_DATE=y +# CONFIG_APP_EXCLUDE_PROJECT_VER_VAR is not set +# CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR is not set +# CONFIG_APP_PROJECT_VER_FROM_CONFIG is not set +CONFIG_APP_RETRIEVE_LEN_ELF_SHA=16 +# end of Application manager + +CONFIG_ESP_ROM_HAS_CRC_LE=y +CONFIG_ESP_ROM_HAS_CRC_BE=y +CONFIG_ESP_ROM_HAS_MZ_CRC32=y +CONFIG_ESP_ROM_HAS_JPEG_DECODE=y +CONFIG_ESP_ROM_HAS_UART_BUF_SWITCH=y +CONFIG_ESP_ROM_NEEDS_SWSETUP_WORKAROUND=y +CONFIG_ESP_ROM_HAS_NEWLIB_NANO_FORMAT=y + # # Serial flasher config # -CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200 # CONFIG_ESPTOOLPY_NO_STUB is not set CONFIG_ESPTOOLPY_FLASHMODE_QIO=y # CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set # CONFIG_ESPTOOLPY_FLASHMODE_DIO is not set # CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set +CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR=y CONFIG_ESPTOOLPY_FLASHMODE="dio" CONFIG_ESPTOOLPY_FLASHFREQ_80M=y # CONFIG_ESPTOOLPY_FLASHFREQ_40M is not set @@ -96,23 +313,17 @@ CONFIG_ESPTOOLPY_FLASHFREQ="80m" CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y # CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set # CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set CONFIG_ESPTOOLPY_FLASHSIZE="4MB" -CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y +# CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE is not set CONFIG_ESPTOOLPY_BEFORE_RESET=y # CONFIG_ESPTOOLPY_BEFORE_NORESET is not set CONFIG_ESPTOOLPY_BEFORE="default_reset" CONFIG_ESPTOOLPY_AFTER_RESET=y # CONFIG_ESPTOOLPY_AFTER_NORESET is not set CONFIG_ESPTOOLPY_AFTER="hard_reset" -# CONFIG_ESPTOOLPY_MONITOR_BAUD_CONSOLE is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_9600B is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_57600B is not set -CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y -# CONFIG_ESPTOOLPY_MONITOR_BAUD_230400B is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_921600B is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_2MB is not set -# CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER is not set -CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER_VAL=115200 CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 # end of Serial flasher config @@ -120,6 +331,7 @@ CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 # Partition Table # # CONFIG_PARTITION_TABLE_SINGLE_APP is not set +# CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set # CONFIG_PARTITION_TABLE_TWO_OTA is not set CONFIG_PARTITION_TABLE_CUSTOM=y CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" @@ -129,7 +341,22 @@ CONFIG_PARTITION_TABLE_MD5=y # end of Partition Table # -# Audio HAL +# Snapclient Configuration +# +CONFIG_SNAPSERVER_USE_MDNS=y +CONFIG_SNAPCLIENT_NAME="esp-snapclient" + +# +# HTTP Server Setting +# +CONFIG_WEB_PORT=8000 +# end of HTTP Server Setting + +CONFIG_USE_SAMPLE_INSERTION=y +# end of Snapclient Configuration + +# +# Audio Board # # CONFIG_AUDIO_BOARD_CUSTOM is not set CONFIG_ESP_LYRAT_V4_3_BOARD=y @@ -139,7 +366,8 @@ CONFIG_ESP_LYRAT_V4_3_BOARD=y # CONFIG_ESP_LYRAT_MINI_V1_1_BOARD is not set # CONFIG_ESP32_KORVO_DU1906_BOARD is not set # CONFIG_ESP32_S2_KALUGA_1_V1_2_BOARD is not set -# end of Audio HAL +# CONFIG_ESP_AI_THINKER_ES8388_BOARD is not set +# end of Audio Board # # ESP32 DSP processor config @@ -164,24 +392,11 @@ CONFIG_SNTP_SERVER="pool.ntp.org" # Wifi Configuration # # CONFIG_ENABLE_WIFI_PROVISIONING is not set -CONFIG_WIFI_SSID="test" -CONFIG_WIFI_PASSWORD="12345678" +CONFIG_WIFI_SSID="" +CONFIG_WIFI_PASSWORD="" CONFIG_WIFI_MAXIMUM_RETRY=0 # end of Wifi Configuration -# -# Snapclient Configuration -# -CONFIG_SNAPSERVER_USE_MDNS=y -CONFIG_SNAPCLIENT_NAME="esp-snapclient" - -# -# HTTP Server Setting -# -CONFIG_WEB_PORT=8000 -# end of HTTP Server Setting -# end of Snapclient Configuration - # # Compiler options # @@ -192,6 +407,10 @@ CONFIG_COMPILER_OPTIMIZATION_PERF=y CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y # CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT is not set # CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE is not set +CONFIG_COMPILER_FLOAT_LIB_FROM_GCCLIB=y +CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2 +# CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT is not set +CONFIG_COMPILER_HIDE_PATHS_MACROS=y # CONFIG_COMPILER_CXX_EXCEPTIONS is not set # CONFIG_COMPILER_CXX_RTTI is not set CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y @@ -199,7 +418,7 @@ CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y # CONFIG_COMPILER_STACK_CHECK_MODE_STRONG is not set # CONFIG_COMPILER_STACK_CHECK_MODE_ALL is not set # CONFIG_COMPILER_WARN_WRITE_STRINGS is not set -# CONFIG_COMPILER_DISABLE_GCC8_WARNINGS is not set +# CONFIG_COMPILER_DISABLE_GCC12_WARNINGS is not set # CONFIG_COMPILER_DUMP_RTL_FILES is not set # end of Compiler options @@ -212,15 +431,13 @@ CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y # # CONFIG_APPTRACE_DEST_JTAG is not set CONFIG_APPTRACE_DEST_NONE=y +# CONFIG_APPTRACE_DEST_UART1 is not set +# CONFIG_APPTRACE_DEST_UART2 is not set +CONFIG_APPTRACE_DEST_UART_NONE=y +CONFIG_APPTRACE_UART_TASK_PRIO=1 CONFIG_APPTRACE_LOCK_ENABLE=y # end of Application Level Tracing -# -# ESP-ASIO -# -# CONFIG_ASIO_SSL_SUPPORT is not set -# end of ESP-ASIO - # # Bluetooth # @@ -228,36 +445,35 @@ CONFIG_APPTRACE_LOCK_ENABLE=y # end of Bluetooth # -# CoAP Configuration +# Driver Configurations # -CONFIG_COAP_MBEDTLS_PSK=y -# CONFIG_COAP_MBEDTLS_PKI is not set -# CONFIG_COAP_MBEDTLS_DEBUG is not set -CONFIG_COAP_LOG_DEFAULT_LEVEL=0 -# end of CoAP Configuration # -# Driver configurations +# Legacy ADC Configuration # +CONFIG_ADC_DISABLE_DAC=y +# CONFIG_ADC_SUPPRESS_DEPRECATE_WARN is not set # -# ADC configuration +# Legacy ADC Calibration Configuration # -# CONFIG_ADC_FORCE_XPD_FSM is not set -CONFIG_ADC_DISABLE_DAC=y -# end of ADC configuration +CONFIG_ADC_CAL_EFUSE_TP_ENABLE=y +CONFIG_ADC_CAL_EFUSE_VREF_ENABLE=y +CONFIG_ADC_CAL_LUT_ENABLE=y +# CONFIG_ADC_CALI_SUPPRESS_DEPRECATE_WARN is not set +# end of Legacy ADC Calibration Configuration +# end of Legacy ADC Configuration # -# SPI configuration +# SPI Configuration # -# CONFIG_SPI_MASTER_IN_IRAM is not set CONFIG_SPI_MASTER_ISR_IN_IRAM=y # CONFIG_SPI_SLAVE_IN_IRAM is not set # CONFIG_SPI_SLAVE_ISR_IN_IRAM is not set -# end of SPI configuration +# end of SPI Configuration # -# TWAI configuration +# TWAI Configuration # # CONFIG_TWAI_ISR_IN_IRAM is not set # CONFIG_TWAI_ERRATA_FIX_BUS_OFF_REC is not set @@ -265,26 +481,82 @@ CONFIG_SPI_MASTER_ISR_IN_IRAM=y # CONFIG_TWAI_ERRATA_FIX_RX_FRAME_INVALID is not set # CONFIG_TWAI_ERRATA_FIX_RX_FIFO_CORRUPT is not set # CONFIG_TWAI_ERRATA_FIX_LISTEN_ONLY_DOM is not set -# end of TWAI configuration +# end of TWAI Configuration # -# UART configuration +# UART Configuration # # CONFIG_UART_ISR_IN_IRAM is not set -# end of UART configuration - -# -# RTCIO configuration -# -# CONFIG_RTCIO_SUPPORT_RTC_GPIO_DESC is not set -# end of RTCIO configuration +# end of UART Configuration # # GPIO Configuration # # CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL is not set +# CONFIG_GPIO_CTRL_FUNC_IN_IRAM is not set # end of GPIO Configuration -# end of Driver configurations + +# +# Sigma Delta Modulator Configuration +# +# CONFIG_SDM_CTRL_FUNC_IN_IRAM is not set +# CONFIG_SDM_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_SDM_ENABLE_DEBUG_LOG is not set +# end of Sigma Delta Modulator Configuration + +# +# GPTimer Configuration +# +# CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM is not set +# CONFIG_GPTIMER_ISR_IRAM_SAFE is not set +# CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_GPTIMER_ENABLE_DEBUG_LOG is not set +# end of GPTimer Configuration + +# +# PCNT Configuration +# +# CONFIG_PCNT_CTRL_FUNC_IN_IRAM is not set +# CONFIG_PCNT_ISR_IRAM_SAFE is not set +# CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_PCNT_ENABLE_DEBUG_LOG is not set +# end of PCNT Configuration + +# +# RMT Configuration +# +# CONFIG_RMT_ISR_IRAM_SAFE is not set +# CONFIG_RMT_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_RMT_ENABLE_DEBUG_LOG is not set +# end of RMT Configuration + +# +# MCPWM Configuration +# +# CONFIG_MCPWM_ISR_IRAM_SAFE is not set +# CONFIG_MCPWM_CTRL_FUNC_IN_IRAM is not set +# CONFIG_MCPWM_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_MCPWM_ENABLE_DEBUG_LOG is not set +# end of MCPWM Configuration + +# +# I2S Configuration +# +# CONFIG_I2S_ISR_IRAM_SAFE is not set +# CONFIG_I2S_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_I2S_ENABLE_DEBUG_LOG is not set +# end of I2S Configuration + +# +# DAC Configuration +# +# CONFIG_DAC_CTRL_FUNC_IN_IRAM is not set +# CONFIG_DAC_ISR_IRAM_SAFE is not set +# CONFIG_DAC_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_DAC_ENABLE_DEBUG_LOG is not set +CONFIG_DAC_DMA_AUTO_16BIT_ALIGN=y +# end of DAC Configuration +# end of Driver Configurations # # eFuse Bit Manager @@ -302,174 +574,38 @@ CONFIG_EFUSE_MAX_BLK_LEN=192 # CONFIG_ESP_TLS_USING_MBEDTLS=y # CONFIG_ESP_TLS_USE_SECURE_ELEMENT is not set +# CONFIG_ESP_TLS_CLIENT_SESSION_TICKETS is not set # CONFIG_ESP_TLS_SERVER is not set # CONFIG_ESP_TLS_PSK_VERIFICATION is not set # CONFIG_ESP_TLS_INSECURE is not set # end of ESP-TLS # -# ESP32-specific +# ADC and ADC Calibration # -CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y -CONFIG_ESP32_REV_MIN_0=y -# CONFIG_ESP32_REV_MIN_1 is not set -# CONFIG_ESP32_REV_MIN_1_1 is not set -# CONFIG_ESP32_REV_MIN_2 is not set -# CONFIG_ESP32_REV_MIN_3 is not set -# CONFIG_ESP32_REV_MIN_3_1 is not set -CONFIG_ESP32_REV_MIN=0 -CONFIG_ESP32_REV_MIN_FULL=0 -CONFIG_ESP_REV_MIN_FULL=0 -CONFIG_ESP32_REV_MAX_FULL_STR_OPT=y -CONFIG_ESP32_REV_MAX_FULL=399 -CONFIG_ESP_REV_MAX_FULL=399 -CONFIG_ESP32_DPORT_WORKAROUND=y -# CONFIG_ESP32_DEFAULT_CPU_FREQ_80 is not set -# CONFIG_ESP32_DEFAULT_CPU_FREQ_160 is not set -CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y -CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240 -CONFIG_ESP32_SPIRAM_SUPPORT=y +# CONFIG_ADC_ONESHOT_CTRL_FUNC_IN_IRAM is not set +# CONFIG_ADC_CONTINUOUS_ISR_IRAM_SAFE is not set # -# SPI RAM config +# ADC Calibration Configurations # -CONFIG_SPIRAM_TYPE_AUTO=y -# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set -# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set -CONFIG_SPIRAM_SIZE=-1 -# CONFIG_SPIRAM_SPEED_40M is not set -CONFIG_SPIRAM_SPEED_80M=y -CONFIG_SPIRAM=y -CONFIG_SPIRAM_BOOT_INIT=y -# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set -# CONFIG_SPIRAM_USE_MEMMAP is not set -# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set -CONFIG_SPIRAM_USE_MALLOC=y -CONFIG_SPIRAM_MEMTEST=y -CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=16384 -# CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is not set -CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768 -# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set -CONFIG_SPIRAM_CACHE_WORKAROUND=y +CONFIG_ADC_CALI_EFUSE_TP_ENABLE=y +CONFIG_ADC_CALI_EFUSE_VREF_ENABLE=y +CONFIG_ADC_CALI_LUT_ENABLE=y +# end of ADC Calibration Configurations -# -# SPIRAM cache workaround debugging -# -CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_MEMW=y -# CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_DUPLDST is not set -# CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_NOPS is not set -# end of SPIRAM cache workaround debugging - -CONFIG_SPIRAM_BANKSWITCH_ENABLE=y -CONFIG_SPIRAM_BANKSWITCH_RESERVE=8 -# CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY is not set -# CONFIG_SPIRAM_OCCUPY_HSPI_HOST is not set -CONFIG_SPIRAM_OCCUPY_VSPI_HOST=y -# CONFIG_SPIRAM_OCCUPY_NO_HOST is not set - -# -# PSRAM clock and cs IO for ESP32-DOWD -# -CONFIG_D0WD_PSRAM_CLK_IO=17 -CONFIG_D0WD_PSRAM_CS_IO=16 -# end of PSRAM clock and cs IO for ESP32-DOWD - -# -# PSRAM clock and cs IO for ESP32-D2WD -# -CONFIG_D2WD_PSRAM_CLK_IO=9 -CONFIG_D2WD_PSRAM_CS_IO=10 -# end of PSRAM clock and cs IO for ESP32-D2WD - -# -# PSRAM clock and cs IO for ESP32-PICO -# -CONFIG_PICO_PSRAM_CS_IO=10 -# end of PSRAM clock and cs IO for ESP32-PICO - -# CONFIG_SPIRAM_2T_MODE is not set -# end of SPI RAM config - -# CONFIG_ESP32_TRAX is not set -CONFIG_ESP32_TRACEMEM_RESERVE_DRAM=0x0 -# CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_TWO is not set -CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR=y -CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES=4 -# CONFIG_ESP32_ULP_COPROC_ENABLED is not set -CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=0 -CONFIG_ESP32_DEBUG_OCDAWARE=y -CONFIG_ESP32_BROWNOUT_DET=y -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_0 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_1 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_2 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_3 is not set -CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_4=y -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_5 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_6 is not set -# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_7 is not set -CONFIG_ESP32_BROWNOUT_DET_LVL=4 -CONFIG_ESP32_REDUCE_PHY_TX_POWER=y -CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1=y -# CONFIG_ESP32_TIME_SYSCALL_USE_RTC is not set -# CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 is not set -# CONFIG_ESP32_TIME_SYSCALL_USE_NONE is not set -CONFIG_ESP32_RTC_CLK_SRC_INT_RC=y -# CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS is not set -# CONFIG_ESP32_RTC_CLK_SRC_EXT_OSC is not set -# CONFIG_ESP32_RTC_CLK_SRC_INT_8MD256 is not set -CONFIG_ESP32_RTC_CLK_CAL_CYCLES=1024 -CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY=2000 -CONFIG_ESP32_XTAL_FREQ_40=y -# CONFIG_ESP32_XTAL_FREQ_26 is not set -# CONFIG_ESP32_XTAL_FREQ_AUTO is not set -CONFIG_ESP32_XTAL_FREQ=40 -# CONFIG_ESP32_DISABLE_BASIC_ROM_CONSOLE is not set -# CONFIG_ESP32_NO_BLOBS is not set -# CONFIG_ESP32_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set -# CONFIG_ESP32_COMPATIBLE_PRE_V3_1_BOOTLOADERS is not set -# CONFIG_ESP32_USE_FIXED_STATIC_RAM_SIZE is not set -CONFIG_ESP32_DPORT_DIS_INTERRUPT_LVL=5 -# end of ESP32-specific +CONFIG_ADC_DISABLE_DAC_OUTPUT=y +# end of ADC and ADC Calibration # -# ADC-Calibration +# Wireless Coexistence # -CONFIG_ADC_CAL_EFUSE_TP_ENABLE=y -CONFIG_ADC_CAL_EFUSE_VREF_ENABLE=y -CONFIG_ADC_CAL_LUT_ENABLE=y -# end of ADC-Calibration +# end of Wireless Coexistence # # Common ESP-related # CONFIG_ESP_ERR_TO_NAME_LOOKUP=y -CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32 -CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304 -CONFIG_ESP_MAIN_TASK_STACK_SIZE=2560 -CONFIG_ESP_IPC_TASK_STACK_SIZE=1024 -CONFIG_ESP_IPC_USES_CALLERS_PRIORITY=y -CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE=2048 -CONFIG_ESP_CONSOLE_UART_DEFAULT=y -# CONFIG_ESP_CONSOLE_UART_CUSTOM is not set -# CONFIG_ESP_CONSOLE_NONE is not set -CONFIG_ESP_CONSOLE_UART=y -CONFIG_ESP_CONSOLE_MULTIPLE_UART=y -CONFIG_ESP_CONSOLE_UART_NUM=0 -CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 -CONFIG_ESP_INT_WDT=y -CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 -CONFIG_ESP_INT_WDT_CHECK_CPU1=y -CONFIG_ESP_TASK_WDT=y -# CONFIG_ESP_TASK_WDT_PANIC is not set -CONFIG_ESP_TASK_WDT_TIMEOUT_S=5 -CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y -CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=y -# CONFIG_ESP_PANIC_HANDLER_IRAM is not set -CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA=y -CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP=y -CONFIG_ESP_MAC_ADDR_UNIVERSE_BT=y -CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y # end of Common ESP-related # @@ -478,7 +614,6 @@ CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y CONFIG_ETH_ENABLED=y CONFIG_ETH_USE_ESP32_EMAC=y CONFIG_ETH_PHY_INTERFACE_RMII=y -# CONFIG_ETH_PHY_INTERFACE_MII is not set CONFIG_ETH_RMII_CLK_INPUT=y # CONFIG_ETH_RMII_CLK_OUTPUT is not set CONFIG_ETH_RMII_CLK_IN_GPIO=0 @@ -489,7 +624,9 @@ CONFIG_ETH_DMA_TX_BUFFER_NUM=5 CONFIG_ETH_USE_SPI_ETHERNET=y # CONFIG_ETH_SPI_ETHERNET_DM9051 is not set # CONFIG_ETH_SPI_ETHERNET_W5500 is not set +# CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL is not set # CONFIG_ETH_USE_OPENETH is not set +# CONFIG_ETH_TRANSMIT_MUTEX is not set # end of Ethernet # @@ -510,6 +647,7 @@ CONFIG_ESP_EVENT_POST_FROM_ISR=y # CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=y # CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set +# CONFIG_ESP_HTTP_CLIENT_ENABLE_DIGEST_AUTH is not set # end of ESP HTTP client # @@ -521,12 +659,14 @@ CONFIG_HTTPD_ERR_RESP_NO_DELAY=y CONFIG_HTTPD_PURGE_BUF_LEN=32 # CONFIG_HTTPD_LOG_PURGE_DATA is not set # CONFIG_HTTPD_WS_SUPPORT is not set +# CONFIG_HTTPD_QUEUE_WORK_BLOCKING is not set # end of HTTP Server # # ESP HTTPS OTA # -# CONFIG_OTA_ALLOW_HTTP is not set +# CONFIG_ESP_HTTPS_OTA_DECRYPT_CB is not set +# CONFIG_ESP_HTTPS_OTA_ALLOW_HTTP is not set # end of ESP HTTPS OTA # @@ -535,96 +675,394 @@ CONFIG_HTTPD_PURGE_BUF_LEN=32 # CONFIG_ESP_HTTPS_SERVER_ENABLE is not set # end of ESP HTTPS server +# +# Hardware Settings +# + +# +# Chip revision +# +CONFIG_ESP32_REV_MIN_0=y +# CONFIG_ESP32_REV_MIN_1 is not set +# CONFIG_ESP32_REV_MIN_1_1 is not set +# CONFIG_ESP32_REV_MIN_2 is not set +# CONFIG_ESP32_REV_MIN_3 is not set +# CONFIG_ESP32_REV_MIN_3_1 is not set +CONFIG_ESP32_REV_MIN=0 +CONFIG_ESP32_REV_MIN_FULL=0 +CONFIG_ESP_REV_MIN_FULL=0 + +# +# Maximum Supported ESP32 Revision (Rev v3.99) +# +CONFIG_ESP32_REV_MAX_FULL=399 +CONFIG_ESP_REV_MAX_FULL=399 +# end of Chip revision + +# +# MAC Config +# +CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA=y +CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP=y +CONFIG_ESP_MAC_ADDR_UNIVERSE_BT=y +CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y +CONFIG_ESP_MAC_UNIVERSAL_MAC_ADDRESSES_FOUR=y +# CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_TWO is not set +CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR=y +CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES=4 +# CONFIG_ESP_MAC_IGNORE_MAC_CRC_ERROR is not set +# end of MAC Config + +# +# Sleep Config +# +CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND=y +CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND=y +# CONFIG_ESP_SLEEP_MSPI_NEED_ALL_IO_PU is not set +CONFIG_ESP_SLEEP_RTC_BUS_ISO_WORKAROUND=y +# CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set +CONFIG_ESP_SLEEP_DEEP_SLEEP_WAKEUP_DELAY=2000 +# end of Sleep Config + +# +# RTC Clock Config +# +CONFIG_RTC_CLK_SRC_INT_RC=y +# CONFIG_RTC_CLK_SRC_EXT_CRYS is not set +# CONFIG_RTC_CLK_SRC_EXT_OSC is not set +# CONFIG_RTC_CLK_SRC_INT_8MD256 is not set +CONFIG_RTC_CLK_CAL_CYCLES=1024 +# end of RTC Clock Config + +# +# Peripheral Control +# +CONFIG_PERIPH_CTRL_FUNC_IN_IRAM=y +# end of Peripheral Control + +# +# Main XTAL Config +# +# CONFIG_XTAL_FREQ_26 is not set +CONFIG_XTAL_FREQ_40=y +# CONFIG_XTAL_FREQ_AUTO is not set +CONFIG_XTAL_FREQ=40 +# end of Main XTAL Config +# end of Hardware Settings + +# +# LCD and Touch Panel +# + +# +# LCD Touch Drivers are maintained in the IDF Component Registry +# + +# +# LCD Peripheral Configuration +# +CONFIG_LCD_PANEL_IO_FORMAT_BUF_SIZE=32 +# CONFIG_LCD_ENABLE_DEBUG_LOG is not set +# end of LCD Peripheral Configuration +# end of LCD and Touch Panel + # # ESP NETIF Adapter # CONFIG_ESP_NETIF_IP_LOST_TIMER_INTERVAL=120 CONFIG_ESP_NETIF_TCPIP_LWIP=y # CONFIG_ESP_NETIF_LOOPBACK is not set -CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=y +CONFIG_ESP_NETIF_USES_TCPIP_WITH_BSD_API=y +# CONFIG_ESP_NETIF_RECEIVE_REPORT_ERRORS is not set +# CONFIG_ESP_NETIF_L2_TAP is not set +# CONFIG_ESP_NETIF_BRIDGE_EN is not set # end of ESP NETIF Adapter +# +# Partition API Configuration +# +# end of Partition API Configuration + +# +# PHY +# +CONFIG_ESP_PHY_CALIBRATION_AND_DATA_STORAGE=y +# CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION is not set +CONFIG_ESP_PHY_MAX_WIFI_TX_POWER=20 +CONFIG_ESP_PHY_MAX_TX_POWER=20 +CONFIG_ESP_PHY_REDUCE_TX_POWER=y +CONFIG_ESP_PHY_RF_CAL_PARTIAL=y +# CONFIG_ESP_PHY_RF_CAL_NONE is not set +# CONFIG_ESP_PHY_RF_CAL_FULL is not set +CONFIG_ESP_PHY_CALIBRATION_MODE=0 +# end of PHY + # # Power Management # # CONFIG_PM_ENABLE is not set # end of Power Management +# +# ESP PSRAM +# +CONFIG_SPIRAM=y + +# +# SPI RAM config +# +CONFIG_SPIRAM_MODE_QUAD=y +CONFIG_SPIRAM_TYPE_AUTO=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +# CONFIG_SPIRAM_SPEED_40M is not set +CONFIG_SPIRAM_SPEED_80M=y +CONFIG_SPIRAM_SPEED=80 +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +# CONFIG_SPIRAM_USE_MEMMAP is not set +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +CONFIG_SPIRAM_USE_MALLOC=y +CONFIG_SPIRAM_MEMTEST=y +CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=2048 +# CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is not set +CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768 +# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set +CONFIG_SPIRAM_CACHE_WORKAROUND=y + +# +# SPIRAM cache workaround debugging +# +CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_MEMW=y +# CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_DUPLDST is not set +# CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_NOPS is not set +# end of SPIRAM cache workaround debugging + +# +# SPIRAM workaround libraries placement +# +CONFIG_SPIRAM_CACHE_LIBJMP_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBMATH_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBNUMPARSER_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBIO_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBTIME_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBCHAR_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBMEM_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBSTR_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBRAND_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBENV_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBFILE_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBMISC_IN_IRAM=y +# end of SPIRAM workaround libraries placement + +CONFIG_SPIRAM_BANKSWITCH_ENABLE=y +CONFIG_SPIRAM_BANKSWITCH_RESERVE=8 +# CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY is not set +# CONFIG_SPIRAM_OCCUPY_HSPI_HOST is not set +CONFIG_SPIRAM_OCCUPY_VSPI_HOST=y +# CONFIG_SPIRAM_OCCUPY_NO_HOST is not set + +# +# PSRAM clock and cs IO for ESP32-DOWD +# +CONFIG_D0WD_PSRAM_CLK_IO=17 +CONFIG_D0WD_PSRAM_CS_IO=16 +# end of PSRAM clock and cs IO for ESP32-DOWD + +# +# PSRAM clock and cs IO for ESP32-D2WD +# +CONFIG_D2WD_PSRAM_CLK_IO=9 +CONFIG_D2WD_PSRAM_CS_IO=10 +# end of PSRAM clock and cs IO for ESP32-D2WD + +# +# PSRAM clock and cs IO for ESP32-PICO +# +CONFIG_PICO_PSRAM_CS_IO=10 +# end of PSRAM clock and cs IO for ESP32-PICO + +# CONFIG_SPIRAM_2T_MODE is not set +# end of SPI RAM config +# end of ESP PSRAM + +# +# ESP Ringbuf +# +# CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH is not set +# end of ESP Ringbuf + # # ESP System Settings # -# CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT is not set -CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y -# CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set -# CONFIG_ESP_SYSTEM_PANIC_GDBSTUB is not set -# CONFIG_ESP_SYSTEM_PSRAM_LEAKAGE_WORKAROUND is not set -# CONFIG_ESP_SYSTEM_FLASH_LEAKAGE_WORKAROUND is not set +# CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_80 is not set +# CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_160 is not set +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ=240 # -# RTC Clock Config +# Memory # -# end of RTC Clock Config +# CONFIG_ESP32_USE_FIXED_STATIC_RAM_SIZE is not set # -# Memory protection +# Non-backward compatible options # -# end of Memory protection -# end of ESP System Settings +# CONFIG_ESP_SYSTEM_ESP32_SRAM1_REGION_AS_IRAM is not set +# end of Non-backward compatible options +# end of Memory # -# High resolution timer (esp_timer) +# Trace memory # -# CONFIG_ESP_TIMER_PROFILING is not set -CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER=y -CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER=y -CONFIG_ESP_TIMER_TASK_STACK_SIZE=2048 -# CONFIG_ESP_TIMER_IMPL_FRC2 is not set -CONFIG_ESP_TIMER_IMPL_TG0_LAC=y -# end of High resolution timer (esp_timer) +# CONFIG_ESP32_TRAX is not set +CONFIG_ESP32_TRACEMEM_RESERVE_DRAM=0x0 +# end of Trace memory + +# CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT is not set +CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y +# CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set +# CONFIG_ESP_SYSTEM_PANIC_GDBSTUB is not set +# CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME is not set +CONFIG_ESP_SYSTEM_PANIC_REBOOT_DELAY_SECONDS=0 # -# Wi-Fi +# Memory protection # -CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=8 -CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=64 -CONFIG_ESP32_WIFI_STATIC_TX_BUFFER=y -CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=0 -CONFIG_ESP32_WIFI_STATIC_TX_BUFFER_NUM=8 -CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM=32 -# CONFIG_ESP32_WIFI_CSI_ENABLED is not set -CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y -CONFIG_ESP32_WIFI_TX_BA_WIN=8 -CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y -CONFIG_ESP32_WIFI_RX_BA_WIN=16 -# CONFIG_ESP32_WIFI_AMSDU_TX_ENABLED is not set -CONFIG_ESP32_WIFI_NVS_ENABLED=y -CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y -# CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1 is not set -CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752 -CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32 -# CONFIG_WIFI_LOG_DEFAULT_LEVEL_NONE is not set -# CONFIG_WIFI_LOG_DEFAULT_LEVEL_ERROR is not set -# CONFIG_WIFI_LOG_DEFAULT_LEVEL_WARN is not set -CONFIG_WIFI_LOG_DEFAULT_LEVEL_INFO=y -# CONFIG_WIFI_LOG_DEFAULT_LEVEL_DEBUG is not set -# CONFIG_WIFI_LOG_DEFAULT_LEVEL_VERBOSE is not set -# CONFIG_ESP32_WIFI_IRAM_OPT is not set -CONFIG_ESP32_WIFI_RX_IRAM_OPT=y -CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=y +# end of Memory protection + +CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32 +CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=3072 +CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0=y +# CONFIG_ESP_MAIN_TASK_AFFINITY_CPU1 is not set +# CONFIG_ESP_MAIN_TASK_AFFINITY_NO_AFFINITY is not set +CONFIG_ESP_MAIN_TASK_AFFINITY=0x0 +CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE=2048 +CONFIG_ESP_CONSOLE_UART_DEFAULT=y +# CONFIG_ESP_CONSOLE_UART_CUSTOM is not set +# CONFIG_ESP_CONSOLE_NONE is not set +CONFIG_ESP_CONSOLE_UART=y +CONFIG_ESP_CONSOLE_MULTIPLE_UART=y +CONFIG_ESP_CONSOLE_UART_NUM=0 +CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 +CONFIG_ESP_INT_WDT=y +CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 +CONFIG_ESP_INT_WDT_CHECK_CPU1=y +CONFIG_ESP_TASK_WDT_EN=y +CONFIG_ESP_TASK_WDT_INIT=y +# CONFIG_ESP_TASK_WDT_PANIC is not set +CONFIG_ESP_TASK_WDT_TIMEOUT_S=5 +CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y +CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=y +# CONFIG_ESP_PANIC_HANDLER_IRAM is not set +# CONFIG_ESP_DEBUG_STUBS_ENABLE is not set +CONFIG_ESP_DEBUG_OCDAWARE=y +# CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set +CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_4=y + +# +# Brownout Detector +# +CONFIG_ESP_BROWNOUT_DET=y +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_0 is not set +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_1 is not set +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_2 is not set +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_3 is not set +CONFIG_ESP_BROWNOUT_DET_LVL_SEL_4=y +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_5 is not set +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_6 is not set +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_7 is not set +CONFIG_ESP_BROWNOUT_DET_LVL=4 +# end of Brownout Detector + +# CONFIG_ESP32_DISABLE_BASIC_ROM_CONSOLE is not set +CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y +CONFIG_ESP_SYSTEM_BROWNOUT_INTR=y +# end of ESP System Settings + +# +# IPC (Inter-Processor Call) +# +CONFIG_ESP_IPC_TASK_STACK_SIZE=1024 +CONFIG_ESP_IPC_USES_CALLERS_PRIORITY=y +CONFIG_ESP_IPC_ISR_ENABLE=y +# end of IPC (Inter-Processor Call) + +# +# High resolution timer (esp_timer) +# +# CONFIG_ESP_TIMER_PROFILING is not set +CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER=y +CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER=y +CONFIG_ESP_TIMER_TASK_STACK_SIZE=2048 +CONFIG_ESP_TIMER_INTERRUPT_LEVEL=1 +# CONFIG_ESP_TIMER_SHOW_EXPERIMENTAL is not set +CONFIG_ESP_TIMER_TASK_AFFINITY=0x0 +CONFIG_ESP_TIMER_TASK_AFFINITY_CPU0=y +CONFIG_ESP_TIMER_ISR_AFFINITY=0x1 +CONFIG_ESP_TIMER_ISR_AFFINITY_CPU0=y +# CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD is not set +CONFIG_ESP_TIMER_IMPL_TG0_LAC=y +# end of High resolution timer (esp_timer) + +# +# Wi-Fi +# +CONFIG_ESP_WIFI_ENABLED=y +CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=8 +CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=64 +CONFIG_ESP_WIFI_STATIC_TX_BUFFER=y +CONFIG_ESP_WIFI_TX_BUFFER_TYPE=0 +CONFIG_ESP_WIFI_STATIC_TX_BUFFER_NUM=8 +CONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM=32 +# CONFIG_ESP_WIFI_CSI_ENABLED is not set +CONFIG_ESP_WIFI_AMPDU_TX_ENABLED=y +CONFIG_ESP_WIFI_TX_BA_WIN=8 +CONFIG_ESP_WIFI_AMPDU_RX_ENABLED=y +CONFIG_ESP_WIFI_RX_BA_WIN=16 +# CONFIG_ESP_WIFI_AMSDU_TX_ENABLED is not set +CONFIG_ESP_WIFI_NVS_ENABLED=y +CONFIG_ESP_WIFI_TASK_PINNED_TO_CORE_0=y +# CONFIG_ESP_WIFI_TASK_PINNED_TO_CORE_1 is not set +CONFIG_ESP_WIFI_SOFTAP_BEACON_MAX_LEN=752 +CONFIG_ESP_WIFI_MGMT_SBUF_NUM=32 +# CONFIG_ESP_WIFI_IRAM_OPT is not set +CONFIG_ESP_WIFI_RX_IRAM_OPT=y +CONFIG_ESP_WIFI_ENABLE_WPA3_SAE=y +CONFIG_ESP_WIFI_ENABLE_SAE_PK=y +CONFIG_ESP_WIFI_SOFTAP_SAE_SUPPORT=y +CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_STA=y # CONFIG_ESP_WIFI_SLP_IRAM_OPT is not set # CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE is not set +# CONFIG_ESP_WIFI_GMAC_SUPPORT is not set +CONFIG_ESP_WIFI_SOFTAP_SUPPORT=y # CONFIG_ESP_WIFI_SLP_BEACON_LOST_OPT is not set +CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=7 +# CONFIG_ESP_WIFI_NAN_ENABLE is not set +CONFIG_ESP_WIFI_MBEDTLS_CRYPTO=y +CONFIG_ESP_WIFI_MBEDTLS_TLS_CLIENT=y +# CONFIG_ESP_WIFI_WAPI_PSK is not set +# CONFIG_ESP_WIFI_SUITE_B_192 is not set +# CONFIG_ESP_WIFI_11KV_SUPPORT is not set +# CONFIG_ESP_WIFI_MBO_SUPPORT is not set +# CONFIG_ESP_WIFI_DPP_SUPPORT is not set +# CONFIG_ESP_WIFI_11R_SUPPORT is not set +# CONFIG_ESP_WIFI_WPS_SOFTAP_REGISTRAR is not set + +# +# WPS Configuration Options +# +# CONFIG_ESP_WIFI_WPS_STRICT is not set +# CONFIG_ESP_WIFI_WPS_PASSPHRASE is not set +# end of WPS Configuration Options + +# CONFIG_ESP_WIFI_DEBUG_PRINT is not set +# CONFIG_ESP_WIFI_TESTING_OPTIONS is not set # end of Wi-Fi -# -# PHY -# -CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y -# CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set -CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20 -CONFIG_ESP32_PHY_MAX_TX_POWER=20 -# end of PHY - # # Core dump # @@ -636,6 +1074,12 @@ CONFIG_ESP_COREDUMP_ENABLE_TO_NONE=y # # FAT Filesystem support # +CONFIG_FATFS_VOLUME_COUNT=2 +CONFIG_FATFS_LFN_NONE=y +# CONFIG_FATFS_LFN_HEAP is not set +# CONFIG_FATFS_LFN_STACK is not set +# CONFIG_FATFS_SECTOR_512 is not set +CONFIG_FATFS_SECTOR_4096=y # CONFIG_FATFS_CODEPAGE_DYNAMIC is not set CONFIG_FATFS_CODEPAGE_437=y # CONFIG_FATFS_CODEPAGE_720 is not set @@ -659,88 +1103,78 @@ CONFIG_FATFS_CODEPAGE_437=y # CONFIG_FATFS_CODEPAGE_949 is not set # CONFIG_FATFS_CODEPAGE_950 is not set CONFIG_FATFS_CODEPAGE=437 -CONFIG_FATFS_LFN_NONE=y -# CONFIG_FATFS_LFN_HEAP is not set -# CONFIG_FATFS_LFN_STACK is not set CONFIG_FATFS_FS_LOCK=0 CONFIG_FATFS_TIMEOUT_MS=10000 CONFIG_FATFS_PER_FILE_CACHE=y CONFIG_FATFS_ALLOC_PREFER_EXTRAM=y # CONFIG_FATFS_USE_FASTSEEK is not set +CONFIG_FATFS_VFS_FSTAT_BLKSIZE=0 # end of FAT Filesystem support # -# Modbus configuration -# -CONFIG_FMB_COMM_MODE_TCP_EN=y -CONFIG_FMB_TCP_PORT_DEFAULT=502 -CONFIG_FMB_TCP_PORT_MAX_CONN=5 -CONFIG_FMB_TCP_CONNECTION_TOUT_SEC=20 -CONFIG_FMB_COMM_MODE_RTU_EN=y -CONFIG_FMB_COMM_MODE_ASCII_EN=y -CONFIG_FMB_MASTER_TIMEOUT_MS_RESPOND=150 -CONFIG_FMB_MASTER_DELAY_MS_CONVERT=200 -CONFIG_FMB_QUEUE_LENGTH=20 -CONFIG_FMB_PORT_TASK_STACK_SIZE=4096 -CONFIG_FMB_SERIAL_BUF_SIZE=256 -CONFIG_FMB_SERIAL_ASCII_BITS_PER_SYMB=8 -CONFIG_FMB_SERIAL_ASCII_TIMEOUT_RESPOND_MS=1000 -CONFIG_FMB_PORT_TASK_PRIO=10 -# CONFIG_FMB_PORT_TASK_AFFINITY_NO_AFFINITY is not set -CONFIG_FMB_PORT_TASK_AFFINITY_CPU0=y -# CONFIG_FMB_PORT_TASK_AFFINITY_CPU1 is not set -CONFIG_FMB_PORT_TASK_AFFINITY=0x0 -CONFIG_FMB_CONTROLLER_SLAVE_ID_SUPPORT=y -CONFIG_FMB_CONTROLLER_SLAVE_ID=0x00112233 -CONFIG_FMB_CONTROLLER_NOTIFY_TIMEOUT=20 -CONFIG_FMB_CONTROLLER_NOTIFY_QUEUE_SIZE=20 -CONFIG_FMB_CONTROLLER_STACK_SIZE=4096 -CONFIG_FMB_EVENT_QUEUE_TIMEOUT=20 -CONFIG_FMB_TIMER_PORT_ENABLED=y -CONFIG_FMB_TIMER_GROUP=0 -CONFIG_FMB_TIMER_INDEX=0 -CONFIG_FMB_MASTER_TIMER_GROUP=0 -CONFIG_FMB_MASTER_TIMER_INDEX=0 -# CONFIG_FMB_TIMER_ISR_IN_IRAM is not set -# end of Modbus configuration +# FreeRTOS +# # -# FreeRTOS +# Kernel # +# CONFIG_FREERTOS_SMP is not set # CONFIG_FREERTOS_UNICORE is not set -CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF -CONFIG_FREERTOS_CORETIMER_0=y -# CONFIG_FREERTOS_CORETIMER_1 is not set CONFIG_FREERTOS_HZ=1000 -CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION=y # CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE is not set # CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL is not set CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY=y -# CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK is not set -CONFIG_FREERTOS_INTERRUPT_BACKTRACE=y CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 -# CONFIG_FREERTOS_ASSERT_FAIL_ABORT is not set -# CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE is not set -CONFIG_FREERTOS_ASSERT_DISABLE=y CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=768 -CONFIG_FREERTOS_ISR_STACKSIZE=1536 -# CONFIG_FREERTOS_LEGACY_HOOKS is not set +# CONFIG_FREERTOS_USE_IDLE_HOOK is not set +# CONFIG_FREERTOS_USE_TICK_HOOK is not set CONFIG_FREERTOS_MAX_TASK_NAME_LEN=10 -CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y -# CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP is not set +CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY=y CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=1536 CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=5 CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 +CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=1 # CONFIG_FREERTOS_USE_TRACE_FACILITY is not set # CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set +# end of Kernel + +# +# Port +# +# CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK is not set +CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS=y +# CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP is not set CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y -# CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set +CONFIG_FREERTOS_ISR_STACKSIZE=1536 +CONFIG_FREERTOS_INTERRUPT_BACKTRACE=y +# CONFIG_FREERTOS_FPU_IN_ISR is not set +CONFIG_FREERTOS_TICK_SUPPORT_CORETIMER=y +CONFIG_FREERTOS_CORETIMER_0=y +# CONFIG_FREERTOS_CORETIMER_1 is not set +CONFIG_FREERTOS_SYSTICK_USES_CCOUNT=y CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y +# CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH is not set +# CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set +CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT=y +# end of Port + +CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF +CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y CONFIG_FREERTOS_DEBUG_OCDAWARE=y -# CONFIG_FREERTOS_FPU_IN_ISR is not set # end of FreeRTOS +# +# Hardware Abstraction Layer (HAL) and Low Level (LL) +# +CONFIG_HAL_ASSERTION_EQUALS_SYSTEM=y +# CONFIG_HAL_ASSERTION_DISABLE is not set +# CONFIG_HAL_ASSERTION_SILENT is not set +# CONFIG_HAL_ASSERTION_ENABLE is not set +CONFIG_HAL_DEFAULT_ASSERTION_LEVEL=2 +CONFIG_HAL_SPI_MASTER_FUNC_IN_IRAM=y +# end of Hardware Abstraction Layer (HAL) and Low Level (LL) + # # Heap memory debugging # @@ -750,20 +1184,13 @@ CONFIG_HEAP_POISONING_DISABLED=y CONFIG_HEAP_TRACING_OFF=y # CONFIG_HEAP_TRACING_STANDALONE is not set # CONFIG_HEAP_TRACING_TOHOST is not set +# CONFIG_HEAP_USE_HOOKS is not set # CONFIG_HEAP_ABORT_WHEN_ALLOCATION_FAILS is not set +# CONFIG_HEAP_PLACE_FUNCTION_INTO_FLASH is not set # end of Heap memory debugging -# -# jsmn -# -# CONFIG_JSMN_PARENT_LINKS is not set -# CONFIG_JSMN_STRICT is not set -# end of jsmn - -# -# libsodium -# -# end of libsodium +CONFIG_IEEE802154_CCA_THRESHOLD=-60 +CONFIG_IEEE802154_PENDING_TABLE_SIZE=20 # # Log output @@ -775,6 +1202,10 @@ CONFIG_LOG_DEFAULT_LEVEL_INFO=y # CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set # CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set CONFIG_LOG_DEFAULT_LEVEL=3 +CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y +# CONFIG_LOG_MAXIMUM_LEVEL_DEBUG is not set +# CONFIG_LOG_MAXIMUM_LEVEL_VERBOSE is not set +CONFIG_LOG_MAXIMUM_LEVEL=3 CONFIG_LOG_COLORS=y CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y # CONFIG_LOG_TIMESTAMP_SOURCE_SYSTEM is not set @@ -784,6 +1215,9 @@ CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y # LWIP # CONFIG_LWIP_LOCAL_HOSTNAME="espressif" +# CONFIG_LWIP_NETIF_API is not set +# CONFIG_LWIP_TCPIP_CORE_LOCKING is not set +# CONFIG_LWIP_CHECK_THREAD_SAFETY is not set CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y # CONFIG_LWIP_L2_TO_L3_COPY is not set # CONFIG_LWIP_IRAM_OPTIMIZATION is not set @@ -799,15 +1233,20 @@ CONFIG_LWIP_IP4_FRAG=y CONFIG_LWIP_IP6_FRAG=y # CONFIG_LWIP_IP4_REASSEMBLY is not set # CONFIG_LWIP_IP6_REASSEMBLY is not set +CONFIG_LWIP_IP_REASS_MAX_PBUFS=10 # CONFIG_LWIP_IP_FORWARD is not set # CONFIG_LWIP_STATS is not set -# CONFIG_LWIP_ETHARP_TRUST_IP_MAC is not set CONFIG_LWIP_ESP_GRATUITOUS_ARP=y CONFIG_LWIP_GARP_TMR_INTERVAL=60 +CONFIG_LWIP_ESP_MLDV6_REPORT=y +CONFIG_LWIP_MLDV6_TMR_INTERVAL=40 CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32 CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y # CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set +CONFIG_LWIP_DHCP_DISABLE_VENDOR_CLASS_ID=y # CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set +CONFIG_LWIP_DHCP_OPTIONS_LEN=68 +CONFIG_LWIP_NUM_NETIF_CLIENT_DATA=0 CONFIG_LWIP_DHCP_COARSE_TIMER_SECS=1 # @@ -819,8 +1258,12 @@ CONFIG_LWIP_DHCPS_MAX_STATION_NUM=8 # end of DHCP server # CONFIG_LWIP_AUTOIP is not set +CONFIG_LWIP_IPV4=y CONFIG_LWIP_IPV6=y # CONFIG_LWIP_IPV6_AUTOCONFIG is not set +CONFIG_LWIP_IPV6_NUM_ADDRESSES=3 +# CONFIG_LWIP_IPV6_FORWARD is not set +# CONFIG_LWIP_NETIF_STATUS_CALLBACK is not set CONFIG_LWIP_NETIF_LOOPBACK=y CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 @@ -841,7 +1284,6 @@ CONFIG_LWIP_TCP_WND_DEFAULT=11680 CONFIG_LWIP_TCP_RECVMBOX_SIZE=10 CONFIG_LWIP_TCP_QUEUE_OOSEQ=y CONFIG_LWIP_TCP_SACK_OUT=y -# CONFIG_LWIP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set CONFIG_LWIP_TCP_OVERSIZE_MSS=y # CONFIG_LWIP_TCP_OVERSIZE_QUARTER_MSS is not set # CONFIG_LWIP_TCP_OVERSIZE_DISABLE is not set @@ -890,10 +1332,12 @@ CONFIG_LWIP_MAX_RAW_PCBS=16 # # SNTP # -CONFIG_LWIP_DHCP_MAX_NTP_SERVERS=1 +CONFIG_LWIP_SNTP_MAX_SERVERS=1 +# CONFIG_LWIP_DHCP_GET_NTP_SRV is not set CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000 # end of SNTP +CONFIG_LWIP_BRIDGEIF_MAX_PORTS=7 CONFIG_LWIP_ESP_LWIP_ASSERT=y # @@ -905,9 +1349,18 @@ CONFIG_LWIP_HOOK_TCP_ISN_DEFAULT=y CONFIG_LWIP_HOOK_IP6_ROUTE_NONE=y # CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT is not set # CONFIG_LWIP_HOOK_IP6_ROUTE_CUSTOM is not set +CONFIG_LWIP_HOOK_ND6_GET_GW_NONE=y +# CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT is not set +# CONFIG_LWIP_HOOK_ND6_GET_GW_CUSTOM is not set +CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_NONE=y +# CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_DEFAULT is not set +# CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_CUSTOM is not set CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_NONE=y # CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_DEFAULT is not set # CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_CUSTOM is not set +CONFIG_LWIP_HOOK_IP6_INPUT_NONE=y +# CONFIG_LWIP_HOOK_IP6_INPUT_DEFAULT is not set +# CONFIG_LWIP_HOOK_IP6_INPUT_CUSTOM is not set # end of Hooks # CONFIG_LWIP_DEBUG is not set @@ -927,13 +1380,15 @@ CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096 # CONFIG_MBEDTLS_DEBUG is not set # -# mbedTLS v2.28.x related +# mbedTLS v3.x related # +# CONFIG_MBEDTLS_SSL_PROTO_TLS1_3 is not set # CONFIG_MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH is not set # CONFIG_MBEDTLS_X509_TRUSTED_CERT_CALLBACK is not set # CONFIG_MBEDTLS_SSL_CONTEXT_SERIALIZATION is not set CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE=y -# end of mbedTLS v2.28.x related +CONFIG_MBEDTLS_PKCS7_C=y +# end of mbedTLS v3.x related # # Certificate Bundle @@ -950,6 +1405,7 @@ CONFIG_MBEDTLS_ROM_MD5=y # CONFIG_MBEDTLS_ATCA_HW_ECDSA_SIGN is not set # CONFIG_MBEDTLS_ATCA_HW_ECDSA_VERIFY is not set CONFIG_MBEDTLS_HAVE_TIME=y +# CONFIG_MBEDTLS_PLATFORM_TIME_ALT is not set # CONFIG_MBEDTLS_HAVE_TIME_DATE is not set CONFIG_MBEDTLS_ECDSA_DETERMINISTIC=y CONFIG_MBEDTLS_SHA512_C=y @@ -966,7 +1422,6 @@ CONFIG_MBEDTLS_TLS_ENABLED=y # # CONFIG_MBEDTLS_PSK_MODES is not set CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y -CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA=y CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE=y CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA=y CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA=y @@ -975,15 +1430,11 @@ CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA=y # end of TLS Key Exchange Methods CONFIG_MBEDTLS_SSL_RENEGOTIATION=y -# CONFIG_MBEDTLS_SSL_PROTO_SSL3 is not set -CONFIG_MBEDTLS_SSL_PROTO_TLS1=y -CONFIG_MBEDTLS_SSL_PROTO_TLS1_1=y CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y +# CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set # CONFIG_MBEDTLS_SSL_PROTO_DTLS is not set CONFIG_MBEDTLS_SSL_ALPN=y CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS=y -CONFIG_MBEDTLS_X509_CHECK_KEY_USAGE=y -CONFIG_MBEDTLS_X509_CHECK_EXTENDED_KEY_USAGE=y CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS=y # @@ -992,9 +1443,6 @@ CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS=y CONFIG_MBEDTLS_AES_C=y # CONFIG_MBEDTLS_CAMELLIA_C is not set # CONFIG_MBEDTLS_DES_C is not set -CONFIG_MBEDTLS_RC4_DISABLED=y -# CONFIG_MBEDTLS_RC4_ENABLED_NO_DEFAULT is not set -# CONFIG_MBEDTLS_RC4_ENABLED is not set # CONFIG_MBEDTLS_BLOWFISH_C is not set # CONFIG_MBEDTLS_XTEA_C is not set CONFIG_MBEDTLS_CCM_C=y @@ -1014,6 +1462,7 @@ CONFIG_MBEDTLS_X509_CSR_PARSE_C=y # end of Certificates CONFIG_MBEDTLS_ECP_C=y +# CONFIG_MBEDTLS_DHM_C is not set CONFIG_MBEDTLS_ECDH_C=y CONFIG_MBEDTLS_ECDSA_C=y # CONFIG_MBEDTLS_ECJPAKE_C is not set @@ -1038,25 +1487,11 @@ CONFIG_MBEDTLS_ECP_NIST_OPTIM=y # CONFIG_MBEDTLS_SECURITY_RISKS is not set # end of mbedTLS -# -# mDNS -# -CONFIG_MDNS_MAX_SERVICES=10 -CONFIG_MDNS_TASK_PRIORITY=1 -CONFIG_MDNS_TASK_STACK_SIZE=2816 -CONFIG_MDNS_TASK_AFFINITY_NO_AFFINITY=y -# CONFIG_MDNS_TASK_AFFINITY_CPU0 is not set -# CONFIG_MDNS_TASK_AFFINITY_CPU1 is not set -CONFIG_MDNS_TASK_AFFINITY=0x7FFFFFFF -CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS=2000 -# CONFIG_MDNS_STRICT_MODE is not set -CONFIG_MDNS_TIMER_PERIOD_MS=100 -# end of mDNS - # # ESP-MQTT Configurations # CONFIG_MQTT_PROTOCOL_311=y +# CONFIG_MQTT_PROTOCOL_5 is not set CONFIG_MQTT_TRANSPORT_SSL=y CONFIG_MQTT_TRANSPORT_WEBSOCKET=y CONFIG_MQTT_TRANSPORT_WEBSOCKET_SECURE=y @@ -1078,21 +1513,42 @@ CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF=y # CONFIG_NEWLIB_STDIN_LINE_ENDING_LF is not set CONFIG_NEWLIB_STDIN_LINE_ENDING_CR=y # CONFIG_NEWLIB_NANO_FORMAT is not set +CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC_HRT=y +# CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC is not set +# CONFIG_NEWLIB_TIME_SYSCALL_USE_HRT is not set +# CONFIG_NEWLIB_TIME_SYSCALL_USE_NONE is not set # end of Newlib # # NVS # +# CONFIG_NVS_ASSERT_ERROR_CHECK is not set # end of NVS # -# OpenSSL +# OpenThread +# +# CONFIG_OPENTHREAD_ENABLED is not set + +# +# Thread Operational Dataset # -# CONFIG_OPENSSL_DEBUG is not set -CONFIG_OPENSSL_ERROR_STACK=y -# CONFIG_OPENSSL_ASSERT_DO_NOTHING is not set -CONFIG_OPENSSL_ASSERT_EXIT=y -# end of OpenSSL +CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread-ESP" +CONFIG_OPENTHREAD_NETWORK_CHANNEL=15 +CONFIG_OPENTHREAD_NETWORK_PANID=0x1234 +CONFIG_OPENTHREAD_NETWORK_EXTPANID="dead00beef00cafe" +CONFIG_OPENTHREAD_NETWORK_MASTERKEY="00112233445566778899aabbccddeeff" +CONFIG_OPENTHREAD_NETWORK_PSKC="104810e2315100afd6bc9215a6bfac53" +# end of Thread Operational Dataset +# end of OpenThread + +# +# Protocomm +# +CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_0=y +CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_1=y +CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_2=y +# end of Protocomm # # PThreads @@ -1107,6 +1563,14 @@ CONFIG_PTHREAD_TASK_CORE_DEFAULT=-1 CONFIG_PTHREAD_TASK_NAME_DEFAULT="pthread" # end of PThreads +# +# MMU Config +# +CONFIG_MMU_PAGE_SIZE_64KB=y +CONFIG_MMU_PAGE_MODE="64KB" +CONFIG_MMU_PAGE_SIZE=0x10000 +# end of MMU Config + # # SPI Flash driver # @@ -1116,7 +1580,6 @@ CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS=y # CONFIG_SPI_FLASH_DANGEROUS_WRITE_FAILS is not set # CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED is not set -# CONFIG_SPI_FLASH_USE_LEGACY_IMPL is not set # CONFIG_SPI_FLASH_SHARE_SPI1_BUS is not set # CONFIG_SPI_FLASH_BYPASS_BLOCK_ERASE is not set CONFIG_SPI_FLASH_YIELD_DURING_ERASE=y @@ -1125,10 +1588,23 @@ CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=1 CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=8192 # CONFIG_SPI_FLASH_SIZE_OVERRIDE is not set # CONFIG_SPI_FLASH_CHECK_ERASE_TIMEOUT_DISABLED is not set +# CONFIG_SPI_FLASH_OVERRIDE_CHIP_DRIVER_LIST is not set + +# +# SPI Flash behavior when brownout +# +CONFIG_SPI_FLASH_BROWNOUT_RESET_XMC=y +CONFIG_SPI_FLASH_BROWNOUT_RESET=y +# end of SPI Flash behavior when brownout # # Auto-detect flash chips # +CONFIG_SPI_FLASH_VENDOR_XMC_SUPPORTED=y +CONFIG_SPI_FLASH_VENDOR_GD_SUPPORTED=y +CONFIG_SPI_FLASH_VENDOR_ISSI_SUPPORTED=y +CONFIG_SPI_FLASH_VENDOR_MXIC_SUPPORTED=y +CONFIG_SPI_FLASH_VENDOR_WINBOND_SUPPORTED=y CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP=y CONFIG_SPI_FLASH_SUPPORT_MXIC_CHIP=y CONFIG_SPI_FLASH_SUPPORT_GD_CHIP=y @@ -1185,25 +1661,33 @@ CONFIG_SPIFFS_USE_MTIME=y # CONFIG_WS_TRANSPORT=y CONFIG_WS_BUFFER_SIZE=1024 +# CONFIG_WS_DYNAMIC_BUFFER is not set # end of Websocket # end of TCP Transport # -# TinyUSB +# Ultra Low Power (ULP) Co-processor # -# end of TinyUSB +# CONFIG_ULP_COPROC_ENABLED is not set +# end of Ultra Low Power (ULP) Co-processor # # Unity unit testing library # CONFIG_UNITY_ENABLE_FLOAT=y CONFIG_UNITY_ENABLE_DOUBLE=y +# CONFIG_UNITY_ENABLE_64BIT is not set # CONFIG_UNITY_ENABLE_COLOR is not set CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=y # CONFIG_UNITY_ENABLE_FIXTURE is not set # CONFIG_UNITY_ENABLE_BACKTRACE_ON_FAIL is not set # end of Unity unit testing library +# +# Root Hub configuration +# +# end of Root Hub configuration + # # Virtual file system # @@ -1212,12 +1696,12 @@ CONFIG_VFS_SUPPORT_DIR=y CONFIG_VFS_SUPPORT_SELECT=y CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT=y CONFIG_VFS_SUPPORT_TERMIOS=y +CONFIG_VFS_MAX_COUNT=8 # # Host File System I/O (Semihosting) # CONFIG_VFS_SEMIHOSTFS_MAX_MOUNT_POINTS=1 -CONFIG_VFS_SEMIHOSTFS_HOST_PATH_MAX_LEN=128 # end of Host File System I/O (Semihosting) # end of Virtual file system @@ -1234,23 +1718,56 @@ CONFIG_WL_SECTOR_SIZE=4096 # CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16 CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT=30 +# CONFIG_WIFI_PROV_BLE_FORCE_ENCRYPTION is not set +CONFIG_WIFI_PROV_STA_ALL_CHANNEL_SCAN=y +# CONFIG_WIFI_PROV_STA_FAST_SCAN is not set # end of Wi-Fi Provisioning Manager # -# Supplicant +# WebSocket Server # -CONFIG_WPA_MBEDTLS_CRYPTO=y -# CONFIG_WPA_WAPI_PSK is not set -# CONFIG_WPA_DEBUG_PRINT is not set -# CONFIG_WPA_TESTING_OPTIONS is not set -# CONFIG_WPA_WPS_STRICT is not set -# CONFIG_WPA_11KV_SUPPORT is not set -# CONFIG_WPA_DPP_SUPPORT is not set -# end of Supplicant +CONFIG_WEBSOCKET_SERVER_MAX_CLIENTS=1 +CONFIG_WEBSOCKET_SERVER_QUEUE_SIZE=2 +CONFIG_WEBSOCKET_SERVER_QUEUE_TIMEOUT=30 +CONFIG_WEBSOCKET_SERVER_TASK_STACK_DEPTH=3000 +CONFIG_WEBSOCKET_SERVER_TASK_PRIORITY=5 +# CONFIG_WEBSOCKET_SERVER_PINNED is not set +# end of WebSocket Server + +# +# mDNS +# +CONFIG_MDNS_MAX_INTERFACES=3 +CONFIG_MDNS_MAX_SERVICES=10 +CONFIG_MDNS_TASK_PRIORITY=1 +CONFIG_MDNS_ACTION_QUEUE_LEN=16 +CONFIG_MDNS_TASK_STACK_SIZE=2816 +CONFIG_MDNS_TASK_AFFINITY_NO_AFFINITY=y +# CONFIG_MDNS_TASK_AFFINITY_CPU0 is not set +# CONFIG_MDNS_TASK_AFFINITY_CPU1 is not set +CONFIG_MDNS_TASK_AFFINITY=0x7FFFFFFF +CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS=2000 +CONFIG_MDNS_TIMER_PERIOD_MS=100 +# CONFIG_MDNS_NETWORKING_SOCKET is not set +# CONFIG_MDNS_SKIP_SUPPRESSING_OWN_QUERIES is not set +# CONFIG_MDNS_ENABLE_DEBUG_PRINTS is not set +CONFIG_MDNS_ENABLE_CONSOLE_CLI=y +# CONFIG_MDNS_RESPOND_REVERSE_QUERIES is not set +CONFIG_MDNS_MULTIPLE_INSTANCE=y + +# +# MDNS Predefined interfaces +# +CONFIG_MDNS_PREDEF_NETIF_STA=y +CONFIG_MDNS_PREDEF_NETIF_AP=y +CONFIG_MDNS_PREDEF_NETIF_ETH=y +# end of MDNS Predefined interfaces +# end of mDNS # # DSP Library # +CONFIG_DSP_OPTIMIZATIONS_SUPPORTED=y # CONFIG_DSP_ANSI is not set CONFIG_DSP_OPTIMIZED=y CONFIG_DSP_OPTIMIZATION=1 @@ -1263,34 +1780,23 @@ CONFIG_DSP_MAX_FFT_SIZE_4096=y # CONFIG_DSP_MAX_FFT_SIZE_32768 is not set CONFIG_DSP_MAX_FFT_SIZE=4096 # end of DSP Library - -# -# WebSocket Server -# -CONFIG_WEBSOCKET_SERVER_MAX_CLIENTS=1 -CONFIG_WEBSOCKET_SERVER_QUEUE_SIZE=2 -CONFIG_WEBSOCKET_SERVER_QUEUE_TIMEOUT=30 -CONFIG_WEBSOCKET_SERVER_TASK_STACK_DEPTH=3000 -CONFIG_WEBSOCKET_SERVER_TASK_PRIORITY=5 -# CONFIG_WEBSOCKET_SERVER_PINNED is not set -# end of WebSocket Server # end of Component config -# -# Compatibility options -# -# CONFIG_LEGACY_INCLUDE_COMMON_HEADERS is not set -# end of Compatibility options +# CONFIG_IDF_EXPERIMENTAL_FEATURES is not set # Deprecated options for backward compatibility -CONFIG_TOOLPREFIX="xtensa-esp32-elf-" +# CONFIG_APP_BUILD_TYPE_ELF_RAM is not set +# CONFIG_NO_BLOBS is not set +# CONFIG_ESP32_NO_BLOBS is not set +# CONFIG_ESP32_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set +# CONFIG_ESP32_COMPATIBLE_PRE_V3_1_BOOTLOADERS is not set # CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set -# CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set +CONFIG_LOG_BOOTLOADER_LEVEL_ERROR=y # CONFIG_LOG_BOOTLOADER_LEVEL_WARN is not set -CONFIG_LOG_BOOTLOADER_LEVEL_INFO=y +# CONFIG_LOG_BOOTLOADER_LEVEL_INFO is not set # CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set # CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set -CONFIG_LOG_BOOTLOADER_LEVEL=3 +CONFIG_LOG_BOOTLOADER_LEVEL=1 CONFIG_APP_ROLLBACK_ENABLE=y # CONFIG_APP_ANTI_ROLLBACK is not set # CONFIG_FLASH_ENCRYPTION_ENABLED is not set @@ -1298,63 +1804,71 @@ CONFIG_FLASHMODE_QIO=y # CONFIG_FLASHMODE_QOUT is not set # CONFIG_FLASHMODE_DIO is not set # CONFIG_FLASHMODE_DOUT is not set -# CONFIG_MONITOR_BAUD_9600B is not set -# CONFIG_MONITOR_BAUD_57600B is not set -CONFIG_MONITOR_BAUD_115200B=y -# CONFIG_MONITOR_BAUD_230400B is not set -# CONFIG_MONITOR_BAUD_921600B is not set -# CONFIG_MONITOR_BAUD_2MB is not set -# CONFIG_MONITOR_BAUD_OTHER is not set -CONFIG_MONITOR_BAUD_OTHER_VAL=115200 CONFIG_MONITOR_BAUD=115200 +# CONFIG_OPTIMIZATION_LEVEL_DEBUG is not set # CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG is not set +# CONFIG_OPTIMIZATION_LEVEL_RELEASE is not set # CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE is not set CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED=y # CONFIG_OPTIMIZATION_ASSERTIONS_SILENT is not set # CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED is not set +CONFIG_OPTIMIZATION_ASSERTION_LEVEL=2 # CONFIG_CXX_EXCEPTIONS is not set CONFIG_STACK_CHECK_NONE=y # CONFIG_STACK_CHECK_NORM is not set # CONFIG_STACK_CHECK_STRONG is not set # CONFIG_STACK_CHECK_ALL is not set # CONFIG_WARN_WRITE_STRINGS is not set -# CONFIG_DISABLE_GCC8_WARNINGS is not set # CONFIG_ESP32_APPTRACE_DEST_TRAX is not set CONFIG_ESP32_APPTRACE_DEST_NONE=y CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y CONFIG_ADC2_DISABLE_DAC=y -CONFIG_SPIRAM_SUPPORT=y -# CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST is not set -CONFIG_TRACEMEM_RESERVE_DRAM=0x0 +# CONFIG_MCPWM_ISR_IN_IRAM is not set +# CONFIG_EVENT_LOOP_PROFILING is not set +CONFIG_POST_EVENTS_FROM_ISR=y +# CONFIG_POST_EVENTS_FROM_IRAM_ISR is not set +# CONFIG_OTA_ALLOW_HTTP is not set # CONFIG_TWO_UNIVERSAL_MAC_ADDRESS is not set CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4 -# CONFIG_ULP_COPROC_ENABLED is not set -CONFIG_ULP_COPROC_RESERVE_MEM=0 -CONFIG_BROWNOUT_DET=y -# CONFIG_BROWNOUT_DET_LVL_SEL_0 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_1 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_2 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_3 is not set -CONFIG_BROWNOUT_DET_LVL_SEL_4=y -# CONFIG_BROWNOUT_DET_LVL_SEL_5 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_6 is not set -# CONFIG_BROWNOUT_DET_LVL_SEL_7 is not set -CONFIG_BROWNOUT_DET_LVL=4 -CONFIG_REDUCE_PHY_TX_POWER=y +CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY=2000 +CONFIG_ESP32_RTC_CLK_SRC_INT_RC=y CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC=y +# CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS is not set # CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL is not set +# CONFIG_ESP32_RTC_CLK_SRC_EXT_OSC is not set # CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_OSC is not set +# CONFIG_ESP32_RTC_CLK_SRC_INT_8MD256 is not set # CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_8MD256 is not set -# CONFIG_DISABLE_BASIC_ROM_CONSOLE is not set -# CONFIG_NO_BLOBS is not set -# CONFIG_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set +CONFIG_ESP32_RTC_CLK_CAL_CYCLES=1024 +# CONFIG_ESP32_XTAL_FREQ_26 is not set +CONFIG_ESP32_XTAL_FREQ_40=y +# CONFIG_ESP32_XTAL_FREQ_AUTO is not set +CONFIG_ESP32_XTAL_FREQ=40 +CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y +# CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set +CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20 +CONFIG_ESP32_PHY_MAX_TX_POWER=20 +CONFIG_REDUCE_PHY_TX_POWER=y +CONFIG_ESP32_REDUCE_PHY_TX_POWER=y +CONFIG_SPIRAM_SUPPORT=y +CONFIG_ESP32_SPIRAM_SUPPORT=y +# CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST is not set +# CONFIG_ESP32_DEFAULT_CPU_FREQ_80 is not set +# CONFIG_ESP32_DEFAULT_CPU_FREQ_160 is not set +CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y +CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240 +CONFIG_TRACEMEM_RESERVE_DRAM=0x0 +# CONFIG_ESP32_PANIC_PRINT_HALT is not set +CONFIG_ESP32_PANIC_PRINT_REBOOT=y +# CONFIG_ESP32_PANIC_SILENT_REBOOT is not set +# CONFIG_ESP32_PANIC_GDBSTUB is not set CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32 CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=2304 -CONFIG_MAIN_TASK_STACK_SIZE=2560 -CONFIG_IPC_TASK_STACK_SIZE=1024 +CONFIG_MAIN_TASK_STACK_SIZE=3072 CONFIG_CONSOLE_UART_DEFAULT=y # CONFIG_CONSOLE_UART_CUSTOM is not set +# CONFIG_CONSOLE_UART_NONE is not set # CONFIG_ESP_CONSOLE_UART_NONE is not set CONFIG_CONSOLE_UART=y CONFIG_CONSOLE_UART_NUM=0 @@ -1363,42 +1877,81 @@ CONFIG_INT_WDT=y CONFIG_INT_WDT_TIMEOUT_MS=300 CONFIG_INT_WDT_CHECK_CPU1=y CONFIG_TASK_WDT=y +CONFIG_ESP_TASK_WDT=y # CONFIG_TASK_WDT_PANIC is not set CONFIG_TASK_WDT_TIMEOUT_S=5 CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1=y -# CONFIG_EVENT_LOOP_PROFILING is not set -CONFIG_POST_EVENTS_FROM_ISR=y -# CONFIG_POST_EVENTS_FROM_IRAM_ISR is not set -# CONFIG_ESP32S2_PANIC_PRINT_HALT is not set -CONFIG_ESP32S2_PANIC_PRINT_REBOOT=y -# CONFIG_ESP32S2_PANIC_SILENT_REBOOT is not set -# CONFIG_ESP32S2_PANIC_GDBSTUB is not set +# CONFIG_ESP32_DEBUG_STUBS_ENABLE is not set +CONFIG_ESP32_DEBUG_OCDAWARE=y +CONFIG_BROWNOUT_DET=y +CONFIG_ESP32_BROWNOUT_DET=y +# CONFIG_BROWNOUT_DET_LVL_SEL_0 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_0 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_1 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_1 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_2 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_2 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_3 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_3 is not set +CONFIG_BROWNOUT_DET_LVL_SEL_4=y +CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_4=y +# CONFIG_BROWNOUT_DET_LVL_SEL_5 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_5 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_6 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_6 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_7 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_7 is not set +CONFIG_BROWNOUT_DET_LVL=4 +CONFIG_ESP32_BROWNOUT_DET_LVL=4 +# CONFIG_DISABLE_BASIC_ROM_CONSOLE is not set +CONFIG_IPC_TASK_STACK_SIZE=1024 CONFIG_TIMER_TASK_STACK_SIZE=2048 +CONFIG_ESP32_WIFI_ENABLED=y +CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=8 +CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=64 +CONFIG_ESP32_WIFI_STATIC_TX_BUFFER=y +CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=0 +CONFIG_ESP32_WIFI_STATIC_TX_BUFFER_NUM=8 +CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM=32 +# CONFIG_ESP32_WIFI_CSI_ENABLED is not set +CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y +CONFIG_ESP32_WIFI_TX_BA_WIN=8 +CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y +CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y +CONFIG_ESP32_WIFI_RX_BA_WIN=16 +CONFIG_ESP32_WIFI_RX_BA_WIN=16 +# CONFIG_ESP32_WIFI_AMSDU_TX_ENABLED is not set +CONFIG_ESP32_WIFI_NVS_ENABLED=y +CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y +# CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1 is not set +CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752 +CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32 +# CONFIG_ESP32_WIFI_IRAM_OPT is not set +CONFIG_ESP32_WIFI_RX_IRAM_OPT=y +CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=y +CONFIG_ESP32_WIFI_ENABLE_WPA3_OWE_STA=y +CONFIG_WPA_MBEDTLS_CRYPTO=y +CONFIG_WPA_MBEDTLS_TLS_CLIENT=y +# CONFIG_WPA_WAPI_PSK is not set +# CONFIG_WPA_SUITE_B_192 is not set +# CONFIG_WPA_11KV_SUPPORT is not set +# CONFIG_WPA_MBO_SUPPORT is not set +# CONFIG_WPA_DPP_SUPPORT is not set +# CONFIG_WPA_11R_SUPPORT is not set +# CONFIG_WPA_WPS_SOFTAP_REGISTRAR is not set +# CONFIG_WPA_WPS_STRICT is not set +# CONFIG_WPA_DEBUG_PRINT is not set +# CONFIG_WPA_TESTING_OPTIONS is not set # CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set # CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y -CONFIG_MB_MASTER_TIMEOUT_MS_RESPOND=150 -CONFIG_MB_MASTER_DELAY_MS_CONVERT=200 -CONFIG_MB_QUEUE_LENGTH=20 -CONFIG_MB_SERIAL_TASK_STACK_SIZE=4096 -CONFIG_MB_SERIAL_BUF_SIZE=256 -CONFIG_MB_SERIAL_TASK_PRIO=10 -CONFIG_MB_CONTROLLER_SLAVE_ID_SUPPORT=y -CONFIG_MB_CONTROLLER_SLAVE_ID=0x00112233 -CONFIG_MB_CONTROLLER_NOTIFY_TIMEOUT=20 -CONFIG_MB_CONTROLLER_NOTIFY_QUEUE_SIZE=20 -CONFIG_MB_CONTROLLER_STACK_SIZE=4096 -CONFIG_MB_EVENT_QUEUE_TIMEOUT=20 -CONFIG_MB_TIMER_PORT_ENABLED=y -CONFIG_MB_TIMER_GROUP=0 -CONFIG_MB_TIMER_INDEX=0 -# CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK is not set CONFIG_TIMER_TASK_PRIORITY=1 CONFIG_TIMER_TASK_STACK_DEPTH=1536 CONFIG_TIMER_QUEUE_LENGTH=5 +# CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK is not set +# CONFIG_HAL_ASSERTION_SILIENT is not set # CONFIG_L2_TO_L3_COPY is not set -# CONFIG_USE_ONLY_LWIP_SELECT is not set CONFIG_ESP_GRATUITOUS_ARP=y CONFIG_GARP_TMR_INTERVAL=60 CONFIG_TCPIP_RECVMBOX_SIZE=32 @@ -1410,7 +1963,6 @@ CONFIG_TCP_SND_BUF_DEFAULT=11680 CONFIG_TCP_WND_DEFAULT=11680 CONFIG_TCP_RECVMBOX_SIZE=10 CONFIG_TCP_QUEUE_OOSEQ=y -# CONFIG_ESP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set CONFIG_TCP_OVERSIZE_MSS=y # CONFIG_TCP_OVERSIZE_QUARTER_MSS is not set # CONFIG_TCP_OVERSIZE_DISABLE is not set @@ -1421,6 +1973,12 @@ CONFIG_TCPIP_TASK_AFFINITY_CPU0=y # CONFIG_TCPIP_TASK_AFFINITY_CPU1 is not set CONFIG_TCPIP_TASK_AFFINITY=0x0 # CONFIG_PPP_SUPPORT is not set +CONFIG_ESP32_TIME_SYSCALL_USE_RTC_HRT=y +CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1=y +# CONFIG_ESP32_TIME_SYSCALL_USE_RTC is not set +# CONFIG_ESP32_TIME_SYSCALL_USE_HRT is not set +# CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 is not set +# CONFIG_ESP32_TIME_SYSCALL_USE_NONE is not set CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT=5 CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072 CONFIG_ESP32_PTHREAD_STACK_MIN=768 @@ -1432,8 +1990,8 @@ CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT="pthread" CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS=y # CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS is not set # CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED is not set +# CONFIG_ESP32_ULP_COPROC_ENABLED is not set CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT=y CONFIG_SUPPORT_TERMIOS=y CONFIG_SEMIHOSTFS_MAX_MOUNT_POINTS=1 -CONFIG_SEMIHOSTFS_HOST_PATH_MAX_LEN=128 # End of deprecated options diff --git a/sdkconfig_TAS5805M b/sdkconfig_TAS5805M new file mode 100644 index 00000000..867083aa --- /dev/null +++ b/sdkconfig_TAS5805M @@ -0,0 +1,2038 @@ +# +# Automatically generated file. DO NOT EDIT. +# Espressif IoT Development Framework (ESP-IDF) 5.1.1 Project Configuration +# +CONFIG_SOC_BROWNOUT_RESET_SUPPORTED="Not determined" +CONFIG_SOC_TWAI_BRP_DIV_SUPPORTED="Not determined" +CONFIG_SOC_DPORT_WORKAROUND="Not determined" +CONFIG_SOC_CAPS_ECO_VER_MAX=301 +CONFIG_SOC_ADC_SUPPORTED=y +CONFIG_SOC_DAC_SUPPORTED=y +CONFIG_SOC_UART_SUPPORTED=y +CONFIG_SOC_MCPWM_SUPPORTED=y +CONFIG_SOC_GPTIMER_SUPPORTED=y +CONFIG_SOC_SDMMC_HOST_SUPPORTED=y +CONFIG_SOC_BT_SUPPORTED=y +CONFIG_SOC_PCNT_SUPPORTED=y +CONFIG_SOC_WIFI_SUPPORTED=y +CONFIG_SOC_SDIO_SLAVE_SUPPORTED=y +CONFIG_SOC_TWAI_SUPPORTED=y +CONFIG_SOC_EMAC_SUPPORTED=y +CONFIG_SOC_ULP_SUPPORTED=y +CONFIG_SOC_CCOMP_TIMER_SUPPORTED=y +CONFIG_SOC_RTC_FAST_MEM_SUPPORTED=y +CONFIG_SOC_RTC_SLOW_MEM_SUPPORTED=y +CONFIG_SOC_RTC_MEM_SUPPORTED=y +CONFIG_SOC_I2S_SUPPORTED=y +CONFIG_SOC_RMT_SUPPORTED=y +CONFIG_SOC_SDM_SUPPORTED=y +CONFIG_SOC_GPSPI_SUPPORTED=y +CONFIG_SOC_LEDC_SUPPORTED=y +CONFIG_SOC_I2C_SUPPORTED=y +CONFIG_SOC_SUPPORT_COEXISTENCE=y +CONFIG_SOC_AES_SUPPORTED=y +CONFIG_SOC_MPI_SUPPORTED=y +CONFIG_SOC_SHA_SUPPORTED=y +CONFIG_SOC_FLASH_ENC_SUPPORTED=y +CONFIG_SOC_SECURE_BOOT_SUPPORTED=y +CONFIG_SOC_TOUCH_SENSOR_SUPPORTED=y +CONFIG_SOC_BOD_SUPPORTED=y +CONFIG_SOC_ULP_FSM_SUPPORTED=y +CONFIG_SOC_DPORT_WORKAROUND_DIS_INTERRUPT_LVL=5 +CONFIG_SOC_XTAL_SUPPORT_26M=y +CONFIG_SOC_XTAL_SUPPORT_40M=y +CONFIG_SOC_XTAL_SUPPORT_AUTO_DETECT=y +CONFIG_SOC_ADC_RTC_CTRL_SUPPORTED=y +CONFIG_SOC_ADC_DIG_CTRL_SUPPORTED=y +CONFIG_SOC_ADC_DMA_SUPPORTED=y +CONFIG_SOC_ADC_PERIPH_NUM=2 +CONFIG_SOC_ADC_MAX_CHANNEL_NUM=10 +CONFIG_SOC_ADC_ATTEN_NUM=4 +CONFIG_SOC_ADC_DIGI_CONTROLLER_NUM=2 +CONFIG_SOC_ADC_PATT_LEN_MAX=16 +CONFIG_SOC_ADC_DIGI_MIN_BITWIDTH=9 +CONFIG_SOC_ADC_DIGI_MAX_BITWIDTH=12 +CONFIG_SOC_ADC_DIGI_RESULT_BYTES=2 +CONFIG_SOC_ADC_DIGI_DATA_BYTES_PER_CONV=4 +CONFIG_SOC_ADC_SAMPLE_FREQ_THRES_HIGH=2 +CONFIG_SOC_ADC_SAMPLE_FREQ_THRES_LOW=20 +CONFIG_SOC_ADC_RTC_MIN_BITWIDTH=9 +CONFIG_SOC_ADC_RTC_MAX_BITWIDTH=12 +CONFIG_SOC_SHARED_IDCACHE_SUPPORTED=y +CONFIG_SOC_IDCACHE_PER_CORE=y +CONFIG_SOC_CPU_CORES_NUM=2 +CONFIG_SOC_CPU_INTR_NUM=32 +CONFIG_SOC_CPU_HAS_FPU=y +CONFIG_SOC_CPU_BREAKPOINTS_NUM=2 +CONFIG_SOC_CPU_WATCHPOINTS_NUM=2 +CONFIG_SOC_CPU_WATCHPOINT_SIZE=64 +CONFIG_SOC_DAC_CHAN_NUM=2 +CONFIG_SOC_DAC_RESOLUTION=8 +CONFIG_SOC_DAC_DMA_16BIT_ALIGN=y +CONFIG_SOC_GPIO_PORT=1 +CONFIG_SOC_GPIO_PIN_COUNT=40 +CONFIG_SOC_GPIO_VALID_GPIO_MASK=0xFFFFFFFFFF +CONFIG_SOC_GPIO_VALID_DIGITAL_IO_PAD_MASK=0xEF0FEA +CONFIG_SOC_I2C_NUM=2 +CONFIG_SOC_I2C_FIFO_LEN=32 +CONFIG_SOC_I2C_CMD_REG_NUM=16 +CONFIG_SOC_I2C_SUPPORT_SLAVE=y +CONFIG_SOC_I2C_SUPPORT_APB=y +CONFIG_SOC_I2S_NUM=2 +CONFIG_SOC_I2S_HW_VERSION_1=y +CONFIG_SOC_I2S_SUPPORTS_APLL=y +CONFIG_SOC_I2S_SUPPORTS_PLL_F160M=y +CONFIG_SOC_I2S_SUPPORTS_PDM=y +CONFIG_SOC_I2S_SUPPORTS_PDM_TX=y +CONFIG_SOC_I2S_PDM_MAX_TX_LINES=1 +CONFIG_SOC_I2S_SUPPORTS_PDM_RX=y +CONFIG_SOC_I2S_PDM_MAX_RX_LINES=1 +CONFIG_SOC_I2S_SUPPORTS_ADC_DAC=y +CONFIG_SOC_I2S_SUPPORTS_ADC=y +CONFIG_SOC_I2S_SUPPORTS_DAC=y +CONFIG_SOC_I2S_SUPPORTS_LCD_CAMERA=y +CONFIG_SOC_I2S_TRANS_SIZE_ALIGN_WORD=y +CONFIG_SOC_I2S_LCD_I80_VARIANT=y +CONFIG_SOC_LCD_I80_SUPPORTED=y +CONFIG_SOC_LCD_I80_BUSES=2 +CONFIG_SOC_LCD_I80_BUS_WIDTH=24 +CONFIG_SOC_LEDC_HAS_TIMER_SPECIFIC_MUX=y +CONFIG_SOC_LEDC_SUPPORT_APB_CLOCK=y +CONFIG_SOC_LEDC_SUPPORT_REF_TICK=y +CONFIG_SOC_LEDC_SUPPORT_HS_MODE=y +CONFIG_SOC_LEDC_CHANNEL_NUM=8 +CONFIG_SOC_LEDC_TIMER_BIT_WIDTH=20 +CONFIG_SOC_MCPWM_GROUPS=2 +CONFIG_SOC_MCPWM_TIMERS_PER_GROUP=3 +CONFIG_SOC_MCPWM_OPERATORS_PER_GROUP=3 +CONFIG_SOC_MCPWM_COMPARATORS_PER_OPERATOR=2 +CONFIG_SOC_MCPWM_GENERATORS_PER_OPERATOR=2 +CONFIG_SOC_MCPWM_TRIGGERS_PER_OPERATOR=2 +CONFIG_SOC_MCPWM_GPIO_FAULTS_PER_GROUP=3 +CONFIG_SOC_MCPWM_CAPTURE_TIMERS_PER_GROUP=y +CONFIG_SOC_MCPWM_CAPTURE_CHANNELS_PER_TIMER=3 +CONFIG_SOC_MCPWM_GPIO_SYNCHROS_PER_GROUP=3 +CONFIG_SOC_MMU_PERIPH_NUM=2 +CONFIG_SOC_MMU_LINEAR_ADDRESS_REGION_NUM=3 +CONFIG_SOC_MPU_MIN_REGION_SIZE=0x20000000 +CONFIG_SOC_MPU_REGIONS_MAX_NUM=8 +CONFIG_SOC_PCNT_GROUPS=1 +CONFIG_SOC_PCNT_UNITS_PER_GROUP=8 +CONFIG_SOC_PCNT_CHANNELS_PER_UNIT=2 +CONFIG_SOC_PCNT_THRES_POINT_PER_UNIT=2 +CONFIG_SOC_RMT_GROUPS=1 +CONFIG_SOC_RMT_TX_CANDIDATES_PER_GROUP=8 +CONFIG_SOC_RMT_RX_CANDIDATES_PER_GROUP=8 +CONFIG_SOC_RMT_CHANNELS_PER_GROUP=8 +CONFIG_SOC_RMT_MEM_WORDS_PER_CHANNEL=64 +CONFIG_SOC_RMT_SUPPORT_REF_TICK=y +CONFIG_SOC_RMT_SUPPORT_APB=y +CONFIG_SOC_RMT_CHANNEL_CLK_INDEPENDENT=y +CONFIG_SOC_RTCIO_PIN_COUNT=18 +CONFIG_SOC_RTCIO_INPUT_OUTPUT_SUPPORTED=y +CONFIG_SOC_RTCIO_HOLD_SUPPORTED=y +CONFIG_SOC_RTCIO_WAKE_SUPPORTED=y +CONFIG_SOC_SDM_GROUPS=1 +CONFIG_SOC_SDM_CHANNELS_PER_GROUP=8 +CONFIG_SOC_SDM_CLK_SUPPORT_APB=y +CONFIG_SOC_SPI_HD_BOTH_INOUT_SUPPORTED=y +CONFIG_SOC_SPI_AS_CS_SUPPORTED=y +CONFIG_SOC_SPI_PERIPH_NUM=3 +CONFIG_SOC_SPI_DMA_CHAN_NUM=2 +CONFIG_SOC_SPI_MAX_CS_NUM=3 +CONFIG_SOC_SPI_SUPPORT_CLK_APB=y +CONFIG_SOC_SPI_MAXIMUM_BUFFER_SIZE=64 +CONFIG_SOC_SPI_MAX_PRE_DIVIDER=8192 +CONFIG_SOC_MEMSPI_SRC_FREQ_80M_SUPPORTED=y +CONFIG_SOC_MEMSPI_SRC_FREQ_40M_SUPPORTED=y +CONFIG_SOC_MEMSPI_SRC_FREQ_26M_SUPPORTED=y +CONFIG_SOC_MEMSPI_SRC_FREQ_20M_SUPPORTED=y +CONFIG_SOC_TIMER_GROUPS=2 +CONFIG_SOC_TIMER_GROUP_TIMERS_PER_GROUP=2 +CONFIG_SOC_TIMER_GROUP_COUNTER_BIT_WIDTH=64 +CONFIG_SOC_TIMER_GROUP_TOTAL_TIMERS=4 +CONFIG_SOC_TIMER_GROUP_SUPPORT_APB=y +CONFIG_SOC_TOUCH_VERSION_1=y +CONFIG_SOC_TOUCH_SENSOR_NUM=10 +CONFIG_SOC_TOUCH_PAD_MEASURE_WAIT_MAX=0xFF +CONFIG_SOC_TWAI_CONTROLLER_NUM=1 +CONFIG_SOC_TWAI_BRP_MIN=2 +CONFIG_SOC_TWAI_CLK_SUPPORT_APB=y +CONFIG_SOC_TWAI_SUPPORT_MULTI_ADDRESS_LAYOUT=y +CONFIG_SOC_UART_NUM=3 +CONFIG_SOC_UART_SUPPORT_APB_CLK=y +CONFIG_SOC_UART_SUPPORT_REF_TICK=y +CONFIG_SOC_UART_FIFO_LEN=128 +CONFIG_SOC_UART_BITRATE_MAX=5000000 +CONFIG_SOC_SPIRAM_SUPPORTED=y +CONFIG_SOC_SPI_MEM_SUPPORT_CONFIG_GPIO_BY_EFUSE=y +CONFIG_SOC_SHA_SUPPORT_PARALLEL_ENG=y +CONFIG_SOC_SHA_SUPPORT_SHA1=y +CONFIG_SOC_SHA_SUPPORT_SHA256=y +CONFIG_SOC_SHA_SUPPORT_SHA384=y +CONFIG_SOC_SHA_SUPPORT_SHA512=y +CONFIG_SOC_RSA_MAX_BIT_LEN=4096 +CONFIG_SOC_AES_SUPPORT_AES_128=y +CONFIG_SOC_AES_SUPPORT_AES_192=y +CONFIG_SOC_AES_SUPPORT_AES_256=y +CONFIG_SOC_SECURE_BOOT_V1=y +CONFIG_SOC_EFUSE_SECURE_BOOT_KEY_DIGESTS=y +CONFIG_SOC_FLASH_ENCRYPTED_XTS_AES_BLOCK_MAX=32 +CONFIG_SOC_PHY_DIG_REGS_MEM_SIZE=21 +CONFIG_SOC_PM_SUPPORT_EXT0_WAKEUP=y +CONFIG_SOC_PM_SUPPORT_EXT1_WAKEUP=y +CONFIG_SOC_PM_SUPPORT_EXT_WAKEUP=y +CONFIG_SOC_PM_SUPPORT_TOUCH_SENSOR_WAKEUP=y +CONFIG_SOC_PM_SUPPORT_RTC_PERIPH_PD=y +CONFIG_SOC_PM_SUPPORT_RTC_FAST_MEM_PD=y +CONFIG_SOC_PM_SUPPORT_RTC_SLOW_MEM_PD=y +CONFIG_SOC_PM_SUPPORT_RC_FAST_PD=y +CONFIG_SOC_PM_SUPPORT_VDDSDIO_PD=y +CONFIG_SOC_PM_SUPPORT_MODEM_PD=y +CONFIG_SOC_CONFIGURABLE_VDDSDIO_SUPPORTED=y +CONFIG_SOC_CLK_APLL_SUPPORTED=y +CONFIG_SOC_APLL_MULTIPLIER_OUT_MIN_HZ=350000000 +CONFIG_SOC_APLL_MULTIPLIER_OUT_MAX_HZ=500000000 +CONFIG_SOC_APLL_MIN_HZ=5303031 +CONFIG_SOC_APLL_MAX_HZ=125000000 +CONFIG_SOC_CLK_RC_FAST_D256_SUPPORTED=y +CONFIG_SOC_RTC_SLOW_CLK_SUPPORT_RC_FAST_D256=y +CONFIG_SOC_CLK_RC_FAST_SUPPORT_CALIBRATION=y +CONFIG_SOC_CLK_XTAL32K_SUPPORTED=y +CONFIG_SOC_SDMMC_USE_IOMUX=y +CONFIG_SOC_SDMMC_NUM_SLOTS=2 +CONFIG_SOC_WIFI_WAPI_SUPPORT=y +CONFIG_SOC_WIFI_CSI_SUPPORT=y +CONFIG_SOC_WIFI_MESH_SUPPORT=y +CONFIG_SOC_WIFI_SUPPORT_VARIABLE_BEACON_WINDOW=y +CONFIG_SOC_WIFI_NAN_SUPPORT=y +CONFIG_SOC_BLE_SUPPORTED=y +CONFIG_SOC_BLE_MESH_SUPPORTED=y +CONFIG_SOC_BT_CLASSIC_SUPPORTED=y +CONFIG_SOC_BLUFI_SUPPORTED=y +CONFIG_SOC_ULP_HAS_ADC=y +CONFIG_IDF_CMAKE=y +CONFIG_IDF_TARGET_ARCH_XTENSA=y +CONFIG_IDF_TARGET_ARCH="xtensa" +CONFIG_IDF_TARGET="esp32" +CONFIG_IDF_TARGET_ESP32=y +CONFIG_IDF_FIRMWARE_CHIP_ID=0x0000 + +# +# Build type +# +CONFIG_APP_BUILD_TYPE_APP_2NDBOOT=y +# CONFIG_APP_BUILD_TYPE_RAM is not set +CONFIG_APP_BUILD_GENERATE_BINARIES=y +CONFIG_APP_BUILD_BOOTLOADER=y +CONFIG_APP_BUILD_USE_FLASH_SECTIONS=y +# CONFIG_APP_REPRODUCIBLE_BUILD is not set +# CONFIG_APP_NO_BLOBS is not set +# CONFIG_APP_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set +# CONFIG_APP_COMPATIBLE_PRE_V3_1_BOOTLOADERS is not set +# end of Build type + +# +# Bootloader config +# +CONFIG_BOOTLOADER_OFFSET_IN_FLASH=0x1000 +CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_SIZE=y +# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_DEBUG is not set +# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_PERF is not set +# CONFIG_BOOTLOADER_COMPILER_OPTIMIZATION_NONE is not set +# CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set +# CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set +# CONFIG_BOOTLOADER_LOG_LEVEL_WARN is not set +CONFIG_BOOTLOADER_LOG_LEVEL_INFO=y +# CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set +# CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set +CONFIG_BOOTLOADER_LOG_LEVEL=3 +# CONFIG_BOOTLOADER_SPI_CUSTOM_WP_PIN is not set +CONFIG_BOOTLOADER_SPI_WP_PIN=7 +CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y +# CONFIG_BOOTLOADER_FACTORY_RESET is not set +# CONFIG_BOOTLOADER_APP_TEST is not set +CONFIG_BOOTLOADER_REGION_PROTECTION_ENABLE=y +CONFIG_BOOTLOADER_WDT_ENABLE=y +# CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE is not set +CONFIG_BOOTLOADER_WDT_TIME_MS=9000 +CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y +# CONFIG_BOOTLOADER_APP_ANTI_ROLLBACK is not set +# CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP is not set +# CONFIG_BOOTLOADER_SKIP_VALIDATE_ON_POWER_ON is not set +# CONFIG_BOOTLOADER_SKIP_VALIDATE_ALWAYS is not set +CONFIG_BOOTLOADER_RESERVE_RTC_SIZE=0 +# CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC is not set +CONFIG_BOOTLOADER_FLASH_XMC_SUPPORT=y +# end of Bootloader config + +# +# Security features +# +CONFIG_SECURE_BOOT_V1_SUPPORTED=y +# CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT is not set +# CONFIG_SECURE_BOOT is not set +# CONFIG_SECURE_FLASH_ENC_ENABLED is not set +# end of Security features + +# +# Application manager +# +CONFIG_APP_COMPILE_TIME_DATE=y +# CONFIG_APP_EXCLUDE_PROJECT_VER_VAR is not set +# CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR is not set +# CONFIG_APP_PROJECT_VER_FROM_CONFIG is not set +CONFIG_APP_RETRIEVE_LEN_ELF_SHA=16 +# end of Application manager + +CONFIG_ESP_ROM_HAS_CRC_LE=y +CONFIG_ESP_ROM_HAS_CRC_BE=y +CONFIG_ESP_ROM_HAS_MZ_CRC32=y +CONFIG_ESP_ROM_HAS_JPEG_DECODE=y +CONFIG_ESP_ROM_HAS_UART_BUF_SWITCH=y +CONFIG_ESP_ROM_NEEDS_SWSETUP_WORKAROUND=y +CONFIG_ESP_ROM_HAS_NEWLIB_NANO_FORMAT=y + +# +# Serial flasher config +# +# CONFIG_ESPTOOLPY_NO_STUB is not set +CONFIG_ESPTOOLPY_FLASHMODE_QIO=y +# CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set +# CONFIG_ESPTOOLPY_FLASHMODE_DIO is not set +# CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set +CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_STR=y +CONFIG_ESPTOOLPY_FLASHMODE="dio" +CONFIG_ESPTOOLPY_FLASHFREQ_80M=y +# CONFIG_ESPTOOLPY_FLASHFREQ_40M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set +# CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set +CONFIG_ESPTOOLPY_FLASHFREQ="80m" +# CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set +CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y +# CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_32MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_64MB is not set +# CONFIG_ESPTOOLPY_FLASHSIZE_128MB is not set +CONFIG_ESPTOOLPY_FLASHSIZE="4MB" +# CONFIG_ESPTOOLPY_HEADER_FLASHSIZE_UPDATE is not set +CONFIG_ESPTOOLPY_BEFORE_RESET=y +# CONFIG_ESPTOOLPY_BEFORE_NORESET is not set +CONFIG_ESPTOOLPY_BEFORE="default_reset" +CONFIG_ESPTOOLPY_AFTER_RESET=y +# CONFIG_ESPTOOLPY_AFTER_NORESET is not set +CONFIG_ESPTOOLPY_AFTER="hard_reset" +CONFIG_ESPTOOLPY_MONITOR_BAUD=115200 +# end of Serial flasher config + +# +# Partition Table +# +# CONFIG_PARTITION_TABLE_SINGLE_APP is not set +# CONFIG_PARTITION_TABLE_SINGLE_APP_LARGE is not set +# CONFIG_PARTITION_TABLE_TWO_OTA is not set +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" +CONFIG_PARTITION_TABLE_FILENAME="partitions.csv" +CONFIG_PARTITION_TABLE_OFFSET=0x8000 +CONFIG_PARTITION_TABLE_MD5=y +# end of Partition Table + +# +# Snapclient Configuration +# +CONFIG_SNAPSERVER_USE_MDNS=y +CONFIG_SNAPCLIENT_NAME="esp-snapclient" + +# +# HTTP Server Setting +# +CONFIG_WEB_PORT=8000 +# end of HTTP Server Setting +# end of Snapclient Configuration + +# +# Audio HAL +# +CONFIG_AUDIO_BOARD_CUSTOM=y +# CONFIG_ESP_LYRAT_V4_3_BOARD is not set +# CONFIG_ESP_LYRAT_MINI_V1_1_BOARD is not set +# end of Audio HAL + +# +# Custom Audio Board +# +# CONFIG_DAC_PCM51XX is not set +# CONFIG_DAC_PCM5102A is not set +# CONFIG_DAC_MA120 is not set +# CONFIG_DAC_MA120X0 is not set +# CONFIG_DAC_ADAU1961 is not set +# CONFIG_DAC_MAX98357 is not set +CONFIG_DAC_TAS5805M=y + +# +# DAC I2C control interface +# +CONFIG_DAC_I2C_SDA=21 +CONFIG_DAC_I2C_SCL=27 +CONFIG_DAC_I2C_ADDR=0x2D +# end of DAC I2C control interface + +# +# I2S master interface +# +CONFIG_MASTER_I2S_MCLK_PIN=0 +CONFIG_MASTER_I2S_BCK_PIN=26 +CONFIG_MASTER_I2S_LRCK_PIN=25 +CONFIG_MASTER_I2S_DATAOUT_PIN=22 +# end of I2S master interface + +# +# DAC-Operation-Mode +# +# CONFIG_DAC_BRIDGE_MODE is not set +# end of DAC-Operation-Mode + +# +# I2S slave interface +# +CONFIG_SLAVE_I2S_BCK_PIN=99 +CONFIG_SLAVE_I2S_MCLK_PIN=0 +CONFIG_SLAVE_I2S_LRCK_PIN=12 +CONFIG_SLAVE_I2S_DATAOUT_PIN=5 +# end of I2S slave interface + +# +# Logic-Level-Settings +# +# CONFIG_INVERT_MCLK_LEVEL is not set +CONFIG_INVERT_WORD_SELECT_LEVEL=y +# CONFIG_INVERT_BCLK_LEVEL is not set +CONFIG_DISABLE_APLL_ADJUST=y +# end of Logic-Level-Settings +# end of Custom Audio Board + +# +# ESP32 DSP processor config +# +# CONFIG_USE_DSP_PROCESSOR is not set +# end of ESP32 DSP processor config + +# +# Snapclient Ethernet Configuration +# +# CONFIG_SNAPCLIENT_ENABLE_ETHERNET is not set +# end of Snapclient Ethernet Configuration + +# +# SNTP Configuration +# +CONFIG_SNTP_TIMEZONE="UTC" +CONFIG_SNTP_SERVER="pool.ntp.org" +# end of SNTP Configuration + +# +# Wifi Configuration +# +# CONFIG_ENABLE_WIFI_PROVISIONING is not set +CONFIG_WIFI_SSID="SSID" +CONFIG_WIFI_PASSWORD="YOUR_WIFI_PASSWORD" +CONFIG_WIFI_MAXIMUM_RETRY=3 +# end of Wifi Configuration + +# +# Compiler options +# +# CONFIG_COMPILER_OPTIMIZATION_DEFAULT is not set +# CONFIG_COMPILER_OPTIMIZATION_SIZE is not set +CONFIG_COMPILER_OPTIMIZATION_PERF=y +# CONFIG_COMPILER_OPTIMIZATION_NONE is not set +CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y +# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT is not set +# CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE is not set +CONFIG_COMPILER_FLOAT_LIB_FROM_GCCLIB=y +CONFIG_COMPILER_OPTIMIZATION_ASSERTION_LEVEL=2 +# CONFIG_COMPILER_OPTIMIZATION_CHECKS_SILENT is not set +CONFIG_COMPILER_HIDE_PATHS_MACROS=y +# CONFIG_COMPILER_CXX_EXCEPTIONS is not set +# CONFIG_COMPILER_CXX_RTTI is not set +CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y +# CONFIG_COMPILER_STACK_CHECK_MODE_NORM is not set +# CONFIG_COMPILER_STACK_CHECK_MODE_STRONG is not set +# CONFIG_COMPILER_STACK_CHECK_MODE_ALL is not set +# CONFIG_COMPILER_WARN_WRITE_STRINGS is not set +# CONFIG_COMPILER_DISABLE_GCC12_WARNINGS is not set +# CONFIG_COMPILER_DUMP_RTL_FILES is not set +# end of Compiler options + +# +# Component config +# + +# +# Application Level Tracing +# +# CONFIG_APPTRACE_DEST_JTAG is not set +CONFIG_APPTRACE_DEST_NONE=y +# CONFIG_APPTRACE_DEST_UART1 is not set +# CONFIG_APPTRACE_DEST_UART2 is not set +CONFIG_APPTRACE_DEST_UART_NONE=y +CONFIG_APPTRACE_UART_TASK_PRIO=1 +CONFIG_APPTRACE_LOCK_ENABLE=y +# end of Application Level Tracing + +# +# Bluetooth +# +# CONFIG_BT_ENABLED is not set +# end of Bluetooth + +# +# Driver Configurations +# + +# +# Legacy ADC Configuration +# +CONFIG_ADC_DISABLE_DAC=y +# CONFIG_ADC_SUPPRESS_DEPRECATE_WARN is not set + +# +# Legacy ADC Calibration Configuration +# +CONFIG_ADC_CAL_EFUSE_TP_ENABLE=y +CONFIG_ADC_CAL_EFUSE_VREF_ENABLE=y +CONFIG_ADC_CAL_LUT_ENABLE=y +# CONFIG_ADC_CALI_SUPPRESS_DEPRECATE_WARN is not set +# end of Legacy ADC Calibration Configuration +# end of Legacy ADC Configuration + +# +# SPI Configuration +# +CONFIG_SPI_MASTER_ISR_IN_IRAM=y +# CONFIG_SPI_SLAVE_IN_IRAM is not set +# CONFIG_SPI_SLAVE_ISR_IN_IRAM is not set +# end of SPI Configuration + +# +# TWAI Configuration +# +# CONFIG_TWAI_ISR_IN_IRAM is not set +# CONFIG_TWAI_ERRATA_FIX_BUS_OFF_REC is not set +# CONFIG_TWAI_ERRATA_FIX_TX_INTR_LOST is not set +# CONFIG_TWAI_ERRATA_FIX_RX_FRAME_INVALID is not set +# CONFIG_TWAI_ERRATA_FIX_RX_FIFO_CORRUPT is not set +# CONFIG_TWAI_ERRATA_FIX_LISTEN_ONLY_DOM is not set +# end of TWAI Configuration + +# +# UART Configuration +# +# CONFIG_UART_ISR_IN_IRAM is not set +# end of UART Configuration + +# +# GPIO Configuration +# +# CONFIG_GPIO_ESP32_SUPPORT_SWITCH_SLP_PULL is not set +# CONFIG_GPIO_CTRL_FUNC_IN_IRAM is not set +# end of GPIO Configuration + +# +# Sigma Delta Modulator Configuration +# +# CONFIG_SDM_CTRL_FUNC_IN_IRAM is not set +# CONFIG_SDM_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_SDM_ENABLE_DEBUG_LOG is not set +# end of Sigma Delta Modulator Configuration + +# +# GPTimer Configuration +# +# CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM is not set +# CONFIG_GPTIMER_ISR_IRAM_SAFE is not set +# CONFIG_GPTIMER_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_GPTIMER_ENABLE_DEBUG_LOG is not set +# end of GPTimer Configuration + +# +# PCNT Configuration +# +# CONFIG_PCNT_CTRL_FUNC_IN_IRAM is not set +# CONFIG_PCNT_ISR_IRAM_SAFE is not set +# CONFIG_PCNT_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_PCNT_ENABLE_DEBUG_LOG is not set +# end of PCNT Configuration + +# +# RMT Configuration +# +# CONFIG_RMT_ISR_IRAM_SAFE is not set +# CONFIG_RMT_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_RMT_ENABLE_DEBUG_LOG is not set +# end of RMT Configuration + +# +# MCPWM Configuration +# +# CONFIG_MCPWM_ISR_IRAM_SAFE is not set +# CONFIG_MCPWM_CTRL_FUNC_IN_IRAM is not set +# CONFIG_MCPWM_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_MCPWM_ENABLE_DEBUG_LOG is not set +# end of MCPWM Configuration + +# +# I2S Configuration +# +# CONFIG_I2S_ISR_IRAM_SAFE is not set +# CONFIG_I2S_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_I2S_ENABLE_DEBUG_LOG is not set +# end of I2S Configuration + +# +# DAC Configuration +# +# CONFIG_DAC_CTRL_FUNC_IN_IRAM is not set +# CONFIG_DAC_ISR_IRAM_SAFE is not set +# CONFIG_DAC_SUPPRESS_DEPRECATE_WARN is not set +# CONFIG_DAC_ENABLE_DEBUG_LOG is not set +CONFIG_DAC_DMA_AUTO_16BIT_ALIGN=y +# end of DAC Configuration +# end of Driver Configurations + +# +# eFuse Bit Manager +# +# CONFIG_EFUSE_CUSTOM_TABLE is not set +# CONFIG_EFUSE_VIRTUAL is not set +# CONFIG_EFUSE_CODE_SCHEME_COMPAT_NONE is not set +CONFIG_EFUSE_CODE_SCHEME_COMPAT_3_4=y +# CONFIG_EFUSE_CODE_SCHEME_COMPAT_REPEAT is not set +CONFIG_EFUSE_MAX_BLK_LEN=192 +# end of eFuse Bit Manager + +# +# ESP-TLS +# +CONFIG_ESP_TLS_USING_MBEDTLS=y +# CONFIG_ESP_TLS_USE_SECURE_ELEMENT is not set +# CONFIG_ESP_TLS_CLIENT_SESSION_TICKETS is not set +# CONFIG_ESP_TLS_SERVER is not set +# CONFIG_ESP_TLS_PSK_VERIFICATION is not set +# CONFIG_ESP_TLS_INSECURE is not set +# end of ESP-TLS + +# +# ADC and ADC Calibration +# +# CONFIG_ADC_ONESHOT_CTRL_FUNC_IN_IRAM is not set +# CONFIG_ADC_CONTINUOUS_ISR_IRAM_SAFE is not set + +# +# ADC Calibration Configurations +# +CONFIG_ADC_CALI_EFUSE_TP_ENABLE=y +CONFIG_ADC_CALI_EFUSE_VREF_ENABLE=y +CONFIG_ADC_CALI_LUT_ENABLE=y +# end of ADC Calibration Configurations + +CONFIG_ADC_DISABLE_DAC_OUTPUT=y +# end of ADC and ADC Calibration + +# +# Wireless Coexistence +# +# end of Wireless Coexistence + +# +# Common ESP-related +# +CONFIG_ESP_ERR_TO_NAME_LOOKUP=y +# end of Common ESP-related + +# +# Ethernet +# +CONFIG_ETH_ENABLED=y +CONFIG_ETH_USE_ESP32_EMAC=y +CONFIG_ETH_PHY_INTERFACE_RMII=y +CONFIG_ETH_RMII_CLK_INPUT=y +# CONFIG_ETH_RMII_CLK_OUTPUT is not set +CONFIG_ETH_RMII_CLK_IN_GPIO=0 +CONFIG_ETH_DMA_BUFFER_SIZE=1024 +CONFIG_ETH_DMA_RX_BUFFER_NUM=30 +CONFIG_ETH_DMA_TX_BUFFER_NUM=5 +# CONFIG_ETH_SOFT_FLOW_CONTROL is not set +CONFIG_ETH_USE_SPI_ETHERNET=y +# CONFIG_ETH_SPI_ETHERNET_DM9051 is not set +# CONFIG_ETH_SPI_ETHERNET_W5500 is not set +# CONFIG_ETH_SPI_ETHERNET_KSZ8851SNL is not set +# CONFIG_ETH_USE_OPENETH is not set +# CONFIG_ETH_TRANSMIT_MUTEX is not set +# end of Ethernet + +# +# Event Loop Library +# +# CONFIG_ESP_EVENT_LOOP_PROFILING is not set +CONFIG_ESP_EVENT_POST_FROM_ISR=y +# CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR is not set +# end of Event Loop Library + +# +# GDB Stub +# +# end of GDB Stub + +# +# ESP HTTP client +# +CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=y +# CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set +# CONFIG_ESP_HTTP_CLIENT_ENABLE_DIGEST_AUTH is not set +# end of ESP HTTP client + +# +# HTTP Server +# +CONFIG_HTTPD_MAX_REQ_HDR_LEN=1024 +CONFIG_HTTPD_MAX_URI_LEN=512 +CONFIG_HTTPD_ERR_RESP_NO_DELAY=y +CONFIG_HTTPD_PURGE_BUF_LEN=32 +# CONFIG_HTTPD_LOG_PURGE_DATA is not set +# CONFIG_HTTPD_WS_SUPPORT is not set +# CONFIG_HTTPD_QUEUE_WORK_BLOCKING is not set +# end of HTTP Server + +# +# ESP HTTPS OTA +# +# CONFIG_ESP_HTTPS_OTA_DECRYPT_CB is not set +# CONFIG_ESP_HTTPS_OTA_ALLOW_HTTP is not set +# end of ESP HTTPS OTA + +# +# ESP HTTPS server +# +# CONFIG_ESP_HTTPS_SERVER_ENABLE is not set +# end of ESP HTTPS server + +# +# Hardware Settings +# + +# +# Chip revision +# +CONFIG_ESP32_REV_MIN_0=y +# CONFIG_ESP32_REV_MIN_1 is not set +# CONFIG_ESP32_REV_MIN_1_1 is not set +# CONFIG_ESP32_REV_MIN_2 is not set +# CONFIG_ESP32_REV_MIN_3 is not set +# CONFIG_ESP32_REV_MIN_3_1 is not set +CONFIG_ESP32_REV_MIN=0 +CONFIG_ESP32_REV_MIN_FULL=0 +CONFIG_ESP_REV_MIN_FULL=0 + +# +# Maximum Supported ESP32 Revision (Rev v3.99) +# +CONFIG_ESP32_REV_MAX_FULL=399 +CONFIG_ESP_REV_MAX_FULL=399 +# end of Chip revision + +# +# MAC Config +# +CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA=y +CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP=y +CONFIG_ESP_MAC_ADDR_UNIVERSE_BT=y +CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y +CONFIG_ESP_MAC_UNIVERSAL_MAC_ADDRESSES_FOUR=y +# CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_TWO is not set +CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR=y +CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES=4 +# CONFIG_ESP_MAC_IGNORE_MAC_CRC_ERROR is not set +# end of MAC Config + +# +# Sleep Config +# +CONFIG_ESP_SLEEP_FLASH_LEAKAGE_WORKAROUND=y +CONFIG_ESP_SLEEP_PSRAM_LEAKAGE_WORKAROUND=y +# CONFIG_ESP_SLEEP_MSPI_NEED_ALL_IO_PU is not set +CONFIG_ESP_SLEEP_RTC_BUS_ISO_WORKAROUND=y +# CONFIG_ESP_SLEEP_GPIO_RESET_WORKAROUND is not set +CONFIG_ESP_SLEEP_DEEP_SLEEP_WAKEUP_DELAY=2000 +# end of Sleep Config + +# +# RTC Clock Config +# +CONFIG_RTC_CLK_SRC_INT_RC=y +# CONFIG_RTC_CLK_SRC_EXT_CRYS is not set +# CONFIG_RTC_CLK_SRC_EXT_OSC is not set +# CONFIG_RTC_CLK_SRC_INT_8MD256 is not set +CONFIG_RTC_CLK_CAL_CYCLES=1024 +# end of RTC Clock Config + +# +# Peripheral Control +# +CONFIG_PERIPH_CTRL_FUNC_IN_IRAM=y +# end of Peripheral Control + +# +# Main XTAL Config +# +# CONFIG_XTAL_FREQ_26 is not set +CONFIG_XTAL_FREQ_40=y +# CONFIG_XTAL_FREQ_AUTO is not set +CONFIG_XTAL_FREQ=40 +# end of Main XTAL Config +# end of Hardware Settings + +# +# LCD and Touch Panel +# + +# +# LCD Touch Drivers are maintained in the IDF Component Registry +# + +# +# LCD Peripheral Configuration +# +CONFIG_LCD_PANEL_IO_FORMAT_BUF_SIZE=32 +# CONFIG_LCD_ENABLE_DEBUG_LOG is not set +# end of LCD Peripheral Configuration +# end of LCD and Touch Panel + +# +# ESP NETIF Adapter +# +CONFIG_ESP_NETIF_IP_LOST_TIMER_INTERVAL=120 +CONFIG_ESP_NETIF_TCPIP_LWIP=y +# CONFIG_ESP_NETIF_LOOPBACK is not set +CONFIG_ESP_NETIF_USES_TCPIP_WITH_BSD_API=y +# CONFIG_ESP_NETIF_RECEIVE_REPORT_ERRORS is not set +# CONFIG_ESP_NETIF_L2_TAP is not set +# CONFIG_ESP_NETIF_BRIDGE_EN is not set +# end of ESP NETIF Adapter + +# +# Partition API Configuration +# +# end of Partition API Configuration + +# +# PHY +# +CONFIG_ESP_PHY_CALIBRATION_AND_DATA_STORAGE=y +# CONFIG_ESP_PHY_INIT_DATA_IN_PARTITION is not set +CONFIG_ESP_PHY_MAX_WIFI_TX_POWER=20 +CONFIG_ESP_PHY_MAX_TX_POWER=20 +CONFIG_ESP_PHY_REDUCE_TX_POWER=y +CONFIG_ESP_PHY_RF_CAL_PARTIAL=y +# CONFIG_ESP_PHY_RF_CAL_NONE is not set +# CONFIG_ESP_PHY_RF_CAL_FULL is not set +CONFIG_ESP_PHY_CALIBRATION_MODE=0 +# end of PHY + +# +# Power Management +# +# CONFIG_PM_ENABLE is not set +# end of Power Management + +# +# ESP PSRAM +# +CONFIG_SPIRAM=y + +# +# SPI RAM config +# +CONFIG_SPIRAM_MODE_QUAD=y +CONFIG_SPIRAM_TYPE_AUTO=y +# CONFIG_SPIRAM_TYPE_ESPPSRAM16 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM32 is not set +# CONFIG_SPIRAM_TYPE_ESPPSRAM64 is not set +CONFIG_SPIRAM_SPEED_40M=y +# CONFIG_SPIRAM_SPEED_80M is not set +CONFIG_SPIRAM_SPEED=40 +CONFIG_SPIRAM_BOOT_INIT=y +# CONFIG_SPIRAM_IGNORE_NOTFOUND is not set +# CONFIG_SPIRAM_USE_MEMMAP is not set +# CONFIG_SPIRAM_USE_CAPS_ALLOC is not set +CONFIG_SPIRAM_USE_MALLOC=y +CONFIG_SPIRAM_MEMTEST=y +CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL=16384 +# CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP is not set +CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL=32768 +# CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY is not set +# CONFIG_SPIRAM_ALLOW_NOINIT_SEG_EXTERNAL_MEMORY is not set +CONFIG_SPIRAM_CACHE_WORKAROUND=y + +# +# SPIRAM cache workaround debugging +# +CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_MEMW=y +# CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_DUPLDST is not set +# CONFIG_SPIRAM_CACHE_WORKAROUND_STRATEGY_NOPS is not set +# end of SPIRAM cache workaround debugging + +# +# SPIRAM workaround libraries placement +# +CONFIG_SPIRAM_CACHE_LIBJMP_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBMATH_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBNUMPARSER_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBIO_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBTIME_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBCHAR_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBMEM_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBSTR_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBRAND_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBENV_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBFILE_IN_IRAM=y +CONFIG_SPIRAM_CACHE_LIBMISC_IN_IRAM=y +# end of SPIRAM workaround libraries placement + +CONFIG_SPIRAM_BANKSWITCH_ENABLE=y +CONFIG_SPIRAM_BANKSWITCH_RESERVE=8 +# CONFIG_SPIRAM_ALLOW_STACK_EXTERNAL_MEMORY is not set + +# +# PSRAM clock and cs IO for ESP32-DOWD +# +CONFIG_D0WD_PSRAM_CLK_IO=17 +CONFIG_D0WD_PSRAM_CS_IO=16 +# end of PSRAM clock and cs IO for ESP32-DOWD + +# +# PSRAM clock and cs IO for ESP32-D2WD +# +CONFIG_D2WD_PSRAM_CLK_IO=9 +CONFIG_D2WD_PSRAM_CS_IO=10 +# end of PSRAM clock and cs IO for ESP32-D2WD + +# +# PSRAM clock and cs IO for ESP32-PICO +# +CONFIG_PICO_PSRAM_CS_IO=10 +# end of PSRAM clock and cs IO for ESP32-PICO + +# CONFIG_SPIRAM_2T_MODE is not set +# end of SPI RAM config +# end of ESP PSRAM + +# +# ESP Ringbuf +# +# CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH is not set +# end of ESP Ringbuf + +# +# ESP System Settings +# +# CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_80 is not set +# CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_160 is not set +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ=240 + +# +# Memory +# +# CONFIG_ESP32_USE_FIXED_STATIC_RAM_SIZE is not set + +# +# Non-backward compatible options +# +# CONFIG_ESP_SYSTEM_ESP32_SRAM1_REGION_AS_IRAM is not set +# end of Non-backward compatible options +# end of Memory + +# +# Trace memory +# +# CONFIG_ESP32_TRAX is not set +CONFIG_ESP32_TRACEMEM_RESERVE_DRAM=0x0 +# end of Trace memory + +# CONFIG_ESP_SYSTEM_PANIC_PRINT_HALT is not set +CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT=y +# CONFIG_ESP_SYSTEM_PANIC_SILENT_REBOOT is not set +# CONFIG_ESP_SYSTEM_PANIC_GDBSTUB is not set +# CONFIG_ESP_SYSTEM_GDBSTUB_RUNTIME is not set +CONFIG_ESP_SYSTEM_PANIC_REBOOT_DELAY_SECONDS=0 + +# +# Memory protection +# +# end of Memory protection + +CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32 +CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304 +CONFIG_ESP_MAIN_TASK_STACK_SIZE=2560 +CONFIG_ESP_MAIN_TASK_AFFINITY_CPU0=y +# CONFIG_ESP_MAIN_TASK_AFFINITY_CPU1 is not set +# CONFIG_ESP_MAIN_TASK_AFFINITY_NO_AFFINITY is not set +CONFIG_ESP_MAIN_TASK_AFFINITY=0x0 +CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE=2048 +CONFIG_ESP_CONSOLE_UART_DEFAULT=y +# CONFIG_ESP_CONSOLE_UART_CUSTOM is not set +# CONFIG_ESP_CONSOLE_NONE is not set +CONFIG_ESP_CONSOLE_UART=y +CONFIG_ESP_CONSOLE_MULTIPLE_UART=y +CONFIG_ESP_CONSOLE_UART_NUM=0 +CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200 +CONFIG_ESP_INT_WDT=y +CONFIG_ESP_INT_WDT_TIMEOUT_MS=300 +CONFIG_ESP_INT_WDT_CHECK_CPU1=y +CONFIG_ESP_TASK_WDT_EN=y +CONFIG_ESP_TASK_WDT_INIT=y +# CONFIG_ESP_TASK_WDT_PANIC is not set +CONFIG_ESP_TASK_WDT_TIMEOUT_S=5 +CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y +CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=y +# CONFIG_ESP_PANIC_HANDLER_IRAM is not set +# CONFIG_ESP_DEBUG_STUBS_ENABLE is not set +CONFIG_ESP_DEBUG_OCDAWARE=y +# CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_5 is not set +CONFIG_ESP_SYSTEM_CHECK_INT_LEVEL_4=y + +# +# Brownout Detector +# +CONFIG_ESP_BROWNOUT_DET=y +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_0 is not set +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_1 is not set +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_2 is not set +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_3 is not set +CONFIG_ESP_BROWNOUT_DET_LVL_SEL_4=y +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_5 is not set +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_6 is not set +# CONFIG_ESP_BROWNOUT_DET_LVL_SEL_7 is not set +CONFIG_ESP_BROWNOUT_DET_LVL=4 +# end of Brownout Detector + +# CONFIG_ESP32_DISABLE_BASIC_ROM_CONSOLE is not set +CONFIG_ESP32_ECO3_CACHE_LOCK_FIX=y +CONFIG_ESP_SYSTEM_BROWNOUT_INTR=y +# end of ESP System Settings + +# +# IPC (Inter-Processor Call) +# +CONFIG_ESP_IPC_TASK_STACK_SIZE=1024 +CONFIG_ESP_IPC_USES_CALLERS_PRIORITY=y +CONFIG_ESP_IPC_ISR_ENABLE=y +# end of IPC (Inter-Processor Call) + +# +# High resolution timer (esp_timer) +# +# CONFIG_ESP_TIMER_PROFILING is not set +CONFIG_ESP_TIME_FUNCS_USE_RTC_TIMER=y +CONFIG_ESP_TIME_FUNCS_USE_ESP_TIMER=y +CONFIG_ESP_TIMER_TASK_STACK_SIZE=2048 +CONFIG_ESP_TIMER_INTERRUPT_LEVEL=1 +# CONFIG_ESP_TIMER_SHOW_EXPERIMENTAL is not set +CONFIG_ESP_TIMER_TASK_AFFINITY=0x0 +CONFIG_ESP_TIMER_TASK_AFFINITY_CPU0=y +CONFIG_ESP_TIMER_ISR_AFFINITY=0x1 +CONFIG_ESP_TIMER_ISR_AFFINITY_CPU0=y +# CONFIG_ESP_TIMER_SUPPORTS_ISR_DISPATCH_METHOD is not set +CONFIG_ESP_TIMER_IMPL_TG0_LAC=y +# end of High resolution timer (esp_timer) + +# +# Wi-Fi +# +CONFIG_ESP_WIFI_ENABLED=y +CONFIG_ESP_WIFI_STATIC_RX_BUFFER_NUM=8 +CONFIG_ESP_WIFI_DYNAMIC_RX_BUFFER_NUM=64 +CONFIG_ESP_WIFI_STATIC_TX_BUFFER=y +CONFIG_ESP_WIFI_TX_BUFFER_TYPE=0 +CONFIG_ESP_WIFI_STATIC_TX_BUFFER_NUM=8 +CONFIG_ESP_WIFI_CACHE_TX_BUFFER_NUM=32 +# CONFIG_ESP_WIFI_CSI_ENABLED is not set +CONFIG_ESP_WIFI_AMPDU_TX_ENABLED=y +CONFIG_ESP_WIFI_TX_BA_WIN=8 +CONFIG_ESP_WIFI_AMPDU_RX_ENABLED=y +CONFIG_ESP_WIFI_RX_BA_WIN=16 +# CONFIG_ESP_WIFI_AMSDU_TX_ENABLED is not set +CONFIG_ESP_WIFI_NVS_ENABLED=y +CONFIG_ESP_WIFI_TASK_PINNED_TO_CORE_0=y +# CONFIG_ESP_WIFI_TASK_PINNED_TO_CORE_1 is not set +CONFIG_ESP_WIFI_SOFTAP_BEACON_MAX_LEN=752 +CONFIG_ESP_WIFI_MGMT_SBUF_NUM=32 +# CONFIG_ESP_WIFI_IRAM_OPT is not set +CONFIG_ESP_WIFI_RX_IRAM_OPT=y +CONFIG_ESP_WIFI_ENABLE_WPA3_SAE=y +CONFIG_ESP_WIFI_ENABLE_SAE_PK=y +CONFIG_ESP_WIFI_SOFTAP_SAE_SUPPORT=y +CONFIG_ESP_WIFI_ENABLE_WPA3_OWE_STA=y +# CONFIG_ESP_WIFI_SLP_IRAM_OPT is not set +# CONFIG_ESP_WIFI_STA_DISCONNECTED_PM_ENABLE is not set +# CONFIG_ESP_WIFI_GMAC_SUPPORT is not set +CONFIG_ESP_WIFI_SOFTAP_SUPPORT=y +# CONFIG_ESP_WIFI_SLP_BEACON_LOST_OPT is not set +CONFIG_ESP_WIFI_ESPNOW_MAX_ENCRYPT_NUM=7 +# CONFIG_ESP_WIFI_NAN_ENABLE is not set +CONFIG_ESP_WIFI_MBEDTLS_CRYPTO=y +CONFIG_ESP_WIFI_MBEDTLS_TLS_CLIENT=y +# CONFIG_ESP_WIFI_WAPI_PSK is not set +# CONFIG_ESP_WIFI_SUITE_B_192 is not set +# CONFIG_ESP_WIFI_11KV_SUPPORT is not set +# CONFIG_ESP_WIFI_MBO_SUPPORT is not set +# CONFIG_ESP_WIFI_DPP_SUPPORT is not set +# CONFIG_ESP_WIFI_11R_SUPPORT is not set +# CONFIG_ESP_WIFI_WPS_SOFTAP_REGISTRAR is not set + +# +# WPS Configuration Options +# +# CONFIG_ESP_WIFI_WPS_STRICT is not set +# CONFIG_ESP_WIFI_WPS_PASSPHRASE is not set +# end of WPS Configuration Options + +# CONFIG_ESP_WIFI_DEBUG_PRINT is not set +# CONFIG_ESP_WIFI_TESTING_OPTIONS is not set +# end of Wi-Fi + +# +# Core dump +# +# CONFIG_ESP_COREDUMP_ENABLE_TO_FLASH is not set +# CONFIG_ESP_COREDUMP_ENABLE_TO_UART is not set +CONFIG_ESP_COREDUMP_ENABLE_TO_NONE=y +# end of Core dump + +# +# FAT Filesystem support +# +CONFIG_FATFS_VOLUME_COUNT=2 +CONFIG_FATFS_LFN_NONE=y +# CONFIG_FATFS_LFN_HEAP is not set +# CONFIG_FATFS_LFN_STACK is not set +# CONFIG_FATFS_SECTOR_512 is not set +CONFIG_FATFS_SECTOR_4096=y +# CONFIG_FATFS_CODEPAGE_DYNAMIC is not set +CONFIG_FATFS_CODEPAGE_437=y +# CONFIG_FATFS_CODEPAGE_720 is not set +# CONFIG_FATFS_CODEPAGE_737 is not set +# CONFIG_FATFS_CODEPAGE_771 is not set +# CONFIG_FATFS_CODEPAGE_775 is not set +# CONFIG_FATFS_CODEPAGE_850 is not set +# CONFIG_FATFS_CODEPAGE_852 is not set +# CONFIG_FATFS_CODEPAGE_855 is not set +# CONFIG_FATFS_CODEPAGE_857 is not set +# CONFIG_FATFS_CODEPAGE_860 is not set +# CONFIG_FATFS_CODEPAGE_861 is not set +# CONFIG_FATFS_CODEPAGE_862 is not set +# CONFIG_FATFS_CODEPAGE_863 is not set +# CONFIG_FATFS_CODEPAGE_864 is not set +# CONFIG_FATFS_CODEPAGE_865 is not set +# CONFIG_FATFS_CODEPAGE_866 is not set +# CONFIG_FATFS_CODEPAGE_869 is not set +# CONFIG_FATFS_CODEPAGE_932 is not set +# CONFIG_FATFS_CODEPAGE_936 is not set +# CONFIG_FATFS_CODEPAGE_949 is not set +# CONFIG_FATFS_CODEPAGE_950 is not set +CONFIG_FATFS_CODEPAGE=437 +CONFIG_FATFS_FS_LOCK=0 +CONFIG_FATFS_TIMEOUT_MS=10000 +CONFIG_FATFS_PER_FILE_CACHE=y +CONFIG_FATFS_ALLOC_PREFER_EXTRAM=y +# CONFIG_FATFS_USE_FASTSEEK is not set +CONFIG_FATFS_VFS_FSTAT_BLKSIZE=0 +# end of FAT Filesystem support + +# +# FreeRTOS +# + +# +# Kernel +# +# CONFIG_FREERTOS_SMP is not set +# CONFIG_FREERTOS_UNICORE is not set +CONFIG_FREERTOS_HZ=1000 +# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE is not set +# CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL is not set +CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY=y +CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1 +CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=768 +# CONFIG_FREERTOS_USE_IDLE_HOOK is not set +# CONFIG_FREERTOS_USE_TICK_HOOK is not set +CONFIG_FREERTOS_MAX_TASK_NAME_LEN=10 +CONFIG_FREERTOS_ENABLE_BACKWARD_COMPATIBILITY=y +CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1 +CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=1536 +CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=5 +CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0 +CONFIG_FREERTOS_TASK_NOTIFICATION_ARRAY_ENTRIES=1 +# CONFIG_FREERTOS_USE_TRACE_FACILITY is not set +# CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set +# end of Kernel + +# +# Port +# +# CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK is not set +CONFIG_FREERTOS_TLSP_DELETION_CALLBACKS=y +# CONFIG_FREERTOS_ENABLE_STATIC_TASK_CLEAN_UP is not set +CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y +CONFIG_FREERTOS_ISR_STACKSIZE=1536 +CONFIG_FREERTOS_INTERRUPT_BACKTRACE=y +# CONFIG_FREERTOS_FPU_IN_ISR is not set +CONFIG_FREERTOS_TICK_SUPPORT_CORETIMER=y +CONFIG_FREERTOS_CORETIMER_0=y +# CONFIG_FREERTOS_CORETIMER_1 is not set +CONFIG_FREERTOS_SYSTICK_USES_CCOUNT=y +CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=y +# CONFIG_FREERTOS_PLACE_SNAPSHOT_FUNS_INTO_FLASH is not set +# CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set +CONFIG_FREERTOS_ENABLE_TASK_SNAPSHOT=y +# end of Port + +CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF +CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION=y +CONFIG_FREERTOS_DEBUG_OCDAWARE=y +# end of FreeRTOS + +# +# Hardware Abstraction Layer (HAL) and Low Level (LL) +# +CONFIG_HAL_ASSERTION_EQUALS_SYSTEM=y +# CONFIG_HAL_ASSERTION_DISABLE is not set +# CONFIG_HAL_ASSERTION_SILENT is not set +# CONFIG_HAL_ASSERTION_ENABLE is not set +CONFIG_HAL_DEFAULT_ASSERTION_LEVEL=2 +CONFIG_HAL_SPI_MASTER_FUNC_IN_IRAM=y +# end of Hardware Abstraction Layer (HAL) and Low Level (LL) + +# +# Heap memory debugging +# +CONFIG_HEAP_POISONING_DISABLED=y +# CONFIG_HEAP_POISONING_LIGHT is not set +# CONFIG_HEAP_POISONING_COMPREHENSIVE is not set +CONFIG_HEAP_TRACING_OFF=y +# CONFIG_HEAP_TRACING_STANDALONE is not set +# CONFIG_HEAP_TRACING_TOHOST is not set +# CONFIG_HEAP_USE_HOOKS is not set +# CONFIG_HEAP_ABORT_WHEN_ALLOCATION_FAILS is not set +# CONFIG_HEAP_PLACE_FUNCTION_INTO_FLASH is not set +# end of Heap memory debugging + +CONFIG_IEEE802154_CCA_THRESHOLD=-60 +CONFIG_IEEE802154_PENDING_TABLE_SIZE=20 + +# +# Log output +# +# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set +# CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set +# CONFIG_LOG_DEFAULT_LEVEL_WARN is not set +CONFIG_LOG_DEFAULT_LEVEL_INFO=y +# CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set +# CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set +CONFIG_LOG_DEFAULT_LEVEL=3 +CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y +# CONFIG_LOG_MAXIMUM_LEVEL_DEBUG is not set +# CONFIG_LOG_MAXIMUM_LEVEL_VERBOSE is not set +CONFIG_LOG_MAXIMUM_LEVEL=3 +CONFIG_LOG_COLORS=y +CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y +# CONFIG_LOG_TIMESTAMP_SOURCE_SYSTEM is not set +# end of Log output + +# +# LWIP +# +CONFIG_LWIP_LOCAL_HOSTNAME="espressif" +# CONFIG_LWIP_NETIF_API is not set +# CONFIG_LWIP_TCPIP_CORE_LOCKING is not set +# CONFIG_LWIP_CHECK_THREAD_SAFETY is not set +CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y +# CONFIG_LWIP_L2_TO_L3_COPY is not set +# CONFIG_LWIP_IRAM_OPTIMIZATION is not set +CONFIG_LWIP_TIMERS_ONDEMAND=y +CONFIG_LWIP_MAX_SOCKETS=6 +# CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set +# CONFIG_LWIP_SO_LINGER is not set +CONFIG_LWIP_SO_REUSE=y +# CONFIG_LWIP_SO_REUSE_RXTOALL is not set +# CONFIG_LWIP_SO_RCVBUF is not set +# CONFIG_LWIP_NETBUF_RECVINFO is not set +CONFIG_LWIP_IP4_FRAG=y +CONFIG_LWIP_IP6_FRAG=y +# CONFIG_LWIP_IP4_REASSEMBLY is not set +# CONFIG_LWIP_IP6_REASSEMBLY is not set +CONFIG_LWIP_IP_REASS_MAX_PBUFS=10 +# CONFIG_LWIP_IP_FORWARD is not set +# CONFIG_LWIP_STATS is not set +CONFIG_LWIP_ESP_GRATUITOUS_ARP=y +CONFIG_LWIP_GARP_TMR_INTERVAL=60 +CONFIG_LWIP_ESP_MLDV6_REPORT=y +CONFIG_LWIP_MLDV6_TMR_INTERVAL=40 +CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32 +CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y +# CONFIG_LWIP_DHCP_DISABLE_CLIENT_ID is not set +CONFIG_LWIP_DHCP_DISABLE_VENDOR_CLASS_ID=y +# CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set +CONFIG_LWIP_DHCP_OPTIONS_LEN=68 +CONFIG_LWIP_NUM_NETIF_CLIENT_DATA=0 +CONFIG_LWIP_DHCP_COARSE_TIMER_SECS=1 + +# +# DHCP server +# +CONFIG_LWIP_DHCPS=y +CONFIG_LWIP_DHCPS_LEASE_UNIT=60 +CONFIG_LWIP_DHCPS_MAX_STATION_NUM=8 +# end of DHCP server + +# CONFIG_LWIP_AUTOIP is not set +CONFIG_LWIP_IPV4=y +CONFIG_LWIP_IPV6=y +# CONFIG_LWIP_IPV6_AUTOCONFIG is not set +CONFIG_LWIP_IPV6_NUM_ADDRESSES=3 +# CONFIG_LWIP_IPV6_FORWARD is not set +# CONFIG_LWIP_NETIF_STATUS_CALLBACK is not set +CONFIG_LWIP_NETIF_LOOPBACK=y +CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8 + +# +# TCP +# +CONFIG_LWIP_MAX_ACTIVE_TCP=6 +CONFIG_LWIP_MAX_LISTENING_TCP=6 +CONFIG_LWIP_TCP_HIGH_SPEED_RETRANSMISSION=y +CONFIG_LWIP_TCP_MAXRTX=12 +CONFIG_LWIP_TCP_SYNMAXRTX=12 +CONFIG_LWIP_TCP_MSS=1460 +CONFIG_LWIP_TCP_TMR_INTERVAL=250 +CONFIG_LWIP_TCP_MSL=60000 +CONFIG_LWIP_TCP_FIN_WAIT_TIMEOUT=20000 +CONFIG_LWIP_TCP_SND_BUF_DEFAULT=11680 +CONFIG_LWIP_TCP_WND_DEFAULT=11680 +CONFIG_LWIP_TCP_RECVMBOX_SIZE=10 +CONFIG_LWIP_TCP_QUEUE_OOSEQ=y +CONFIG_LWIP_TCP_SACK_OUT=y +CONFIG_LWIP_TCP_OVERSIZE_MSS=y +# CONFIG_LWIP_TCP_OVERSIZE_QUARTER_MSS is not set +# CONFIG_LWIP_TCP_OVERSIZE_DISABLE is not set +CONFIG_LWIP_TCP_RTO_TIME=1500 +# end of TCP + +# +# UDP +# +CONFIG_LWIP_MAX_UDP_PCBS=1 +CONFIG_LWIP_UDP_RECVMBOX_SIZE=6 +# end of UDP + +# +# Checksums +# +# CONFIG_LWIP_CHECKSUM_CHECK_IP is not set +# CONFIG_LWIP_CHECKSUM_CHECK_UDP is not set +CONFIG_LWIP_CHECKSUM_CHECK_ICMP=y +# end of Checksums + +CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=3072 +# CONFIG_LWIP_TCPIP_TASK_AFFINITY_NO_AFFINITY is not set +CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0=y +# CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU1 is not set +CONFIG_LWIP_TCPIP_TASK_AFFINITY=0x0 +# CONFIG_LWIP_PPP_SUPPORT is not set +CONFIG_LWIP_IPV6_MEMP_NUM_ND6_QUEUE=3 +CONFIG_LWIP_IPV6_ND6_NUM_NEIGHBORS=5 +# CONFIG_LWIP_SLIP_SUPPORT is not set + +# +# ICMP +# +CONFIG_LWIP_ICMP=y +# CONFIG_LWIP_MULTICAST_PING is not set +# CONFIG_LWIP_BROADCAST_PING is not set +# end of ICMP + +# +# LWIP RAW API +# +CONFIG_LWIP_MAX_RAW_PCBS=16 +# end of LWIP RAW API + +# +# SNTP +# +CONFIG_LWIP_SNTP_MAX_SERVERS=1 +# CONFIG_LWIP_DHCP_GET_NTP_SRV is not set +CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000 +# end of SNTP + +CONFIG_LWIP_BRIDGEIF_MAX_PORTS=7 +CONFIG_LWIP_ESP_LWIP_ASSERT=y + +# +# Hooks +# +# CONFIG_LWIP_HOOK_TCP_ISN_NONE is not set +CONFIG_LWIP_HOOK_TCP_ISN_DEFAULT=y +# CONFIG_LWIP_HOOK_TCP_ISN_CUSTOM is not set +CONFIG_LWIP_HOOK_IP6_ROUTE_NONE=y +# CONFIG_LWIP_HOOK_IP6_ROUTE_DEFAULT is not set +# CONFIG_LWIP_HOOK_IP6_ROUTE_CUSTOM is not set +CONFIG_LWIP_HOOK_ND6_GET_GW_NONE=y +# CONFIG_LWIP_HOOK_ND6_GET_GW_DEFAULT is not set +# CONFIG_LWIP_HOOK_ND6_GET_GW_CUSTOM is not set +CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_NONE=y +# CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_DEFAULT is not set +# CONFIG_LWIP_HOOK_IP6_SELECT_SRC_ADDR_CUSTOM is not set +CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_NONE=y +# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_DEFAULT is not set +# CONFIG_LWIP_HOOK_NETCONN_EXT_RESOLVE_CUSTOM is not set +CONFIG_LWIP_HOOK_IP6_INPUT_NONE=y +# CONFIG_LWIP_HOOK_IP6_INPUT_DEFAULT is not set +# CONFIG_LWIP_HOOK_IP6_INPUT_CUSTOM is not set +# end of Hooks + +# CONFIG_LWIP_DEBUG is not set +# end of LWIP + +# +# mbedTLS +# +CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y +# CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC is not set +# CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC is not set +# CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC is not set +CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y +CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384 +CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096 +# CONFIG_MBEDTLS_DYNAMIC_BUFFER is not set +# CONFIG_MBEDTLS_DEBUG is not set + +# +# mbedTLS v3.x related +# +# CONFIG_MBEDTLS_SSL_PROTO_TLS1_3 is not set +# CONFIG_MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH is not set +# CONFIG_MBEDTLS_X509_TRUSTED_CERT_CALLBACK is not set +# CONFIG_MBEDTLS_SSL_CONTEXT_SERIALIZATION is not set +CONFIG_MBEDTLS_SSL_KEEP_PEER_CERTIFICATE=y +CONFIG_MBEDTLS_PKCS7_C=y +# end of mbedTLS v3.x related + +# +# Certificate Bundle +# +# CONFIG_MBEDTLS_CERTIFICATE_BUNDLE is not set +# end of Certificate Bundle + +# CONFIG_MBEDTLS_ECP_RESTARTABLE is not set +# CONFIG_MBEDTLS_CMAC_C is not set +CONFIG_MBEDTLS_HARDWARE_AES=y +CONFIG_MBEDTLS_HARDWARE_MPI=y +CONFIG_MBEDTLS_HARDWARE_SHA=y +CONFIG_MBEDTLS_ROM_MD5=y +# CONFIG_MBEDTLS_ATCA_HW_ECDSA_SIGN is not set +# CONFIG_MBEDTLS_ATCA_HW_ECDSA_VERIFY is not set +CONFIG_MBEDTLS_HAVE_TIME=y +# CONFIG_MBEDTLS_PLATFORM_TIME_ALT is not set +# CONFIG_MBEDTLS_HAVE_TIME_DATE is not set +CONFIG_MBEDTLS_ECDSA_DETERMINISTIC=y +CONFIG_MBEDTLS_SHA512_C=y +CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=y +# CONFIG_MBEDTLS_TLS_SERVER_ONLY is not set +# CONFIG_MBEDTLS_TLS_CLIENT_ONLY is not set +# CONFIG_MBEDTLS_TLS_DISABLED is not set +CONFIG_MBEDTLS_TLS_SERVER=y +CONFIG_MBEDTLS_TLS_CLIENT=y +CONFIG_MBEDTLS_TLS_ENABLED=y + +# +# TLS Key Exchange Methods +# +# CONFIG_MBEDTLS_PSK_MODES is not set +CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y +CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE=y +CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA=y +CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA=y +CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA=y +CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA=y +# end of TLS Key Exchange Methods + +CONFIG_MBEDTLS_SSL_RENEGOTIATION=y +CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y +# CONFIG_MBEDTLS_SSL_PROTO_GMTSSL1_1 is not set +# CONFIG_MBEDTLS_SSL_PROTO_DTLS is not set +CONFIG_MBEDTLS_SSL_ALPN=y +CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS=y +CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS=y + +# +# Symmetric Ciphers +# +CONFIG_MBEDTLS_AES_C=y +# CONFIG_MBEDTLS_CAMELLIA_C is not set +# CONFIG_MBEDTLS_DES_C is not set +# CONFIG_MBEDTLS_BLOWFISH_C is not set +# CONFIG_MBEDTLS_XTEA_C is not set +CONFIG_MBEDTLS_CCM_C=y +CONFIG_MBEDTLS_GCM_C=y +# CONFIG_MBEDTLS_NIST_KW_C is not set +# end of Symmetric Ciphers + +# CONFIG_MBEDTLS_RIPEMD160_C is not set + +# +# Certificates +# +CONFIG_MBEDTLS_PEM_PARSE_C=y +CONFIG_MBEDTLS_PEM_WRITE_C=y +CONFIG_MBEDTLS_X509_CRL_PARSE_C=y +CONFIG_MBEDTLS_X509_CSR_PARSE_C=y +# end of Certificates + +CONFIG_MBEDTLS_ECP_C=y +# CONFIG_MBEDTLS_DHM_C is not set +CONFIG_MBEDTLS_ECDH_C=y +CONFIG_MBEDTLS_ECDSA_C=y +# CONFIG_MBEDTLS_ECJPAKE_C is not set +CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED=y +CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED=y +CONFIG_MBEDTLS_ECP_NIST_OPTIM=y +# CONFIG_MBEDTLS_POLY1305_C is not set +# CONFIG_MBEDTLS_CHACHA20_C is not set +# CONFIG_MBEDTLS_HKDF_C is not set +# CONFIG_MBEDTLS_THREADING_C is not set +# CONFIG_MBEDTLS_LARGE_KEY_SOFTWARE_MPI is not set +# CONFIG_MBEDTLS_SECURITY_RISKS is not set +# end of mbedTLS + +# +# ESP-MQTT Configurations +# +CONFIG_MQTT_PROTOCOL_311=y +# CONFIG_MQTT_PROTOCOL_5 is not set +CONFIG_MQTT_TRANSPORT_SSL=y +CONFIG_MQTT_TRANSPORT_WEBSOCKET=y +CONFIG_MQTT_TRANSPORT_WEBSOCKET_SECURE=y +# CONFIG_MQTT_MSG_ID_INCREMENTAL is not set +# CONFIG_MQTT_SKIP_PUBLISH_IF_DISCONNECTED is not set +# CONFIG_MQTT_REPORT_DELETED_MESSAGES is not set +# CONFIG_MQTT_USE_CUSTOM_CONFIG is not set +# CONFIG_MQTT_TASK_CORE_SELECTION_ENABLED is not set +# CONFIG_MQTT_CUSTOM_OUTBOX is not set +# end of ESP-MQTT Configurations + +# +# Newlib +# +CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF=y +# CONFIG_NEWLIB_STDOUT_LINE_ENDING_LF is not set +# CONFIG_NEWLIB_STDOUT_LINE_ENDING_CR is not set +# CONFIG_NEWLIB_STDIN_LINE_ENDING_CRLF is not set +# CONFIG_NEWLIB_STDIN_LINE_ENDING_LF is not set +CONFIG_NEWLIB_STDIN_LINE_ENDING_CR=y +# CONFIG_NEWLIB_NANO_FORMAT is not set +CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC_HRT=y +# CONFIG_NEWLIB_TIME_SYSCALL_USE_RTC is not set +# CONFIG_NEWLIB_TIME_SYSCALL_USE_HRT is not set +# CONFIG_NEWLIB_TIME_SYSCALL_USE_NONE is not set +# end of Newlib + +# +# NVS +# +# CONFIG_NVS_ASSERT_ERROR_CHECK is not set +# end of NVS + +# +# OpenThread +# +# CONFIG_OPENTHREAD_ENABLED is not set + +# +# Thread Operational Dataset +# +CONFIG_OPENTHREAD_NETWORK_NAME="OpenThread-ESP" +CONFIG_OPENTHREAD_NETWORK_CHANNEL=15 +CONFIG_OPENTHREAD_NETWORK_PANID=0x1234 +CONFIG_OPENTHREAD_NETWORK_EXTPANID="dead00beef00cafe" +CONFIG_OPENTHREAD_NETWORK_MASTERKEY="00112233445566778899aabbccddeeff" +CONFIG_OPENTHREAD_NETWORK_PSKC="104810e2315100afd6bc9215a6bfac53" +# end of Thread Operational Dataset +# end of OpenThread + +# +# Protocomm +# +CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_0=y +CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_1=y +CONFIG_ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_2=y +# end of Protocomm + +# +# PThreads +# +CONFIG_PTHREAD_TASK_PRIO_DEFAULT=5 +CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072 +CONFIG_PTHREAD_STACK_MIN=768 +CONFIG_PTHREAD_DEFAULT_CORE_NO_AFFINITY=y +# CONFIG_PTHREAD_DEFAULT_CORE_0 is not set +# CONFIG_PTHREAD_DEFAULT_CORE_1 is not set +CONFIG_PTHREAD_TASK_CORE_DEFAULT=-1 +CONFIG_PTHREAD_TASK_NAME_DEFAULT="pthread" +# end of PThreads + +# +# MMU Config +# +CONFIG_MMU_PAGE_SIZE_64KB=y +CONFIG_MMU_PAGE_MODE="64KB" +CONFIG_MMU_PAGE_SIZE=0x10000 +# end of MMU Config + +# +# SPI Flash driver +# +# CONFIG_SPI_FLASH_VERIFY_WRITE is not set +# CONFIG_SPI_FLASH_ENABLE_COUNTERS is not set +CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y +CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS=y +# CONFIG_SPI_FLASH_DANGEROUS_WRITE_FAILS is not set +# CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED is not set +# CONFIG_SPI_FLASH_SHARE_SPI1_BUS is not set +# CONFIG_SPI_FLASH_BYPASS_BLOCK_ERASE is not set +CONFIG_SPI_FLASH_YIELD_DURING_ERASE=y +CONFIG_SPI_FLASH_ERASE_YIELD_DURATION_MS=20 +CONFIG_SPI_FLASH_ERASE_YIELD_TICKS=1 +CONFIG_SPI_FLASH_WRITE_CHUNK_SIZE=8192 +# CONFIG_SPI_FLASH_SIZE_OVERRIDE is not set +# CONFIG_SPI_FLASH_CHECK_ERASE_TIMEOUT_DISABLED is not set +# CONFIG_SPI_FLASH_OVERRIDE_CHIP_DRIVER_LIST is not set + +# +# SPI Flash behavior when brownout +# +CONFIG_SPI_FLASH_BROWNOUT_RESET_XMC=y +CONFIG_SPI_FLASH_BROWNOUT_RESET=y +# end of SPI Flash behavior when brownout + +# +# Auto-detect flash chips +# +CONFIG_SPI_FLASH_VENDOR_XMC_SUPPORTED=y +CONFIG_SPI_FLASH_VENDOR_GD_SUPPORTED=y +CONFIG_SPI_FLASH_VENDOR_ISSI_SUPPORTED=y +CONFIG_SPI_FLASH_VENDOR_MXIC_SUPPORTED=y +CONFIG_SPI_FLASH_VENDOR_WINBOND_SUPPORTED=y +CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP=y +CONFIG_SPI_FLASH_SUPPORT_MXIC_CHIP=y +CONFIG_SPI_FLASH_SUPPORT_GD_CHIP=y +CONFIG_SPI_FLASH_SUPPORT_WINBOND_CHIP=y +# CONFIG_SPI_FLASH_SUPPORT_BOYA_CHIP is not set +# CONFIG_SPI_FLASH_SUPPORT_TH_CHIP is not set +# end of Auto-detect flash chips + +CONFIG_SPI_FLASH_ENABLE_ENCRYPTED_READ_WRITE=y +# end of SPI Flash driver + +# +# SPIFFS Configuration +# +CONFIG_SPIFFS_MAX_PARTITIONS=3 + +# +# SPIFFS Cache Configuration +# +CONFIG_SPIFFS_CACHE=y +CONFIG_SPIFFS_CACHE_WR=y +# CONFIG_SPIFFS_CACHE_STATS is not set +# end of SPIFFS Cache Configuration + +CONFIG_SPIFFS_PAGE_CHECK=y +CONFIG_SPIFFS_GC_MAX_RUNS=10 +# CONFIG_SPIFFS_GC_STATS is not set +CONFIG_SPIFFS_PAGE_SIZE=256 +CONFIG_SPIFFS_OBJ_NAME_LEN=32 +# CONFIG_SPIFFS_FOLLOW_SYMLINKS is not set +CONFIG_SPIFFS_USE_MAGIC=y +CONFIG_SPIFFS_USE_MAGIC_LENGTH=y +CONFIG_SPIFFS_META_LENGTH=4 +CONFIG_SPIFFS_USE_MTIME=y + +# +# Debug Configuration +# +# CONFIG_SPIFFS_DBG is not set +# CONFIG_SPIFFS_API_DBG is not set +# CONFIG_SPIFFS_GC_DBG is not set +# CONFIG_SPIFFS_CACHE_DBG is not set +# CONFIG_SPIFFS_CHECK_DBG is not set +# CONFIG_SPIFFS_TEST_VISUALISATION is not set +# end of Debug Configuration +# end of SPIFFS Configuration + +# +# TCP Transport +# + +# +# Websocket +# +CONFIG_WS_TRANSPORT=y +CONFIG_WS_BUFFER_SIZE=1024 +# CONFIG_WS_DYNAMIC_BUFFER is not set +# end of Websocket +# end of TCP Transport + +# +# Ultra Low Power (ULP) Co-processor +# +# CONFIG_ULP_COPROC_ENABLED is not set +# end of Ultra Low Power (ULP) Co-processor + +# +# Unity unit testing library +# +CONFIG_UNITY_ENABLE_FLOAT=y +CONFIG_UNITY_ENABLE_DOUBLE=y +# CONFIG_UNITY_ENABLE_64BIT is not set +# CONFIG_UNITY_ENABLE_COLOR is not set +CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=y +# CONFIG_UNITY_ENABLE_FIXTURE is not set +# CONFIG_UNITY_ENABLE_BACKTRACE_ON_FAIL is not set +# end of Unity unit testing library + +# +# Root Hub configuration +# +# end of Root Hub configuration + +# +# Virtual file system +# +CONFIG_VFS_SUPPORT_IO=y +CONFIG_VFS_SUPPORT_DIR=y +CONFIG_VFS_SUPPORT_SELECT=y +CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT=y +CONFIG_VFS_SUPPORT_TERMIOS=y +CONFIG_VFS_MAX_COUNT=8 + +# +# Host File System I/O (Semihosting) +# +CONFIG_VFS_SEMIHOSTFS_MAX_MOUNT_POINTS=1 +# end of Host File System I/O (Semihosting) +# end of Virtual file system + +# +# Wear Levelling +# +# CONFIG_WL_SECTOR_SIZE_512 is not set +CONFIG_WL_SECTOR_SIZE_4096=y +CONFIG_WL_SECTOR_SIZE=4096 +# end of Wear Levelling + +# +# Wi-Fi Provisioning Manager +# +CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16 +CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT=30 +# CONFIG_WIFI_PROV_BLE_FORCE_ENCRYPTION is not set +CONFIG_WIFI_PROV_STA_ALL_CHANNEL_SCAN=y +# CONFIG_WIFI_PROV_STA_FAST_SCAN is not set +# end of Wi-Fi Provisioning Manager + +# +# WebSocket Server +# +CONFIG_WEBSOCKET_SERVER_MAX_CLIENTS=1 +CONFIG_WEBSOCKET_SERVER_QUEUE_SIZE=2 +CONFIG_WEBSOCKET_SERVER_QUEUE_TIMEOUT=30 +CONFIG_WEBSOCKET_SERVER_TASK_STACK_DEPTH=3000 +CONFIG_WEBSOCKET_SERVER_TASK_PRIORITY=5 +# CONFIG_WEBSOCKET_SERVER_PINNED is not set +# end of WebSocket Server + +# +# DSP Library +# +CONFIG_DSP_OPTIMIZATIONS_SUPPORTED=y +# CONFIG_DSP_ANSI is not set +CONFIG_DSP_OPTIMIZED=y +CONFIG_DSP_OPTIMIZATION=1 +# CONFIG_DSP_MAX_FFT_SIZE_512 is not set +# CONFIG_DSP_MAX_FFT_SIZE_1024 is not set +# CONFIG_DSP_MAX_FFT_SIZE_2048 is not set +CONFIG_DSP_MAX_FFT_SIZE_4096=y +# CONFIG_DSP_MAX_FFT_SIZE_8192 is not set +# CONFIG_DSP_MAX_FFT_SIZE_16384 is not set +# CONFIG_DSP_MAX_FFT_SIZE_32768 is not set +CONFIG_DSP_MAX_FFT_SIZE=4096 +# end of DSP Library + +# +# mDNS +# +CONFIG_MDNS_MAX_INTERFACES=3 +CONFIG_MDNS_MAX_SERVICES=10 +CONFIG_MDNS_TASK_PRIORITY=1 +CONFIG_MDNS_ACTION_QUEUE_LEN=16 +CONFIG_MDNS_TASK_STACK_SIZE=2816 +CONFIG_MDNS_TASK_AFFINITY_NO_AFFINITY=y +# CONFIG_MDNS_TASK_AFFINITY_CPU0 is not set +# CONFIG_MDNS_TASK_AFFINITY_CPU1 is not set +CONFIG_MDNS_TASK_AFFINITY=0x7FFFFFFF +CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS=2000 +CONFIG_MDNS_TIMER_PERIOD_MS=100 +# CONFIG_MDNS_NETWORKING_SOCKET is not set +# CONFIG_MDNS_SKIP_SUPPRESSING_OWN_QUERIES is not set +# CONFIG_MDNS_ENABLE_DEBUG_PRINTS is not set +# CONFIG_MDNS_RESPOND_REVERSE_QUERIES is not set +CONFIG_MDNS_MULTIPLE_INSTANCE=y + +# +# MDNS Predefined interfaces +# +CONFIG_MDNS_PREDEF_NETIF_STA=y +CONFIG_MDNS_PREDEF_NETIF_AP=y +CONFIG_MDNS_PREDEF_NETIF_ETH=y +# end of MDNS Predefined interfaces +# end of mDNS +# end of Component config + +# CONFIG_IDF_EXPERIMENTAL_FEATURES is not set + +# Deprecated options for backward compatibility +# CONFIG_APP_BUILD_TYPE_ELF_RAM is not set +# CONFIG_NO_BLOBS is not set +# CONFIG_ESP32_NO_BLOBS is not set +# CONFIG_ESP32_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set +# CONFIG_ESP32_COMPATIBLE_PRE_V3_1_BOOTLOADERS is not set +# CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set +# CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set +# CONFIG_LOG_BOOTLOADER_LEVEL_WARN is not set +CONFIG_LOG_BOOTLOADER_LEVEL_INFO=y +# CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set +# CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set +CONFIG_LOG_BOOTLOADER_LEVEL=3 +CONFIG_APP_ROLLBACK_ENABLE=y +# CONFIG_APP_ANTI_ROLLBACK is not set +# CONFIG_FLASH_ENCRYPTION_ENABLED is not set +CONFIG_FLASHMODE_QIO=y +# CONFIG_FLASHMODE_QOUT is not set +# CONFIG_FLASHMODE_DIO is not set +# CONFIG_FLASHMODE_DOUT is not set +CONFIG_MONITOR_BAUD=115200 +# CONFIG_OPTIMIZATION_LEVEL_DEBUG is not set +# CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG is not set +# CONFIG_OPTIMIZATION_LEVEL_RELEASE is not set +# CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE is not set +CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED=y +# CONFIG_OPTIMIZATION_ASSERTIONS_SILENT is not set +# CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED is not set +CONFIG_OPTIMIZATION_ASSERTION_LEVEL=2 +# CONFIG_CXX_EXCEPTIONS is not set +CONFIG_STACK_CHECK_NONE=y +# CONFIG_STACK_CHECK_NORM is not set +# CONFIG_STACK_CHECK_STRONG is not set +# CONFIG_STACK_CHECK_ALL is not set +# CONFIG_WARN_WRITE_STRINGS is not set +# CONFIG_ESP32_APPTRACE_DEST_TRAX is not set +CONFIG_ESP32_APPTRACE_DEST_NONE=y +CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y +CONFIG_ADC2_DISABLE_DAC=y +# CONFIG_MCPWM_ISR_IN_IRAM is not set +# CONFIG_EVENT_LOOP_PROFILING is not set +CONFIG_POST_EVENTS_FROM_ISR=y +# CONFIG_POST_EVENTS_FROM_IRAM_ISR is not set +# CONFIG_OTA_ALLOW_HTTP is not set +# CONFIG_TWO_UNIVERSAL_MAC_ADDRESS is not set +CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y +CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4 +CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY=2000 +CONFIG_ESP32_RTC_CLK_SRC_INT_RC=y +CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC=y +# CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS is not set +# CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL is not set +# CONFIG_ESP32_RTC_CLK_SRC_EXT_OSC is not set +# CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_OSC is not set +# CONFIG_ESP32_RTC_CLK_SRC_INT_8MD256 is not set +# CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_8MD256 is not set +CONFIG_ESP32_RTC_CLK_CAL_CYCLES=1024 +# CONFIG_ESP32_XTAL_FREQ_26 is not set +CONFIG_ESP32_XTAL_FREQ_40=y +# CONFIG_ESP32_XTAL_FREQ_AUTO is not set +CONFIG_ESP32_XTAL_FREQ=40 +CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y +# CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set +CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20 +CONFIG_ESP32_PHY_MAX_TX_POWER=20 +CONFIG_REDUCE_PHY_TX_POWER=y +CONFIG_ESP32_REDUCE_PHY_TX_POWER=y +CONFIG_SPIRAM_SUPPORT=y +CONFIG_ESP32_SPIRAM_SUPPORT=y +# CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST is not set +# CONFIG_ESP32_DEFAULT_CPU_FREQ_80 is not set +# CONFIG_ESP32_DEFAULT_CPU_FREQ_160 is not set +CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y +CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240 +CONFIG_TRACEMEM_RESERVE_DRAM=0x0 +# CONFIG_ESP32_PANIC_PRINT_HALT is not set +CONFIG_ESP32_PANIC_PRINT_REBOOT=y +# CONFIG_ESP32_PANIC_SILENT_REBOOT is not set +# CONFIG_ESP32_PANIC_GDBSTUB is not set +CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32 +CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=2304 +CONFIG_MAIN_TASK_STACK_SIZE=2560 +CONFIG_CONSOLE_UART_DEFAULT=y +# CONFIG_CONSOLE_UART_CUSTOM is not set +# CONFIG_CONSOLE_UART_NONE is not set +# CONFIG_ESP_CONSOLE_UART_NONE is not set +CONFIG_CONSOLE_UART=y +CONFIG_CONSOLE_UART_NUM=0 +CONFIG_CONSOLE_UART_BAUDRATE=115200 +CONFIG_INT_WDT=y +CONFIG_INT_WDT_TIMEOUT_MS=300 +CONFIG_INT_WDT_CHECK_CPU1=y +CONFIG_TASK_WDT=y +CONFIG_ESP_TASK_WDT=y +# CONFIG_TASK_WDT_PANIC is not set +CONFIG_TASK_WDT_TIMEOUT_S=5 +CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y +CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1=y +# CONFIG_ESP32_DEBUG_STUBS_ENABLE is not set +CONFIG_ESP32_DEBUG_OCDAWARE=y +CONFIG_BROWNOUT_DET=y +CONFIG_ESP32_BROWNOUT_DET=y +# CONFIG_BROWNOUT_DET_LVL_SEL_0 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_0 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_1 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_1 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_2 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_2 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_3 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_3 is not set +CONFIG_BROWNOUT_DET_LVL_SEL_4=y +CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_4=y +# CONFIG_BROWNOUT_DET_LVL_SEL_5 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_5 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_6 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_6 is not set +# CONFIG_BROWNOUT_DET_LVL_SEL_7 is not set +# CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_7 is not set +CONFIG_BROWNOUT_DET_LVL=4 +CONFIG_ESP32_BROWNOUT_DET_LVL=4 +# CONFIG_DISABLE_BASIC_ROM_CONSOLE is not set +CONFIG_IPC_TASK_STACK_SIZE=1024 +CONFIG_TIMER_TASK_STACK_SIZE=2048 +CONFIG_ESP32_WIFI_ENABLED=y +CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=8 +CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=64 +CONFIG_ESP32_WIFI_STATIC_TX_BUFFER=y +CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=0 +CONFIG_ESP32_WIFI_STATIC_TX_BUFFER_NUM=8 +CONFIG_ESP32_WIFI_CACHE_TX_BUFFER_NUM=32 +# CONFIG_ESP32_WIFI_CSI_ENABLED is not set +CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y +CONFIG_ESP32_WIFI_TX_BA_WIN=8 +CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y +CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y +CONFIG_ESP32_WIFI_RX_BA_WIN=16 +CONFIG_ESP32_WIFI_RX_BA_WIN=16 +# CONFIG_ESP32_WIFI_AMSDU_TX_ENABLED is not set +CONFIG_ESP32_WIFI_NVS_ENABLED=y +CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y +# CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1 is not set +CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752 +CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32 +# CONFIG_ESP32_WIFI_IRAM_OPT is not set +CONFIG_ESP32_WIFI_RX_IRAM_OPT=y +CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE=y +CONFIG_ESP32_WIFI_ENABLE_WPA3_OWE_STA=y +CONFIG_WPA_MBEDTLS_CRYPTO=y +CONFIG_WPA_MBEDTLS_TLS_CLIENT=y +# CONFIG_WPA_WAPI_PSK is not set +# CONFIG_WPA_SUITE_B_192 is not set +# CONFIG_WPA_11KV_SUPPORT is not set +# CONFIG_WPA_MBO_SUPPORT is not set +# CONFIG_WPA_DPP_SUPPORT is not set +# CONFIG_WPA_11R_SUPPORT is not set +# CONFIG_WPA_WPS_SOFTAP_REGISTRAR is not set +# CONFIG_WPA_WPS_STRICT is not set +# CONFIG_WPA_DEBUG_PRINT is not set +# CONFIG_WPA_TESTING_OPTIONS is not set +# CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set +# CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set +CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y +CONFIG_TIMER_TASK_PRIORITY=1 +CONFIG_TIMER_TASK_STACK_DEPTH=1536 +CONFIG_TIMER_QUEUE_LENGTH=5 +# CONFIG_ENABLE_STATIC_TASK_CLEAN_UP_HOOK is not set +# CONFIG_HAL_ASSERTION_SILIENT is not set +# CONFIG_L2_TO_L3_COPY is not set +CONFIG_ESP_GRATUITOUS_ARP=y +CONFIG_GARP_TMR_INTERVAL=60 +CONFIG_TCPIP_RECVMBOX_SIZE=32 +CONFIG_TCP_MAXRTX=12 +CONFIG_TCP_SYNMAXRTX=12 +CONFIG_TCP_MSS=1460 +CONFIG_TCP_MSL=60000 +CONFIG_TCP_SND_BUF_DEFAULT=11680 +CONFIG_TCP_WND_DEFAULT=11680 +CONFIG_TCP_RECVMBOX_SIZE=10 +CONFIG_TCP_QUEUE_OOSEQ=y +CONFIG_TCP_OVERSIZE_MSS=y +# CONFIG_TCP_OVERSIZE_QUARTER_MSS is not set +# CONFIG_TCP_OVERSIZE_DISABLE is not set +CONFIG_UDP_RECVMBOX_SIZE=6 +CONFIG_TCPIP_TASK_STACK_SIZE=3072 +# CONFIG_TCPIP_TASK_AFFINITY_NO_AFFINITY is not set +CONFIG_TCPIP_TASK_AFFINITY_CPU0=y +# CONFIG_TCPIP_TASK_AFFINITY_CPU1 is not set +CONFIG_TCPIP_TASK_AFFINITY=0x0 +# CONFIG_PPP_SUPPORT is not set +CONFIG_ESP32_TIME_SYSCALL_USE_RTC_HRT=y +CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1=y +# CONFIG_ESP32_TIME_SYSCALL_USE_RTC is not set +# CONFIG_ESP32_TIME_SYSCALL_USE_HRT is not set +# CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 is not set +# CONFIG_ESP32_TIME_SYSCALL_USE_NONE is not set +CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT=5 +CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072 +CONFIG_ESP32_PTHREAD_STACK_MIN=768 +CONFIG_ESP32_DEFAULT_PTHREAD_CORE_NO_AFFINITY=y +# CONFIG_ESP32_DEFAULT_PTHREAD_CORE_0 is not set +# CONFIG_ESP32_DEFAULT_PTHREAD_CORE_1 is not set +CONFIG_ESP32_PTHREAD_TASK_CORE_DEFAULT=-1 +CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT="pthread" +CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS=y +# CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS is not set +# CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED is not set +# CONFIG_ESP32_ULP_COPROC_ENABLED is not set +CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT=y +CONFIG_SUPPORT_TERMIOS=y +CONFIG_SEMIHOSTFS_MAX_MOUNT_POINTS=1 +# End of deprecated options