driver: sdmmc: add esp32s3 support
* Extend sdmmc_slot_config_t with GPIO pin numbers for all SD bus signals. These new fields are available if SOC_SDMMC_USE_GPIO_MATRIX is set. * Add shorter "sd" and "wp" aliases for "gpio_sd" and "gpio_wp" field names in sdmmc_slot_config_t. * Deprecate sdmmc_host_pullup_en, prefer to enable this feature using SDMMC_SLOT_FLAG_INTERNAL_PULLUP instead.
This commit is contained in:
@@ -59,8 +59,26 @@ extern "C" {
|
||||
* Extra configuration for SDMMC peripheral slot
|
||||
*/
|
||||
typedef struct {
|
||||
gpio_num_t gpio_cd; ///< GPIO number of card detect signal
|
||||
gpio_num_t gpio_wp; ///< GPIO number of write protect signal
|
||||
#ifdef SOC_SDMMC_USE_GPIO_MATRIX
|
||||
gpio_num_t clk; ///< GPIO number of CLK signal.
|
||||
gpio_num_t cmd; ///< GPIO number of CMD signal.
|
||||
gpio_num_t d0; ///< GPIO number of D0 signal.
|
||||
gpio_num_t d1; ///< GPIO number of D1 signal.
|
||||
gpio_num_t d2; ///< GPIO number of D2 signal.
|
||||
gpio_num_t d3; ///< GPIO number of D3 signal.
|
||||
gpio_num_t d4; ///< GPIO number of D4 signal. Ignored in 1- or 4- line mode.
|
||||
gpio_num_t d5; ///< GPIO number of D5 signal. Ignored in 1- or 4- line mode.
|
||||
gpio_num_t d6; ///< GPIO number of D6 signal. Ignored in 1- or 4- line mode.
|
||||
gpio_num_t d7; ///< GPIO number of D7 signal. Ignored in 1- or 4- line mode.
|
||||
#endif // SOC_SDMMC_USE_GPIO_MATRIX
|
||||
union {
|
||||
gpio_num_t gpio_cd; ///< GPIO number of card detect signal
|
||||
gpio_num_t cd; ///< GPIO number of card detect signal; shorter name.
|
||||
};
|
||||
union {
|
||||
gpio_num_t gpio_wp; ///< GPIO number of write protect signal
|
||||
gpio_num_t wp; ///< GPIO number of write protect signal; shorter name.
|
||||
};
|
||||
uint8_t width; ///< Bus width used by the slot (might be less than the max width supported)
|
||||
uint32_t flags; ///< Features used by this slot
|
||||
#define SDMMC_SLOT_FLAG_INTERNAL_PULLUP BIT(0)
|
||||
@@ -72,18 +90,44 @@ typedef struct {
|
||||
|
||||
#define SDMMC_SLOT_NO_CD GPIO_NUM_NC ///< indicates that card detect line is not used
|
||||
#define SDMMC_SLOT_NO_WP GPIO_NUM_NC ///< indicates that write protect line is not used
|
||||
#define SDMMC_SLOT_WIDTH_DEFAULT 0 ///< use the default width for the slot (8 for slot 0, 4 for slot 1)
|
||||
#define SDMMC_SLOT_WIDTH_DEFAULT 0 ///< use the maximum possible width for the slot
|
||||
|
||||
#ifdef SOC_SDMMC_USE_GPIO_MATRIX
|
||||
|
||||
/**
|
||||
* Macro defining default configuration of SDMMC host slot
|
||||
*/
|
||||
#define SDMMC_SLOT_CONFIG_DEFAULT() {\
|
||||
.gpio_cd = SDMMC_SLOT_NO_CD, \
|
||||
.gpio_wp = SDMMC_SLOT_NO_WP, \
|
||||
.clk = GPIO_NUM_14, \
|
||||
.cmd = GPIO_NUM_15, \
|
||||
.d0 = GPIO_NUM_2, \
|
||||
.d1 = GPIO_NUM_4, \
|
||||
.d2 = GPIO_NUM_12, \
|
||||
.d3 = GPIO_NUM_13, \
|
||||
.d4 = GPIO_NUM_33, \
|
||||
.d5 = GPIO_NUM_34, \
|
||||
.d6 = GPIO_NUM_35, \
|
||||
.d7 = GPIO_NUM_36, \
|
||||
.cd = SDMMC_SLOT_NO_CD, \
|
||||
.wp = SDMMC_SLOT_NO_WP, \
|
||||
.width = SDMMC_SLOT_WIDTH_DEFAULT, \
|
||||
.flags = 0, \
|
||||
}
|
||||
|
||||
#else // SOC_SDMMC_USE_GPIO_MATRIX
|
||||
|
||||
/**
|
||||
* Macro defining default configuration of SDMMC host slot
|
||||
*/
|
||||
#define SDMMC_SLOT_CONFIG_DEFAULT() {\
|
||||
.cd = SDMMC_SLOT_NO_CD, \
|
||||
.wp = SDMMC_SLOT_NO_WP, \
|
||||
.width = SDMMC_SLOT_WIDTH_DEFAULT, \
|
||||
.flags = 0, \
|
||||
}
|
||||
|
||||
#endif // SOC_SDMMC_USE_GPIO_MATRIX
|
||||
|
||||
/**
|
||||
* @brief Initialize SDMMC host peripheral
|
||||
*
|
||||
@@ -226,6 +270,9 @@ esp_err_t sdmmc_host_deinit(void);
|
||||
/**
|
||||
* @brief Enable the pull-ups of sd pins.
|
||||
*
|
||||
* This function is deprecated. Please set SDMMC_SLOT_FLAG_INTERNAL_PULLUP flag in
|
||||
* sdmmc_slot_config_t::flags instead.
|
||||
*
|
||||
* @note You should always place actual pullups on the lines instead of using
|
||||
* this function. Internal pullup resistance are high and not sufficient, may
|
||||
* cause instability in products. This is for debug or examples only.
|
||||
@@ -238,7 +285,7 @@ esp_err_t sdmmc_host_deinit(void);
|
||||
* - ESP_ERR_INVALID_ARG: if configured width larger than maximum the slot can
|
||||
* support
|
||||
*/
|
||||
esp_err_t sdmmc_host_pullup_en(int slot, int width);
|
||||
esp_err_t sdmmc_host_pullup_en(int slot, int width) __attribute__((deprecated));
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user