Atmel Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SD/MMC Protocol Definition

Macros

#define SDMMC_CLOCK_INIT   400000
 

Macros for command definition

Commands types:

  • broadcast commands (bc), no response
  • broadcast commands with response (bcr) (Note: No open drain on SD card)
  • addressed (point-to-point) commands (ac), no data transfer on DAT lines
  • addressed (point-to-point) data transfer commands (adtc), data transfer on DAT lines

Specific MMC norms: CMD1, CMD2 & CMD3 are processed in the open-drain mode. The CMD line is driven with push-pull drivers.

Specific SD norms: There is no open drain mode in SD memory card.

Responses types:

R1, R3, R4 & R5 use a 48 bits response protected by a 7bit CRC checksum

  • R1 receiv data not specified
  • R3 receiv OCR
  • R4, R5 RCA management (MMC only)
  • R6, R7 RCA management (SD only)

R1b assert the BUSY signal and respond with R1. If the busy signal is asserted, it is done two clock cycles (Nsr time) after the end bit of the command. The DAT0 line is driven low. DAT1-DAT7 lines are driven by the card though their values are not relevant.

R2 use a 136 bits response protected by a 7bit CRC checksum The content is CID or CSD

Specific MMC norms:

  • R4 (Fast I/O) return RCA
  • R5 (interrupt request) return RCA null

Specific SD norms:

  • R6 (Published RCA) return RCA
  • R7 (Card interface condition) return RCA null
typedef uint32_t sdmmc_cmd_def_t
 Value to define a SD/MMC/SDIO command. More...
 

Flags used to define a SD/MMC/SDIO command

#define SDMMC_CMD_GET_INDEX(cmd)   (cmd & 0x3F)
 
#define SDMMC_RESP_PRESENT   (1lu << 8)
 Have response (MCI only) More...
 
#define SDMMC_RESP_8   (1lu << 9)
 8 bit response (SPI only) More...
 
#define SDMMC_RESP_32   (1lu << 10)
 32 bit response (SPI only) More...
 
#define SDMMC_RESP_136   (1lu << 11)
 136 bit response (MCI only) More...
 
#define SDMMC_RESP_CRC   (1lu << 12)
 Expect valid crc (MCI only) More...
 
#define SDMMC_RESP_BUSY   (1lu << 13)
 Card may send busy. More...
 
#define SDMMC_CMD_OPENDRAIN   (1lu << 14)
 
#define SDMMC_CMD_WRITE   (1lu << 15)
 To signal a data write operation. More...
 
#define SDMMC_CMD_SDIO_BYTE   (1lu << 16)
 To signal a SDIO tranfer in multi byte mode. More...
 
#define SDMMC_CMD_SDIO_BLOCK   (1lu << 17)
 To signal a SDIO tranfer in block mode. More...
 
#define SDMMC_CMD_STREAM   (1lu << 18)
 To signal a data transfer in stream mode. More...
 
#define SDMMC_CMD_SINGLE_BLOCK   (1lu << 19)
 To signal a data transfer in single block mode. More...
 
#define SDMMC_CMD_MULTI_BLOCK   (1lu << 20)
 To signal a data transfer in multi block mode. More...
 

Set of flags to define a reponse type

#define SDMMC_CMD_NO_RESP   (0)
 
#define SDMMC_CMD_R1   (SDMMC_RESP_PRESENT | SDMMC_RESP_CRC)
 
#define SDMMC_CMD_R1B   (SDMMC_RESP_PRESENT | SDMMC_RESP_CRC | SDMMC_RESP_BUSY)
 
#define SDMMC_CMD_R2   (SDMMC_RESP_PRESENT | SDMMC_RESP_8 | SDMMC_RESP_136 | SDMMC_RESP_CRC)
 
#define SDMMC_CMD_R3   (SDMMC_RESP_PRESENT | SDMMC_RESP_32)
 
#define SDMMC_CMD_R4   (SDMMC_RESP_PRESENT | SDMMC_RESP_32)
 
#define SDMMC_CMD_R5   (SDMMC_RESP_PRESENT | SDMMC_RESP_8 | SDMMC_RESP_CRC)
 
#define SDMMC_CMD_R6   (SDMMC_RESP_PRESENT | SDMMC_RESP_CRC)
 
#define SDMMC_CMD_R7   (SDMMC_RESP_PRESENT | SDMMC_RESP_32 | SDMMC_RESP_CRC)
 

