LPCOpen Platform for LPC112X microcontrollers  112X
LPCOpen Platform for the NXP LPC112X family of Microcontrollers
Data Structures | Macros | Typedefs | Enumerations
CHIP: Common SD/MMC definitions

Detailed Description

Data Structures

struct  SDMMC_CARD_T
 SD/MMC Card specific setup data structure. More...
 

Macros

#define SDC_OCR_20_21   (((uint32_t) 1) << 8)
 OCR Register definitions. More...
 
#define SDC_OCR_21_22   (((uint32_t) 1) << 9)
 
#define SDC_OCR_22_23   (((uint32_t) 1) << 10)
 
#define SDC_OCR_23_24   (((uint32_t) 1) << 11)
 
#define SDC_OCR_24_25   (((uint32_t) 1) << 12)
 
#define SDC_OCR_25_26   (((uint32_t) 1) << 13)
 
#define SDC_OCR_26_27   (((uint32_t) 1) << 14)
 
#define SDC_OCR_27_28   (((uint32_t) 1) << 15)
 
#define SDC_OCR_28_29   (((uint32_t) 1) << 16)
 
#define SDC_OCR_29_30   (((uint32_t) 1) << 17)
 
#define SDC_OCR_30_31   (((uint32_t) 1) << 18)
 
#define SDC_OCR_31_32   (((uint32_t) 1) << 19)
 
#define SDC_OCR_32_33   (((uint32_t) 1) << 20)
 
#define SDC_OCR_33_34   (((uint32_t) 1) << 21)
 
#define SDC_OCR_34_35   (((uint32_t) 1) << 22)
 
#define SDC_OCR_35_36   (((uint32_t) 1) << 23)
 
#define SDC_OCR_27_36   ((uint32_t) 0x00FF8000)
 
#define SDC_OCR_HC_CCS   (((uint32_t) 1) << 30)
 
#define SDC_OCR_IDLE   (((uint32_t) 1) << 31)
 
#define SDC_OCR_BUSY   (((uint32_t) 0) << 31)
 
#define MMC_GO_IDLE_STATE   0 /* bc */
 SD/MMC commands, arguments and responses Standard SD/MMC commands (3.1) type argument response. More...
 
#define MMC_SEND_OP_COND   1 /* bcr [31:0] OCR R3 */
 
#define MMC_ALL_SEND_CID   2 /* bcr R2 */
 
#define MMC_SET_RELATIVE_ADDR   3 /* ac [31:16] RCA R1 */
 
#define MMC_SET_DSR   4 /* bc [31:16] RCA */
 
#define MMC_SELECT_CARD   7 /* ac [31:16] RCA R1 */
 
#define MMC_SEND_EXT_CSD   8 /* bc R1 */
 
#define MMC_SEND_CSD   9 /* ac [31:16] RCA R2 */
 
#define MMC_SEND_CID   10 /* ac [31:16] RCA R2 */
 
#define MMC_STOP_TRANSMISSION   12 /* ac R1b */
 
#define MMC_SEND_STATUS   13 /* ac [31:16] RCA R1 */
 
#define MMC_GO_INACTIVE_STATE   15 /* ac [31:16] RCA */
 
#define MMC_SET_BLOCKLEN   16 /* ac [31:0] block len R1 */
 
#define MMC_READ_SINGLE_BLOCK   17 /* adtc [31:0] data addr R1 */
 
#define MMC_READ_MULTIPLE_BLOCK   18 /* adtc [31:0] data addr R1 */
 
#define MMC_WRITE_DAT_UNTIL_STOP   20 /* adtc [31:0] data addr R1 */
 
#define MMC_SET_BLOCK_COUNT   23 /* adtc [31:0] data addr R1 */
 
#define MMC_WRITE_BLOCK   24 /* adtc [31:0] data addr R1 */
 
#define MMC_WRITE_MULTIPLE_BLOCK   25 /* adtc R1 */
 
#define MMC_PROGRAM_CID   26 /* adtc R1 */
 
#define MMC_PROGRAM_CSD   27 /* adtc R1 */
 
#define MMC_SET_WRITE_PROT   28 /* ac [31:0] data addr R1b */
 
#define MMC_CLR_WRITE_PROT   29 /* ac [31:0] data addr R1b */
 
