mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-05-21 17:16:29 +08:00
feat(esp8266): Add access align capacity to heap API
This commit is contained in:
@ -15,6 +15,8 @@
|
||||
#include "esp_wifi_os_adapter.h"
|
||||
#include "esp_system.h"
|
||||
|
||||
#include "c_types.h"
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "freertos/queue.h"
|
||||
@ -271,6 +273,34 @@ static bool timer_delete_wrapper(void *timer, uint32_t ticks)
|
||||
return xTimerDelete(timer, ticks);
|
||||
}
|
||||
|
||||
static void *malloc_wrapper(uint32_t s, uint32_t cap)
|
||||
{
|
||||
if (cap & (OSI_MALLOC_CAP_8BIT | OSI_MALLOC_CAP_DMA))
|
||||
return os_malloc(s);
|
||||
else
|
||||
return os_malloc_iram(s);
|
||||
}
|
||||
|
||||
static void *zalloc_wrapper(uint32_t s, uint32_t cap)
|
||||
{
|
||||
return os_zalloc(s);
|
||||
}
|
||||
|
||||
static void *realloc_wrapper(void *ptr, uint32_t s, uint32_t cap)
|
||||
{
|
||||
return os_realloc(ptr, s);
|
||||
}
|
||||
|
||||
static void *calloc_wrapper(uint32_t cnt, uint32_t s, uint32_t cap)
|
||||
{
|
||||
return os_calloc(cnt, s);
|
||||
}
|
||||
|
||||
static void free_wrapper(void *ptr)
|
||||
{
|
||||
os_free(ptr);
|
||||
}
|
||||
|
||||
static void srand_wrapper(uint32_t seed)
|
||||
{
|
||||
/* empty function */
|
||||
@ -327,8 +357,11 @@ wifi_osi_funcs_t s_wifi_osi_funcs = {
|
||||
.timer_stop = timer_stop_wrapper,
|
||||
.timer_delete = timer_delete_wrapper,
|
||||
|
||||
.malloc = malloc,
|
||||
.free = free,
|
||||
.malloc = malloc_wrapper,
|
||||
.zalloc = zalloc_wrapper,
|
||||
.realloc = realloc_wrapper,
|
||||
.calloc = calloc_wrapper,
|
||||
.free = free_wrapper,
|
||||
.get_free_heap_size = get_free_heap_size_wrapper,
|
||||
|
||||
.srand = srand_wrapper,
|
||||
|
Reference in New Issue
Block a user