bsp_sdmmc.h
Generated from bsp_sdmmc.h in platform-idf. Edit the header’s doxygen comments to change this page.
ESP BSP: CrossPad.
Functions
Section titled “Functions”bsp_sdcard_mount
Section titled “bsp_sdcard_mount”esp_err_t bsp_sdcard_mount(void)Mount microSD card to virtual file system.
Returns
- ESP_OK on success
- ESP_ERR_INVALID_STATE if esp_vfs_fat_sdmmc_mount was already called
- ESP_ERR_NO_MEM if memory can not be allocated
- ESP_FAIL if partition can not be mounted
- other error codes from SDMMC or SPI drivers, SDMMC protocol, or FATFS drivers
Declared in bsp_sdmmc.h:104.
bsp_sdcard_mount_ex
Section titled “bsp_sdcard_mount_ex”esp_err_t bsp_sdcard_mount_ex(bool thorough)bsp_sdcard_mount(), with one more attempt when thorough
4-bit at 40 MHz; when thorough, 4-bit at 20 MHz on a fresh host after 50 ms; then 1-bit at 40 MHz. The boot mounts thoroughly; the hotplug probe shares the board’s worker with the pad LEDs and the power button, so it makes the two quick attempts only. The success line names the bus: “SD Card mounted successfully at /sdcard (4-bit, 40000 kHz)”.
Declared in bsp_sdmmc.h:115.
bsp_sdcard_get_bus
Section titled “bsp_sdcard_get_bus”void bsp_sdcard_get_bus(int *width, int *freq_khz)The bus width (1/4) and clock (kHz) the card came up on; 0 and 0 while no card is mounted. Values kept at the mount safe from any task, never touches the card.
Declared in bsp_sdmmc.h:122.
bsp_sdcard_unmount
Section titled “bsp_sdcard_unmount”esp_err_t bsp_sdcard_unmount(void)Unmount micorSD card from virtual file system.
Returns
- ESP_OK on success
- ESP_ERR_NOT_FOUND if the partition table does not contain FATFS partition with given label
- ESP_ERR_INVALID_STATE if esp_vfs_fat_spiflash_mount was already called
- ESP_ERR_NO_MEM if memory can not be allocated
- ESP_FAIL if partition can not be mounted
- other error codes from wear levelling library, SPI flash driver, or FATFS drivers
Declared in bsp_sdmmc.h:135.
bsp_sdcard_get_handle
Section titled “bsp_sdcard_get_handle”sdmmc_card_t * bsp_sdcard_get_handle(void)Get SD card handle.
Returns
SD card handle
Declared in bsp_sdmmc.h:142.
bsp_sdcard_raw_init
Section titled “bsp_sdcard_raw_init”esp_err_t bsp_sdcard_raw_init(sdmmc_card_t **out_card)Bring the card up without mounting a filesystem on it.
Same host and slot configuration as bsp_sdcard_mount(), including the 4-bit -> 1-bit retry, stopping after sdmmc_card_init(). For USB transfer mode, where the host owns the FAT volume and the firmware must only move sectors (see main/usb_transfer.cpp). Never call it beside bsp_sdcard_mount(): two owners of one card is what this exists to avoid.
Parameters
out_card— Receives the card handle on success
Returns
ESP_OK, ESP_ERR_NO_MEM, or an SDMMC driver/protocol error
Declared in bsp_sdmmc.h:157.
bsp_sdcard_get_sdmmc_host
Section titled “bsp_sdcard_get_sdmmc_host”void bsp_sdcard_get_sdmmc_host(const int slot, sdmmc_host_t *config)Get SD card MMC host config.
Parameters
slot— SD card slotconfig— Structure which will be filled
Declared in bsp_sdmmc.h:165.
bsp_sdcard_sdmmc_get_slot
Section titled “bsp_sdcard_sdmmc_get_slot”void bsp_sdcard_sdmmc_get_slot(const int slot, sdmmc_slot_config_t *config)Get SD card MMC slot config.
Parameters
slot— SD card slotconfig— Structure which will be filled
Declared in bsp_sdmmc.h:173.
bsp_sdcard_sdmmc_mount
Section titled “bsp_sdcard_sdmmc_mount”esp_err_t bsp_sdcard_sdmmc_mount(bsp_sdcard_cfg_t *cfg)Mount microSD card to virtual file system (MMC mode)
Parameters
cfg— SD card configuration
Returns
- ESP_OK on success
- ESP_ERR_INVALID_STATE if esp_vfs_fat_sdmmc_mount was already called
- ESP_ERR_NO_MEM if memory cannot be allocated
- ESP_FAIL if partition cannot be mounted
- other error codes from SDMMC or SPI drivers, SDMMC protocol, or FATFS drivers
Declared in bsp_sdmmc.h:187.
bsp_sdcard_cfg_t
Section titled “bsp_sdcard_cfg_t”BSP SD card configuration structure.
Declared in bsp_sdmmc.h:83.
Macros
Section titled “Macros”| Macro | Value | Description |
|---|---|---|
CONFIG_BSP_SPIFFS_MOUNT_POINT | "/spiffs" | |
CONFIG_BSP_SPIFFS_PARTITION_LABEL | "spiffs" | |
CONFIG_BSP_SPIFFS_MAX_FILES | 5 | |
BSP_BOARD_CROSSPAD_S3 | ||
BSP_SD_MOUNT_POINT | CONFIG_BSP_SD_MOUNT_POINT | |
BSP_SDSPI_HOST | (SPI2_HOST) |
Variables
Section titled “Variables”| Declaration | Description |
|---|---|
const esp_vfs_fat_sdmmc_mount_config_t * mount | |
sdmmc_host_t * host | |
const sdmmc_slot_config_t * sdmmc | |
const sdmmc_slot_config_t * sdmmc | |
const sdspi_device_config_t * sdspi | |
const sdspi_device_config_t * sdspi | |
union bsp_sdcard_cfg_t slot |