From 378c54e2730361aaaa6c7b10798487a87ad5df88 Mon Sep 17 00:00:00 2001 From: Guillaume Souchere Date: Wed, 3 Aug 2022 08:17:06 +0200 Subject: [PATCH] heap: Move the declaration of tlsf_poison_fill_pfunc_set() in esp_rom component - The declaration is moved to esp_rom/include/esp32c2/rom/tlsf.h. - multi_heap_poisoning.h now includes rom/tlsf.h instead of declaring tlsf_poison_fill_pfunc_set(). Note: If more targets will support an implementation of the TLSF in ROM, esp_rom will be extended with new headers in the respective target directories but multi_heap_poisoning.h will remain unchanged. --- components/esp_rom/include/esp32c2/rom/tlsf.h | 23 +++++++++++++++++++ components/heap/multi_heap_poisoning.c | 9 ++++---- 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 components/esp_rom/include/esp32c2/rom/tlsf.h diff --git a/components/esp_rom/include/esp32c2/rom/tlsf.h b/components/esp_rom/include/esp32c2/rom/tlsf.h new file mode 100644 index 0000000000..516822190e --- /dev/null +++ b/components/esp_rom/include/esp32c2/rom/tlsf.h @@ -0,0 +1,23 @@ +/* + * SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +/*! + * @brief Set the function to call for filling memory region when + * poisoning is configured. + * + * @param pfunc The callback function to trigger for poisoning + * a memory region. + */ +void tlsf_poison_fill_pfunc_set(void *pfunc); + +#ifdef __cplusplus +} +#endif diff --git a/components/heap/multi_heap_poisoning.c b/components/heap/multi_heap_poisoning.c index 24739637a8..f59ef6766d 100644 --- a/components/heap/multi_heap_poisoning.c +++ b/components/heap/multi_heap_poisoning.c @@ -24,11 +24,12 @@ #if !CONFIG_HEAP_TLSF_USE_ROM_IMPL #include "tlsf.h" #else -/* Declaration of the tlsf_poison_fill_pfunc_set defined in RAM - * used to call IDF function multi_heap_internal_poison_fill_region() - * in this source file +/* Header containing the declaration of tlsf_poison_fill_pfunc_set() + * used to register multi_heap_internal_poison_fill_region() as a + * callback to fill memory region with given patterns in the heap + * components. */ -extern void tlsf_poison_fill_pfunc_set(void *pfunc); +#include "rom/tlsf.h" #endif #ifdef MULTI_HEAP_POISONING