SD/MMC/SDIO command definitions

SDMMC_CMDx are include in SD and MMC norms MMC_CMDx are include in MMC norms only SD_CMDx are include in SD norms only SDIO_CMDx are include in SDIO norms only

#define SDMMC_SPI_CMD0_GO_IDLE_STATE   (0 | SDMMC_CMD_R1)
 Cmd0(bc): Reset all cards to idle state. More...
 
#define SDMMC_MCI_CMD0_GO_IDLE_STATE   (0 | SDMMC_CMD_NO_RESP | SDMMC_CMD_OPENDRAIN)
 
#define MMC_SPI_CMD1_SEND_OP_COND   (1 | SDMMC_CMD_R1)
 MMC Cmd1(bcr, R3): Ask the card to send its Operating Conditions. More...
 
#define MMC_MCI_CMD1_SEND_OP_COND   (1 | SDMMC_CMD_R3 | SDMMC_CMD_OPENDRAIN)
 
#define SDMMC_CMD2_ALL_SEND_CID   (2 | SDMMC_CMD_R2 | SDMMC_CMD_OPENDRAIN)
 Cmd2(bcr, R2): Ask the card to send its CID number (stuff but arg 0 used) More...
 
#define SD_CMD3_SEND_RELATIVE_ADDR   (3 | SDMMC_CMD_R6 | SDMMC_CMD_OPENDRAIN)
 SD Cmd3(bcr, R6): Ask the card to publish a new relative address (RCA) More...
 
#define MMC_CMD3_SET_RELATIVE_ADDR   (3 | SDMMC_CMD_R1)
 MMC Cmd3(ac, R1): Assigns relative address to the card. More...
 
#define SDMMC_CMD4_SET_DSR   (4 | SDMMC_CMD_NO_RESP)
 Cmd4(bc): Program the DSR of all cards (MCI only) More...
 
#define MMC_CMD5_SLEEP_AWAKE   (5 | SDMMC_CMD_R1B)
 MMC Cmd5(ac, R1b): Toggle the card between Sleep state and Standby state. More...
 
#define SDMMC_CMD7_SELECT_CARD_CMD   (7 | SDMMC_CMD_R1B)
 Cmd7(ac, R1/R1b): Select/Deselect card For SD: R1b only from the selected card. More...
 
#define SDMMC_CMD7_DESELECT_CARD_CMD   (7 | SDMMC_CMD_R1)
 
#define MMC_CMD8_SEND_EXT_CSD   (8 | SDMMC_CMD_R1 | SDMMC_CMD_SINGLE_BLOCK)
 MMC Cmd8(adtc, R1): Send EXT_CSD register as a block of data. More...
 
#define SD_CMD8_SEND_IF_COND   (8 | SDMMC_CMD_R7 | SDMMC_CMD_OPENDRAIN)
 SD Cmd8(bcr, R7) : Send SD Memory Card interface condition. More...
 
#define SDMMC_SPI_CMD9_SEND_CSD   (9 | SDMMC_CMD_R1 | SDMMC_CMD_SINGLE_BLOCK)
 Cmd9 SPI (R1): Addressed card sends its card-specific data (CSD) More...
 
#define SDMMC_MCI_CMD9_SEND_CSD   (9 | SDMMC_CMD_R2)
 Cmd9 MCI (ac, R2): Addressed card sends its card-specific data (CSD) More...
 
#define SDMMC_CMD10_SEND_CID   (10 | SDMMC_CMD_R2)
 Cmd10(ac, R2): Addressed card sends its card identification (CID) More...
 
#define MMC_CMD11_READ_DAT_UNTIL_STOP   (11 | SDMMC_CMD_R1)
 MMC Cmd11(adtc, R1): Read data stream from the card, starting at the given address, until a STOP_TRANSMISSION follows. More...
 
#define SD_CMD11_READ_DAT_UNTIL_STOP   (11 | SDMMC_CMD_R1)
 
#define SDMMC_CMD12_STOP_TRANSMISSION   (12 | SDMMC_CMD_R1B)
 Cmd12(ac, R1b): Force the card to stop transmission. More...
 
#define SDMMC_SPI_CMD13_SEND_STATUS   (13 | SDMMC_CMD_R2)
 Cmd13(R2): Addressed card sends its status register. More...
 