#define MMC_SEND_WRITE_PROT   30 /* adtc [31:0] wpdata addr R1 */
 
#define MMC_ERASE_GROUP_START   35 /* ac [31:0] data addr R1 */
 
#define MMC_ERASE_GROUP_END   36 /* ac [31:0] data addr R1 */
 
#define MMC_ERASE   37 /* ac R1b */
 
#define SD_ERASE_WR_BLK_START   32 /* ac [31:0] data addr R1 */
 
#define SD_ERASE_WR_BLK_END   33 /* ac [31:0] data addr R1 */
 
#define SD_ERASE   38 /* ac R1b */
 
#define MMC_FAST_IO   39 /* ac <Complex> R4 */
 
#define MMC_GO_IRQ_STATE   40 /* bcr R5 */
 
#define MMC_LOCK_UNLOCK   42 /* adtc R1b */
 
#define MMC_APP_CMD   55 /* ac [31:16] RCA R1 */
 
#define MMC_GEN_CMD   56 /* adtc [0] RD/WR R1b */
 
#define SD_SEND_RELATIVE_ADDR   3 /* ac R6 */
 
#define SD_CMD8   8 /* bcr [31:0] OCR R3 */
 
#define SD_APP_SET_BUS_WIDTH   6 /* ac [1:0] bus width R1 */
 
#define SD_APP_OP_COND   41 /* bcr [31:0] OCR R1 (R4) */
 
#define SD_APP_SEND_SCR   51 /* adtc R1 */
 
#define R1_OUT_OF_RANGE   (1UL << 31) /* er, c */
 MMC status in R1
Type
e : error bit
s : status bit
r : detected and set for the actual command response
x : detected and set during command execution. the host must poll the card by sending status command in order to read these bits. Clear condition
a : according to the card state
b : always related to the previous command. Reception of a valid command will clear it (with a delay of one command)
c : clear by read
More...
 
#define R1_ADDRESS_ERROR   (1 << 30) /* erx, c */
 
#define R1_BLOCK_LEN_ERROR   (1 << 29) /* er, c */
 
#define R1_ERASE_SEQ_ERROR   (1 << 28) /* er, c */
 
#define R1_ERASE_PARAM   (1 << 27) /* ex, c */
 
#define R1_WP_VIOLATION   (1 << 26) /* erx, c */
 
#define R1_CARD_IS_LOCKED   (1 << 25) /* sx, a */
 
#define R1_LOCK_UNLOCK_FAILED   (1 << 24) /* erx, c */
 
#define R1_COM_CRC_ERROR   (1 << 23) /* er, b */
 
#define R1_ILLEGAL_COMMAND   (1 << 22) /* er, b */
 
#define R1_CARD_ECC_FAILED   (1 << 21) /* ex, c */
 
#define R1_CC_ERROR   (1 << 20) /* erx, c */
 
#define R1_ERROR   (1 << 19) /* erx, c */
 
#define R1_UNDERRUN   (1 << 18) /* ex, c */
 
#define R1_OVERRUN   (1 << 17) /* ex, c */
 
#define R1_CID_CSD_OVERWRITE   (1 << 16) /* erx, c, CID/CSD overwrite */
 
#define R1_WP_ERASE_SKIP   (1 << 15) /* sx, c */
 
#define R1_CARD_ECC_DISABLED   (1 << 14) /* sx, a */
 
#define R1_ERASE_RESET   (1 << 13) /* sr, c */
 
#define R1_STATUS(x)   (x & 0xFFFFE000)
 
#define R1_CURRENT_STATE(x)   ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */
 
#define R1_READY_FOR_DATA   (1 << 8) /* sx, a */
 
#define R1_APP_CMD   (1 << 5) /* sr, c */
 
#define OCR_ALL_READY   (1UL << 31) /* Card Power up status bit */
 SD/MMC card OCR register bits. More...
 
#define OCR_HC_CCS   (1 << 30) /* High capacity card */
 
#define OCR_VOLTAGE_RANGE_MSK   (0x00FF8000)
 
#define SD_SEND_IF_ARG   0x000001AA
 
#define SD_SEND_IF_ECHO_MSK   0x000000FF
 
#define SD_SEND_IF_RESP   0x000000AA
 
