Skip to content

Commit 8f54e33

Browse files
committed
Reapply "espressif: port_malloc() shoud not use SPIRAM when dma_capable=true"
This reverts commit 8af7f37.
1 parent 1e77ad2 commit 8f54e33

File tree

1 file changed

+5
-5
lines changed
  • ports/espressif/supervisor

1 file changed

+5
-5
lines changed

ports/espressif/supervisor/port.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -308,18 +308,18 @@ void port_heap_init(void) {
308308
}
309309

310310
void *port_malloc(size_t size, bool dma_capable) {
311-
size_t caps = MALLOC_CAP_8BIT;
312311
if (dma_capable) {
313-
caps |= MALLOC_CAP_DMA;
312+
// SPIRAM is not DMA-capable, so don't bother to ask for it.
313+
return heap_caps_malloc(size, MALLOC_CAP_8BIT | MALLOC_CAP_DMA);
314314
}
315315

316316
void *ptr = NULL;
317-
// Try SPIRAM first when available.
317+
// Try SPIRAM first if available.
318318
#ifdef CONFIG_SPIRAM
319-
ptr = heap_caps_malloc(size, caps | MALLOC_CAP_SPIRAM);
319+
ptr = heap_caps_malloc(size, MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
320320
#endif
321321
if (ptr == NULL) {
322-
ptr = heap_caps_malloc(size, caps);
322+
ptr = heap_caps_malloc(size, MALLOC_CAP_8BIT);
323323
}
324324
return ptr;
325325
}

0 commit comments

Comments
 (0)