#define SDMMC_MCI_CMD13_SEND_STATUS   (13 | SDMMC_CMD_R1)
 Cmd13(ac, R1): Addressed card sends its status register. More...
 
#define MMC_CMD14_BUSTEST_R   (14 | SDMMC_CMD_R1)
 MMC Cmd14(adtc, R1): Read the reversed bus testing data pattern from a card. More...
 
#define SDMMC_CMD15_GO_INACTIVE_STATE   (15 | SDMMC_CMD_NO_RESP | SDMMC_CMD_OPENDRAIN)
 Cmd15(ac): Send an addressed card into the Inactive State. More...
 
#define MMC_CMD19_BUSTEST_W   (19 | SDMMC_CMD_R1)
 MMC Cmd19(adtc, R1): Send the bus test data pattern. More...
 
#define SDMMC_SPI_CMD58_READ_OCR   (58 | SDMMC_CMD_R3)
 Cmd58(R3): Reads the OCR register of a card. More...
 
#define SDMMC_SPI_CMD59_CRC_ON_OFF   (59 | SDMMC_CMD_R1)
 Cmd59(R1): Turns the CRC option on or off. More...
 
#define SDMMC_CMD16_SET_BLOCKLEN   (16 | SDMMC_CMD_R1)
 Cmd16(ac, R1): Set the block length (in bytes) More...
 
#define SDMMC_CMD17_READ_SINGLE_BLOCK   (17 | SDMMC_CMD_R1 | SDMMC_CMD_SINGLE_BLOCK)
 Cmd17(adtc, R1): Read single block. More...
 
#define SDMMC_CMD18_READ_MULTIPLE_BLOCK   (18 | SDMMC_CMD_R1 | SDMMC_CMD_MULTI_BLOCK)
 Cmd18(adtc, R1): Read multiple block. More...
 
#define MMC_CMD20_WRITE_DAT_UNTIL_STOP   (20 | SDMMC_CMD_R1)
 MMC Cmd20(adtc, R1): Write a data stream from the host, starting at the given address, until a STOP_TRANSMISSION follows. More...
 
#define MMC_CMD23_SET_BLOCK_COUNT   (23 | SDMMC_CMD_R1)
 MMC Cmd23(ac, R1): Set block count. More...
 
#define SDMMC_CMD24_WRITE_BLOCK   (24 | SDMMC_CMD_R1 | SDMMC_CMD_WRITE | SDMMC_CMD_SINGLE_BLOCK)
 Cmd24(adtc, R1): Write block. More...
 
#define SDMMC_CMD25_WRITE_MULTIPLE_BLOCK   (25 | SDMMC_CMD_R1 | SDMMC_CMD_WRITE | SDMMC_CMD_MULTI_BLOCK)
 Cmd25(adtc, R1): Write multiple block. More...
 
#define MMC_CMD26_PROGRAM_CID   (26 | SDMMC_CMD_R1)
 MMC Cmd26(adtc, R1): Programming of the card identification register. More...
 
#define SDMMC_CMD27_PROGRAM_CSD   (27 | SDMMC_CMD_R1)
 Cmd27(adtc, R1): Programming of the programmable bits of the CSD. More...
 
#define SD_CMD32_ERASE_WR_BLK_START   (32 | SDMMC_CMD_R1)
 SD Cmd32(ac, R1): More...
 
#define SD_CMD33_ERASE_WR_BLK_END   (33 | SDMMC_CMD_R1)
 SD Cmd33(ac, R1): More...
 
#define MMC_CMD35_ERASE_GROUP_START   (35 | SDMMC_CMD_R1)
 MMC Cmd35(ac, R1): More...
 
#define MMC_CMD36_ERASE_GROUP_END   (36 | SDMMC_CMD_R1)
 MMC Cmd36(ac, R1): More...
 
#define SDMMC_CMD38_ERASE   (38 | SDMMC_CMD_R1B)
 Cmd38(ac, R1B): More...
 
#define SDMMC_CMD28_SET_WRITE_PROT   (28 | SDMMC_CMD_R1B)
 Cmd28(ac, R1b): Set write protection. More...
 
#define SDMMC_CMD29_CLR_WRITE_PROT   (29 | SDMMC_CMD_R1B)
 Cmd29(ac, R1b): Clr write protection. More...
 
#define SDMMC_CMD30_SEND_WRITE_PROT   (30 | SDMMC_CMD_R1)
 Cmd30(adtc, R1b): Send write protection. More...
 