#define CMDRESP_R3_OCR_VAL(n)   (((uint32_t) n) & 0xFFFFFF)
 R3 response definitions. More...
 
#define CMDRESP_R3_S18A   (((uint32_t) 1 ) << 24)
 
#define CMDRESP_R3_HC_CCS   (((uint32_t) 1 ) << 30)
 
#define CMDRESP_R3_INIT_COMPLETE   (((uint32_t) 1 ) << 31)
 
#define CMDRESP_R6_RCA_VAL(n)   (((uint32_t) (n >> 16)) & 0xFFFF)
 R6 response definitions. More...
 
#define CMDRESP_R6_CARD_STATUS(n)
 
#define CMDRESP_R7_CHECK_PATTERN(n)   (((uint32_t) n ) & 0xFF)
 R7 response definitions. More...
 
#define CMDRESP_R7_VOLTAGE_ACCEPTED   (((uint32_t) 1 ) << 8)
 
#define CMD3_RCA(n)   (((uint32_t) (n & 0xFFFF) ) << 16)
 CMD3 command definitions. More...
 
#define CMD7_RCA(n)   (((uint32_t) (n & 0xFFFF) ) << 16)
 CMD7 command definitions. More...
 
#define CMD8_CHECKPATTERN(n)   (((uint32_t) (n & 0xFF) ) << 0)
 CMD8 command definitions. More...
 
#define CMD8_DEF_PATTERN   (0xAA)
 
#define CMD8_VOLTAGESUPPLIED_27_36   (((uint32_t) 1 ) << 8)
 
#define CMD9_RCA(n)   (((uint32_t) (n & 0xFFFF) ) << 16)
 CMD9 command definitions. More...
 
#define CMD13_RCA(n)   (((uint32_t) (n & 0xFFFF) ) << 16)
 CMD13 command definitions. More...
 
#define CMD55_RCA(n)   (((uint32_t) (n & 0xFFFF) ) << 16)
 APP_CMD command definitions. More...
 
#define ACMD41_OCR(n)   (((uint32_t) n) & 0xFFFFFF)
 ACMD41 command definitions. More...
 
#define ACMD41_S18R   (((uint32_t) 1 ) << 24)
 
#define ACMD41_XPC   (((uint32_t) 1 ) << 28)
 
#define ACMD41_HCS   (((uint32_t) 1 ) << 30)
 
#define ACMD6_BUS_WIDTH(n)   ((uint32_t) n & 0x03)
 ACMD6 command definitions. More...
 
#define ACMD6_BUS_WIDTH_1   (0)
 
#define ACMD6_BUS_WIDTH_4   (2)
 
#define CARD_TYPE_SD   (1 << 0)
 Card type defines. More...
 
#define CARD_TYPE_4BIT   (1 << 1)
 
#define CARD_TYPE_8BIT   (1 << 2)
 
#define CARD_TYPE_HC   (OCR_HC_CCS)
 
#define MMC_SECTOR_SIZE   512
 SD/MMC sector size in bytes. More...
 
#define SD_MMC_ENUM_CLOCK   400000
 Typical enumeration clock rate. More...
 
#define MMC_MAX_CLOCK   20000000
 Max MMC clock rate. More...
 
#define MMC_LOW_BUS_MAX_CLOCK   26000000
 Type 0 MMC card max clock rate. More...
 
#define MMC_HIGH_BUS_MAX_CLOCK   52000000
 Type 1 MMC card max clock rate. More...
 
#define SD_MAX_CLOCK   25000000
 Max SD clock rate. More...
 

Typedefs

typedef void(* SDMMC_EVSETUP_FUNC_T )(void *)
 
typedef uint32_t(* SDMMC_EVWAIT_FUNC_T )(void)
 
typedef void(* SDMMC_MSDELAY_FUNC_T )(uint32_t)
 

Enumerations

enum  SD_APP_CMD_T {
  SD_SET_BUS_WIDTH, SD_SEND_STATUS, SD_SEND_WR_BLOCKS, SD_SET_ERASE_COUNT,
  SD_SENDOP_COND, SD_CLEAR_CARD_DET, SD_SEND_SCR, SD_INVALID_APP_CMD
}
 SD/MMC application specific commands for SD cards only - these must be preceded by the SDMMC CMD55 to work correctly. More...
 
