From 707c87fdb603744389aae575c4da12928eaff95b Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Wed, 17 Feb 2016 11:42:52 +0300 Subject: [PATCH] Move umm_info into cache --- cores/esp8266/heap.c | 2 +- cores/esp8266/umm_malloc/umm_malloc.c | 4 ++-- cores/esp8266/umm_malloc/umm_malloc_cfg.h | 7 +++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/cores/esp8266/heap.c b/cores/esp8266/heap.c index 0d02592b1..e543dd39d 100644 --- a/cores/esp8266/heap.c +++ b/cores/esp8266/heap.c @@ -32,7 +32,7 @@ void* ICACHE_RAM_ATTR pvPortZalloc(size_t size, const char* file, int line) return calloc(1, size); } -size_t ICACHE_RAM_ATTR xPortGetFreeHeapSize(void) +size_t xPortGetFreeHeapSize(void) { return umm_free_heap_size(); } diff --git a/cores/esp8266/umm_malloc/umm_malloc.c b/cores/esp8266/umm_malloc/umm_malloc.c index 1988dde53..189892a22 100644 --- a/cores/esp8266/umm_malloc/umm_malloc.c +++ b/cores/esp8266/umm_malloc/umm_malloc.c @@ -967,7 +967,7 @@ static void *get_unpoisoned( unsigned char *ptr ) { UMM_HEAP_INFO ummHeapInfo; -void *umm_info( void *ptr, int force ) { +void ICACHE_FLASH_ATTR *umm_info( void *ptr, int force ) { unsigned short int blockNo = 0; @@ -1728,7 +1728,7 @@ void umm_free( void *ptr ) { /* ------------------------------------------------------------------------ */ -size_t umm_free_heap_size( void ) { +size_t ICACHE_FLASH_ATTR umm_free_heap_size( void ) { umm_info(NULL, 0); return (size_t)ummHeapInfo.freeBlocks * sizeof(umm_block); } diff --git a/cores/esp8266/umm_malloc/umm_malloc_cfg.h b/cores/esp8266/umm_malloc/umm_malloc_cfg.h index 3d38d2b0e..544545a47 100644 --- a/cores/esp8266/umm_malloc/umm_malloc_cfg.h +++ b/cores/esp8266/umm_malloc/umm_malloc_cfg.h @@ -6,6 +6,13 @@ #define _UMM_MALLOC_CFG_H #include +#ifdef __cplusplus +#extern "C" { +#endif +#include "c_types.h" +#ifdef __cplusplus +} +#endif /* * There are a number of defines you can set at compile time that affect how * the memory allocator will operate.