#define SDMMC_CMD42_LOCK_UNLOCK   (42 | SDMMC_CMD_R1)
 Cmd42(adtc, R1): Used to set/reset the password or lock/unlock the card. More...
 
#define SDMMC_CMD55_APP_CMD   (55 | SDMMC_CMD_R1)
 Cmd55(ac, R1): Indicate to the card that the next command is an application specific command rather than a standard command. More...
 
#define SDMMC_CMD56_GEN_CMD   (56 | SDMMC_CMD_R1)
 Cmd 56(adtc, R1): Used either to transfer a data block to the card or to get a data block from the card for general purpose/application specific commands. More...
 
#define MMC_CMD6_SWITCH   (6 | SDMMC_CMD_R1B)
 MMC Cmd6(ac, R1b) : Switche the mode of operation of the selected card or modifies the EXT_CSD registers. More...
 
#define SD_CMD6_SWITCH_FUNC   (6 | SDMMC_CMD_R1 | SDMMC_CMD_SINGLE_BLOCK)
 SD Cmd6(adtc, R1) : Check switchable function (mode 0) and switch card function (mode 1). More...
 
#define SD_ACMD6_SET_BUS_WIDTH   (6 | SDMMC_CMD_R1)
 ACMD6(ac, R1): Define the data bus width. More...
 
#define SD_ACMD13_SD_STATUS   (13 | SDMMC_CMD_R1)
 ACMD13(adtc, R1): Send the SD Status. More...
 
#define SD_ACMD22_SEND_NUM_WR_BLOCKS   (22 | SDMMC_CMD_R1)
 ACMD22(adtc, R1): Send the number of the written (with-out errors) write blocks. More...
 
#define SD_ACMD23_SET_WR_BLK_ERASE_COUNT   (23 | SDMMC_CMD_R1)
 ACMD23(ac, R1): Set the number of write blocks to be pre-erased before writing. More...
 
#define SD_MCI_ACMD41_SD_SEND_OP_COND   (41 | SDMMC_CMD_R3 | SDMMC_CMD_OPENDRAIN)
 ACMD41(bcr, R3): Send host capacity support information (HCS) and asks the accessed card to send its operating condition register (OCR) content in the response. More...
 
#define SD_SPI_ACMD41_SD_SEND_OP_COND   (41 | SDMMC_CMD_R1)
 ACMD41(R1): Send host capacity support information (HCS) and activates the card's initilization process. More...
 
#define SD_ACMD42_SET_CLR_CARD_DETECT   (42 | SDMMC_CMD_R1)
 ACMD42(ac, R1): Connect[1]/Disconnect[0] the 50 KOhm pull-up resistor on CD/DAT3 (pin 1) of the card. More...
 
#define SD_ACMD51_SEND_SCR   (51 | SDMMC_CMD_R1 | SDMMC_CMD_SINGLE_BLOCK)
 ACMD51(adtc, R1): Read the SD Configuration Register (SCR). More...
 
#define MMC_CMD39_FAST_IO   (39 | SDMMC_CMD_R4)
 MMC Cmd39(ac, R4): Used to write and read 8 bit (register) data fields. More...
 
#define MMC_CMD40_GO_IRQ_STATE   (40 | SDMMC_CMD_R5 | SDMMC_CMD_OPENDRAIN)
 MMC Cmd40(bcr, R5): Set the system into interrupt mode. More...
 
#define SDIO_CMD5_SEND_OP_COND   (5 | SDMMC_CMD_R4 | SDMMC_CMD_OPENDRAIN)
 SDIO Cmd5(R4): Send operation condition. More...
 
#define SDIO_CMD52_IO_RW_DIRECT   (52 | SDMMC_CMD_R5)
 SDIO CMD52(R5): Direct IO read/write. More...
 
#define SDIO_CMD53_IO_R_BYTE_EXTENDED   (53 | SDMMC_CMD_R5 | SDMMC_CMD_SDIO_BYTE)
 SDIO CMD53(R5): Extended IO read/write. More...
 
#define SDIO_CMD53_IO_W_BYTE_EXTENDED   (53 | SDMMC_CMD_R5 | SDMMC_CMD_SDIO_BYTE | SDMMC_CMD_WRITE)
 
