refactor(esp_mm): reformat code with astyle_py

This commit is contained in:
Armando 2023-09-28 15:27:51 +08:00
parent 2144eedb66
commit 3d4b60afc0
5 changed files with 2 additions and 25 deletions

View File

@ -10,19 +10,16 @@
#include "rom/cache.h" #include "rom/cache.h"
#include "esp_private/esp_cache_esp32_private.h" #include "esp_private/esp_cache_esp32_private.h"
static cache_driver_t s_cache_drv = { static cache_driver_t s_cache_drv = {
Cache_Flush, Cache_Flush,
NULL, NULL,
}; };
void cache_register_writeback(cache_driver_t *func) void cache_register_writeback(cache_driver_t *func)
{ {
s_cache_drv.cache_writeback_psram = func->cache_writeback_psram; s_cache_drv.cache_writeback_psram = func->cache_writeback_psram;
} }
void cache_sync(void) void cache_sync(void)
{ {
if (s_cache_drv.cache_writeback_psram) { if (s_cache_drv.cache_writeback_psram) {

View File

@ -26,7 +26,6 @@ static const char *TAG = "cache";
DEFINE_CRIT_SECTION_LOCK_STATIC(s_spinlock); DEFINE_CRIT_SECTION_LOCK_STATIC(s_spinlock);
esp_err_t esp_cache_msync(void *addr, size_t size, int flags) esp_err_t esp_cache_msync(void *addr, size_t size, int flags)
{ {
ESP_RETURN_ON_FALSE_ISR(addr, ESP_ERR_INVALID_ARG, TAG, "null pointer"); ESP_RETURN_ON_FALSE_ISR(addr, ESP_ERR_INVALID_ARG, TAG, "null pointer");
@ -90,7 +89,6 @@ esp_err_t esp_cache_msync(void *addr, size_t size, int flags)
return ESP_OK; return ESP_OK;
} }
esp_err_t esp_cache_aligned_malloc(size_t size, uint32_t flags, void **out_ptr, size_t *actual_size) esp_err_t esp_cache_aligned_malloc(size_t size, uint32_t flags, void **out_ptr, size_t *actual_size)
{ {
ESP_RETURN_ON_FALSE_ISR(out_ptr, ESP_ERR_INVALID_ARG, TAG, "null pointer"); ESP_RETURN_ON_FALSE_ISR(out_ptr, ESP_ERR_INVALID_ARG, TAG, "null pointer");
@ -132,7 +130,6 @@ esp_err_t esp_cache_aligned_malloc(size_t size, uint32_t flags, void **out_ptr,
return ESP_OK; return ESP_OK;
} }
esp_err_t esp_cache_aligned_calloc(size_t n, size_t size, uint32_t flags, void **out_ptr, size_t *actual_size) esp_err_t esp_cache_aligned_calloc(size_t n, size_t size, uint32_t flags, void **out_ptr, size_t *actual_size)
{ {
ESP_RETURN_ON_FALSE_ISR(out_ptr, ESP_ERR_INVALID_ARG, TAG, "null pointer"); ESP_RETURN_ON_FALSE_ISR(out_ptr, ESP_ERR_INVALID_ARG, TAG, "null pointer");

View File

@ -29,7 +29,6 @@
#include "ext_mem_layout.h" #include "ext_mem_layout.h"
#include "esp_mmu_map.h" #include "esp_mmu_map.h"
//This is for size align //This is for size align
#define ALIGN_UP_BY(num, align) (((num) + ((align) - 1)) & ~((align) - 1)) #define ALIGN_UP_BY(num, align) (((num) + ((align) - 1)) & ~((align) - 1))
//This is for vaddr align //This is for vaddr align
@ -108,7 +107,6 @@ typedef struct {
mem_region_t mem_regions[SOC_MMU_LINEAR_ADDRESS_REGION_NUM]; mem_region_t mem_regions[SOC_MMU_LINEAR_ADDRESS_REGION_NUM];
} mmu_ctx_t; } mmu_ctx_t;
static mmu_ctx_t s_mmu_ctx; static mmu_ctx_t s_mmu_ctx;
#if ENABLE_PADDR_CHECK #if ENABLE_PADDR_CHECK
@ -116,7 +114,6 @@ static bool s_is_enclosed(uint32_t block_start, uint32_t block_end, uint32_t new
static bool s_is_overlapped(uint32_t block_start, uint32_t block_end, uint32_t new_block_start, uint32_t new_block_size); static bool s_is_overlapped(uint32_t block_start, uint32_t block_end, uint32_t new_block_start, uint32_t new_block_size);
#endif //#if ENABLE_PADDR_CHECK #endif //#if ENABLE_PADDR_CHECK
#if CONFIG_APP_BUILD_USE_FLASH_SECTIONS #if CONFIG_APP_BUILD_USE_FLASH_SECTIONS
static cache_bus_mask_t s_get_bus_mask(uint32_t vaddr_start, uint32_t len) static cache_bus_mask_t s_get_bus_mask(uint32_t vaddr_start, uint32_t len)
@ -232,7 +229,7 @@ void esp_mmu_map_init(void)
//Count the mem regions left after coalescing //Count the mem regions left after coalescing
uint32_t region_num = 0; uint32_t region_num = 0;
for (int i = 0; i < SOC_MMU_LINEAR_ADDRESS_REGION_NUM; i++) { for (int i = 0; i < SOC_MMU_LINEAR_ADDRESS_REGION_NUM; i++) {
if(hw_mem_regions[i].caps != MEM_REGION_MERGED) { if (hw_mem_regions[i].caps != MEM_REGION_MERGED) {
region_num++; region_num++;
} }
} }
@ -257,7 +254,6 @@ void esp_mmu_map_init(void)
assert(available_region_idx == region_num); assert(available_region_idx == region_num);
} }
static esp_err_t s_mem_caps_check(mmu_mem_caps_t caps) static esp_err_t s_mem_caps_check(mmu_mem_caps_t caps)
{ {
if (caps & MMU_MEM_CAP_EXEC) { if (caps & MMU_MEM_CAP_EXEC) {
@ -291,7 +287,6 @@ esp_err_t esp_mmu_map_get_max_consecutive_free_block_size(mmu_mem_caps_t caps, m
return ESP_OK; return ESP_OK;
} }
static int32_t s_find_available_region(mem_region_t *mem_regions, uint32_t region_nums, size_t size, mmu_mem_caps_t caps, mmu_target_t target) static int32_t s_find_available_region(mem_region_t *mem_regions, uint32_t region_nums, size_t size, mmu_mem_caps_t caps, mmu_target_t target)
{ {
int32_t found_region_id = -1; int32_t found_region_id = -1;
@ -372,7 +367,6 @@ IRAM_ATTR esp_err_t esp_mmu_paddr_find_caps(const esp_paddr_t paddr, mmu_mem_cap
return ESP_OK; return ESP_OK;
} }
static void IRAM_ATTR NOINLINE_ATTR s_do_cache_invalidate(uint32_t vaddr_start, uint32_t size) static void IRAM_ATTR NOINLINE_ATTR s_do_cache_invalidate(uint32_t vaddr_start, uint32_t size)
{ {
#if CONFIG_IDF_TARGET_ESP32 #if CONFIG_IDF_TARGET_ESP32
@ -387,7 +381,6 @@ static void IRAM_ATTR NOINLINE_ATTR s_do_cache_invalidate(uint32_t vaddr_start,
#endif // CONFIG_IDF_TARGET_ESP32 #endif // CONFIG_IDF_TARGET_ESP32
} }
#if MMU_LL_MMU_PER_TARGET #if MMU_LL_MMU_PER_TARGET
FORCE_INLINE_ATTR uint32_t s_mapping_operation(mmu_target_t target, uint32_t vaddr_start, esp_paddr_t paddr_start, uint32_t size) FORCE_INLINE_ATTR uint32_t s_mapping_operation(mmu_target_t target, uint32_t vaddr_start, esp_paddr_t paddr_start, uint32_t size)
{ {
@ -418,7 +411,6 @@ FORCE_INLINE_ATTR uint32_t s_mapping_operation(mmu_target_t target, uint32_t vad
} }
#endif #endif
static void IRAM_ATTR NOINLINE_ATTR s_do_mapping(mmu_target_t target, uint32_t vaddr_start, esp_paddr_t paddr_start, uint32_t size) static void IRAM_ATTR NOINLINE_ATTR s_do_mapping(mmu_target_t target, uint32_t vaddr_start, esp_paddr_t paddr_start, uint32_t size)
{ {
/** /**
@ -592,7 +584,6 @@ err:
return ret; return ret;
} }
#if MMU_LL_MMU_PER_TARGET #if MMU_LL_MMU_PER_TARGET
FORCE_INLINE_ATTR void s_unmapping_operation(uint32_t vaddr_start, uint32_t size) FORCE_INLINE_ATTR void s_unmapping_operation(uint32_t vaddr_start, uint32_t size)
{ {
@ -618,7 +609,6 @@ FORCE_INLINE_ATTR void s_unmapping_operation(uint32_t vaddr_start, uint32_t size
} }
#endif #endif
static void IRAM_ATTR NOINLINE_ATTR s_do_unmapping(uint32_t vaddr_start, uint32_t size) static void IRAM_ATTR NOINLINE_ATTR s_do_unmapping(uint32_t vaddr_start, uint32_t size)
{ {
/** /**
@ -680,7 +670,6 @@ esp_err_t esp_mmu_unmap(void *ptr)
return ESP_OK; return ESP_OK;
} }
esp_err_t esp_mmu_map_dump_mapped_blocks(FILE* stream) esp_err_t esp_mmu_map_dump_mapped_blocks(FILE* stream)
{ {
char line[100]; char line[100];
@ -725,7 +714,6 @@ esp_err_t esp_mmu_map_dump_mapped_blocks(FILE* stream)
return ESP_OK; return ESP_OK;
} }
/*--------------------------------------------------------------- /*---------------------------------------------------------------
Private dump functions, IRAM Safe Private dump functions, IRAM Safe
---------------------------------------------------------------*/ ---------------------------------------------------------------*/
@ -753,7 +741,6 @@ esp_err_t IRAM_ATTR esp_mmu_map_dump_mapped_blocks_private(void)
return ESP_OK; return ESP_OK;
} }
/*--------------------------------------------------------------- /*---------------------------------------------------------------
Helper APIs for conversion between vaddr and paddr Helper APIs for conversion between vaddr and paddr
---------------------------------------------------------------*/ ---------------------------------------------------------------*/
@ -785,7 +772,6 @@ esp_err_t esp_mmu_vaddr_to_paddr(void *vaddr, esp_paddr_t *out_paddr, mmu_target
return ESP_OK; return ESP_OK;
} }
static bool NOINLINE_ATTR IRAM_ATTR s_paddr_to_vaddr(esp_paddr_t paddr, mmu_target_t target, mmu_vaddr_t type, uint32_t *out_vaddr) static bool NOINLINE_ATTR IRAM_ATTR s_paddr_to_vaddr(esp_paddr_t paddr, mmu_target_t target, mmu_vaddr_t type, uint32_t *out_vaddr)
{ {
//we call this for now, but this will be refactored to move out of `spi_flash` //we call this for now, but this will be refactored to move out of `spi_flash`
@ -812,7 +798,6 @@ esp_err_t esp_mmu_paddr_to_vaddr(esp_paddr_t paddr, mmu_target_t target, mmu_vad
return ESP_OK; return ESP_OK;
} }
#if ENABLE_PADDR_CHECK #if ENABLE_PADDR_CHECK
/*--------------------------------------------------------------- /*---------------------------------------------------------------
Helper functions to check block Helper functions to check block
@ -875,7 +860,7 @@ static bool s_is_overlapped(uint32_t block_start, uint32_t block_end, uint32_t n
uint32_t new_block_end = new_block_start + new_block_size; uint32_t new_block_end = new_block_start + new_block_size;
if (((new_block_start < block_start) && (new_block_end > block_start)) || if (((new_block_start < block_start) && (new_block_end > block_start)) ||
((new_block_start < block_end) && (new_block_end > block_end))) { ((new_block_start < block_end) && (new_block_end > block_end))) {
is_overlapped = true; is_overlapped = true;
} else { } else {
is_overlapped = false; is_overlapped = false;

View File

@ -16,7 +16,6 @@
extern "C" { extern "C" {
#endif #endif
typedef struct { typedef struct {
uint32_t start; //laddr start uint32_t start; //laddr start
uint32_t end; //laddr end uint32_t end; //laddr end

View File

@ -66,7 +66,6 @@ components_not_formatted_temporary:
- "/components/esp_https_server/" - "/components/esp_https_server/"
- "/components/esp_hw_support/" - "/components/esp_hw_support/"
- "/components/esp_local_ctrl/" - "/components/esp_local_ctrl/"
- "/components/esp_mm/"
- "/components/esp_netif/" - "/components/esp_netif/"
- "/components/esp_partition/" - "/components/esp_partition/"
- "/components/esp_phy/" - "/components/esp_phy/"