You copied the Doc URL to your clipboard.

MMC component

This section describes the MMC component.

MMC - about

This LISA+ component is a model of a MultiMediaCard (MMC) device.

It can simulate an SD card compatible with the MultiMedia Card Association (MMCA, www.jedec.org) specification version 3.31, or an eMMC card compatible with version 4.4. You can extend functionality using the supplied source code.

When paired with a PL180_MCI component, the MMC device model provides emulation of a flexible, persistent storage mechanism. The MMC component uses a file on the host PC to simulate the storage device. The size of this backing store file determines the reported size of the MMC device. As small sections of this file are paged in by the model, large filesystems can be modeled while making efficient use of host PC memory. The backing store file can contain a partition table and filesystems such as FAT or EXT2. The image file is a direct bit copy of the contents of an SD card. If the image file that p_mmc_file refers to does not exist, the component behaves as if the card is absent. If the image file is read-only, then the component behaves as if the card is read-only. Note that operating-system boots often attempt to write to the boot filesystem. They might not work properly if the boot filesystem is on a read-only card.

The MMC component does not model card insertion or removal. It models having already been inserted at system instantiation time.

You can configure the MMC component to behave as an eMMC module by setting the card_type parameter to eMMC. In this mode, it handles the MMC_SLEEP_AWAKE, MMC_SWITCH, MMC_SEND_EXT_CSD, and MMC_SET_BLOCKLEN commands, which are otherwise illegal.

The component supports these commands:

  • MMC_GO_IDLE_STATE.
  • MMC_SEND_OP_COND.
  • MMC_ALL_SEND_CID.
  • MMC_SET_RELATIVE_ADDR.
  • MMC_SET_DSR.
  • MMC_SELDESL_CARD.
  • MMC_SEND_CSD.
  • MMC_SEND_CID.
  • MMC_STOP_TRANSMISSION.
  • MMC_SEND_STATUS.
  • MMC_GO_INACTIVE_STATE.
  • MMC_READ_SINGLE_BLOCK.
  • MMC_READ_MULTIPLE_BLOCK.
  • MMC_SET_BLOCK_COUNT.
  • MMC_WRITE_BLOCK.
  • MMC_WRITE_MULTIPLE_BLOCK.
  • MMC_SLEEP_AWAKE.
  • MMC_SWITCH.
  • MMC_SEND_EXT_CSD.
  • MMC_SET_BLOCKLEN.

In SD mode, the block length is 512 bytes. SimGen reports attempts to change it as errors.

The component supports these erase commands (Class 5), but they have no effect on the disk backing storage:

  • MMC_ERASE_GROUP_START.
  • MMC_ERASE_GROUP_END.
  • MMC_ERASE.

The component does not support these commands:

  • MMC_BUSTEST_R.
  • MMC_BUSTEST_W.

The component does not support stream read and write commands (Classes 1 and 3):

  • MMC_READ_DAT_UNTIL_STOP.
  • MMC_WRITE_DAT_UNTIL_STOP.
  • MMC_PROGRAM_CID.
  • MMC_PROGRAM_CSD.

The component does not support block oriented write protection commands (Class 6):

  • MMC_SET_WRITE_PROT.
  • MMC_CLR_WRITE_PROT.
  • MMC_SEND_WRITE_PROT.

The component does not support lock card commands (Class 7) or application-specific commands (Class 8):

  • MMC_LOCK_UNLOCK.
  • MMC_APP_CMD.
  • MMC_GEN_CMD.

The component does not support I/O mode commands (Class 9):

  • MMC_FAST_IO.
  • MMC_GO_IRQ_STATE.

The component does not support reserved commands. Using a reserved command sets the MMC ST_ER_B_ILLEGAL_COMMAND bit in the status register of the card. Read this with the MMC_SEND_STATUS command.

MMC - ports

This section describes the ports.

Table 4-100 MMC ports

Name Protocol Type Description
card_present StateSignal Master Used to signal whether an MMC image is loaded. It is set if an image is loaded, and is clear if no image is loaded.
clk_in ClockSignal Slave Master clock input.
mmc MMC_Protocol Slave The MMC slave port.

MMC - parameters

This section describes the parameters.

The parameters permit configuration of a number of attributes reflected in the CID and CSD registers. You can customize the component further by modifying the MMC model source code directly.

Table 4-101 MMC parameters

Name Type Allowed values Default value Description
card_type string 'SD', 'eMMC' 'SD' The card is eMMC (MMCA v4.4) or SD (v3.31).
force_sector_addressing bool true, false false Use sector addressing not byte addressing even if p_mmc_file is a file <2GB in size.
p_diagnostics int 0-4 0 Level of diagnostics printed to stdout on MMC accesses: 0 none, 4 many.
p_fast_access bool true, false true Complete MMC-card block reads and writes as fast as possible, or simulate a delay.
p_mmc_file string Valid filename 'mmc.dat' File for the MMC component backing store.
p_prodName string Six character string 'ARMmmc' Card ID product name.
p_prodRev int - 0x1 Card ID product revision.
p_manid int - 0x2a Card ID manufacturer ID.
p_OEMid int - 0x0000 Card ID OEM ID.
p_sernum int - 0xCA4D0001 Card serial number.

MMC - registers

This section describes the registers.

The registers are not memory mapped. Instead, you access them using relevant MMC commands. The MMC component model makes the registers available through a CADI interface. Modification of these registers through CADI is not recommended, but not prohibited. For example, modifying the card ID (CID) registers can be useful when experimenting with drivers, but direct modification of the STATUS_REG register is likely to put the card model into an indeterminate state.

For a full definition of MMC registers, see the MMCA System Summary documentation. Device-specific register information can also be obtained from MMC vendors.

Table 4-102 MMC registers

Name CADI register number Description
OCR_REG 0x000 Operating conditions register
CID_REG0 0x004 Card ID bits 127:96
CID_REG1 0x005 Card ID bits 95:64
CID_REG2 0x006 Card ID bits 63:32
CID_REG3 0x007 Card ID bits 31:0
CSD_REG0 0x008 Card specific data bits 127:96
CSD_REG1 0x009 Card specific data bits 95:64
CSD_REG2 0x00a Card specific data bits 63:32
CSD_REG3 0x00b Card specific data bit 31:0
RCA_REG 0x00c Relative card address register
DSR_REG 0x00d Driver stage register
BLOCKLEN_REG 0x00e Block length
STATUS_REG 0x00f Card status
BLOCK_COUNT_REG 0x010 Block count

MMC - debug features

This component provides a CADI interface for viewing internal registers.

Use the p_diagnostics parameter to select the level of diagnostic output, to help to debug device driver and controller-to-card protocol issues:

Level 0
None.
Level 1
Warnings about attempting to change read-only settings.
Level 2
Trace of command calls.
Level 3
Information about every step in the MMC_Protocol interaction.
Level 4
Hex dump of every block sent or received.

See the source code for details.

MMC - verification and testing

This component passes tests in conjunction with the ARM MMC reference model, and in the VE example with Boot Monitor and Linux drivers.

a

This is equivalent to ‘Sandisk’.

Was this page helpful? Yes No