#define SDIO_CMD53_IO_R_BLOCK_EXTENDED   (53 | SDMMC_CMD_R5 | SDMMC_CMD_SDIO_BLOCK)
 
#define SDIO_CMD53_IO_W_BLOCK_EXTENDED   (53 | SDMMC_CMD_R5 | SDMMC_CMD_SDIO_BLOCK | SDMMC_CMD_WRITE)
 

#define MMC_CMD11_READ_DAT_UNTIL_STOP   (11 | SDMMC_CMD_R1)

MMC Cmd11(adtc, R1): Read data stream from the card, starting at the given address, until a STOP_TRANSMISSION follows.

#define MMC_CMD14_BUSTEST_R   (14 | SDMMC_CMD_R1)

MMC Cmd14(adtc, R1): Read the reversed bus testing data pattern from a card.

#define MMC_CMD19_BUSTEST_W   (19 | SDMMC_CMD_R1)

MMC Cmd19(adtc, R1): Send the bus test data pattern.

#define MMC_CMD20_WRITE_DAT_UNTIL_STOP   (20 | SDMMC_CMD_R1)

MMC Cmd20(adtc, R1): Write a data stream from the host, starting at the given address, until a STOP_TRANSMISSION follows.

#define MMC_CMD23_SET_BLOCK_COUNT   (23 | SDMMC_CMD_R1)

MMC Cmd23(ac, R1): Set block count.

#define MMC_CMD26_PROGRAM_CID   (26 | SDMMC_CMD_R1)

MMC Cmd26(adtc, R1): Programming of the card identification register.

#define MMC_CMD35_ERASE_GROUP_START   (35 | SDMMC_CMD_R1)

MMC Cmd35(ac, R1):

#define MMC_CMD36_ERASE_GROUP_END   (36 | SDMMC_CMD_R1)

MMC Cmd36(ac, R1):

#define MMC_CMD39_FAST_IO   (39 | SDMMC_CMD_R4)

MMC Cmd39(ac, R4): Used to write and read 8 bit (register) data fields.

#define MMC_CMD3_SET_RELATIVE_ADDR   (3 | SDMMC_CMD_R1)

MMC Cmd3(ac, R1): Assigns relative address to the card.

Referenced by sd_mmc_mci_install_mmc().

#define MMC_CMD40_GO_IRQ_STATE   (40 | SDMMC_CMD_R5 | SDMMC_CMD_OPENDRAIN)

MMC Cmd40(bcr, R5): Set the system into interrupt mode.

#define MMC_CMD5_SLEEP_AWAKE   (5 | SDMMC_CMD_R1B)

MMC Cmd5(ac, R1b): Toggle the card between Sleep state and Standby state.

#define MMC_CMD6_SWITCH   (6 | SDMMC_CMD_R1B)

MMC Cmd6(ac, R1b) : Switche the mode of operation of the selected card or modifies the EXT_CSD registers.

Referenced by mmc_cmd6_set_bus_width(), and mmc_cmd6_set_high_speed().

#define MMC_CMD8_SEND_EXT_CSD   (8 | SDMMC_CMD_R1 | SDMMC_CMD_SINGLE_BLOCK)

MMC Cmd8(adtc, R1): Send EXT_CSD register as a block of data.

Referenced by mmc_cmd8().

#define MMC_MCI_CMD1_SEND_OP_COND   (1 | SDMMC_CMD_R3 | SDMMC_CMD_OPENDRAIN)

Referenced by mmc_mci_op_cond().

#define MMC_SPI_CMD1_SEND_OP_COND   (1 | SDMMC_CMD_R1)

MMC Cmd1(bcr, R3): Ask the card to send its Operating Conditions.

Referenced by mmc_spi_op_cond().

#define SD_ACMD13_SD_STATUS   (13 | SDMMC_CMD_R1)

ACMD13(adtc, R1): Send the SD Status.

#define SD_ACMD22_SEND_NUM_WR_BLOCKS   (22 | SDMMC_CMD_R1)

ACMD22(adtc, R1): Send the number of the written (with-out errors) write blocks.

#define SD_ACMD23_SET_WR_BLK_ERASE_COUNT   (23 | SDMMC_CMD_R1)

ACMD23(ac, R1): Set the number of write blocks to be pre-erased before writing.

#define SD_ACMD42_SET_CLR_CARD_DETECT   (42 | SDMMC_CMD_R1)

