esp_rom_tlsf.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. /*!
  13. * Defines the function prototypes for multi_heap_internal_poison_fill_region
  14. * and multi_heap_internal_check_block_poisoning, these two function will
  15. * be registered to the ROM tlsf IMPL through the function tlsf_poison_fill_pfunc_set()
  16. * and tlsf_poison_check_pfunc_set() when the heap poisoning feature is enabled.
  17. */
  18. typedef void (*poison_fill_pfunc_t)(void *start, size_t size, bool is_free);
  19. typedef bool (*poison_check_pfunc_t)(void *start, size_t size, bool is_free, bool print_errors);
  20. /*!
  21. * @brief Set the function to call for filling memory region when
  22. * poisoning is configured.
  23. *
  24. * @note Please keep in mind that this function in ROM still accepts void*.
  25. *
  26. * @param pfunc The callback function to trigger for poisoning
  27. * a memory region.
  28. */
  29. void tlsf_poison_fill_pfunc_set(poison_fill_pfunc_t pfunc);
  30. /*!
  31. * @brief Set the function to call for checking memory region when
  32. * poisoning is configured.
  33. *
  34. * @param pfunc The callback function to trigger for checking
  35. * the content of a memory region.
  36. */
  37. void tlsf_poison_check_pfunc_set(poison_check_pfunc_t pfunc);
  38. #ifdef __cplusplus
  39. }
  40. #endif