mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'ci/sdmmc_tests' into 'master'
sdmmc: test-related fixes Closes IDF-8734 See merge request espressif/esp-idf!30221
This commit is contained in:
commit
57a80129bc
@ -348,7 +348,8 @@ esp_err_t sdmmc_host_start_command(int slot, sdmmc_hw_cmd_t cmd, uint32_t arg)
|
||||
if (!(slot == 0 || slot == 1)) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
if (!sdmmc_ll_is_card_detected(s_host_ctx.hal.dev, slot)) {
|
||||
// if this isn't a clock update command, check the card detect status
|
||||
if (!sdmmc_ll_is_card_detected(s_host_ctx.hal.dev, slot) && !cmd.update_clk_reg) {
|
||||
return ESP_ERR_NOT_FOUND;
|
||||
}
|
||||
if (cmd.data_expected && cmd.rw && sdmmc_ll_is_card_write_protected(s_host_ctx.hal.dev, slot)) {
|
||||
|
@ -341,7 +341,7 @@ static const sdmmc_test_board_info_t s_board_info = {
|
||||
.d7 = GPIO_NUM_NC,
|
||||
.cd = GPIO_NUM_NC,
|
||||
.wp = GPIO_NUM_NC,
|
||||
.unused_pin = 2,
|
||||
.unused_pin = 54,
|
||||
}
|
||||
},
|
||||
};
|
||||
|
@ -12,8 +12,6 @@
|
||||
#include "sd_pwr_ctrl.h"
|
||||
#include "sd_pwr_ctrl_by_on_chip_ldo.h"
|
||||
|
||||
//TODO: IDF-8734
|
||||
#if !CONFIG_IDF_TARGET_ESP32 && !CONFIG_IDF_TARGET_ESP32S3
|
||||
TEST_CASE("CD input works in SD mode", "[sdmmc]")
|
||||
{
|
||||
sdmmc_host_t config = SDMMC_HOST_DEFAULT();
|
||||
@ -21,6 +19,17 @@ TEST_CASE("CD input works in SD mode", "[sdmmc]")
|
||||
sdmmc_test_board_get_config_sdmmc(SDMMC_HOST_SLOT_1, &config, &slot_config);
|
||||
const int test_gpio = sdmmc_test_board_get_slot_info(SDMMC_HOST_SLOT_1)->unused_pin;
|
||||
slot_config.gpio_cd = test_gpio;
|
||||
#if SOC_SDMMC_IO_POWER_EXTERNAL
|
||||
#define SDMMC_PWR_LDO_CHANNEL 4
|
||||
sd_pwr_ctrl_ldo_config_t ldo_config = {
|
||||
.ldo_chan_id = SDMMC_PWR_LDO_CHANNEL,
|
||||
};
|
||||
sd_pwr_ctrl_handle_t pwr_ctrl_handle = NULL;
|
||||
|
||||
TEST_ESP_OK(sd_pwr_ctrl_new_on_chip_ldo(&ldo_config, &pwr_ctrl_handle));
|
||||
config.pwr_ctrl_handle = pwr_ctrl_handle;
|
||||
#endif
|
||||
|
||||
sdmmc_test_board_card_power_set(true);
|
||||
TEST_ESP_OK(sdmmc_host_init());
|
||||
TEST_ESP_OK(sdmmc_host_init_slot(SDMMC_HOST_SLOT_1, &slot_config));
|
||||
@ -42,6 +51,17 @@ TEST_CASE("WP input works in SD mode", "[sdmmc]")
|
||||
sdmmc_test_board_get_config_sdmmc(SDMMC_HOST_SLOT_1, &config, &slot_config);
|
||||
const int test_gpio = sdmmc_test_board_get_slot_info(SDMMC_HOST_SLOT_1)->unused_pin;
|
||||
slot_config.gpio_wp = test_gpio;
|
||||
#if SOC_SDMMC_IO_POWER_EXTERNAL
|
||||
#define SDMMC_PWR_LDO_CHANNEL 4
|
||||
sd_pwr_ctrl_ldo_config_t ldo_config = {
|
||||
.ldo_chan_id = SDMMC_PWR_LDO_CHANNEL,
|
||||
};
|
||||
sd_pwr_ctrl_handle_t pwr_ctrl_handle = NULL;
|
||||
|
||||
TEST_ESP_OK(sd_pwr_ctrl_new_on_chip_ldo(&ldo_config, &pwr_ctrl_handle));
|
||||
config.pwr_ctrl_handle = pwr_ctrl_handle;
|
||||
#endif
|
||||
|
||||
TEST_ESP_OK(sdmmc_host_init());
|
||||
TEST_ESP_OK(sdmmc_host_init_slot(SDMMC_HOST_SLOT_1, &slot_config));
|
||||
|
||||
@ -53,4 +73,3 @@ TEST_CASE("WP input works in SD mode", "[sdmmc]")
|
||||
TEST_ESP_OK(sd_pwr_ctrl_del_on_chip_ldo(config.pwr_ctrl_handle));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
@ -13,11 +13,13 @@
|
||||
|
||||
void setUp(void)
|
||||
{
|
||||
printf("%s", ""); /* sneakily lazy-allocate the reent structure for this test task */
|
||||
unity_utils_record_free_mem();
|
||||
}
|
||||
|
||||
void tearDown(void)
|
||||
{
|
||||
esp_reent_cleanup();
|
||||
unity_utils_evaluate_leaks_direct(TEST_MEMORY_LEAK_THRESHOLD);
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,16 @@
|
||||
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
import pytest
|
||||
from pytest_embedded_idf import IdfDut
|
||||
|
||||
|
||||
@pytest.mark.esp32
|
||||
@pytest.mark.esp32s3
|
||||
@pytest.mark.esp32p4
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32p4'], reason='lack of runners, IDF-8970')
|
||||
@pytest.mark.sdcard
|
||||
def test_sdmmc(dut: IdfDut) -> None:
|
||||
dut.run_all_single_board_cases()
|
||||
# SDMMC driver can't be reinitialized if the test fails,
|
||||
# so we need to reset the board between tests to avoid failing
|
||||
# all the tests after the first one fails.
|
||||
dut.run_all_single_board_cases(reset=True)
|
||||
|
Loading…
Reference in New Issue
Block a user