mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
mmu: move mem_caps macro to hal/mmu_types.h as an enum type
This commit is contained in:
parent
8ba67dfc38
commit
16398c2d06
@ -8,7 +8,7 @@
|
|||||||
#include "sdkconfig.h"
|
#include "sdkconfig.h"
|
||||||
#include "soc/ext_mem_defs.h"
|
#include "soc/ext_mem_defs.h"
|
||||||
#include "ext_mem_layout.h"
|
#include "ext_mem_layout.h"
|
||||||
#include "mmu.h"
|
#include "hal/mmu_types.h"
|
||||||
|
|
||||||
|
|
||||||
#if CONFIG_IDF_TARGET_ESP32
|
#if CONFIG_IDF_TARGET_ESP32
|
||||||
|
@ -184,7 +184,7 @@ void esp_mmu_init(void)
|
|||||||
assert(available_region_idx == region_num);
|
assert(available_region_idx == region_num);
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t esp_mmu_get_max_consecutive_free_block(int caps, size_t *out_len)
|
esp_err_t esp_mmu_get_max_consecutive_free_block(mmu_mem_caps_t caps, size_t *out_len)
|
||||||
{
|
{
|
||||||
ESP_RETURN_ON_FALSE(out_len, ESP_ERR_INVALID_ARG, TAG, "null pointer");
|
ESP_RETURN_ON_FALSE(out_len, ESP_ERR_INVALID_ARG, TAG, "null pointer");
|
||||||
if (caps & MMU_MEM_CAP_EXEC) {
|
if (caps & MMU_MEM_CAP_EXEC) {
|
||||||
@ -210,7 +210,7 @@ esp_err_t esp_mmu_get_max_consecutive_free_block(int caps, size_t *out_len)
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
esp_err_t esp_mmu_reserve_block_with_caps(size_t size, uint32_t caps, const void **out_ptr)
|
esp_err_t esp_mmu_reserve_block_with_caps(size_t size, mmu_mem_caps_t caps, const void **out_ptr)
|
||||||
{
|
{
|
||||||
ESP_RETURN_ON_FALSE(out_ptr, ESP_ERR_INVALID_ARG, TAG, "null pointer");
|
ESP_RETURN_ON_FALSE(out_ptr, ESP_ERR_INVALID_ARG, TAG, "null pointer");
|
||||||
if (caps & MMU_MEM_CAP_EXEC) {
|
if (caps & MMU_MEM_CAP_EXEC) {
|
||||||
|
@ -24,12 +24,6 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#define MMU_MEM_CAP_EXEC (1<<0)
|
|
||||||
#define MMU_MEM_CAP_READ (1<<1)
|
|
||||||
#define MMU_MEM_CAP_WRITE (1<<2)
|
|
||||||
#define MMU_MEM_CAP_32BIT (1<<3)
|
|
||||||
#define MMU_MEM_CAP_8BIT (1<<4)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialise the MMU driver
|
* @brief Initialise the MMU driver
|
||||||
*
|
*
|
||||||
@ -47,7 +41,7 @@ void esp_mmu_init(void);
|
|||||||
* - ESP_OK: On success
|
* - ESP_OK: On success
|
||||||
* - ESP_ERR_INVALID_ARG: Invalid arguments, could be null pointer
|
* - ESP_ERR_INVALID_ARG: Invalid arguments, could be null pointer
|
||||||
*/
|
*/
|
||||||
esp_err_t esp_mmu_get_max_consecutive_free_block(int caps, size_t *out_len);
|
esp_err_t esp_mmu_get_max_consecutive_free_block(mmu_mem_caps_t caps, size_t *out_len);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Reserve a consecutive external virtual memory block, with given capabilities and size
|
* @brief Reserve a consecutive external virtual memory block, with given capabilities and size
|
||||||
@ -61,7 +55,7 @@ esp_err_t esp_mmu_get_max_consecutive_free_block(int caps, size_t *out_len);
|
|||||||
* - ESP_ERR_INVALID_ARG: Invalid arguments, could be wrong caps makeup, or null pointer
|
* - ESP_ERR_INVALID_ARG: Invalid arguments, could be wrong caps makeup, or null pointer
|
||||||
* - ESP_ERR_NOT_FOUND: Didn't find enough memory with give caps
|
* - ESP_ERR_NOT_FOUND: Didn't find enough memory with give caps
|
||||||
*/
|
*/
|
||||||
esp_err_t esp_mmu_reserve_block_with_caps(size_t size, uint32_t caps, const void **out_ptr);
|
esp_err_t esp_mmu_reserve_block_with_caps(size_t size, mmu_mem_caps_t caps, const void **out_ptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Dump internal memory region usage
|
* @brief Dump internal memory region usage
|
||||||
|
@ -6,11 +6,20 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "esp_bit_defs.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
MMU_MEM_CAP_EXEC = BIT(0),
|
||||||
|
MMU_MEM_CAP_READ = BIT(1),
|
||||||
|
MMU_MEM_CAP_WRITE = BIT(2),
|
||||||
|
MMU_MEM_CAP_32BIT = BIT(3),
|
||||||
|
MMU_MEM_CAP_8BIT = BIT(4),
|
||||||
|
} mmu_mem_caps_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MMU Page size
|
* MMU Page size
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user