Merge branch 'feature/add_cap_to_heap' into 'master'

Add access align capacity to heap API

See merge request sdk/ESP8266_RTOS_SDK!171
This commit is contained in:
Wu Jian Gang
2018-05-24 14:11:13 +08:00
12 changed files with 62 additions and 13 deletions

View File

@ -28,6 +28,10 @@ extern "C" {
#define OSI_QUEUE_SEND_BACK 1
#define OSI_QUEUE_SEND_OVERWRITE 2
#define OSI_MALLOC_CAP_32BIT (1 << 1)
#define OSI_MALLOC_CAP_8BIT (1 << 2)
#define OSI_MALLOC_CAP_DMA (1 << 3)
typedef struct {
uint32_t (*enter_critical)(void);
void (*exit_critical)(uint32_t tmp);
@ -74,7 +78,10 @@ typedef struct {
bool (*timer_stop)(void *timer, uint32_t ticks);
bool (*timer_delete)(void *timer, uint32_t ticks);
void *(*malloc)(uint32_t size);
void *(*malloc)(uint32_t size, uint32_t cap);
void *(*zalloc)(uint32_t size, uint32_t cap);
void *(*realloc)(void *ptr, uint32_t size, uint32_t cap);
void *(*calloc)(uint32_t cnt, uint32_t size, uint32_t cap);
void (*free)(void *p);
uint32_t (*get_free_heap_size)(void);

View File

@ -131,8 +131,17 @@ extern wifi_osi_funcs_t s_wifi_osi_funcs;
#define wifi_timer_delete(t, tk) \
s_wifi_osi_funcs.timer_delete(t, tk)
#define wifi_malloc(s) \
s_wifi_osi_funcs.malloc(s)
#define wifi_malloc(s, c) \
s_wifi_osi_funcs.malloc(s, c)
#define wifi_zalloc(s, c) \
s_wifi_osi_funcs.zalloc(s, c)
#define wifi_calloc(cnt, s, c) \
s_wifi_osi_funcs.calloc(cnt, s, c)
#define wifi_realloc(ptr, s, c) \
s_wifi_osi_funcs.realloc(ptr, s, c)
#define wifi_free(p) \
s_wifi_osi_funcs.free(p)

View File

@ -1,11 +1,11 @@
gwen:
crypto: 5fc5b4f
espnow: 5fc5b4f
core: 0b78c0f
crypto: 0181338
espnow: 0181338
core: 0181338
minic: 5fc5b4f
net80211: 0b78c0f
pp: 06675a3
pwm: 5fc5b4f
net80211: 0181338
pp: 0181338
pwm: 0181338
smartconfig:9ec59b5
wpa: 06675a3
wps: 06675a3
wpa: 0181338
wps: 0181338

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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,