mirror of
https://github.com/espressif/esp-idf.git
synced 2025-12-16 04:22:22 +00:00
ci: fix one ut issue when using Wrover-B module with newer ver of PSRAM
The workaround for PSRAM that will occupy an SPI bus is enabled only when: 1. used on 32MBit ver 0 PSRAM. 2. work at 80MHz. The test used to only check 32MBit by the config option, but for PSRAM on Wrover-B module seems to use a newer version of 32MBit PSRAM. So it expects the workaround to be enabled, but actually not. This commit split the unit test into two parts: 1. check all SPI buses are available, for all configs except psram_hspi and psram_vspi, run on regular runners (including Wrover and Wrover-B). a hidden option is enabled so that the compiler knows it's not building psram_hspi or psram_vspi. 2. check the specified bus are acquired, for config psram_hspi and psram_vspi. This only run on special runner (legacy Wrover module).
This commit is contained in:
committed by
bot
parent
363b573e60
commit
748b79e94a
@@ -36,37 +36,60 @@ static void test_psram_content(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
// NOTE: this unit test rely on the config that PSRAM of 8MB is used only when CONFIG_SPIRAM_BNKSWITCH_ENABLE is set
|
||||
TEST_CASE("can use spi when not being used by psram", "[psram_4m]")
|
||||
{
|
||||
spi_host_device_t host;
|
||||
#if !CONFIG_SPIRAM || !CONFIG_SPIRAM_SPEED_80M || CONFIG_SPIRAM_BANKSWITCH_ENABLE
|
||||
//currently all 8M psram don't need more SPI peripherals
|
||||
host = -1;
|
||||
#elif CONFIG_SPIRAM_OCCUPY_HSPI_HOST
|
||||
host = HSPI_HOST;
|
||||
#elif CONFIG_SPIRAM_OCCUPY_VSPI_HOST
|
||||
host = VSPI_HOST;
|
||||
#endif
|
||||
bool psram_is_32mbit_ver0(void);
|
||||
|
||||
static void test_spi_bus_occupy(spi_host_device_t expected_occupied_host)
|
||||
{
|
||||
bool claim_hspi = spicommon_periph_claim(HSPI_HOST, "ut-hspi");
|
||||
if (claim_hspi) ESP_LOGI(TAG, "HSPI claimed.");
|
||||
|
||||
bool claim_vspi = spicommon_periph_claim(VSPI_HOST, "ut-vspi");
|
||||
if (claim_vspi) ESP_LOGI(TAG, "VSPI claimed.");
|
||||
|
||||
if (host == HSPI_HOST) {
|
||||
TEST_ASSERT(claim_hspi==false);
|
||||
TEST_ASSERT(claim_vspi==true);
|
||||
} else if (host == VSPI_HOST) {
|
||||
TEST_ASSERT(claim_vspi==false);
|
||||
TEST_ASSERT(claim_hspi==true);
|
||||
if (expected_occupied_host == HSPI_HOST) {
|
||||
TEST_ASSERT_FALSE(claim_hspi);
|
||||
TEST_ASSERT(claim_vspi);
|
||||
} else if (expected_occupied_host == VSPI_HOST) {
|
||||
TEST_ASSERT_FALSE(claim_vspi);
|
||||
TEST_ASSERT(claim_hspi);
|
||||
} else {
|
||||
TEST_ASSERT(claim_hspi==true);
|
||||
TEST_ASSERT(claim_vspi==true);
|
||||
TEST_ASSERT(claim_hspi);
|
||||
TEST_ASSERT(claim_vspi);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SPIRAM
|
||||
test_psram_content();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if CONFIG_SPIRAM_OCCUPY_HSPI_HOST || CONFIG_SPIRAM_OCCUPY_VSPI_HOST
|
||||
TEST_CASE("some spi bus occpied by psram", "[psram_4m][test_env=UT_T1_PSRAMV0]")
|
||||
{
|
||||
// NOTE: this unit test rely on the config that PSRAM of 8MB is used only when CONFIG_SPIRAM_BNKSWITCH_ENABLE is set
|
||||
//currently all 8M psram don't need more SPI peripherals
|
||||
#if !CONFIG_SPIRAM || !CONFIG_SPIRAM_SPEED_80M || CONFIG_SPIRAM_BANKSWITCH_ENABLE
|
||||
#error unexpected test config, only psram 32MBit ver 0 at 80MHz will trigger the workaround
|
||||
#endif
|
||||
|
||||
spi_host_device_t host;
|
||||
if (!psram_is_32mbit_ver0()) {
|
||||
TEST_FAIL_MESSAGE("unexpected psram version");
|
||||
}
|
||||
|
||||
#if CONFIG_SPIRAM_OCCUPY_HSPI_HOST
|
||||
host = HSPI_HOST;
|
||||
#elif CONFIG_SPIRAM_OCCUPY_VSPI_HOST
|
||||
host = VSPI_HOST;
|
||||
#endif
|
||||
test_spi_bus_occupy(host);
|
||||
}
|
||||
#else
|
||||
TEST_CASE("can use spi when not being used by psram", "[psram_4m]")
|
||||
{
|
||||
#if CONFIG_SPIRAM && CONFIG_SPIRAM_SPEED_80M
|
||||
#error unexpected test config, some runners using the UT_T1_PSRAMV0 but still perform this test.\
|
||||
they will not pass this test at 80MHz.
|
||||
#endif
|
||||
test_spi_bus_occupy(-1);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user