mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-07-04 22:36:32 +02:00
IDF release/v4.0 a3f3c7bdc
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
|
||||
#if CONFIG_SPIRAM_SUPPORT
|
||||
#if CONFIG_ESP32_SPIRAM_SUPPORT
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#endif
|
||||
|
||||
@ -80,20 +80,20 @@ typedef struct
|
||||
* @param align Align of memory. If not required, set 0.
|
||||
* @return Pointer of allocated memory. Null for failed.
|
||||
*/
|
||||
static inline void *dl_lib_calloc(int cnt, int size, int align)
|
||||
static void *dl_lib_calloc(int cnt, int size, int align)
|
||||
{
|
||||
int total_size = cnt * size + align + sizeof(void *);
|
||||
void *res = malloc(total_size);
|
||||
if (NULL == res)
|
||||
{
|
||||
#if CONFIG_SPIRAM_SUPPORT
|
||||
#if CONFIG_ESP32_SPIRAM_SUPPORT
|
||||
res = heap_caps_malloc(total_size, MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);
|
||||
}
|
||||
if (NULL == res)
|
||||
{
|
||||
printf("Item psram alloc failed. Size: %d x %d\n", cnt, size);
|
||||
#else
|
||||
printf("Item alloc failed. Size: %d x %d\n", cnt, size);
|
||||
printf("Item alloc failed. Size: %d x %d, SPIRAM_FLAG: %d\n", cnt, size, CONFIG_ESP32_SPIRAM_SUPPORT);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user