mirror of
https://github.com/espressif/esp-idf
synced 2025-04-09 16:20:09 -04:00
Introduce new APIs in essp_heap_caps.h: - heap_caps_walk() - heap_caps_walk_all() Those functions are triggering a callback for all blocks (allocated or free) of memory present in heaps meeting the set of capabilities passed as parameter (or all heaps for heap_caps_walk_all() function) test_walker.c added to test the new functionality in test_apps/heap_test/
41 lines
1.1 KiB
C
41 lines
1.1 KiB
C
/*
|
|
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
#pragma once
|
|
#include <stdint.h>
|
|
#include <stddef.h>
|
|
#include <stdbool.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/** @brief Opaque handle to a registered heap */
|
|
typedef struct multi_heap_info *multi_heap_handle_t;
|
|
|
|
/**
|
|
* @brief Callback called when walking the given heap blocks of memory
|
|
*
|
|
* @param block_ptr Pointer to the block data
|
|
* @param block_size The size of the block
|
|
* @param block_used Block status. True if free, false if used
|
|
* @param user_data Opaque pointer to user defined data
|
|
*/
|
|
typedef void (*multi_heap_walker_cb_t)(void *block_ptr, size_t block_size, int block_used, void *user_data);
|
|
|
|
/**
|
|
* @brief Call the tlsf_walk_pool function of the heap given as parameter with
|
|
* the walker function passed as parameter
|
|
*
|
|
* @param heap The heap to traverse
|
|
* @param walker_func The walker to trigger on each block of the heap
|
|
* @param user_data Opaque pointer to user defined data
|
|
*/
|
|
void multi_heap_walk(multi_heap_handle_t heap, multi_heap_walker_cb_t walker_func, void *user_data);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|