From f5de966471457274035da48cf834f33509e8af61 Mon Sep 17 00:00:00 2001 From: Marco Casaroli Date: Mon, 1 Jul 2024 14:25:22 +0000 Subject: [PATCH] fix(esp32-qemu-openeth): allocate buffers in internal memory When the PSRAM is enabled, we should not allocate the TX/RX buffers there, so we use kmm_calloc here, to make it into IRAM, so the ethernet controller can read bytes from it. --- arch/xtensa/src/esp32/esp32_openeth.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/xtensa/src/esp32/esp32_openeth.c b/arch/xtensa/src/esp32/esp32_openeth.c index 442c0af874..2f157992d2 100644 --- a/arch/xtensa/src/esp32/esp32_openeth.c +++ b/arch/xtensa/src/esp32/esp32_openeth.c @@ -38,6 +38,7 @@ #include #include +#include #include #include #include @@ -791,7 +792,7 @@ int esp32_openeth_initialize(void) for (int i = 0; i < RX_BUF_COUNT; i++) { - priv->rx_buf[i] = calloc(1, DMA_BUF_SIZE); + priv->rx_buf[i] = kmm_calloc(1, DMA_BUF_SIZE); if (!(priv->rx_buf[i])) { nerr("ERROR: Failed allocate RX descriptors\n"); @@ -807,7 +808,7 @@ int esp32_openeth_initialize(void) for (int i = 0; i < TX_BUF_COUNT; i++) { - priv->tx_buf[i] = calloc(1, DMA_BUF_SIZE); + priv->tx_buf[i] = kmm_calloc(1, DMA_BUF_SIZE); if (!(priv->tx_buf[i])) { nerr("ERROR: Failed allocate TX descriptors\n");