ACMD42(ac, R1): Connect[1]/Disconnect[0] the 50 KOhm pull-up resistor on CD/DAT3 (pin 1) of the card.

#define SD_ACMD51_SEND_SCR   (51 | SDMMC_CMD_R1 | SDMMC_CMD_SINGLE_BLOCK)

ACMD51(adtc, R1): Read the SD Configuration Register (SCR).

Referenced by sd_acmd51().

#define SD_ACMD6_SET_BUS_WIDTH   (6 | SDMMC_CMD_R1)

ACMD6(ac, R1): Define the data bus width.

Referenced by sd_acmd6().

#define SD_CMD11_READ_DAT_UNTIL_STOP   (11 | SDMMC_CMD_R1)
#define SD_CMD32_ERASE_WR_BLK_START   (32 | SDMMC_CMD_R1)

SD Cmd32(ac, R1):

#define SD_CMD33_ERASE_WR_BLK_END   (33 | SDMMC_CMD_R1)

SD Cmd33(ac, R1):

#define SD_CMD3_SEND_RELATIVE_ADDR   (3 | SDMMC_CMD_R6 | SDMMC_CMD_OPENDRAIN)

SD Cmd3(bcr, R6): Ask the card to publish a new relative address (RCA)

Referenced by sd_mmc_mci_card_init().

#define SD_CMD6_SWITCH_FUNC   (6 | SDMMC_CMD_R1 | SDMMC_CMD_SINGLE_BLOCK)

SD Cmd6(adtc, R1) : Check switchable function (mode 0) and switch card function (mode 1).

Referenced by sd_cm6_set_high_speed().

#define SD_CMD8_SEND_IF_COND   (8 | SDMMC_CMD_R7 | SDMMC_CMD_OPENDRAIN)

SD Cmd8(bcr, R7) : Send SD Memory Card interface condition.

Referenced by sd_cmd8().

#define SD_MCI_ACMD41_SD_SEND_OP_COND   (41 | SDMMC_CMD_R3 | SDMMC_CMD_OPENDRAIN)

ACMD41(bcr, R3): Send host capacity support information (HCS) and asks the accessed card to send its operating condition register (OCR) content in the response.

Referenced by sd_mci_op_cond().

#define SD_SPI_ACMD41_SD_SEND_OP_COND   (41 | SDMMC_CMD_R1)

ACMD41(R1): Send host capacity support information (HCS) and activates the card's initilization process.

Referenced by sd_spi_op_cond().

#define SDIO_CMD52_IO_RW_DIRECT   (52 | SDMMC_CMD_R5)

SDIO CMD52(R5): Direct IO read/write.

#define SDIO_CMD53_IO_R_BLOCK_EXTENDED   (53 | SDMMC_CMD_R5 | SDMMC_CMD_SDIO_BLOCK)
#define SDIO_CMD53_IO_R_BYTE_EXTENDED   (53 | SDMMC_CMD_R5 | SDMMC_CMD_SDIO_BYTE)

SDIO CMD53(R5): Extended IO read/write.

#define SDIO_CMD53_IO_W_BLOCK_EXTENDED   (53 | SDMMC_CMD_R5 | SDMMC_CMD_SDIO_BLOCK | SDMMC_CMD_WRITE)
#define SDIO_CMD53_IO_W_BYTE_EXTENDED   (53 | SDMMC_CMD_R5 | SDMMC_CMD_SDIO_BYTE | SDMMC_CMD_WRITE)
#define SDIO_CMD5_SEND_OP_COND   (5 | SDMMC_CMD_R4 | SDMMC_CMD_OPENDRAIN)

SDIO Cmd5(R4): Send operation condition.

#define SDMMC_CLOCK_INIT   400000

Referenced by sd_mmc_select_slot().

#define SDMMC_CMD10_SEND_CID   (10 | SDMMC_CMD_R2)

Cmd10(ac, R2): Addressed card sends its card identification (CID)

#define SDMMC_CMD12_STOP_TRANSMISSION   (12 | SDMMC_CMD_R1B)

Cmd12(ac, R1b): Force the card to stop transmission.

Referenced by sd_mmc_wait_end_of_read_blocks(), and sd_mmc_wait_end_of_write_blocks().

#define SDMMC_CMD15_GO_INACTIVE_STATE   (15 | SDMMC_CMD_NO_RESP | SDMMC_CMD_OPENDRAIN)

Cmd15(ac): Send an addressed card into the Inactive State.

