feat(dma): graduate the dma driver from esp_hw_support to esp_driver_dma

This commit is contained in:
morris
2026-01-20 23:39:33 +08:00
parent 9ed8ae514a
commit db750dc1a0
90 changed files with 137 additions and 135 deletions
+1 -1
View File
@@ -56,6 +56,6 @@ endif()
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS ${includes}
PRIV_REQUIRES esp_driver_gpio efuse esp_pm esp_ringbuf esp_mm ${extra_requires}
PRIV_REQUIRES esp_driver_gpio esp_driver_dma efuse esp_pm esp_ringbuf esp_mm ${extra_requires}
REQUIRES esp_hal_ana_conv
LDFRAGMENTS linker.lf)
@@ -11,6 +11,6 @@ endif()
idf_component_register(SRCS ${srcs}
REQUIRES "esp_hal_dma"
PRIV_REQUIRES "esp_mm"
PRIV_REQUIRES "esp_mm" "esp_driver_dma"
INCLUDE_DIRS "include"
LDFRAGMENTS "linker.lf")
+1 -1
View File
@@ -6,7 +6,7 @@ set(includes "include" "interface")
set(requires "esp_driver_isp" "esp_hal_cam")
set(priv_requires "esp_driver_gpio")
set(priv_requires "esp_driver_gpio" "esp_driver_dma")
if(CONFIG_SOC_MIPI_CSI_SUPPORTED)
list(APPEND srcs "csi/src/esp_cam_ctlr_csi.c")
+50
View File
@@ -0,0 +1,50 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
set(public_include "include")
set(requires esp_hal_dma)
set(srcs "src/esp_dma_utils.c" "src/gdma_link.c")
if(CONFIG_SOC_GDMA_SUPPORTED)
list(APPEND srcs "src/gdma.c")
if(CONFIG_SOC_GDMA_SUPPORT_SLEEP_RETENTION AND CONFIG_SOC_PAU_SUPPORTED)
list(APPEND srcs "src/gdma_sleep_retention.c")
endif()
if(CONFIG_SOC_GDMA_SUPPORT_ETM)
list(APPEND srcs "src/gdma_etm.c")
endif()
if(CONFIG_SOC_GDMA_SUPPORT_CRC)
list(APPEND srcs "src/gdma_crc.c")
endif()
endif()
if(CONFIG_SOC_ASYNC_MEMCPY_SUPPORTED)
list(APPEND srcs "src/esp_async_memcpy.c")
if(CONFIG_SOC_GDMA_SUPPORTED)
list(APPEND srcs "src/async_memcpy_gdma.c")
endif() # CONFIG_SOC_GDMA_SUPPORTED
if(CONFIG_SOC_CP_DMA_SUPPORTED)
list(APPEND srcs "src/async_memcpy_cp_dma.c")
endif() # CONFIG_SOC_CP_DMA_SUPPORTED
endif() # CONFIG_SOC_ASYNC_MEMCPY_SUPPORTED
if(CONFIG_SOC_DW_GDMA_SUPPORTED)
list(APPEND srcs "src/dw_gdma.c")
endif()
if(CONFIG_SOC_DMA2D_SUPPORTED)
list(APPEND srcs "src/dma2d.c")
endif()
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS ${public_include}
REQUIRES ${requires}
PRIV_REQUIRES esp_mm bootloader_support
LDFRAGMENTS "linker.lf"
)
if(CONFIG_SPIRAM)
idf_component_optional_requires(PRIVATE esp_psram)
endif()
@@ -62,6 +62,7 @@ typedef struct {
#define ASYNC_MEMCPY_DEFAULT_CONFIG() \
{ \
.backlog = 8, \
.weight = 0, \
.dma_burst_size = 16, \
.flags = 0, \
}
@@ -10,7 +10,6 @@
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
@@ -173,7 +173,6 @@ esp_err_t dma2d_enqueue(dma2d_pool_handle_t dma2d_pool, const dma2d_trans_config
*/
esp_err_t dma2d_force_end(dma2d_trans_t *trans, bool *need_yield);
/*********************************************** DMA CHANNEL OPERATIONS ***********************************************/
/**
@@ -1,5 +1,5 @@
[mapping:gdma_driver]
archive: libesp_hw_support.a
archive: libesp_driver_dma.a
entries:
if GDMA_ISR_HANDLER_IN_IRAM = y:
gdma: gdma_default_tx_isr (noflash)
@@ -68,7 +68,7 @@ entries:
gdma_hal_axi: gdma_axi_hal_reset (noflash)
[mapping:dw_gdma_driver]
archive: libesp_hw_support.a
archive: libesp_driver_dma.a
entries:
# performance optimization, always put the DW_GDMA default interrupt handler in IRAM
if SOC_DW_GDMA_SUPPORTED = y:
@@ -88,7 +88,7 @@ entries:
dw_gdma: dw_gdma_link_list_get_item (noflash)
[mapping:dma2d_driver]
archive: libesp_hw_support.a
archive: libesp_driver_dma.a
entries:
# performance optimization, always put the 2D-DMA default interrupt handler in IRAM
if SOC_DMA2D_SUPPORTED = y:
@@ -60,7 +60,6 @@ uint32_t dma2d_rx_channel_reserved_mask[DMA2D_LL_GET(INST_NUM)] = { [0 ... DMA2D
// The most number of channels required for a 2D-DMA transaction (a PPA Blend operation requires 2 TX + 1 RX)
#define DMA2D_MAX_CHANNEL_NUM_PER_TRANSACTION 3
/* This static function is not thread-safe, group's spinlock protection should be added in its caller */
static bool acquire_free_channels_for_trans(dma2d_group_t *dma2d_group, const dma2d_trans_config_t *trans_desc, dma2d_trans_channel_info_t *channel_handle_array)
{
@@ -73,7 +72,7 @@ static bool acquire_free_channels_for_trans(dma2d_group_t *dma2d_group, const dm
if (!trans_desc->specified_tx_channel_mask) {
tx_free_channel_mask = dma2d_group->tx_channel_free_mask;
tx_free_channel_mask &= (((trans_desc->channel_flags & DMA2D_CHANNEL_FUNCTION_FLAG_TX_REORDER) ? DMA2D_LL_TX_CHANNEL_SUPPORT_RO_MASK : UINT32_MAX) &
((trans_desc->channel_flags & DMA2D_CHANNEL_FUNCTION_FLAG_TX_CSC) ? DMA2D_LL_TX_CHANNEL_SUPPORT_CSC_MASK : UINT32_MAX));
((trans_desc->channel_flags & DMA2D_CHANNEL_FUNCTION_FLAG_TX_CSC) ? DMA2D_LL_TX_CHANNEL_SUPPORT_CSC_MASK : UINT32_MAX));
tx_free_channel_mask &= ~dma2d_group->tx_channel_reserved_mask;
if (trans_desc->channel_flags & DMA2D_CHANNEL_FUNCTION_FLAG_SIBLING) {
uint32_t rx_channel_candidate = dma2d_group->rx_channel_free_mask &
@@ -121,7 +120,7 @@ static bool acquire_free_channels_for_trans(dma2d_group_t *dma2d_group, const dm
} else {
rx_free_channel_mask = dma2d_group->rx_channel_free_mask;
rx_free_channel_mask &= (((trans_desc->channel_flags & DMA2D_CHANNEL_FUNCTION_FLAG_RX_REORDER) ? DMA2D_LL_RX_CHANNEL_SUPPORT_RO_MASK : UINT32_MAX) &
((trans_desc->channel_flags & DMA2D_CHANNEL_FUNCTION_FLAG_RX_CSC) ? DMA2D_LL_RX_CHANNEL_SUPPORT_CSC_MASK : UINT32_MAX));
((trans_desc->channel_flags & DMA2D_CHANNEL_FUNCTION_FLAG_RX_CSC) ? DMA2D_LL_RX_CHANNEL_SUPPORT_CSC_MASK : UINT32_MAX));
rx_free_channel_mask &= ~dma2d_group->rx_channel_reserved_mask;
// As long as __builtin_popcount(rx_free_channel_mask) >= trans_desc->rx_channel_num, it can meet the criteria of "found"
}
@@ -910,8 +909,8 @@ esp_err_t dma2d_enqueue(dma2d_pool_handle_t dma2d_pool, const dma2d_trans_config
dma2d_group_t *dma2d_group = dma2d_pool;
if (trans_desc->specified_tx_channel_mask || trans_desc->specified_rx_channel_mask) {
ESP_GOTO_ON_FALSE_ISR(
(trans_desc->specified_tx_channel_mask ? (trans_desc->specified_tx_channel_mask & dma2d_group->tx_channel_reserved_mask) : 1 ) &&
(trans_desc->specified_rx_channel_mask ? (trans_desc->specified_rx_channel_mask & dma2d_group->rx_channel_reserved_mask) : 1 ),
(trans_desc->specified_tx_channel_mask ? (trans_desc->specified_tx_channel_mask & dma2d_group->tx_channel_reserved_mask) : 1) &&
(trans_desc->specified_rx_channel_mask ? (trans_desc->specified_rx_channel_mask & dma2d_group->rx_channel_reserved_mask) : 1),
ESP_ERR_INVALID_ARG, err, TAG, "specified channel(s) not reserved");
ESP_GOTO_ON_FALSE_ISR(
(__builtin_popcount(trans_desc->specified_tx_channel_mask) == trans_desc->tx_channel_num) &&
@@ -0,0 +1,15 @@
# Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps
components/esp_driver_dma/test_apps/dma:
disable:
- if: SOC_GDMA_SUPPORTED != 1 and SOC_CP_DMA_SUPPORTED != 1
depends_components:
- esp_driver_dma
- esp_hal_dma
components/esp_driver_dma/test_apps/dma2d:
disable:
- if: SOC_DMA2D_SUPPORTED != 1
depends_components:
- esp_driver_dma
- esp_hal_dma
@@ -1,11 +1,9 @@
# This is the project CMakeLists.txt file for the test subproject
cmake_minimum_required(VERSION 3.22)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
# "Trim" the build. Include the minimal set of components, main, and anything it depends on. We also depend on esp_psram
# as we set CONFIG_SPIRAM_... options.
set(COMPONENTS main esp_psram)
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
idf_build_set_property(MINIMAL_BUILD ON)
project(dma_test)
@@ -23,7 +23,7 @@ endif()
# In order for the cases defined by `TEST_CASE` to be linked into the final elf,
# the component can be registered as WHOLE_ARCHIVE
idf_component_register(SRCS ${srcs}
PRIV_REQUIRES unity esp_mm esp_driver_gpio
PRIV_REQUIRES unity esp_mm esp_driver_gpio esp_psram esp_driver_dma
WHOLE_ARCHIVE)
idf_component_get_property(lib_name esp_hal_dma COMPONENT_LIB)
@@ -52,7 +52,7 @@ static void async_memcpy_setup_testbench(memcpy_testbench_context_t *test_contex
uint32_t mem_caps = test_context->src_in_psram ? MALLOC_CAP_SPIRAM | MALLOC_CAP_DMA | MALLOC_CAP_8BIT : MALLOC_CAP_INTERNAL | MALLOC_CAP_DMA | MALLOC_CAP_8BIT ;
src_buf = heap_caps_aligned_calloc(test_context->align, 1, buffer_size, mem_caps);
TEST_ASSERT_NOT_NULL(src_buf);
if(test_context->src_dst_same) {
if (test_context->src_dst_same) {
dst_buf = src_buf;
} else {
mem_caps = test_context->dst_in_psram ? MALLOC_CAP_SPIRAM | MALLOC_CAP_DMA | MALLOC_CAP_8BIT : MALLOC_CAP_INTERNAL | MALLOC_CAP_DMA | MALLOC_CAP_8BIT ;
@@ -239,7 +239,6 @@ TEST_CASE("memory copy with dest address unaligned", "[async mcp]")
};
[[maybe_unused]] async_memcpy_handle_t driver = NULL;
#if SOC_CP_DMA_SUPPORTED
printf("Testing memcpy by CP DMA\r\n");
TEST_ESP_OK(esp_async_memcpy_install_cpdma(&driver_config, &driver));
@@ -402,7 +401,7 @@ static IRAM_ATTR bool test_weighted_arb_isr_cb(async_memcpy_handle_t mcp_hdl, as
static void memcpy_weighted_arb_test(async_memcpy_handle_t driver[2], size_t burst_size, uint32_t buffer_size, bool buffer_in_psram)
{
SemaphoreHandle_t sem[2] = {xSemaphoreCreateBinary(),xSemaphoreCreateBinary()};
SemaphoreHandle_t sem[2] = {xSemaphoreCreateBinary(), xSemaphoreCreateBinary()};
int64_t elapse_us[2] = {0};
float throughput[2] = {0.0};
@@ -432,7 +431,7 @@ static void memcpy_weighted_arb_test(async_memcpy_handle_t driver[2], size_t bur
elapse_us[1] = ctx[1].elapse_us;
// wait for channel_0 done, keep channel_1 busy to do arbitration
while(xSemaphoreTake(sem[0], 0) == pdFALSE) {
while (xSemaphoreTake(sem[0], 0) == pdFALSE) {
TEST_ESP_OK(esp_async_memcpy(driver[1], test_context.to_addr, test_context.from_addr, test_context.copy_size, test_weighted_arb_isr_cb, &ctx[1]));
TEST_ASSERT_EQUAL(pdTRUE, xSemaphoreTake(sem[1], pdMS_TO_TICKS(1000)));
}
@@ -3,8 +3,7 @@ cmake_minimum_required(VERSION 3.22)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
# "Trim" the build. Include the minimal set of components, main, and anything it depends on. We also depend on esp_psram
# as we set CONFIG_SPIRAM_... options.
set(COMPONENTS main esp_psram)
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
idf_build_set_property(MINIMAL_BUILD ON)
project(dma2d_test)
@@ -6,5 +6,5 @@ set(srcs "test_app_main.c"
# the component can be registered as WHOLE_ARCHIVE
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS "."
PRIV_REQUIRES unity esp_mm
PRIV_REQUIRES unity esp_mm esp_psram esp_driver_dma
WHOLE_ARCHIVE)
@@ -173,28 +173,28 @@ static void rgb565_to_rgb888(uint16_t rgb565, void *__r, void *__g, void *__b)
uint8_t *b = (uint8_t *)__b;
uint32_t _rgb565 = rgb565;
uint8_t _b = (_rgb565>>8) & 0xF8;
uint8_t _g = (_rgb565>>3) & 0xFC;
uint8_t _r = (_rgb565<<3) & 0xF8;
uint8_t _b = (_rgb565 >> 8) & 0xF8;
uint8_t _g = (_rgb565 >> 3) & 0xFC;
uint8_t _r = (_rgb565 << 3) & 0xF8;
// *r = (_r & 0x08) ? (_r | 0x1) : (_r);
// *g = (_g & 0x04) ? (_g | 0x1) : (_g);
// *b = (_b & 0x08) ? (_b | 0x1) : (_b);
*r = _r | ( (_r >>3) & 0x7);
*g = _g | ( (_g >>2) & 0x3);
*b = _b | ( (_b >>3) & 0x7);
*r = _r | ((_r >> 3) & 0x7);
*g = _g | ((_g >> 2) & 0x3);
*b = _b | ((_b >> 3) & 0x7);
}
static int rgb565_to_rgb888_and_cmp(void *_rgb565, void *__rgb888, int pix)
{
uint16_t *rgb565 = (uint16_t *)_rgb565;
uint8_t *_rgb888 = (uint8_t *)__rgb888;
uint8_t _r,_g,_b;
uint8_t _r, _g, _b;
for (int i = 0; i < pix; i++) {
rgb565_to_rgb888(rgb565[i], &_r, &_g, &_b);
if (_r != _rgb888[0] || _g != _rgb888[1] || _b != _rgb888[2]) {
printf("idx %d - conv fail, %x:%x:%x, rgb565:%x, _rgb888:%x:%x:%x\r\n",
i, _r, _g, _b, rgb565[i], _rgb888[0], _rgb888[1] ,_rgb888[2]);
i, _r, _g, _b, rgb565[i], _rgb888[0], _rgb888[1], _rgb888[2]);
return -1;
}
_rgb888 += 3;
@@ -421,8 +421,8 @@ TEST_CASE("DMA2D_M2M_2D_basic", "[DMA2D]")
static void rgb888_to_rgb565(uint8_t r, uint8_t g, uint8_t b, uint16_t *rgb565)
{
uint16_t _rgb565 = (b >> 3);
_rgb565 = (_rgb565 << 6) | (g >>2);
_rgb565 = (_rgb565 << 5) | (r >>3);
_rgb565 = (_rgb565 << 6) | (g >> 2);
_rgb565 = (_rgb565 << 5) | (r >> 3);
*rgb565 = _rgb565;
}
+1 -1
View File
@@ -6,7 +6,7 @@ endif()
set(srcs)
set(include "include")
set(priv_requires esp_driver_gpio esp_pm esp_mm)
set(priv_requires esp_driver_gpio esp_driver_dma esp_pm esp_mm)
if(${target} STREQUAL "esp32")
# ADC on esp32 is routed to I2S0, I2S driver needs to operate ADC to ensure the I2S function.
+1 -1
View File
@@ -12,7 +12,7 @@ endif()
if(${target} STREQUAL "linux")
set(priv_requires "")
else()
set(priv_requires esp_driver_gpio esp_pm esp_mm)
set(priv_requires esp_driver_gpio esp_pm esp_mm esp_driver_dma)
endif()
idf_component_register(SRCS ${srcs}
+1 -1
View File
@@ -10,7 +10,7 @@ entries:
i3c_master: handle_rx_data_buf_threshold_int (noflash)
[mapping:i3c_driver_gdma]
archive: libesp_hw_support.a
archive: libesp_driver_dma.a
entries:
if I3C_MASTER_ISR_HANDLER_IN_IRAM = y:
gdma_link: gdma_link_mount_buffers (noflash)
+1 -1
View File
@@ -26,7 +26,7 @@ endif()
if(${target} STREQUAL "linux")
set(priv_requires "")
else()
set(priv_requires esp_mm esp_pm esp_psram)
set(priv_requires esp_mm esp_pm esp_psram esp_driver_dma)
endif()
idf_component_register(SRCS ${srcs}
+1 -1
View File
@@ -15,7 +15,7 @@ endif()
if(${target} STREQUAL "linux")
set(priv_requires "")
else()
set(priv_requires esp_pm esp_driver_gpio esp_mm esp_driver_bitscrambler)
set(priv_requires esp_pm esp_driver_gpio esp_mm esp_driver_bitscrambler esp_driver_dma)
endif()
idf_component_register(SRCS ${srcs}
+1 -1
View File
@@ -17,7 +17,7 @@ entries:
parlio_rx: parlio_rx_unit_receive_from_isr (noflash)
[mapping:parlio_driver_gdma_link]
archive: libesp_hw_support.a
archive: libesp_driver_dma.a
entries:
if PARLIO_TX_ISR_HANDLER_IN_IRAM = y:
gdma_link: gdma_link_mount_buffers (noflash)
+1 -1
View File
@@ -12,7 +12,7 @@ endif()
if(${target} STREQUAL "linux")
set(priv_requires "")
else()
set(priv_requires esp_mm esp_pm)
set(priv_requires esp_mm esp_pm esp_driver_dma)
endif()
+1 -1
View File
@@ -21,7 +21,7 @@ if(${target} STREQUAL "linux")
set(priv_requires "")
else()
set(requires esp_hal_rmt)
set(priv_requires esp_pm esp_driver_gpio esp_driver_bitscrambler esp_mm)
set(priv_requires esp_pm esp_driver_gpio esp_driver_bitscrambler esp_mm esp_driver_dma)
endif()
idf_component_register(SRCS ${srcs}
+1 -1
View File
@@ -32,7 +32,7 @@ entries:
rmt_rx: rmt_receive (noflash)
[mapping:rmt_driver_gdma_link]
archive: libesp_hw_support.a
archive: libesp_driver_dma.a
entries:
if RMT_TX_ISR_HANDLER_IN_IRAM = y && SOC_RMT_SUPPORT_DMA = y:
gdma_link: gdma_link_mount_buffers (noflash)
+2 -2
View File
@@ -26,7 +26,7 @@ endif()
idf_component_register(
SRCS ${srcs}
INCLUDE_DIRS ${public_include}
REQUIRES esp_pm esp_hal_gpspi
PRIV_REQUIRES esp_timer esp_mm esp_driver_gpio spi_flash esp_psram #For CONFIG_SPIRAM_SPEED
REQUIRES esp_pm esp_hal_gpspi esp_driver_dma
PRIV_REQUIRES esp_timer esp_mm esp_driver_gpio spi_flash esp_psram
LDFRAGMENTS "linker.lf"
)
+1 -1
View File
@@ -12,7 +12,7 @@ endif()
if(${target} STREQUAL "linux")
set(priv_requires esp_ringbuf)
else()
set(priv_requires esp_pm esp_driver_gpio esp_ringbuf esp_mm esp_psram)
set(priv_requires esp_pm esp_driver_gpio esp_driver_dma esp_ringbuf esp_mm esp_psram)
endif()
idf_component_register(
+1 -1
View File
@@ -19,7 +19,7 @@ entries:
uhci: uhci_do_transmit (noflash)
[mapping:uhci_driver_gdma_link]
archive: libesp_hw_support.a
archive: libesp_driver_dma.a
entries:
if UHCI_ISR_HANDLER_IN_IRAM = y:
gdma_link: gdma_link_count_buffer_size_till_eof (noflash)
+1 -1
View File
@@ -4,7 +4,7 @@ if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
set(requires soc hal)
set(requires soc hal esp_hal_dma)
if(${target} STREQUAL "esp32")
list(APPEND requires esp_hal_i2s)
endif()
-3
View File
@@ -1,7 +1,4 @@
idf_build_get_property(target IDF_TARGET)
if(${target} STREQUAL "linux")
return() # This component is not supported by the POSIX/Linux simulator
endif()
set(srcs)
set(public_include "include")
+1 -1
View File
@@ -24,6 +24,6 @@ endif()
idf_component_register(
SRCS ${srcs}
INCLUDE_DIRS ${includes}
REQUIRES soc hal
REQUIRES soc hal esp_hal_dma
PRIV_REQUIRES esp_hal_gpio
)
+3 -36
View File
@@ -9,7 +9,7 @@ if(${target} STREQUAL "linux")
return()
endif()
set(requires esp_hal_dma esp_hal_gpio esp_hal_usb esp_hal_pmu)
set(requires esp_hal_gpio esp_hal_usb esp_hal_pmu)
# only esp_hw_support/adc_share_hw_ctrl.c requires efuse component
set(priv_requires efuse spi_flash bootloader_support esp_hal_wdt)
@@ -32,8 +32,6 @@ if(NOT non_os_build)
"sar_tsens_ctrl.c"
"port/${target}/io_mux.c"
"port/${target}/esp_clk_tree.c"
"dma/esp_dma_utils.c"
"dma/gdma_link.c"
"spi_bus_lock.c"
"clk_utils.c")
if(CONFIG_SOC_USB_OTG_SUPPORTED)
@@ -92,19 +90,6 @@ if(NOT non_os_build)
list(APPEND srcs "rtc_wdt.c")
endif()
if(CONFIG_SOC_GDMA_SUPPORTED)
list(APPEND srcs "dma/gdma.c")
if(CONFIG_SOC_GDMA_SUPPORT_SLEEP_RETENTION AND CONFIG_SOC_PAU_SUPPORTED)
list(APPEND srcs "dma/gdma_sleep_retention.c")
endif()
if(CONFIG_SOC_GDMA_SUPPORT_ETM)
list(APPEND srcs "dma/gdma_etm.c")
endif()
if(CONFIG_SOC_GDMA_SUPPORT_CRC)
list(APPEND srcs "dma/gdma_crc.c")
endif()
endif()
if(CONFIG_SOC_GP_LDO_SUPPORTED)
list(APPEND srcs "ldo/esp_ldo_regulator.c")
endif()
@@ -113,24 +98,6 @@ if(NOT non_os_build)
list(APPEND srcs "debug_probe/debug_probe.c")
endif()
if(CONFIG_SOC_ASYNC_MEMCPY_SUPPORTED)
list(APPEND srcs "dma/esp_async_memcpy.c")
if(CONFIG_SOC_GDMA_SUPPORTED)
list(APPEND srcs "dma/async_memcpy_gdma.c")
endif() # CONFIG_SOC_GDMA_SUPPORTED
if(CONFIG_SOC_CP_DMA_SUPPORTED)
list(APPEND srcs "dma/async_memcpy_cp_dma.c")
endif() # CONFIG_SOC_CP_DMA_SUPPORTED
endif() # CONFIG_SOC_ASYNC_MEMCPY_SUPPORTED
if(CONFIG_SOC_DW_GDMA_SUPPORTED)
list(APPEND srcs "dma/dw_gdma.c")
endif()
if(CONFIG_SOC_DMA2D_SUPPORTED)
list(APPEND srcs "dma/dma2d.c")
endif()
if(CONFIG_SOC_SYSTIMER_SUPPORTED)
list(APPEND srcs "port/${target}/systimer.c")
endif()
@@ -202,7 +169,7 @@ else()
endif()
set(public_include_dirs "include" "include/soc"
"dma/include" "ldo/include" "debug_probe/include" "etm/include"
"ldo/include" "debug_probe/include" "etm/include"
"mspi_timing_tuning/include" "mspi_timing_tuning/tuning_scheme_impl/include"
"power_supply/include" "modem/include")
@@ -228,7 +195,7 @@ idf_component_register(SRCS ${srcs}
PRIV_INCLUDE_DIRS port/include include/esp_private
REQUIRES ${requires}
PRIV_REQUIRES "${priv_requires}"
LDFRAGMENTS linker.lf dma/linker.lf ldo/linker.lf mspi_timing_tuning/linker.lf)
LDFRAGMENTS linker.lf ldo/linker.lf mspi_timing_tuning/linker.lf)
idf_build_get_property(target IDF_TARGET)
add_subdirectory(port/${target})
-1
View File
@@ -257,7 +257,6 @@ menu "Hardware Settings"
so that these functions can be IRAM-safe and able to be called in the other IRAM interrupt context.
endmenu
rsource "./dma/Kconfig.dma"
rsource "./etm/Kconfig.etm"
menu "Main XTAL Config"
-10
View File
@@ -75,13 +75,3 @@ classDiagram
class gptimer_etm_task_t {
}
```
## DMA Service
With the increasing demand, the hardware design of DMA is changing along the way. At first, each peripheral has a dedicated DMA controller. Later, a centralized DMA controller is introduced, which is called `GDMA` in the software.
There may be multiple GDMA instances on a chip, some is attached to the AHB bus and some is attached to the AXI bus. But their functionalities are almost the same.
Some high-performance peripherals, such as MIPI, require DMA to provide more functions, such as hardware handshake mechanism, address growth mode, out-of-order transmission and so on. Therefore, a new DMA controller, called `DW_GDMA` was born. The prefix *DW* is taken from *DesignWare*.
Please note that the specific DMA controller to be used for peripherals is determined by the specific chip. It is possible that, on chip A, SPI works with AHB GDMA, while on chip B, SPI works with AXI GDMA.
@@ -1,23 +1,5 @@
# Documentation: .gitlab/ci/README.md#manifest-file-to-control-the-buildtest-apps
components/esp_hw_support/test_apps/dma:
disable:
- if: IDF_TARGET in ["esp32"]
temporary: false
reason: No general DMA controller on ESP32
depends_filepatterns:
- components/esp_hw_support/dma/**/*
depends_components:
- esp_hal_dma
components/esp_hw_support/test_apps/dma2d:
disable:
- if: SOC_DMA2D_SUPPORTED != 1
depends_filepatterns:
- components/esp_hw_support/dma/**/*
depends_components:
- esp_hal_dma
components/esp_hw_support/test_apps/host_test_linux:
enable:
- if: IDF_TARGET == "linux"
+1 -1
View File
@@ -10,7 +10,7 @@ set(srcs "src/esp_lcd_common.c"
"src/esp_lcd_panel_st7789.c"
"src/esp_lcd_panel_ops.c")
set(includes "include" "interface")
set(priv_requires "esp_mm" "esp_psram" "esp_pm" "esp_driver_i2s")
set(priv_requires "esp_mm" "esp_psram" "esp_pm" "esp_driver_i2s" "esp_driver_dma")
set(public_requires "esp_driver_gpio" "esp_driver_i2c" "esp_driver_spi" "esp_driver_parlio" "esp_hal_lcd")
if(CONFIG_SOC_DMA2D_SUPPORTED)
+2 -2
View File
@@ -6,7 +6,7 @@ entries:
esp_lcd_panel_dpi: mipi_dsi_bridge_isr_handler (noflash)
[mapping:esp_lcd_dsi_dma]
archive: libesp_hw_support.a
archive: libesp_driver_dma.a
entries:
if LCD_DSI_ISR_HANDLER_IN_IRAM = y:
# Control dw_gdma function placement granularly
@@ -16,7 +16,7 @@ entries:
dw_gdma: dw_gdma_channel_enable_ctrl (noflash)
[mapping:esp_lcd_rgb_dma]
archive: libesp_hw_support.a
archive: libesp_driver_dma.a
entries:
if LCD_RGB_ISR_IRAM_SAFE = y:
gdma: gdma_reset (noflash)
+1 -1
View File
@@ -7,7 +7,7 @@ endif()
set(includes "include")
# Note: requires spi_flash for cache_utils, will be refactored
set(priv_requires heap spi_flash)
set(priv_requires heap spi_flash esp_hal_dma)
set(srcs)
+2 -1
View File
@@ -71,7 +71,8 @@ else()
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS include
PRIV_REQUIRES spi_flash esp_timer esp_mm esp_hal_mspi esp_hal_wdt esp_hal_uart
PRIV_REQUIRES spi_flash esp_timer esp_mm
esp_hal_mspi esp_hal_wdt esp_hal_uart esp_hal_dma
# [refactor-todo] requirements due to init code,
# should be removable once using component init functions
# link-time registration is used.
@@ -77,7 +77,7 @@ if(CONFIG_SOC_FLASH_ENCRYPTION_XTS_AES)
endif()
idf_component_register(SRCS ${srcs}
PRIV_REQUIRES efuse mbedtls esp_security esp_mm bootloader_support spi_flash
PRIV_REQUIRES efuse mbedtls esp_security esp_mm bootloader_support spi_flash esp_driver_dma
REQUIRES test_utils unity
WHOLE_ARCHIVE
PRIV_INCLUDE_DIRS "${priv_include_dirs}"
+6 -3
View File
@@ -5,7 +5,6 @@ idf_build_get_property(esp_tee_build ESP_TEE_BUILD)
if(esp_tee_build)
include(${COMPONENT_DIR}/esp_tee/esp_tee_mbedtls.cmake)
return()
elseif(BOOTLOADER_BUILD) # TODO: IDF-11673
if(CONFIG_MBEDTLS_USE_CRYPTO_ROM_IMPL_BOOTLOADER)
set(include_dirs "${COMPONENT_DIR}/mbedtls/include"
@@ -15,14 +14,14 @@ elseif(BOOTLOADER_BUILD) # TODO: IDF-11673
idf_component_register(SRCS "${srcs}"
INCLUDE_DIRS "${include_dirs}"
PRIV_REQUIRES hal)
PRIV_REQUIRES esp_hal_dma)
return()
endif()
if(NOT ${IDF_TARGET} STREQUAL "linux")
set(priv_requires soc esp_hw_support)
if(NOT BOOTLOADER_BUILD)
list(APPEND priv_requires esp_pm)
list(APPEND priv_requires esp_pm esp_driver_dma)
set(requires esp_security)
endif()
endif()
@@ -321,6 +320,10 @@ if(AES_PERIPHERAL_TYPE STREQUAL "dma")
target_sources(tfpsacrypto PRIVATE "${AES_DMA_SRCS}")
endif()
if(CONFIG_SOC_SHA_GDMA OR CONFIG_SOC_AES_GDMA)
target_link_libraries(tfpsacrypto PRIVATE idf::esp_driver_dma)
endif()
if((SHA_PERIPHERAL_TYPE STREQUAL "core" AND CONFIG_SOC_SHA_SUPPORT_DMA) OR AES_PERIPHERAL_TYPE STREQUAL "dma")
target_link_libraries(tfpsacrypto PRIVATE idf::esp_mm)
target_link_libraries(builtin PRIVATE idf::esp_mm)
@@ -1,6 +1,6 @@
idf_component_get_property(heap_dir heap COMPONENT_DIR)
set(priv_requires esp_hw_support hal soc)
set(priv_requires esp_hw_support esp_hal_dma)
set(include_dirs "${COMPONENT_DIR}/port/include"
"${COMPONENT_DIR}/mbedtls/include"
@@ -27,7 +27,6 @@
#include <stddef.h>
#include "esp_err.h"
#include "sd_pwr_ctrl.h"
#include "esp_dma_utils.h"
#include "hal/sd_types.h"
#ifdef __cplusplus
+1 -1
View File
@@ -96,6 +96,7 @@ INPUT = \
$(PROJECT_PATH)/components/esp_driver_dac/include/driver/dac_cosine.h \
$(PROJECT_PATH)/components/esp_driver_dac/include/driver/dac_oneshot.h \
$(PROJECT_PATH)/components/esp_driver_dac/include/driver/dac_types.h \
$(PROJECT_PATH)/components/esp_driver_dma/include/esp_async_memcpy.h \
$(PROJECT_PATH)/components/esp_driver_gpio/include/driver/dedic_gpio.h \
$(PROJECT_PATH)/components/esp_driver_gpio/include/driver/gpio.h \
$(PROJECT_PATH)/components/esp_driver_gpio/include/driver/gpio_etm.h \
@@ -189,7 +190,6 @@ INPUT = \
$(PROJECT_PATH)/components/esp_https_server/include/esp_https_server.h \
$(PROJECT_PATH)/components/esp_hw_support/etm/include/esp_etm.h \
$(PROJECT_PATH)/components/esp_hw_support/include/esp_clk_tree.h \
$(PROJECT_PATH)/components/esp_hw_support/include/esp_async_memcpy.h \
$(PROJECT_PATH)/components/esp_hw_support/include/esp_chip_info.h \
$(PROJECT_PATH)/components/esp_hw_support/include/esp_cpu.h \
$(PROJECT_PATH)/components/esp_hw_support/include/esp_crc.h \
@@ -224,9 +224,10 @@ The legacy timer group driver ``driver/timer.h`` is deprecated since version 5.0
The legacy RMT driver ``driver/rmt.h`` is deprecated since version 5.0 (see :ref:`deprecate_rmt_legacy_driver`). Starting from version 6.0, the legacy driver is completely removed. The new driver is placed in the :component:`esp_driver_rmt`, and the header file path is ``driver/rmt_tx.h``, ``driver/rmt_rx.h`` and ``driver/rmt_encoder.h``.
GDMA
----
DMA Driver
----------
- The DMA core driver has been moved out of the original ``esp_hw_support`` component and is now provided as a separate ``esp_driver_dma`` component. If you are using the ``esp_async_memcpy.h`` and ``esp_dma_utils.h`` drivers, please ensure that you add a dependency on the ``esp_driver_dma`` component in your project.
- The ``GDMA_ISR_IRAM_SAFE`` Kconfig option has been removed due to potential risks. Now, the interrupt behavior of different DMA channels during Cache disabled periods are independent of each other.
- ``gdma_new_channel`` is removed. When requesting a GDMA channel, use either ``gdma_new_ahb_channel`` or ``gdma_new_axi_channel`` according to the bus type.
- The ``sram_trans_align`` and ``psram_trans_align`` members have been removed from :cpp:type:`async_memcpy_config_t`. Use :cpp:member:`async_memcpy_config_t::dma_burst_size` to set the DMA burst transfer size.
@@ -224,9 +224,10 @@ I2C 主机驱动的 API 也有一些用法上的改动。
旧版的 RMT 驱动 ``driver/rmt.h`` 在 5.0 的版本中就已经被弃用(请参考 :ref:`deprecate_rmt_legacy_driver`)。从 6.0 版本开始,旧版驱动被完全移除。新驱动位于 :component:`esp_driver_rmt` 组件中,头文件引用路径为 ``driver/rmt_tx.h``, ``driver/rmt_rx.h````driver/rmt_encoder.h``
GDMA
----
DMA 驱动
--------
- DMA 核心驱动程序现已从原来的 ``esp_hw_support`` 组件中移出,现作为单独的 ``esp_driver_dma`` 组件提供。如果你使用了 ``esp_async_memcpy.h````esp_dma_utils.h`` 驱动,请确保在项目中添加对 ``esp_driver_dma`` 组件的依赖。
- ``GDMA_ISR_IRAM_SAFE`` Kconfig 选项会带来不必要的风险,因此被移除。现在,不同的 GDMA 通道它们的中断在 Cache 关闭期间的行为可以互不影响。
- ``gdma_new_channel`` 已经被移除。现在当申请一个 GDMA 通道时,必须要根据实际使用的总线调用 ``gdma_new_ahb_channel````gdma_new_axi_channel`` 函数。
- :cpp:type:`async_memcpy_config_t` 中的 ``sram_trans_align````psram_trans_align`` 成员均已经被移除。请使用 :cpp:member:`async_memcpy_config_t::dma_burst_size` 来设置 DMA 的突发传输大小。
@@ -115,6 +115,9 @@ set(extra_components_which_shouldnt_be_included
# esp_security is required by mbedtls and spi_flash
esp_security
# esp_driver_dma is required by mbedtls
esp_driver_dma
# esp_usb_cdc_rom_console is used by the panic handler, will be conditional on cdc console option when
# the new build-system is implemented
esp_usb_cdc_rom_console