1 /* 2 * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 #pragma once 7 #include <stddef.h> 8 #include <stdbool.h> 9 10 #ifdef __cplusplus 11 extern "C" { 12 #endif 13 14 /*! 15 * Defines the function prototypes for multi_heap_internal_poison_fill_region 16 * and multi_heap_internal_check_block_poisoning, these two function will 17 * be registered to the ROM tlsf IMPL through the function tlsf_poison_fill_pfunc_set() 18 * and tlsf_poison_check_pfunc_set() when the heap poisoning feature is enabled. 19 */ 20 typedef void (*poison_fill_pfunc_t)(void *start, size_t size, bool is_free); 21 typedef bool (*poison_check_pfunc_t)(void *start, size_t size, bool is_free, bool print_errors); 22 23 /*! 24 * @brief Set the function to call for filling memory region when 25 * poisoning is configured. 26 * 27 * @note Please keep in mind that this function in ROM still accepts void*. 28 * 29 * @param pfunc The callback function to trigger for poisoning 30 * a memory region. 31 */ 32 void tlsf_poison_fill_pfunc_set(poison_fill_pfunc_t pfunc); 33 34 /*! 35 * @brief Set the function to call for checking memory region when 36 * poisoning is configured. 37 * 38 * @param pfunc The callback function to trigger for checking 39 * the content of a memory region. 40 */ 41 void tlsf_poison_check_pfunc_set(poison_check_pfunc_t pfunc); 42 43 #ifdef __cplusplus 44 } 45 #endif 46