28#if (HAL_USE_MMC_SPI == TRUE) || defined(__DOXYGEN__)
34#define MMC_CMD0_RETRY 10U
35#define MMC_CMD1_RETRY 100U
36#define MMC_ACMD41_RETRY 100U
37#define MMC_WAIT_DATA 10000U
44#define MMC_BUFFER_SIZE 16U
58#if !defined(MMC_IDLE_TIMEOUT_MS) || defined(__DOXYGEN__)
59#define MMC_IDLE_TIMEOUT_MS 1000
65#if !defined(MMC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
66#define MMC_USE_MUTUAL_EXCLUSION TRUE
74#if (HAL_USE_SPI == FALSE) || (SPI_USE_WAIT == FALSE)
75#error "MMC_SPI driver requires HAL_USE_SPI and SPI_USE_WAIT"
78#if (MMC_USE_MUTUAL_EXCLUSION == TRUE) && (SPI_USE_MUTUAL_EXCLUSION == FALSE)
79#error "MMC_USE_MUTUAL_EXCLUSION requires SPI_USE_MUTUAL_EXCLUSION"
113#define __mmc_driver_methods \
114 _mmcsd_block_device_methods
178#define mmcIsCardInserted(mmcp) mmc_lld_is_card_inserted(mmcp)
190#define mmcIsWriteProtected(mmcp) mmc_lld_is_write_protected(mmcp)
bool mmcStartSequentialWrite(MMCDriver *mmcp, uint32_t startblk)
Starts a sequential write.
bool mmcDisconnect(MMCDriver *mmcp)
Brings the driver in a state safe for card removal.
void mmcStop(MMCDriver *mmcp)
Disables the MMC peripheral.
bool mmcGetInfo(MMCDriver *mmcp, BlockDeviceInfo *bdip)
Returns the media info.
void mmcInit(void)
MMC over SPI driver initialization.
bool mmcStartSequentialRead(MMCDriver *mmcp, uint32_t startblk)
Starts a sequential read.
bool mmcSync(MMCDriver *mmcp)
Waits for card idle condition.
bool mmc_lld_is_card_inserted(MMCDriver *mmcp)
bool mmc_lld_is_write_protected(MMCDriver *mmcp)
#define __mmc_driver_methods
MMCDriver specific methods.
bool mmcSequentialRead(MMCDriver *mmcp, uint8_t *buffer)
Reads a block within a sequential read operation.
bool mmcSequentialWrite(MMCDriver *mmcp, const uint8_t *buffer)
Writes a block within a sequential write operation.
msg_t mmcStart(MMCDriver *mmcp, const MMCConfig *config)
Configures and activates the MMC peripheral.
void mmcObjectInit(MMCDriver *mmcp, uint8_t *buffer)
Initializes an instance.
bool mmcStopSequentialRead(MMCDriver *mmcp)
Stops a sequential read gracefully.
mmc_spi_config_t MMCConfig
Legacy name for compatibility.
mmc_spi_driver_t MMCDriver
Legacy name for compatibility.
bool mmcErase(MMCDriver *mmcp, uint32_t startblk, uint32_t endblk)
Erases blocks.
bool mmcStopSequentialWrite(MMCDriver *mmcp)
Stops a sequential write gracefully.
bool mmcConnect(MMCDriver *mmcp)
Performs the initialization procedure on the inserted card.
#define _mmcsd_block_device_data
MMCSDBlockDevice specific data.
int32_t msg_t
Type of a message.
struct hal_spi_config SPIConfig
Type of a SPI driver configuration structure.
struct hal_spi_driver SPIDriver
Type of a structure representing an SPI driver.
Type of a MMC/SD over SPI driver configuration structure.
const SPIConfig * lscfg
SPI low speed configuration used during initialization.
const SPIConfig * hscfg
SPI high speed configuration used during transfers.
SPIDriver * spip
SPI driver associated to this MMC driver.
Structure representing a MMC/SD over SPI driver.
uint8_t * buffer
Pointer to an un-cacheable buffer of size MMC_BUFFER_SIZE.
const struct mmc_spi_driver_vmt * vmt
Virtual Methods Table.
bool block_addresses
Addresses use blocks instead of bytes.
_mmcsd_block_device_data const mmc_spi_config_t * config
Current configuration data.
MMCDriver virtual methods table.