فهرست منبع

Merge branch 'refactor/move_gdma_to_hw_support' into 'master'

dma: move from driver to hw_support

See merge request espressif/esp-idf!18706
morris 3 سال پیش
والد
کامیت
602e154c12

+ 0 - 4
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()

+ 0 - 19
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"

+ 0 - 5
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)

+ 14 - 2
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")

+ 19 - 0
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

+ 0 - 0
components/driver/gdma.c → components/esp_hw_support/gdma.c


+ 0 - 0
components/driver/include/esp_private/gdma.h → components/esp_hw_support/include/esp_private/gdma.h


+ 5 - 0
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)

+ 0 - 0
components/esp_hw_support/port/esp32s2/async_memcpy_impl_cp_dma.c → components/esp_hw_support/port/async_memcpy_impl_cp_dma.c


+ 0 - 4
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}")

+ 1 - 2
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")
 

+ 1 - 2
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")
 

+ 1 - 2
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")

+ 3 - 4
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")

+ 1 - 1
components/driver/test/test_gdma.c → 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
  */

+ 5 - 13
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"

+ 5 - 13
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

+ 5 - 13
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
 

+ 4 - 12
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 <stdint.h>

+ 4 - 12
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 <stdint.h>

+ 1 - 1
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")

+ 35 - 0
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);
+}

+ 0 - 24
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);
-}

+ 0 - 6
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