#define SDMMC_CMD16_SET_BLOCKLEN   (16 | SDMMC_CMD_R1)

Cmd16(ac, R1): Set the block length (in bytes)

Referenced by sd_mmc_mci_card_init(), sd_mmc_mci_install_mmc(), sd_mmc_spi_card_init(), and sd_mmc_spi_install_mmc().

#define SDMMC_CMD17_READ_SINGLE_BLOCK   (17 | SDMMC_CMD_R1 | SDMMC_CMD_SINGLE_BLOCK)

Cmd17(adtc, R1): Read single block.

Referenced by sd_mmc_init_read_blocks().

#define SDMMC_CMD18_READ_MULTIPLE_BLOCK   (18 | SDMMC_CMD_R1 | SDMMC_CMD_MULTI_BLOCK)

Cmd18(adtc, R1): Read multiple block.

Referenced by sd_mmc_init_read_blocks().

#define SDMMC_CMD24_WRITE_BLOCK   (24 | SDMMC_CMD_R1 | SDMMC_CMD_WRITE | SDMMC_CMD_SINGLE_BLOCK)

Cmd24(adtc, R1): Write block.

Referenced by sd_mmc_init_write_blocks().

#define SDMMC_CMD25_WRITE_MULTIPLE_BLOCK   (25 | SDMMC_CMD_R1 | SDMMC_CMD_WRITE | SDMMC_CMD_MULTI_BLOCK)

Cmd25(adtc, R1): Write multiple block.

Referenced by sd_mmc_init_write_blocks().

#define SDMMC_CMD27_PROGRAM_CSD   (27 | SDMMC_CMD_R1)

Cmd27(adtc, R1): Programming of the programmable bits of the CSD.

#define SDMMC_CMD28_SET_WRITE_PROT   (28 | SDMMC_CMD_R1B)

Cmd28(ac, R1b): Set write protection.

#define SDMMC_CMD29_CLR_WRITE_PROT   (29 | SDMMC_CMD_R1B)

Cmd29(ac, R1b): Clr write protection.

#define SDMMC_CMD2_ALL_SEND_CID   (2 | SDMMC_CMD_R2 | SDMMC_CMD_OPENDRAIN)

Cmd2(bcr, R2): Ask the card to send its CID number (stuff but arg 0 used)

Referenced by sd_mmc_mci_card_init(), and sd_mmc_mci_install_mmc().

#define SDMMC_CMD30_SEND_WRITE_PROT   (30 | SDMMC_CMD_R1)

Cmd30(adtc, R1b): Send write protection.

#define SDMMC_CMD38_ERASE   (38 | SDMMC_CMD_R1B)

Cmd38(ac, R1B):

#define SDMMC_CMD42_LOCK_UNLOCK   (42 | SDMMC_CMD_R1)

Cmd42(adtc, R1): Used to set/reset the password or lock/unlock the card.

#define SDMMC_CMD4_SET_DSR   (4 | SDMMC_CMD_NO_RESP)

Cmd4(bc): Program the DSR of all cards (MCI only)

#define SDMMC_CMD55_APP_CMD   (55 | SDMMC_CMD_R1)

Cmd55(ac, R1): Indicate to the card that the next command is an application specific command rather than a standard command.

Referenced by sd_acmd51(), sd_acmd6(), sd_mci_op_cond(), and sd_spi_op_cond().

#define SDMMC_CMD56_GEN_CMD   (56 | SDMMC_CMD_R1)

Cmd 56(adtc, R1): Used either to transfer a data block to the card or to get a data block from the card for general purpose/application specific commands.

#define SDMMC_CMD7_DESELECT_CARD_CMD   (7 | SDMMC_CMD_R1)
#define SDMMC_CMD7_SELECT_CARD_CMD   (7 | SDMMC_CMD_R1B)

Cmd7(ac, R1/R1b): Select/Deselect card For SD: R1b only from the selected card.

For MMC: R1 while selecting from Stand-By State to Transfer State; R1b while selecting from Disconnected State to Programming State.

Referenced by sd_mmc_mci_card_init(), and sd_mmc_mci_install_mmc().

#define SDMMC_CMD_GET_INDEX (   cmd)    (cmd & 0x3F)
#define SDMMC_CMD_MULTI_BLOCK   (1lu << 20)

To signal a data transfer in multi block mode.

