IDF release/v4.0 a3f3c7bdc

This commit is contained in:
me-no-dev
2020-04-07 00:12:32 +00:00
parent 2271c7726d
commit b47b0dc966
130 changed files with 1032 additions and 447 deletions

View File

@ -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;
}