enum  SDMMC_RESPONSE_T {
  SDMMC_RESPONSE_R1, SDMMC_RESPONSE_R1B, SDMMC_RESPONSE_R2, SDMMC_RESPONSE_R3,
  SDMMC_RESPONSE_R4, SDMMC_RESPONSE_R5, SDMMC_RESPONSE_R6, SDMMC_RESPONSE_NONE
}
 Possible SDMMC response types. More...
 
enum  SDMMC_STATE_T {
  SDMMC_IDLE_ST = 0, SDMMC_READY_ST, SDMMC_IDENT_ST, SDMMC_STBY_ST,
  SDMMC_TRAN_ST, SDMMC_DATA_ST, SDMMC_RCV_ST, SDMMC_PRG_ST,
  SDMMC_DIS_ST
}
 Possible SDMMC card state types. More...
 

Macro Definition Documentation

#define ACMD41_HCS   (((uint32_t) 1 ) << 30)

Definition at line 396 of file sdmmc.h.

#define ACMD41_OCR (   n)    (((uint32_t) n) & 0xFFFFFF)

ACMD41 command definitions.

Definition at line 393 of file sdmmc.h.

#define ACMD41_S18R   (((uint32_t) 1 ) << 24)

Definition at line 394 of file sdmmc.h.

#define ACMD41_XPC   (((uint32_t) 1 ) << 28)

Definition at line 395 of file sdmmc.h.

#define ACMD6_BUS_WIDTH (   n)    ((uint32_t) n & 0x03)

ACMD6 command definitions.

Definition at line 401 of file sdmmc.h.

#define ACMD6_BUS_WIDTH_1   (0)

Definition at line 402 of file sdmmc.h.

#define ACMD6_BUS_WIDTH_4   (2)

Definition at line 403 of file sdmmc.h.

#define CARD_TYPE_4BIT   (1 << 1)

Definition at line 408 of file sdmmc.h.

#define CARD_TYPE_8BIT   (1 << 2)

Definition at line 409 of file sdmmc.h.

#define CARD_TYPE_HC   (OCR_HC_CCS)

high capacity card > 2GB

Definition at line 410 of file sdmmc.h.

#define CARD_TYPE_SD   (1 << 0)

Card type defines.

Definition at line 407 of file sdmmc.h.

#define CMD13_RCA (   n)    (((uint32_t) (n & 0xFFFF) ) << 16)

CMD13 command definitions.

Definition at line 383 of file sdmmc.h.

#define CMD3_RCA (   n)    (((uint32_t) (n & 0xFFFF) ) << 16)

CMD3 command definitions.

Card Address

Definition at line 357 of file sdmmc.h.

#define CMD55_RCA (   n)    (((uint32_t) (n & 0xFFFF) ) << 16)

APP_CMD command definitions.

Definition at line 388 of file sdmmc.h.

#define CMD7_RCA (   n)    (((uint32_t) (n & 0xFFFF) ) << 16)

CMD7 command definitions.

Card Address

Definition at line 363 of file sdmmc.h.

#define CMD8_CHECKPATTERN (   n)    (((uint32_t) (n & 0xFF) ) << 0)

CMD8 command definitions.

Check pattern

Definition at line 369 of file sdmmc.h.

#define CMD8_DEF_PATTERN   (0xAA)

Recommended pattern

Definition at line 371 of file sdmmc.h.

#define CMD8_VOLTAGESUPPLIED_27_36   (((uint32_t) 1 ) << 8)

Voltage supplied.

Definition at line 373 of file sdmmc.h.

#define CMD9_RCA (   n)    (((uint32_t) (n & 0xFFFF) ) << 16)

CMD9 command definitions.

Definition at line 378 of file sdmmc.h.

#define CMDRESP_R3_HC_CCS   (((uint32_t) 1 ) << 30)

Definition at line 333 of file sdmmc.h.

#define CMDRESP_R3_INIT_COMPLETE   (((uint32_t) 1 ) << 31)

Definition at line 334 of file sdmmc.h.

#define CMDRESP_R3_OCR_VAL (   n)    (((uint32_t) n) & 0xFFFFFF)

R3 response definitions.

Definition at line 331 of file sdmmc.h.

#define CMDRESP_R3_S18A   (((uint32_t) 1 ) << 24)

Definition at line 332 of file sdmmc.h.

