diff --git a/components/driver/CMakeLists.txt b/components/driver/CMakeLists.txt index 4f2c65b4b7..b8dd34318d 100644 --- a/components/driver/CMakeLists.txt +++ b/components/driver/CMakeLists.txt @@ -33,10 +33,6 @@ if(CONFIG_SOC_MCPWM_SUPPORTED) list(APPEND srcs "mcpwm.c") endif() -if(CONFIG_SOC_GDMA_SUPPORTED) - list(APPEND srcs "gdma.c") -endif() - if(CONFIG_SOC_DEDICATED_GPIO_SUPPORTED) list(APPEND srcs "gpio/dedic_gpio.c") endif() diff --git a/components/driver/Kconfig b/components/driver/Kconfig index a04d309270..9a1ee7e6d0 100644 --- a/components/driver/Kconfig +++ b/components/driver/Kconfig @@ -182,25 +182,6 @@ menu "Driver Configurations" so that these functions can be IRAM-safe and able to be called in the other IRAM interrupt context. endmenu # GPIO Configuration - menu "GDMA Configuration" - depends on SOC_GDMA_SUPPORTED - config GDMA_CTRL_FUNC_IN_IRAM - bool "Place GDMA control functions into IRAM" - default n - help - Place GDMA control functions (like start/stop/append/reset) into IRAM, - so that these functions can be IRAM-safe and able to be called in the other IRAM interrupt context. - Enabling this option can improve driver performance as well. - - config GDMA_ISR_IRAM_SAFE - bool "GDMA ISR IRAM-Safe" - default n - help - This will ensure the GDMA interrupt handler is IRAM-Safe, allow to avoid flash - cache misses, and also be able to run whilst the cache is disabled. - (e.g. SPI Flash write). - endmenu # GDMA Configuration - menu "GPTimer Configuration" config GPTIMER_CTRL_FUNC_IN_IRAM bool "Place GPTimer control functions into IRAM" diff --git a/components/driver/linker.lf b/components/driver/linker.lf index c026bdc807..3e45d3dcc2 100644 --- a/components/driver/linker.lf +++ b/components/driver/linker.lf @@ -7,11 +7,6 @@ entries: gptimer: gptimer_set_alarm_action (noflash) gptimer: gptimer_start (noflash) gptimer: gptimer_stop (noflash) - if GDMA_CTRL_FUNC_IN_IRAM = y: - gdma: gdma_start (noflash) - gdma: gdma_stop (noflash) - gdma: gdma_append (noflash) - gdma: gdma_reset (noflash) if PCNT_CTRL_FUNC_IN_IRAM = y: pulse_cnt: pcnt_unit_start (noflash) pulse_cnt: pcnt_unit_stop (noflash) diff --git a/components/esp_hw_support/CMakeLists.txt b/components/esp_hw_support/CMakeLists.txt index d0563caca1..0ba08d14b2 100644 --- a/components/esp_hw_support/CMakeLists.txt +++ b/components/esp_hw_support/CMakeLists.txt @@ -5,8 +5,7 @@ set(priv_requires efuse spi_flash bootloader_support) set(srcs "compare_set.c" "cpu.c" "esp_memory_utils.c") if(NOT BOOTLOADER_BUILD) - list(APPEND srcs "esp_async_memcpy.c" - "esp_clk.c" + list(APPEND srcs "esp_clk.c" "clk_ctrl_os.c" "hw_random.c" "intr_alloc.c" @@ -17,6 +16,7 @@ if(NOT BOOTLOADER_BUILD) "sleep_gpio.c" "sleep_mac_bb.c" "regi2c_ctrl.c") + if(NOT CONFIG_IDF_TARGET_ESP32 AND NOT CONFIG_IDF_TARGET_ESP32S2) list(APPEND srcs "sleep_retention.c") endif() @@ -28,6 +28,18 @@ if(NOT BOOTLOADER_BUILD) list(APPEND srcs "rtc_wdt.c") endif() + if(CONFIG_SOC_GDMA_SUPPORTED) + list(APPEND srcs "gdma.c" "port/async_memcpy_impl_gdma.c") + endif() + + if(CONFIG_SOC_CP_DMA_SUPPORTED) + list(APPEND srcs "port/async_memcpy_impl_cp_dma.c") + endif() + + if(CONFIG_SOC_GDMA_SUPPORTED OR CONFIG_SOC_CP_DMA_SUPPORTED) + list(APPEND srcs "esp_async_memcpy.c") + endif() + else() # Requires "_esp_error_check_failed()" function list(APPEND priv_requires "esp_system") diff --git a/components/esp_hw_support/Kconfig b/components/esp_hw_support/Kconfig index bcccf04e32..901541c7f8 100644 --- a/components/esp_hw_support/Kconfig +++ b/components/esp_hw_support/Kconfig @@ -161,4 +161,23 @@ menu "Hardware Settings" # Insert chip-specific HW config orsource "./port/$IDF_TARGET/Kconfig.hw_support" + menu "GDMA Configuration" + depends on SOC_GDMA_SUPPORTED + config GDMA_CTRL_FUNC_IN_IRAM + bool "Place GDMA control functions into IRAM" + default n + help + Place GDMA control functions (like start/stop/append/reset) into IRAM, + so that these functions can be IRAM-safe and able to be called in the other IRAM interrupt context. + Enabling this option can improve driver performance as well. + + config GDMA_ISR_IRAM_SAFE + bool "GDMA ISR IRAM-Safe" + default n + help + This will ensure the GDMA interrupt handler is IRAM-Safe, allow to avoid flash + cache misses, and also be able to run whilst the cache is disabled. + (e.g. SPI Flash write). + endmenu # GDMA Configuration + endmenu diff --git a/components/driver/gdma.c b/components/esp_hw_support/gdma.c similarity index 100% rename from components/driver/gdma.c rename to components/esp_hw_support/gdma.c diff --git a/components/driver/include/esp_private/gdma.h b/components/esp_hw_support/include/esp_private/gdma.h similarity index 100% rename from components/driver/include/esp_private/gdma.h rename to components/esp_hw_support/include/esp_private/gdma.h diff --git a/components/esp_hw_support/linker.lf b/components/esp_hw_support/linker.lf index e41e78082d..689c677236 100644 --- a/components/esp_hw_support/linker.lf +++ b/components/esp_hw_support/linker.lf @@ -23,3 +23,8 @@ entries: periph_ctrl: periph_module_reset (noflash) periph_ctrl: wifi_module_enable (noflash) periph_ctrl: wifi_module_disable (noflash) + if GDMA_CTRL_FUNC_IN_IRAM = y: + gdma: gdma_start (noflash) + gdma: gdma_stop (noflash) + gdma: gdma_append (noflash) + gdma: gdma_reset (noflash) diff --git a/components/esp_hw_support/port/esp32s2/async_memcpy_impl_cp_dma.c b/components/esp_hw_support/port/async_memcpy_impl_cp_dma.c similarity index 100% rename from components/esp_hw_support/port/esp32s2/async_memcpy_impl_cp_dma.c rename to components/esp_hw_support/port/async_memcpy_impl_cp_dma.c diff --git a/components/esp_hw_support/port/esp32c2/CMakeLists.txt b/components/esp_hw_support/port/esp32c2/CMakeLists.txt index 0ee21b22d6..315e233fc7 100644 --- a/components/esp_hw_support/port/esp32c2/CMakeLists.txt +++ b/components/esp_hw_support/port/esp32c2/CMakeLists.txt @@ -7,10 +7,6 @@ set(srcs "rtc_clk_init.c" "chip_info.c" ) -if(NOT BOOTLOADER_BUILD) - list(APPEND srcs "../async_memcpy_impl_gdma.c") -endif() - add_prefix(srcs "${CMAKE_CURRENT_LIST_DIR}/" "${srcs}") target_sources(${COMPONENT_LIB} PRIVATE "${srcs}") diff --git a/components/esp_hw_support/port/esp32c3/CMakeLists.txt b/components/esp_hw_support/port/esp32c3/CMakeLists.txt index d489fa43dd..74a4790747 100644 --- a/components/esp_hw_support/port/esp32c3/CMakeLists.txt +++ b/components/esp_hw_support/port/esp32c3/CMakeLists.txt @@ -8,8 +8,7 @@ set(srcs "rtc_clk_init.c" ) if(NOT BOOTLOADER_BUILD) - list(APPEND srcs "../async_memcpy_impl_gdma.c" - "esp_hmac.c" + list(APPEND srcs "esp_hmac.c" "esp_crypto_lock.c" "esp_ds.c") diff --git a/components/esp_hw_support/port/esp32h2/CMakeLists.txt b/components/esp_hw_support/port/esp32h2/CMakeLists.txt index d489fa43dd..74a4790747 100644 --- a/components/esp_hw_support/port/esp32h2/CMakeLists.txt +++ b/components/esp_hw_support/port/esp32h2/CMakeLists.txt @@ -8,8 +8,7 @@ set(srcs "rtc_clk_init.c" ) if(NOT BOOTLOADER_BUILD) - list(APPEND srcs "../async_memcpy_impl_gdma.c" - "esp_hmac.c" + list(APPEND srcs "esp_hmac.c" "esp_crypto_lock.c" "esp_ds.c") diff --git a/components/esp_hw_support/port/esp32s2/CMakeLists.txt b/components/esp_hw_support/port/esp32s2/CMakeLists.txt index 4937884c1a..6c8161c3f4 100644 --- a/components/esp_hw_support/port/esp32s2/CMakeLists.txt +++ b/components/esp_hw_support/port/esp32s2/CMakeLists.txt @@ -12,8 +12,7 @@ set(srcs ) if(NOT BOOTLOADER_BUILD) - list(APPEND srcs "async_memcpy_impl_cp_dma.c" - "memprot.c" + list(APPEND srcs "memprot.c" "esp_hmac.c" "esp_crypto_lock.c" "esp_ds.c") diff --git a/components/esp_hw_support/port/esp32s3/CMakeLists.txt b/components/esp_hw_support/port/esp32s3/CMakeLists.txt index d093c60b9d..0f42f03f2d 100644 --- a/components/esp_hw_support/port/esp32s3/CMakeLists.txt +++ b/components/esp_hw_support/port/esp32s3/CMakeLists.txt @@ -12,10 +12,9 @@ set(srcs ) if(NOT BOOTLOADER_BUILD) - list(APPEND srcs "../async_memcpy_impl_gdma.c" - "esp_hmac.c" - "esp_ds.c" - "esp_crypto_lock.c") + list(APPEND srcs "esp_hmac.c" + "esp_ds.c" + "esp_crypto_lock.c") if(CONFIG_ESP_SYSTEM_MEMPROT_FEATURE) list(APPEND srcs "esp_memprot.c" "../esp_memprot_conv.c") diff --git a/components/driver/test/test_gdma.c b/components/esp_hw_support/test/test_gdma.c similarity index 97% rename from components/driver/test/test_gdma.c rename to components/esp_hw_support/test/test_gdma.c index 86ef4683e9..6dc447ddcb 100644 --- a/components/driver/test/test_gdma.c +++ b/components/esp_hw_support/test/test_gdma.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/components/hal/esp32s2/cp_dma_hal.c b/components/hal/esp32s2/cp_dma_hal.c index 014511aeb0..b28340a3af 100644 --- a/components/hal/esp32s2/cp_dma_hal.c +++ b/components/hal/esp32s2/cp_dma_hal.c @@ -1,16 +1,8 @@ -// Copyright 2020 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #include "soc/soc_caps.h" #include "hal/cp_dma_hal.h" diff --git a/components/hal/esp32s2/include/hal/cp_dma_hal.h b/components/hal/esp32s2/include/hal/cp_dma_hal.h index a8f7829ae9..86cea48efd 100644 --- a/components/hal/esp32s2/include/hal/cp_dma_hal.h +++ b/components/hal/esp32s2/include/hal/cp_dma_hal.h @@ -1,16 +1,8 @@ -// Copyright 2020 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ /******************************************************************************* * NOTICE diff --git a/components/hal/esp32s2/include/hal/cp_dma_ll.h b/components/hal/esp32s2/include/hal/cp_dma_ll.h index 1c04315e5b..aec605078a 100644 --- a/components/hal/esp32s2/include/hal/cp_dma_ll.h +++ b/components/hal/esp32s2/include/hal/cp_dma_ll.h @@ -1,16 +1,8 @@ -// Copyright 2020 Espressif Systems (Shanghai) PTE LTD -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. +/* + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once diff --git a/components/soc/esp32s2/include/soc/cp_dma_reg.h b/components/soc/esp32s2/include/soc/cp_dma_reg.h index ee785b4766..c6b9987db0 100644 --- a/components/soc/esp32s2/include/soc/cp_dma_reg.h +++ b/components/soc/esp32s2/include/soc/cp_dma_reg.h @@ -1,17 +1,9 @@ -/** Copyright 2020 Espressif Systems (Shanghai) PTE LTD +/* + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ + #pragma once #include diff --git a/components/soc/esp32s2/include/soc/cp_dma_struct.h b/components/soc/esp32s2/include/soc/cp_dma_struct.h index 15fb42e451..117a7df6b8 100644 --- a/components/soc/esp32s2/include/soc/cp_dma_struct.h +++ b/components/soc/esp32s2/include/soc/cp_dma_struct.h @@ -1,17 +1,9 @@ -/** Copyright 2020 Espressif Systems (Shanghai) PTE LTD +/* + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: Apache-2.0 */ + #pragma once #include diff --git a/examples/common_components/led_strip/CMakeLists.txt b/examples/common_components/led_strip/CMakeLists.txt index 978fdf7111..bdf92d10fc 100644 --- a/examples/common_components/led_strip/CMakeLists.txt +++ b/examples/common_components/led_strip/CMakeLists.txt @@ -1,4 +1,4 @@ -set(srcs) +set(srcs "src/led_strip_api.c") if(CONFIG_SOC_RMT_SUPPORTED) list(APPEND srcs "src/led_strip_rmt_dev.c" "src/led_strip_rmt_encoder.c") diff --git a/examples/common_components/led_strip/src/led_strip_api.c b/examples/common_components/led_strip/src/led_strip_api.c new file mode 100644 index 0000000000..b2fbf8f175 --- /dev/null +++ b/examples/common_components/led_strip/src/led_strip_api.c @@ -0,0 +1,35 @@ +/* + * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include "esp_log.h" +#include "esp_check.h" +#include "led_strip.h" +#include "led_strip_interface.h" + +static const char *TAG = "led_strip"; + +esp_err_t led_strip_set_pixel(led_strip_handle_t strip, uint32_t index, uint32_t red, uint32_t green, uint32_t blue) +{ + ESP_RETURN_ON_FALSE(strip, ESP_ERR_INVALID_ARG, TAG, "invalid argument"); + return strip->set_pixel(strip, index, red, green, blue); +} + +esp_err_t led_strip_refresh(led_strip_handle_t strip) +{ + ESP_RETURN_ON_FALSE(strip, ESP_ERR_INVALID_ARG, TAG, "invalid argument"); + return strip->refresh(strip); +} + +esp_err_t led_strip_clear(led_strip_handle_t strip) +{ + ESP_RETURN_ON_FALSE(strip, ESP_ERR_INVALID_ARG, TAG, "invalid argument"); + return strip->clear(strip); +} + +esp_err_t led_strip_del(led_strip_handle_t strip) +{ + ESP_RETURN_ON_FALSE(strip, ESP_ERR_INVALID_ARG, TAG, "invalid argument"); + return strip->del(strip); +} diff --git a/examples/common_components/led_strip/src/led_strip_rmt_dev.c b/examples/common_components/led_strip/src/led_strip_rmt_dev.c index fc92f30d75..7658df8c93 100644 --- a/examples/common_components/led_strip/src/led_strip_rmt_dev.c +++ b/examples/common_components/led_strip/src/led_strip_rmt_dev.c @@ -110,27 +110,3 @@ err: } return ret; } - -esp_err_t led_strip_set_pixel(led_strip_handle_t strip, uint32_t index, uint32_t red, uint32_t green, uint32_t blue) -{ - ESP_RETURN_ON_FALSE(strip, ESP_ERR_INVALID_ARG, TAG, "invalid argument"); - return strip->set_pixel(strip, index, red, green, blue); -} - -esp_err_t led_strip_refresh(led_strip_handle_t strip) -{ - ESP_RETURN_ON_FALSE(strip, ESP_ERR_INVALID_ARG, TAG, "invalid argument"); - return strip->refresh(strip); -} - -esp_err_t led_strip_clear(led_strip_handle_t strip) -{ - ESP_RETURN_ON_FALSE(strip, ESP_ERR_INVALID_ARG, TAG, "invalid argument"); - return strip->clear(strip); -} - -esp_err_t led_strip_del(led_strip_handle_t strip) -{ - ESP_RETURN_ON_FALSE(strip, ESP_ERR_INVALID_ARG, TAG, "invalid argument"); - return strip->del(strip); -} diff --git a/tools/ci/check_copyright_ignore.txt b/tools/ci/check_copyright_ignore.txt index fbff6c06ae..b29aa6084b 100644 --- a/tools/ci/check_copyright_ignore.txt +++ b/tools/ci/check_copyright_ignore.txt @@ -783,10 +783,7 @@ components/hal/esp32h2/include/hal/spi_flash_encrypted_ll.h components/hal/esp32h2/include/hal/uhci_ll.h components/hal/esp32h2/include/hal/uhci_types.h components/hal/esp32h2/include/hal/usb_serial_jtag_ll.h -components/hal/esp32s2/cp_dma_hal.c components/hal/esp32s2/include/hal/aes_ll.h -components/hal/esp32s2/include/hal/cp_dma_hal.h -components/hal/esp32s2/include/hal/cp_dma_ll.h components/hal/esp32s2/include/hal/crypto_dma_ll.h components/hal/esp32s2/include/hal/dac_hal.h components/hal/esp32s2/include/hal/dedic_gpio_ll.h @@ -1183,7 +1180,6 @@ components/soc/esp32c3/ledc_periph.c components/soc/esp32c3/sigmadelta_periph.c components/soc/esp32c3/spi_periph.c components/soc/esp32c3/uart_periph.c -components/soc/esp32h2/gdma_periph.c components/soc/esp32h2/i2c_periph.c components/soc/esp32h2/include/soc/apb_ctrl_reg.h components/soc/esp32h2/include/soc/apb_ctrl_struct.h @@ -1238,8 +1234,6 @@ components/soc/esp32s2/include/soc/assist_debug_reg.h components/soc/esp32s2/include/soc/bb_reg.h components/soc/esp32s2/include/soc/boot_mode.h components/soc/esp32s2/include/soc/clkout_channel.h -components/soc/esp32s2/include/soc/cp_dma_reg.h -components/soc/esp32s2/include/soc/cp_dma_struct.h components/soc/esp32s2/include/soc/crypto_dma_reg.h components/soc/esp32s2/include/soc/dac_channel.h components/soc/esp32s2/include/soc/dedic_gpio_reg.h