The MCUXpresso SDK provides a driver to access the Secure Digital Card and Embedded MultiMedia Card based on the SDHC driver.
Function groups
This function group implements the SD card functional API.
This function group implements the MMC card functional API.
Typical use case
sdhcConfig->cardDetectDat3 = false;
sdhcConfig->readWatermarkLevel = 0x80U;
sdhcConfig->writeWatermarkLevel = 0x80U;
card->host.base = BOARD_SDHC_BASEADDR;
card->host.sourceClock_Hz = CLOCK_GetFreq(BOARD_SDHC_CLKSRC);
card->host.transfer = SDHC_TransferFunction;
{
PRINTF("\r\nSD card init failed.\r\n");
}
while (true)
{
if (kStatus_Success !=
SD_WriteBlocks(card, g_dataWrite, DATA_BLOCK_START, DATA_BLOCK_COUNT))
{
PRINTF("Write multiple data blocks failed.\r\n");
}
if (kStatus_Success !=
SD_ReadBlocks(card, g_dataRead, DATA_BLOCK_START, DATA_BLOCK_COUNT))
{
PRINTF("Read multiple data blocks failed.\r\n");
}
if (kStatus_Success !=
SD_EraseBlocks(card, DATA_BLOCK_START, DATA_BLOCK_COUNT))
{
PRINTF("Erase multiple data blocks failed.\r\n");
}
}
sdhcConfig->cardDetectDat3 = false;
sdhcConfig->readWatermarkLevel = 0x80U;
sdhcConfig->writeWatermarkLevel = 0x80U;
card->host.base = BOARD_SDHC_BASEADDR;
card->host.sourceClock_Hz = CLOCK_GetFreq(BOARD_SDHC_CLKSRC);
card->host.transfer = SDHC_TransferFunction;
{
PRINTF("\n MMC card init failed \n");
}
while (true)
{
if (kStatus_Success !=
MMC_WriteBlocks(card, g_dataWrite, DATA_BLOCK_START, DATA_BLOCK_COUNT))
{
PRINTF("Write multiple data blocks failed.\r\n");
}
if (kStatus_Success !=
MMC_ReadBlocks(card, g_dataRead, DATA_BLOCK_START, DATA_BLOCK_COUNT))
{
PRINTF("Read multiple data blocks failed.\r\n");
}
}
struct sdmmchost_detect_card_t |
struct sdmmchost_pwr_card_t |
Enumerator |
---|
kSDMMCHOST_EndianModeBig |
Big endian mode.
|
kSDMMCHOST_EndianModeHalfWordBig |
Half word big endian mode.
|
kSDMMCHOST_EndianModeLittle |
Little endian mode.
|
Enumerator |
---|
kSDMMCHOST_DetectCardByGpioCD |
sd card detect by CD pin through GPIO
|
kSDMMCHOST_DetectCardByHostCD |
sd card detect by CD pin through host
|
kSDMMCHOST_DetectCardByHostDATA3 |
sd card detect by DAT3 pin through host
|
static status_t SDMMCHOST_NotSupport |
( |
void * |
parameter | ) |
|
|
inlinestatic |
- Parameters
-
void | parameter ,used to avoid build warning |
- Return values
-
kStatus_Fail,host | do not suppport |
status_t SDMMCHOST_WaitCardDetectStatus |
( |
SDMMCHOST_TYPE * |
hostBase, |
|
|
const sdmmchost_detect_card_t * |
cd, |
|
|
bool |
waitCardStatus |
|
) |
| |
- Parameters
-
base | the pointer to host base address |
cd | card detect configuration |
waitCardStatus | status which user want to wait |
- Return values
-
kStatus_Success | detect card insert |
kStatus_Fail | card insert event fail |
bool SDMMCHOST_IsCardPresent |
( |
void |
| ) |
|
- Return values
-
true | card is present |
false | card is not present |
status_t SDMMCHOST_Init |
( |
SDMMCHOST_CONFIG * |
host, |
|
|
void * |
userData |
|
) |
| |
- Parameters
-
host | the pointer to host structure in card structure. |
userData | specific user data |
- Return values
-
kStatus_Success | host init success |
kStatus_Fail | event fail |
void SDMMCHOST_Reset |
( |
SDMMCHOST_TYPE * |
base | ) |
|
void SDMMCHOST_ErrorRecovery |
( |
SDMMCHOST_TYPE * |
base | ) |
|
void SDMMCHOST_Deinit |
( |
void * |
host | ) |
|
- Parameters
-
host | the pointer to host structure in card structure. |
- Parameters
-
base | host base address. |
pwr | depend on user define power configuration. |
- Parameters
-
base | host base address. |
pwr | depend on user define power configuration. |
void SDMMCHOST_Delay |
( |
uint32_t |
milliseconds | ) |
|
- Parameters
-
milliseconds | delay counter. |