#define CMDRESP_R6_CARD_STATUS (   n)
Value:
(((uint32_t) (n & 0x1FFF)) | \
((n & (1 << 13)) ? (1 << 19) : 0) | \
((n & (1 << 14)) ? (1 << 22) : 0) | \
((n & (1 << 15)) ? (1 << 23) : 0))

Definition at line 340 of file sdmmc.h.

#define CMDRESP_R6_RCA_VAL (   n)    (((uint32_t) (n >> 16)) & 0xFFFF)

R6 response definitions.

Definition at line 339 of file sdmmc.h.

#define CMDRESP_R7_CHECK_PATTERN (   n)    (((uint32_t) n ) & 0xFF)

R7 response definitions.

Echo-back of check-pattern

Definition at line 349 of file sdmmc.h.

#define CMDRESP_R7_VOLTAGE_ACCEPTED   (((uint32_t) 1 ) << 8)

Voltage accepted

Definition at line 351 of file sdmmc.h.

#define MMC_ALL_SEND_CID   2 /* bcr R2 */

Definition at line 217 of file sdmmc.h.

#define MMC_APP_CMD   55 /* ac [31:16] RCA R1 */

Definition at line 264 of file sdmmc.h.

#define MMC_CLR_WRITE_PROT   29 /* ac [31:0] data addr R1b */

Definition at line 245 of file sdmmc.h.

#define MMC_ERASE   37 /* ac R1b */

Definition at line 251 of file sdmmc.h.

#define MMC_ERASE_GROUP_END   36 /* ac [31:0] data addr R1 */

Definition at line 250 of file sdmmc.h.

#define MMC_ERASE_GROUP_START   35 /* ac [31:0] data addr R1 */

Definition at line 249 of file sdmmc.h.

#define MMC_FAST_IO   39 /* ac <Complex> R4 */

Definition at line 257 of file sdmmc.h.

#define MMC_GEN_CMD   56 /* adtc [0] RD/WR R1b */

Definition at line 265 of file sdmmc.h.

#define MMC_GO_IDLE_STATE   0 /* bc */

SD/MMC commands, arguments and responses Standard SD/MMC commands (3.1) type argument response.

Definition at line 215 of file sdmmc.h.

#define MMC_GO_INACTIVE_STATE   15 /* ac [31:16] RCA */

Definition at line 226 of file sdmmc.h.

#define MMC_GO_IRQ_STATE   40 /* bcr R5 */

Definition at line 258 of file sdmmc.h.

#define MMC_HIGH_BUS_MAX_CLOCK   52000000

Type 1 MMC card max clock rate.

Definition at line 435 of file sdmmc.h.

#define MMC_LOCK_UNLOCK   42 /* adtc R1b */

Definition at line 261 of file sdmmc.h.

#define MMC_LOW_BUS_MAX_CLOCK   26000000

Type 0 MMC card max clock rate.

Definition at line 430 of file sdmmc.h.

#define MMC_MAX_CLOCK   20000000

Max MMC clock rate.

Definition at line 425 of file sdmmc.h.

#define MMC_PROGRAM_CID   26 /* adtc R1 */

Definition at line 240 of file sdmmc.h.

#define MMC_PROGRAM_CSD   27 /* adtc R1 */

Definition at line 241 of file sdmmc.h.

#define MMC_READ_MULTIPLE_BLOCK   18 /* adtc [31:0] data addr R1 */

Definition at line 231 of file sdmmc.h.

#define MMC_READ_SINGLE_BLOCK   17 /* adtc [31:0] data addr R1 */

Definition at line 230 of file sdmmc.h.

#define MMC_SECTOR_SIZE   512

SD/MMC sector size in bytes.

Definition at line 415 of file sdmmc.h.

#define MMC_SELECT_CARD   7 /* ac [31:16] RCA R1 */

Definition at line 220 of file sdmmc.h.

#define MMC_SEND_CID   10 /* ac [31:16] RCA R2 */

Definition at line 223 of file sdmmc.h.

#define MMC_SEND_CSD   9 /* ac [31:16] RCA R2 */

Definition at line 222 of file sdmmc.h.

#define MMC_SEND_EXT_CSD   8 /* bc R1 */

Definition at line 221 of file sdmmc.h.

