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