LPCOpen Platform for LPC18XX/43XX microcontrollers  18XX43XX
LPCOpen Platform for the NXP LPC18XX/43XX family of Microcontrollers
Data Structures | Macros | Functions
sdmmc_18xx_43xx.h File Reference
#include "sdmmc.h"

Go to the source code of this file.

Data Structures

struct  mci_card_struct
 

Macros

#define CMD_MASK_RESP   (0x3UL << 28)
 
#define CMD_RESP(r)   (((r) & 0x3) << 28)
 
#define CMD_RESP_R0   (0 << 28)
 
#define CMD_RESP_R1   (1 << 28)
 
#define CMD_RESP_R2   (2 << 28)
 
#define CMD_RESP_R3   (3 << 28)
 
#define CMD_BIT_AUTO_STOP   (1 << 24)
 
#define CMD_BIT_APP   (1 << 23)
 
#define CMD_BIT_INIT   (1 << 22)
 
#define CMD_BIT_BUSY   (1 << 21)
 
#define CMD_BIT_LS   (1 << 20) /* Low speed, used during acquire */
 
#define CMD_BIT_DATA   (1 << 19)
 
#define CMD_BIT_WRITE   (1 << 18)
 
#define CMD_BIT_STREAM   (1 << 17)
 
#define CMD_MASK_CMD   (0xff)
 
#define CMD_SHIFT_CMD   (0)
 
#define CMD(c, r)   ( ((c) & CMD_MASK_CMD) | CMD_RESP((r)) )
 
#define CMD_IDLE   CMD(MMC_GO_IDLE_STATE, 0) | CMD_BIT_LS | CMD_BIT_INIT
 
#define CMD_SD_OP_COND   CMD(SD_APP_OP_COND, 1) | CMD_BIT_LS | CMD_BIT_APP
 
#define CMD_SD_SEND_IF_COND   CMD(SD_CMD8, 1) | CMD_BIT_LS
 
#define CMD_MMC_OP_COND   CMD(MMC_SEND_OP_COND, 3) | CMD_BIT_LS | CMD_BIT_INIT
 
#define CMD_ALL_SEND_CID   CMD(MMC_ALL_SEND_CID, 2) | CMD_BIT_LS
 
#define CMD_MMC_SET_RCA   CMD(MMC_SET_RELATIVE_ADDR, 1) | CMD_BIT_LS
 
#define CMD_SD_SEND_RCA   CMD(SD_SEND_RELATIVE_ADDR, 1) | CMD_BIT_LS
 
#define CMD_SEND_CSD   CMD(MMC_SEND_CSD, 2) | CMD_BIT_LS
 
#define CMD_SEND_EXT_CSD   CMD(MMC_SEND_EXT_CSD, 1) | CMD_BIT_LS | CMD_BIT_DATA
 
#define CMD_DESELECT_CARD   CMD(MMC_SELECT_CARD, 0)
 
#define CMD_SELECT_CARD   CMD(MMC_SELECT_CARD, 1)
 
#define CMD_SET_BLOCKLEN   CMD(MMC_SET_BLOCKLEN, 1)
 
#define CMD_SEND_STATUS   CMD(MMC_SEND_STATUS, 1)
 
#define CMD_READ_SINGLE   CMD(MMC_READ_SINGLE_BLOCK, 1) | CMD_BIT_DATA
 
#define CMD_READ_MULTIPLE   CMD(MMC_READ_MULTIPLE_BLOCK, 1) | CMD_BIT_DATA | CMD_BIT_AUTO_STOP
 
#define CMD_SD_SET_WIDTH   CMD(SD_APP_SET_BUS_WIDTH, 1) | CMD_BIT_APP
 
#define CMD_STOP   CMD(MMC_STOP_TRANSMISSION, 1) | CMD_BIT_BUSY
 
#define CMD_WRITE_SINGLE   CMD(MMC_WRITE_BLOCK, 1) | CMD_BIT_DATA | CMD_BIT_WRITE
 
#define CMD_WRITE_MULTIPLE   CMD(MMC_WRITE_MULTIPLE_BLOCK, 1) | CMD_BIT_DATA | CMD_BIT_WRITE | CMD_BIT_AUTO_STOP
 

Functions

int32_t Chip_SDMMC_GetState (LPC_SDMMC_T *pSDMMC)
 Get card's current state (idle, transfer, program, etc.) More...
 
uint32_t Chip_SDMMC_Acquire (LPC_SDMMC_T *pSDMMC, mci_card_struct *pcardinfo)
 Function to enumerate the SD/MMC/SDHC/MMC+ cards. More...
 
uint64_t Chip_SDMMC_GetDeviceSize (LPC_SDMMC_T *pSDMMC)
 Get the device size of SD/MMC card (after enumeration) More...
 
int32_t Chip_SDMMC_GetDeviceBlocks (LPC_SDMMC_T *pSDMMC)
 Get the number of device blocks of SD/MMC card (after enumeration) Since Chip_SDMMC_GetDeviceSize is limited to 32 bits cards with greater than 2 GBytes of data will not be correct, in such cases users can use this function to get the size of the card in blocks. More...
 
int32_t Chip_SDMMC_ReadBlocks (LPC_SDMMC_T *pSDMMC, void *buffer, int32_t start_block, int32_t num_blocks)
 Performs the read of data from the SD/MMC card. More...
 
int32_t Chip_SDMMC_WriteBlocks (LPC_SDMMC_T *pSDMMC, void *buffer, int32_t start_block, int32_t num_blocks)
 Performs write of data to the SD/MMC card. More...