From b1d3d0ac744ecd72765f9cd102758dcb21c2a9ff Mon Sep 17 00:00:00 2001 From: Cao Sen Miao Date: Tue, 2 Feb 2021 16:46:55 +0800 Subject: [PATCH] suspend_test: delay more time for erase --- components/spi_flash/test/test_esp_flash.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/components/spi_flash/test/test_esp_flash.c b/components/spi_flash/test/test_esp_flash.c index 94810e3963..fef787ebbf 100644 --- a/components/spi_flash/test/test_esp_flash.c +++ b/components/spi_flash/test/test_esp_flash.c @@ -628,10 +628,12 @@ void esp_test_for_suspend(void) printf("aaaaa bbbbb zzzzz fffff qqqqq ccccc\n"); } +static volatile bool task_erase_end, task_suspend_end = false; void task_erase_large_region(void *arg) { esp_partition_t *part = (esp_partition_t *)arg; test_erase_large_region(part); + task_erase_end = true; vTaskDelete(NULL); } @@ -640,12 +642,7 @@ void task_request_suspend(void *arg) vTaskDelay(2); ESP_LOGI(TAG, "flash go into suspend"); esp_test_for_suspend(); - vTaskDelete(NULL); -} - -void task_delay(void *arg) -{ - esp_rom_delay_us(2000000); + task_suspend_end = true; vTaskDelete(NULL); } @@ -653,7 +650,9 @@ static void test_flash_suspend_resume(const esp_partition_t* part) { xTaskCreatePinnedToCore(task_request_suspend, "suspend", 2048, (void *)"test_for_suspend", UNITY_FREERTOS_PRIORITY + 3, NULL, 0); xTaskCreatePinnedToCore(task_erase_large_region, "test", 2048, (void *)part, UNITY_FREERTOS_PRIORITY + 2, NULL, 0); - xTaskCreatePinnedToCore(task_delay, "task_delay", 1024, (void *)"task_delay", UNITY_FREERTOS_PRIORITY + 1, NULL, 0); + while (!task_erase_end || !task_suspend_end) { + } + vTaskDelay(200); } FLASH_TEST_CASE("SPI flash suspend and resume test", test_flash_suspend_resume);