Multimedia Card Interface (MMC/SD) Driver — Using MMC/SD cards with block drivers and filesystems


The MultiMedia Card Interface (MMC/SD) driver in this processor HAL package allows use of MultiMedia Cards (MMC cards) and Secure Digital (SD) flash storage cards within eCos, exported as block devices. This makes them suitable for use as the underlying devices for filesystems such as FAT.

The HPS architecture only has support for one SDMMC controller.


This driver provides the necessary support for the generic MMC bus layer within the CYGPKG_DEVS_DISK_MMC package to export a disk block device. The disk block device is only available if the generic disk I/O layer found in the package CYGPKG_IO_DISK is included in the configuration.

The block device may then be used as the device layer for a filesystem such as FAT. Example devices are "/dev/mmcsd0/1" to refer to the first partition on the card, or "/dev/mmcsd0/0" to address the whole device including potentially the partition table at the start.

The driver may be forcibly disabled within this processor HAL package with the configuration option CYGPKG_HAL_ARM_CORTEXA_ALTERA_HPS_MMC.

If the driver is enabled, the following options are available to control it:

This option specifies the number of descriptors in the DMA ringbuffer. This value can be tuned if needed to optimise performance vs the memory footprint.
This indicates that the driver should operate in interrupt-driven mode if possible. This is enabled by default if the eCos kernel is enabled. Note though that if the driver finds that global interrupts are off when running, then it will fall back to polled mode even if this option is enabled. This allows for use of the MMC/SD driver in an initialisation context.
This is the MMC/SD bus interrupt priority. It may range from 0 to 255.
When the CYGPKG_KERNEL_INSTRUMENTATION support is configured, this option allows control over whether SDMMC device driver instrumentation is generated. Sub-options are provided to control which event code instrumentation records are generated. Normally this option is only useful when developing/debugging the driver; but it can be used to monitor performance of the driver in a running system.

Usage Notes

The driver will detect the appropriate card sizes.

The MMC/SD bus layer will parse partition tables, although it can be configured to allow handling of cards with no partition table.

This driver implements multi-sector I/O operations. If you are using the FAT filesystem, see the generic MMC/SD driver documentation which describes how to exploit this feature when using FAT.


Any cards removed from a socket before an explicit unmounting or a sync() call to flush filesystem buffers will likely result in a corrupted filesystem on the removed card.