esp_mmu_map_private.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #include <stdlib.h>
  8. #include <stdint.h>
  9. #include "esp_err.h"
  10. #include "hal/mmu_types.h"
  11. #ifdef __cplusplus
  12. extern "C" {
  13. #endif
  14. /**
  15. * Memory Mapping Private APIs for MMU supported memory
  16. */
  17. /**
  18. * @brief Initialise the MMU MMAP driver
  19. *
  20. * This is called once in the IDF startup code. Don't call it in applications
  21. */
  22. void esp_mmu_map_init(void);
  23. /**
  24. * @brief Reserve a consecutive external virtual memory block, with given capabilities and size
  25. *
  26. * @note This private API shall be only called internally during startup stage. DO NOT call
  27. * this API in your applications
  28. *
  29. * @param[in] size Size, in bytes, the amount of memory to find
  30. * @param[in] caps Bitwise OR of `mmu_mem_caps_t` flags indicating the memory block capability
  31. * @param[in] target Target memory type. See `mmu_target_t`
  32. * @param[out] out_ptr Pointer to start address of the memory block that is reserved
  33. *
  34. * @return
  35. * - ESP_OK: On success
  36. * - ESP_ERR_INVALID_ARG: Invalid arguments, could be wrong caps makeup, or null pointer
  37. * - ESP_ERR_NOT_FOUND: Didn't find enough memory with give caps
  38. */
  39. esp_err_t esp_mmu_map_reserve_block_with_caps(size_t size, mmu_mem_caps_t caps, mmu_target_t target, const void **out_ptr);
  40. /*
  41. * @brief Dump all mapped blocks
  42. *
  43. * @return
  44. * - ESP_OK
  45. */
  46. esp_err_t esp_mmu_map_dump_mapped_blocks_private(void);
  47. #ifdef __cplusplus
  48. }
  49. #endif