| LPCOpen Platform v1.03 LPCOpen Platform for NXP LPC Microcontrollers

- Main Page
- Modules
- Data Structures
- Files
- Related Pages

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations
lpc_sdmmc.h File Reference

Go to the source code of this file.

## 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.
#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.
#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
#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.
#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.
#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.
#define | CMDRESP_R6_CARD_STATUS(n)
#define | CMDRESP_R7_CHECK_PATTERN(n) (((uint32_t) n ) & 0xFF)
| R7 response definitions.
#define | CMDRESP_R7_VOLTAGE_ACCEPTED (((uint32_t) 1 ) << 8)
#define | CMD3_RCA(n) (((uint32_t) (n & 0xFFFF) ) << 16)
| CMD3 command definitions.
#define | CMD7_RCA(n) (((uint32_t) (n & 0xFFFF) ) << 16)
| CMD7 command definitions.
#define | CMD8_CHECKPATTERN(n) (((uint32_t) (n & 0xFF) ) << 0)
| CMD8 command definitions.
#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.
#define | CMD13_RCA(n) (((uint32_t) (n & 0xFFFF) ) << 16)
| CMD13 command definitions.
#define | CMD55_RCA(n) (((uint32_t) (n & 0xFFFF) ) << 16)
| APP_CMD command definitions.
#define | ACMD41_OCR(n) (((uint32_t) n) & 0xFFFFFF)
| ACMD41 command definitions.
#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.
#define | ACMD6_BUS_WIDTH_1 (0)
#define | ACMD6_BUS_WIDTH_4 (2)
#define | CARD_TYPE_SD (1 << 0)
| Card type defines.
#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.

## 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...