Skip to content

Commit 8af7f37

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

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;
311312
if (dma_capable) {
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);
313+
caps |= MALLOC_CAP_DMA;
314314
}
315315

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy