Add api to get total heap size in bytes for given capability

This commit is contained in:
Kewal
2019-10-21 14:55:58 +08:00
committed by Angus Gratton
parent bb38d181a1
commit d3020b217d
2 changed files with 26 additions and 0 deletions

View File

@@ -329,6 +329,18 @@ IRAM_ATTR void *heap_caps_calloc( size_t n, size_t size, uint32_t caps)
return result;
}
size_t heap_caps_get_total_size(uint32_t caps)
{
size_t total_size = 0;
heap_t *heap;
SLIST_FOREACH(heap, &registered_heaps, next) {
if (heap_caps_match(heap, caps)) {
total_size += (heap->end - heap->start);
}
}
return total_size;
}
size_t heap_caps_get_free_size( uint32_t caps )
{
size_t ret = 0;