#define MMC_SEND_OP_COND   1 /* bcr [31:0] OCR R3 */

Definition at line 216 of file sdmmc.h.

#define MMC_SEND_STATUS   13 /* ac [31:16] RCA R1 */

Definition at line 225 of file sdmmc.h.

#define MMC_SEND_WRITE_PROT   30 /* adtc [31:0] wpdata addr R1 */

Definition at line 246 of file sdmmc.h.

#define MMC_SET_BLOCK_COUNT   23 /* adtc [31:0] data addr R1 */

Definition at line 237 of file sdmmc.h.

#define MMC_SET_BLOCKLEN   16 /* ac [31:0] block len R1 */

Definition at line 229 of file sdmmc.h.

#define MMC_SET_DSR   4 /* bc [31:16] RCA */

Definition at line 219 of file sdmmc.h.

#define MMC_SET_RELATIVE_ADDR   3 /* ac [31:16] RCA R1 */

Definition at line 218 of file sdmmc.h.

#define MMC_SET_WRITE_PROT   28 /* ac [31:0] data addr R1b */

Definition at line 244 of file sdmmc.h.

#define MMC_STOP_TRANSMISSION   12 /* ac R1b */

Definition at line 224 of file sdmmc.h.

#define MMC_WRITE_BLOCK   24 /* adtc [31:0] data addr R1 */

Definition at line 238 of file sdmmc.h.

#define MMC_WRITE_DAT_UNTIL_STOP   20 /* adtc [31:0] data addr R1 */

Definition at line 234 of file sdmmc.h.

#define MMC_WRITE_MULTIPLE_BLOCK   25 /* adtc R1 */

Definition at line 239 of file sdmmc.h.

#define OCR_ALL_READY   (1UL << 31) /* Card Power up status bit */

SD/MMC card OCR register bits.

Definition at line 320 of file sdmmc.h.

#define OCR_HC_CCS   (1 << 30) /* High capacity card */

Definition at line 321 of file sdmmc.h.

#define OCR_VOLTAGE_RANGE_MSK   (0x00FF8000)

Definition at line 322 of file sdmmc.h.

#define R1_ADDRESS_ERROR   (1 << 30) /* erx, c */

Definition at line 294 of file sdmmc.h.

#define R1_APP_CMD   (1 << 5) /* sr, c */

Definition at line 315 of file sdmmc.h.

#define R1_BLOCK_LEN_ERROR   (1 << 29) /* er, c */

Definition at line 295 of file sdmmc.h.

#define R1_CARD_ECC_DISABLED   (1 << 14) /* sx, a */

Definition at line 310 of file sdmmc.h.

#define R1_CARD_ECC_FAILED   (1 << 21) /* ex, c */

Definition at line 303 of file sdmmc.h.

#define R1_CARD_IS_LOCKED   (1 << 25) /* sx, a */

Definition at line 299 of file sdmmc.h.

#define R1_CC_ERROR   (1 << 20) /* erx, c */

Definition at line 304 of file sdmmc.h.

#define R1_CID_CSD_OVERWRITE   (1 << 16) /* erx, c, CID/CSD overwrite */

Definition at line 308 of file sdmmc.h.

#define R1_COM_CRC_ERROR   (1 << 23) /* er, b */

Definition at line 301 of file sdmmc.h.

#define R1_CURRENT_STATE (   x)    ((x & 0x00001E00) >> 9) /* sx, b (4 bits) */

Definition at line 313 of file sdmmc.h.

#define R1_ERASE_PARAM   (1 << 27) /* ex, c */

Definition at line 297 of file sdmmc.h.

#define R1_ERASE_RESET   (1 << 13) /* sr, c */

Definition at line 311 of file sdmmc.h.

#define R1_ERASE_SEQ_ERROR   (1 << 28) /* er, c */

Definition at line 296 of file sdmmc.h.

#define R1_ERROR   (1 << 19) /* erx, c */

Definition at line 305 of file sdmmc.h.

#define R1_ILLEGAL_COMMAND   (1 << 22) /* er, b */

Definition at line 302 of file sdmmc.h.

#define R1_LOCK_UNLOCK_FAILED   (1 << 24) /* erx, c */

Definition at line 300 of file sdmmc.h.

#define R1_OUT_OF_RANGE   (1UL << 31) /* er, c */

