mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
feat(sdspi): add LDO (power control) in sdspi tests
This commit is contained in:
parent
344439dfaa
commit
6b6de47308
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
* SPDX-FileCopyrightText: 2022-2024 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
@ -14,6 +14,8 @@
|
|||||||
#include "sd_protocol_defs.h"
|
#include "sd_protocol_defs.h"
|
||||||
#include "sdmmc_cmd.h"
|
#include "sdmmc_cmd.h"
|
||||||
#include "sdmmc_test_begin_end_spi.h"
|
#include "sdmmc_test_begin_end_spi.h"
|
||||||
|
#include "sd_pwr_ctrl.h"
|
||||||
|
#include "sd_pwr_ctrl_by_on_chip_ldo.h"
|
||||||
|
|
||||||
void sdmmc_test_spi_skip_if_board_incompatible(int slot, int freq_khz)
|
void sdmmc_test_spi_skip_if_board_incompatible(int slot, int freq_khz)
|
||||||
{
|
{
|
||||||
@ -59,6 +61,17 @@ void sdmmc_test_spi_begin(int slot, int freq_khz, sdmmc_card_t *out_card)
|
|||||||
|
|
||||||
config.max_freq_khz = freq_khz;
|
config.max_freq_khz = freq_khz;
|
||||||
|
|
||||||
|
#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);
|
sdmmc_test_board_card_power_set(true);
|
||||||
TEST_ESP_OK(spi_bus_initialize(dev_config.host_id, &bus_config, SPI_DMA_CH_AUTO));
|
TEST_ESP_OK(spi_bus_initialize(dev_config.host_id, &bus_config, SPI_DMA_CH_AUTO));
|
||||||
TEST_ESP_OK(sdspi_host_init());
|
TEST_ESP_OK(sdspi_host_init());
|
||||||
@ -91,4 +104,8 @@ void sdmmc_test_spi_end(int slot, sdmmc_card_t *card)
|
|||||||
esp_log_level_set("gpio", old_level);
|
esp_log_level_set("gpio", old_level);
|
||||||
|
|
||||||
sdmmc_test_board_card_power_set(false);
|
sdmmc_test_board_card_power_set(false);
|
||||||
|
|
||||||
|
#if SOC_SDMMC_IO_POWER_EXTERNAL
|
||||||
|
TEST_ESP_OK(sd_pwr_ctrl_del_on_chip_ldo(card->host.pwr_ctrl_handle));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user