From fc4b9d95079270c035b7fa0f745c14c41a28d374 Mon Sep 17 00:00:00 2001 From: Armando Date: Mon, 9 Oct 2023 15:28:11 +0800 Subject: [PATCH] refactor(esp_mm): reformat code with astyle_py 2 --- components/esp_mm/include/esp_mmu_map.h | 1 - .../include/esp_private/esp_cache_esp32_private.h | 1 - .../esp_mm/include/esp_private/esp_cache_private.h | 1 - .../esp_mm/include/esp_private/esp_mmu_map_private.h | 2 -- .../components/test_mm_utils/include/test_mm_utils.h | 1 - components/esp_mm/test_apps/mm/main/test_app_main.c | 1 - .../esp_mm/test_apps/mm/main/test_cache_msync.c | 4 ---- .../esp_mm/test_apps/mmap_hw/main/test_mmap_hw.c | 12 ++++-------- 8 files changed, 4 insertions(+), 19 deletions(-) diff --git a/components/esp_mm/include/esp_mmu_map.h b/components/esp_mm/include/esp_mmu_map.h index 355b0c9750..e4a42e483d 100644 --- a/components/esp_mm/include/esp_mmu_map.h +++ b/components/esp_mm/include/esp_mmu_map.h @@ -35,7 +35,6 @@ extern "C" { * - A Slot is the vaddr range between 2 blocks. */ - /** * MMAP flags */ diff --git a/components/esp_mm/include/esp_private/esp_cache_esp32_private.h b/components/esp_mm/include/esp_private/esp_cache_esp32_private.h index a8642daf5c..2180e64aa5 100644 --- a/components/esp_mm/include/esp_private/esp_cache_esp32_private.h +++ b/components/esp_mm/include/esp_private/esp_cache_esp32_private.h @@ -53,7 +53,6 @@ void cache_register_writeback(cache_driver_t *func); */ void cache_sync(void); - #ifdef __cplusplus } #endif diff --git a/components/esp_mm/include/esp_private/esp_cache_private.h b/components/esp_mm/include/esp_private/esp_cache_private.h index 7735d298b9..624e6dd087 100644 --- a/components/esp_mm/include/esp_private/esp_cache_private.h +++ b/components/esp_mm/include/esp_private/esp_cache_private.h @@ -58,7 +58,6 @@ esp_err_t esp_cache_aligned_malloc(size_t size, uint32_t flags, void **out_ptr, */ esp_err_t esp_cache_aligned_calloc(size_t n, size_t size, uint32_t flags, void **out_ptr, size_t *actual_size); - #ifdef __cplusplus } #endif diff --git a/components/esp_mm/include/esp_private/esp_mmu_map_private.h b/components/esp_mm/include/esp_private/esp_mmu_map_private.h index d51817542b..b66d6c390c 100644 --- a/components/esp_mm/include/esp_private/esp_mmu_map_private.h +++ b/components/esp_mm/include/esp_private/esp_mmu_map_private.h @@ -14,7 +14,6 @@ extern "C" { #endif - /** * Memory Mapping Private APIs for MMU supported memory */ @@ -52,7 +51,6 @@ esp_err_t esp_mmu_map_reserve_block_with_caps(size_t size, mmu_mem_caps_t caps, */ esp_err_t esp_mmu_map_dump_mapped_blocks_private(void); - #ifdef __cplusplus } #endif diff --git a/components/esp_mm/test_apps/components/test_mm_utils/include/test_mm_utils.h b/components/esp_mm/test_apps/components/test_mm_utils/include/test_mm_utils.h index ded087a326..1e6d2f8223 100644 --- a/components/esp_mm/test_apps/components/test_mm_utils/include/test_mm_utils.h +++ b/components/esp_mm/test_apps/components/test_mm_utils/include/test_mm_utils.h @@ -14,7 +14,6 @@ extern "C" { #endif - /** * Set addr space dirty * diff --git a/components/esp_mm/test_apps/mm/main/test_app_main.c b/components/esp_mm/test_apps/mm/main/test_app_main.c index 03bdfb96dc..1632fa3c8c 100644 --- a/components/esp_mm/test_apps/mm/main/test_app_main.c +++ b/components/esp_mm/test_apps/mm/main/test_app_main.c @@ -61,6 +61,5 @@ void app_main(void) printf("| |___/\\__/ / | | | | || | | | | | | |___/\\__/ / | |\r\n"); printf("\\____/\\____/\\_| \\_| |_/\\_| |_/ \\_/ \\____/\\____/ \\_/\r\n"); - unity_run_menu(); } diff --git a/components/esp_mm/test_apps/mm/main/test_cache_msync.c b/components/esp_mm/test_apps/mm/main/test_cache_msync.c index 21ad6e5f00..8b4c2200dd 100644 --- a/components/esp_mm/test_apps/mm/main/test_cache_msync.c +++ b/components/esp_mm/test_apps/mm/main/test_cache_msync.c @@ -30,7 +30,6 @@ const static char *TAG = "CACHE_TEST"; #define TEST_NUM 10 #define TEST_BUF {0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9} - #define TEST_OFFSET 0x100000 #if CONFIG_IDF_TARGET_ESP32S2 #define TEST_SYNC_START (SOC_DPORT_CACHE_ADDRESS_LOW + TEST_OFFSET) @@ -41,13 +40,11 @@ const static char *TAG = "CACHE_TEST"; #endif #define TEST_SYNC_SIZE 0x8000 - #define RECORD_TIME_PREPARE() uint32_t __t1, __t2 #define RECORD_TIME_START() do {__t1 = esp_cpu_get_cycle_count();} while(0) #define RECORD_TIME_END(p_time) do{__t2 = esp_cpu_get_cycle_count(); p_time = (__t2 - __t1);} while(0) #define GET_US_BY_CCOUNT(t) ((double)(t)/CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ) - static void s_test_with_msync_cb(void *arg) { (void)arg; @@ -156,7 +153,6 @@ TEST_CASE("test cache msync work with Flash operation when XIP from PSRAM", "[ca } #endif //#if CONFIG_SPIRAM_FETCH_INSTRUCTIONS && CONFIG_SPIRAM_RODATA - #if CONFIG_SPIRAM /*--------------------------------------------------------------- Test esp_cache_msync with PSRAM stack diff --git a/components/esp_mm/test_apps/mmap_hw/main/test_mmap_hw.c b/components/esp_mm/test_apps/mmap_hw/main/test_mmap_hw.c index e34a0c56d7..0df1c5b6d0 100644 --- a/components/esp_mm/test_apps/mmap_hw/main/test_mmap_hw.c +++ b/components/esp_mm/test_apps/mmap_hw/main/test_mmap_hw.c @@ -56,7 +56,6 @@ typedef struct test_block_info_ { static LIST_HEAD(test_block_list_head_, test_block_info_) test_block_head; - static void s_fill_random_data(uint8_t *buffer, size_t size, int random_seed) { srand(random_seed); @@ -72,7 +71,7 @@ static bool s_test_mmap_data_by_random(uint8_t *mblock_ptr, size_t size, int ran for (int i = 0; i < size; i++) { uint8_t test_data = rand() % 0xff; - if(test_data != test_ptr[i]) { + if (test_data != test_ptr[i]) { printf("i: %d\n", i); printf("test_data: %d\n", test_data); printf("test_ptr[%d]: %d\n", i, test_ptr[i]); @@ -102,12 +101,11 @@ TEST_CASE("test all readable vaddr can map to flash", "[mmu]") ESP_LOGV(TAG, "rand seed: %d, write flash addr: %p...", test_seed, (void *)part->address); TEST_ESP_OK(esp_flash_write(part->flash_chip, sector_buf, part->address, sizeof(sector_buf))); - esp_err_t ret = ESP_FAIL; int count = 0; LIST_INIT(&test_block_head); while (1) { - test_block_info_t *block_info = heap_caps_calloc(1, sizeof(test_block_info_t), MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT); + test_block_info_t *block_info = heap_caps_calloc(1, sizeof(test_block_info_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); TEST_ASSERT(block_info && "no mem"); void *ptr = NULL; @@ -144,7 +142,6 @@ TEST_CASE("test all readable vaddr can map to flash", "[mmu]") free(sector_buf); } - TEST_CASE("test all executable vaddr can map to flash", "[mmu]") { //Get the partition used for SPI1 erase operation @@ -157,7 +154,7 @@ TEST_CASE("test all executable vaddr can map to flash", "[mmu]") int count = 0; LIST_INIT(&test_block_head); while (1) { - test_block_info_t *block_info = heap_caps_calloc(1, sizeof(test_block_info_t), MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT); + test_block_info_t *block_info = heap_caps_calloc(1, sizeof(test_block_info_t), MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT); TEST_ASSERT(block_info && "no mem"); void *ptr = NULL; @@ -173,8 +170,7 @@ TEST_CASE("test all executable vaddr can map to flash", "[mmu]") TEST_ASSERT(paddr == part->address + i); ESP_LOGV(TAG, "paddr: %p, on %s", (void *)paddr, (mem_target) == MMU_TARGET_FLASH0 ? "Flash" : "PSRAM"); } - } - else if (ret == ESP_ERR_NOT_FOUND) { + } else if (ret == ESP_ERR_NOT_FOUND) { free(block_info); break; } else {