MMC status in R1
Type
e : error bit
s : status bit
r : detected and set for the actual command response
x : detected and set during command execution. the host must poll the card by sending status command in order to read these bits. Clear condition
a : according to the card state
b : always related to the previous command. Reception of a valid command will clear it (with a delay of one command)
c : clear by read

Definition at line 293 of file sdmmc.h.

#define R1_OVERRUN   (1 << 17) /* ex, c */

Definition at line 307 of file sdmmc.h.

#define R1_READY_FOR_DATA   (1 << 8) /* sx, a */

Definition at line 314 of file sdmmc.h.

#define R1_STATUS (   x)    (x & 0xFFFFE000)

Definition at line 312 of file sdmmc.h.

#define R1_UNDERRUN   (1 << 18) /* ex, c */

Definition at line 306 of file sdmmc.h.

#define R1_WP_ERASE_SKIP   (1 << 15) /* sx, c */

Definition at line 309 of file sdmmc.h.

#define R1_WP_VIOLATION   (1 << 26) /* erx, c */

Definition at line 298 of file sdmmc.h.

#define SD_APP_OP_COND   41 /* bcr [31:0] OCR R1 (R4) */

Definition at line 275 of file sdmmc.h.

#define SD_APP_SEND_SCR   51 /* adtc R1 */

Definition at line 276 of file sdmmc.h.

#define SD_APP_SET_BUS_WIDTH   6 /* ac [1:0] bus width R1 */

Definition at line 274 of file sdmmc.h.

#define SD_CMD8   8 /* bcr [31:0] OCR R3 */

Definition at line 271 of file sdmmc.h.

#define SD_ERASE   38 /* ac R1b */

Definition at line 254 of file sdmmc.h.

#define SD_ERASE_WR_BLK_END   33 /* ac [31:0] data addr R1 */

Definition at line 253 of file sdmmc.h.

#define SD_ERASE_WR_BLK_START   32 /* ac [31:0] data addr R1 */

Definition at line 252 of file sdmmc.h.

#define SD_MAX_CLOCK   25000000

Max SD clock rate.

Definition at line 440 of file sdmmc.h.

#define SD_MMC_ENUM_CLOCK   400000

Typical enumeration clock rate.

Definition at line 420 of file sdmmc.h.

#define SD_SEND_IF_ARG   0x000001AA

Definition at line 324 of file sdmmc.h.

#define SD_SEND_IF_ECHO_MSK   0x000000FF

Definition at line 325 of file sdmmc.h.

#define SD_SEND_IF_RESP   0x000000AA

Definition at line 326 of file sdmmc.h.

#define SD_SEND_RELATIVE_ADDR   3 /* ac R6 */

Definition at line 270 of file sdmmc.h.

#define SDC_OCR_20_21   (((uint32_t) 1) << 8)

OCR Register definitions.

Support voltage range 2.0-2.1 (this bit is reserved in SDC)

Definition at line 47 of file sdmmc.h.

#define SDC_OCR_21_22   (((uint32_t) 1) << 9)

Support voltage range 2.1-2.2 (this bit is reserved in SDC)

Definition at line 49 of file sdmmc.h.

#define SDC_OCR_22_23   (((uint32_t) 1) << 10)

Support voltage range 2.2-2.3 (this bit is reserved in SDC)

Definition at line 51 of file sdmmc.h.

#define SDC_OCR_23_24   (((uint32_t) 1) << 11)

Support voltage range 2.3-2.4 (this bit is reserved in SDC)

Definition at line 53 of file sdmmc.h.

#define SDC_OCR_24_25   (((uint32_t) 1) << 12)

Support voltage range 2.4-2.5 (this bit is reserved in SDC)

Definition at line 55 of file sdmmc.h.

#define SDC_OCR_25_26   (((uint32_t) 1) << 13)

Support voltage range 2.5-2.6 (this bit is reserved in SDC)

Definition at line 57 of file sdmmc.h.

#define SDC_OCR_26_27   (((uint32_t) 1) << 14)

Support voltage range 2.6-2.7 (this bit is reserved in SDC)

Definition at line 59 of file sdmmc.h.

#define SDC_OCR_27_28   (((uint32_t) 1) << 15)

Support voltage range 2.7-2.8

Definition at line 61 of file sdmmc.h.