#define SDMMC_CMD_NO_RESP   (0)
#define SDMMC_CMD_OPENDRAIN   (1lu << 14)
#define SDMMC_CMD_R1   (SDMMC_RESP_PRESENT | SDMMC_RESP_CRC)
#define SDMMC_CMD_R1B   (SDMMC_RESP_PRESENT | SDMMC_RESP_CRC | SDMMC_RESP_BUSY)
#define SDMMC_CMD_R2   (SDMMC_RESP_PRESENT | SDMMC_RESP_8 | SDMMC_RESP_136 | SDMMC_RESP_CRC)
#define SDMMC_CMD_R3   (SDMMC_RESP_PRESENT | SDMMC_RESP_32)
#define SDMMC_CMD_R4   (SDMMC_RESP_PRESENT | SDMMC_RESP_32)
#define SDMMC_CMD_R5   (SDMMC_RESP_PRESENT | SDMMC_RESP_8 | SDMMC_RESP_CRC)
#define SDMMC_CMD_R6   (SDMMC_RESP_PRESENT | SDMMC_RESP_CRC)
#define SDMMC_CMD_R7   (SDMMC_RESP_PRESENT | SDMMC_RESP_32 | SDMMC_RESP_CRC)
#define SDMMC_CMD_SDIO_BLOCK   (1lu << 17)

To signal a SDIO tranfer in block mode.

#define SDMMC_CMD_SDIO_BYTE   (1lu << 16)

To signal a SDIO tranfer in multi byte mode.

#define SDMMC_CMD_SINGLE_BLOCK   (1lu << 19)

To signal a data transfer in single block mode.

#define SDMMC_CMD_STREAM   (1lu << 18)

To signal a data transfer in stream mode.

#define SDMMC_CMD_WRITE   (1lu << 15)

To signal a data write operation.

#define SDMMC_MCI_CMD0_GO_IDLE_STATE   (0 | SDMMC_CMD_NO_RESP | SDMMC_CMD_OPENDRAIN)
#define SDMMC_MCI_CMD13_SEND_STATUS   (13 | SDMMC_CMD_R1)

Cmd13(ac, R1): Addressed card sends its status register.

Referenced by sd_mmc_cmd13().

#define SDMMC_MCI_CMD9_SEND_CSD   (9 | SDMMC_CMD_R2)

Cmd9 MCI (ac, R2): Addressed card sends its card-specific data (CSD)

Referenced by sd_mmc_cmd9_mci().

#define SDMMC_RESP_136   (1lu << 11)

136 bit response (MCI only)

#define SDMMC_RESP_32   (1lu << 10)

32 bit response (SPI only)

#define SDMMC_RESP_8   (1lu << 9)

8 bit response (SPI only)

#define SDMMC_RESP_BUSY   (1lu << 13)

Card may send busy.

#define SDMMC_RESP_CRC   (1lu << 12)

Expect valid crc (MCI only)

#define SDMMC_RESP_PRESENT   (1lu << 8)

Have response (MCI only)

#define SDMMC_SPI_CMD0_GO_IDLE_STATE   (0 | SDMMC_CMD_R1)

Cmd0(bc): Reset all cards to idle state.

Referenced by sd_mmc_spi_card_init(), and sd_mmc_spi_install_mmc().

#define SDMMC_SPI_CMD13_SEND_STATUS   (13 | SDMMC_CMD_R2)

Cmd13(R2): Addressed card sends its status register.

Referenced by sd_mmc_cmd13().

#define SDMMC_SPI_CMD58_READ_OCR   (58 | SDMMC_CMD_R3)

Cmd58(R3): Reads the OCR register of a card.

Referenced by mmc_spi_op_cond(), and sd_spi_op_cond().

#define SDMMC_SPI_CMD59_CRC_ON_OFF   (59 | SDMMC_CMD_R1)

Cmd59(R1): Turns the CRC option on or off.

Referenced by sd_mmc_spi_card_init(), and sd_mmc_spi_install_mmc().

#define SDMMC_SPI_CMD9_SEND_CSD   (9 | SDMMC_CMD_R1 | SDMMC_CMD_SINGLE_BLOCK)

Cmd9 SPI (R1): Addressed card sends its card-specific data (CSD)

Referenced by sd_mmc_cmd9_spi().

typedef uint32_t sdmmc_cmd_def_t

Value to define a SD/MMC/SDIO command.