Merge branch 'refa/replce_esp_dma_xxx_malloc_api' into 'master'

refa(spi): clean up esp_dma_xxx memory allocation code

Closes IDF-9656

See merge request espressif/esp-idf!31239
This commit is contained in:
Wan Lei
2024-09-06 22:08:22 +08:00
6 changed files with 23 additions and 32 deletions
@@ -100,7 +100,7 @@ DRAM_ATTR static const lcd_init_cmd_t st_init_cmds[] = {
};
DRAM_ATTR static const lcd_init_cmd_t ili_init_cmds[] = {
/* Power contorl B, power control = 0, DC_ENA = 1 */
/* Power control B, power control = 0, DC_ENA = 1 */
{0xCF, {0x00, 0x83, 0X30}, 3},
/* Power on sequence control,
* cp1 keeps 1 frame, 1st frame enable
@@ -128,7 +128,7 @@ DRAM_ATTR static const lcd_init_cmd_t ili_init_cmds[] = {
{0xC5, {0x35, 0x3E}, 2},
/* VCOM control 2, VCOMH=VMH-2, VCOML=VML-2 */
{0xC7, {0xBE}, 1},
/* Memory access contorl, MX=MY=0, MV=1, ML=0, BGR=1, MH=0 */
/* Memory access control, MX=MY=0, MV=1, ML=0, BGR=1, MH=0 */
{0x36, {0x28}, 1},
/* Pixel format, 16bits/pixel for RGB/MCU interface */
{0x3A, {0x55}, 1},
@@ -377,7 +377,7 @@ static void display_pretty_colors(spi_device_handle_t spi)
uint16_t *lines[2];
//Allocate memory for the pixel buffers
for (int i = 0; i < 2; i++) {
lines[i] = heap_caps_malloc(320 * PARALLEL_LINES * sizeof(uint16_t), MALLOC_CAP_DMA);
lines[i] = spi_bus_dma_memory_alloc(LCD_HOST, 320 * PARALLEL_LINES * sizeof(uint16_t), 0);
assert(lines[i] != NULL);
}
int frame = 0;
@@ -203,12 +203,12 @@ void app_main(void)
printf("Slave MAX Send Buffer Size: %"PRIu32"\n", slave_max_tx_buf_size);
printf("Slave MAX Receive Buffer Size: %"PRIu32"\n", slave_max_rx_buf_size);
uint8_t *recv_buf = heap_caps_calloc(1, rx_buf_size, MALLOC_CAP_DMA);
uint8_t *recv_buf = spi_bus_dma_memory_alloc(MASTER_HOST, rx_buf_size, 0);
if (!recv_buf) {
ESP_LOGE(TAG, "No enough memory!");
abort();
}
uint8_t *send_buf = heap_caps_calloc(1, slave_max_rx_buf_size, MALLOC_CAP_DMA);
uint8_t *send_buf = spi_bus_dma_memory_alloc(MASTER_HOST, slave_max_rx_buf_size, 0);
if (!send_buf) {
ESP_LOGE(TAG, "No enough memory!");
abort();