#define SDC_OCR_27_36   ((uint32_t) 0x00FF8000)

Support voltage range 2.7-3.6

Definition at line 79 of file sdmmc.h.

#define SDC_OCR_28_29   (((uint32_t) 1) << 16)

Support voltage range 2.8-2.9

Definition at line 63 of file sdmmc.h.

#define SDC_OCR_29_30   (((uint32_t) 1) << 17)

Support voltage range 2.9-3.0

Definition at line 65 of file sdmmc.h.

#define SDC_OCR_30_31   (((uint32_t) 1) << 18)

Support voltage range 3.0-3.1

Definition at line 67 of file sdmmc.h.

#define SDC_OCR_31_32   (((uint32_t) 1) << 19)

Support voltage range 3.1-3.2

Definition at line 69 of file sdmmc.h.

#define SDC_OCR_32_33   (((uint32_t) 1) << 20)

Support voltage range 3.2-3.3

Definition at line 71 of file sdmmc.h.

#define SDC_OCR_33_34   (((uint32_t) 1) << 21)

Support voltage range 3.3-3.4

Definition at line 73 of file sdmmc.h.

#define SDC_OCR_34_35   (((uint32_t) 1) << 22)

Support voltage range 3.4-3.5

Definition at line 75 of file sdmmc.h.

#define SDC_OCR_35_36   (((uint32_t) 1) << 23)

Support voltage range 3.5-3.6

Definition at line 77 of file sdmmc.h.

#define SDC_OCR_BUSY   (((uint32_t) 0) << 31)

Definition at line 84 of file sdmmc.h.

#define SDC_OCR_HC_CCS   (((uint32_t) 1) << 30)

Card Capacity Status (CCS). (this bit is reserved in MMC)

Definition at line 81 of file sdmmc.h.

#define SDC_OCR_IDLE   (((uint32_t) 1) << 31)

Card power up status bit

Definition at line 83 of file sdmmc.h.

Typedef Documentation

typedef void(* SDMMC_EVSETUP_FUNC_T)(void *)

Definition at line 182 of file sdmmc.h.

typedef uint32_t(* SDMMC_EVWAIT_FUNC_T)(void)

Definition at line 185 of file sdmmc.h.

typedef void(* SDMMC_MSDELAY_FUNC_T)(uint32_t)

Definition at line 188 of file sdmmc.h.

Enumeration Type Documentation

SD/MMC application specific commands for SD cards only - these must be preceded by the SDMMC CMD55 to work correctly.

Enumerator
SD_SET_BUS_WIDTH 

Set the SD bus width

SD_SEND_STATUS 

Send the SD card status

SD_SEND_WR_BLOCKS 

Send the number of written clocks

SD_SET_ERASE_COUNT 

Set the number of blocks to pre-erase

SD_SENDOP_COND 

Send the OCR register (init)

SD_CLEAR_CARD_DET 

Set or clear the 50K detect pullup

SD_SEND_SCR 

Send the SD configuration register

SD_INVALID_APP_CMD 

Invalid SD application command

Definition at line 141 of file sdmmc.h.

Possible SDMMC response types.

Enumerator
SDMMC_RESPONSE_R1 

Typical status

SDMMC_RESPONSE_R1B 

Typical status with busy

SDMMC_RESPONSE_R2 

CID/CSD registers (CMD2 and CMD10)

SDMMC_RESPONSE_R3 

OCR register (CMD1, ACMD41)

SDMMC_RESPONSE_R4 

Fast IO response word

SDMMC_RESPONSE_R5 

Go IRQ state response word

SDMMC_RESPONSE_R6 

Published RCA response

SDMMC_RESPONSE_NONE 

No response expected

Definition at line 155 of file sdmmc.h.

Possible SDMMC card state types.

Enumerator
SDMMC_IDLE_ST 

Idle state

SDMMC_READY_ST 

Ready state

SDMMC_IDENT_ST 

Identification State

SDMMC_STBY_ST 

standby state

SDMMC_TRAN_ST 

transfer state

SDMMC_DATA_ST 

Sending-data State

SDMMC_RCV_ST 

Receive-data State

SDMMC_PRG_ST 

Programming State

SDMMC_DIS_ST 

Disconnect State

Definition at line 169 of file sdmmc.h.