8000 espressif: port_malloc() shoud not use SPIRAM when dma_capable=true · cezer-io/circuitpython@f999afd · GitHub
[go: up one dir, main page]

Skip to content

Commit f999afd

Browse files
committed
espressif: port_malloc() shoud not use SPIRAM when dma_capable=true
1 parent a2ad339 commit f999afd

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
@@ -304,18 +304,18 @@ void port_heap_init(void) {
304304
}
305305

306306
void *port_malloc(size_t size, bool dma_capable) {
307-
size_t caps = MALLOC_CAP_8BIT;
308307
if (dma_capable) {
309-
caps |= MALLOC_CAP_DMA;
308+
// SPIRAM is not DMA-capable, so don't bother to ask for it.
309+
return heap_caps_malloc(size, MALLOC_CAP_8BIT | MALLOC_CAP_DMA);
310310
}
311311

312312
void *ptr = NULL;
313-
// Try SPIRAM first when available.
313+
// Try SPIRAM first if available.
314314
#ifdef CONFIG_SPIRAM
315-
ptr = heap_caps_malloc(size, caps | MALLOC_CAP_SPIRAM);
315+
ptr = heap_caps_malloc(size, MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
316316
#endif
317317
if (ptr == NULL) {
318-
ptr = heap_caps_malloc(size, caps);
318+
ptr = heap_caps_malloc(size, MALLOC_CAP_8BIT);
319319
}
320320
return ptr;
321321
}

0 commit comments

Comments
 (0)
0