![]() |
MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
Data Structures | |
struct | sdcard_usr_param_t |
card user parameter, user can define the parameter according the board, card capability More... | |
struct | sd_card_t |
SD card state. More... | |
Enumerations | |
enum | _sd_card_flag { kSD_SupportHighCapacityFlag = (1U << 1U), kSD_Support4BitWidthFlag = (1U << 2U), kSD_SupportSdhcFlag = (1U << 3U), kSD_SupportSdxcFlag = (1U << 4U), kSD_SupportVoltage180v = (1U << 5U), kSD_SupportSetBlockCountCmd = (1U << 6U), kSD_SupportSpeedClassControlCmd = (1U << 7U) } |
SD card flags. More... | |
SDCARD Function | |
status_t | SD_Init (sd_card_t *card) |
Initializes the card on a specific host controller. More... | |
void | SD_Deinit (sd_card_t *card) |
Deinitializes the card. More... | |
status_t | SD_CardInit (sd_card_t *card) |
Initializes the card. More... | |
void | SD_CardDeinit (sd_card_t *card) |
Deinitializes the card. More... | |
status_t | SD_HostInit (sd_card_t *card) |
initialize the host. More... | |
void | SD_HostDeinit (sd_card_t *card) |
Deinitializes the host. More... | |
void | SD_HostReset (SDMMCHOST_CONFIG *host) |
reset the host. More... | |
void | SD_PowerOnCard (SDMMCHOST_TYPE *base, const sdmmchost_pwr_card_t *pwr) |
power on card. More... | |
void | SD_PowerOffCard (SDMMCHOST_TYPE *base, const sdmmchost_pwr_card_t *pwr) |
power on card. More... | |
status_t | SD_WaitCardDetectStatus (SDMMCHOST_TYPE *hostBase, const sdmmchost_detect_card_t *cd, bool waitCardStatus) |
sd wait card detect function. More... | |
bool | SD_IsCardPresent (sd_card_t *card) |
sd card present check function. More... | |
bool | SD_CheckReadOnly (sd_card_t *card) |
Checks whether the card is write-protected. More... | |
status_t | SD_ReadBlocks (sd_card_t *card, uint8_t *buffer, uint32_t startBlock, uint32_t blockCount) |
Reads blocks from the specific card. More... | |
status_t | SD_WriteBlocks (sd_card_t *card, const uint8_t *buffer, uint32_t startBlock, uint32_t blockCount) |
Writes blocks of data to the specific card. More... | |
status_t | SD_EraseBlocks (sd_card_t *card, uint32_t startBlock, uint32_t blockCount) |
Erases blocks of the specific card. More... | |
struct sdcard_usr_param_t |
Data Fields | |
const sdmmchost_detect_card_t * | cd |
card detect type | |
const sdmmchost_pwr_card_t * | pwr |
power control configuration | |
struct sd_card_t |
Define the card structure including the necessary fields to identify and describe the card.
Data Fields | |
SDMMCHOST_CONFIG | host |
Host information. | |
sdcard_usr_param_t | usrParam |
user parameter | |
bool | isHostReady |
use this flag to indicate if need host re-init or not | |
bool | noInteralAlign |
use this flag to disable sdmmc align. More... | |
uint32_t | busClock_Hz |
SD bus clock frequency united in Hz. | |
uint32_t | relativeAddress |
Relative address of the card. | |
uint32_t | version |
Card version. | |
uint32_t | flags |
Flags in _sd_card_flag. | |
uint32_t | rawCid [4U] |
Raw CID content. | |
uint32_t | rawCsd [4U] |
Raw CSD content. | |
uint32_t | rawScr [2U] |
Raw CSD content. | |
uint32_t | ocr |
Raw OCR content. | |
sd_cid_t | cid |
CID. | |
sd_csd_t | csd |
CSD. | |
sd_scr_t | scr |
SCR. | |
uint32_t | blockCount |
Card total block number. | |
uint32_t | blockSize |
Card block size. | |
sd_timing_mode_t | currentTiming |
current timing mode | |
sd_driver_strength_t | driverStrength |
driver strength | |
sd_max_current_t | maxCurrent |
card current limit | |
sdmmc_operation_voltage_t | operationVoltage |
card operation voltage | |
bool sd_card_t::noInteralAlign |
If disable, sdmmc will not make sure the data buffer address is word align, otherwise all the transfer are align to low level driver
enum _sd_card_flag |
status_t SD_Init | ( | sd_card_t * | card | ) |
This function initializes the card on a specific host controller, it is consist of host init, card detect, card init function, however user can ignore this high level function, instead of use the low level function, such as SD_CardInit, SD_HostInit, SD_CardDetect.
card | Card descriptor. |
kStatus_SDMMC_HostNotReady | host is not ready. |
kStatus_SDMMC_GoIdleFailed | Go idle failed. |
kStatus_SDMMC_NotSupportYet | Card not support. |
kStatus_SDMMC_SendOperationConditionFailed | Send operation condition failed. |
kStatus_SDMMC_AllSendCidFailed | Send CID failed. |
kStatus_SDMMC_SendRelativeAddressFailed | Send relative address failed. |
kStatus_SDMMC_SendCsdFailed | Send CSD failed. |
kStatus_SDMMC_SelectCardFailed | Send SELECT_CARD command failed. |
kStatus_SDMMC_SendScrFailed | Send SCR failed. |
kStatus_SDMMC_SetBusWidthFailed | Set bus width failed. |
kStatus_SDMMC_SwitchHighSpeedFailed | Switch high speed failed. |
kStatus_SDMMC_SetCardBlockSizeFailed | Set card block size failed. |
kStatus_Success | Operate successfully. |
void SD_Deinit | ( | sd_card_t * | card | ) |
card | Card descriptor. |
status_t SD_CardInit | ( | sd_card_t * | card | ) |
This function initializes the card only, make sure the host is ready when call this function, otherwise it will return kStatus_SDMMC_HostNotReady.
card | Card descriptor. |
kStatus_SDMMC_HostNotReady | host is not ready. |
kStatus_SDMMC_GoIdleFailed | Go idle failed. |
kStatus_SDMMC_NotSupportYet | Card not support. |
kStatus_SDMMC_SendOperationConditionFailed | Send operation condition failed. |
kStatus_SDMMC_AllSendCidFailed | Send CID failed. |
kStatus_SDMMC_SendRelativeAddressFailed | Send relative address failed. |
kStatus_SDMMC_SendCsdFailed | Send CSD failed. |
kStatus_SDMMC_SelectCardFailed | Send SELECT_CARD command failed. |
kStatus_SDMMC_SendScrFailed | Send SCR failed. |
kStatus_SDMMC_SetBusWidthFailed | Set bus width failed. |
kStatus_SDMMC_SwitchHighSpeedFailed | Switch high speed failed. |
kStatus_SDMMC_SetCardBlockSizeFailed | Set card block size failed. |
kStatus_Success | Operate successfully. |
void SD_CardDeinit | ( | sd_card_t * | card | ) |
This function deinitializes the specific card.
card | Card descriptor. |
status_t SD_HostInit | ( | sd_card_t * | card | ) |
This function deinitializes the specific host.
card | Card descriptor. |
void SD_HostDeinit | ( | sd_card_t * | card | ) |
This function deinitializes the host.
card | Card descriptor. |
void SD_HostReset | ( | SDMMCHOST_CONFIG * | host | ) |
This function reset the specific host.
host | host descriptor. |
void SD_PowerOnCard | ( | SDMMCHOST_TYPE * | base, |
const sdmmchost_pwr_card_t * | pwr | ||
) |
The power on operation depend on host or the user define power on function.
base | host base address. |
pwr | user define power control configuration |
void SD_PowerOffCard | ( | SDMMCHOST_TYPE * | base, |
const sdmmchost_pwr_card_t * | pwr | ||
) |
The power off operation depend on host or the user define power on function.
base | host base address. |
pwr | user define power control configuration |
status_t SD_WaitCardDetectStatus | ( | SDMMCHOST_TYPE * | hostBase, |
const sdmmchost_detect_card_t * | cd, | ||
bool | waitCardStatus | ||
) |
Detect card through GPIO, CD, DATA3.
card | card descriptor. |
card | detect configuration |
waitCardStatus | wait card detect status |
bool SD_IsCardPresent | ( | sd_card_t * | card | ) |
card | card descriptor. |
bool SD_CheckReadOnly | ( | sd_card_t * | card | ) |
This function checks if the card is write-protected via the CSD register.
card | The specific card. |
true | Card is read only. |
false | Card isn't read only. |
status_t SD_ReadBlocks | ( | sd_card_t * | card, |
uint8_t * | buffer, | ||
uint32_t | startBlock, | ||
uint32_t | blockCount | ||
) |
This function reads blocks from the specific card with default block size defined by the SDHC_CARD_DEFAULT_BLOCK_SIZE.
card | Card descriptor. |
buffer | The buffer to save the data read from card. |
startBlock | The start block index. |
blockCount | The number of blocks to read. |
kStatus_InvalidArgument | Invalid argument. |
kStatus_SDMMC_CardNotSupport | Card not support. |
kStatus_SDMMC_NotSupportYet | Not support now. |
kStatus_SDMMC_WaitWriteCompleteFailed | Send status failed. |
kStatus_SDMMC_TransferFailed | Transfer failed. |
kStatus_SDMMC_StopTransmissionFailed | Stop transmission failed. |
kStatus_Success | Operate successfully. |
status_t SD_WriteBlocks | ( | sd_card_t * | card, |
const uint8_t * | buffer, | ||
uint32_t | startBlock, | ||
uint32_t | blockCount | ||
) |
This function writes blocks to the specific card with default block size 512 bytes.
card | Card descriptor. |
buffer | The buffer holding the data to be written to the card. |
startBlock | The start block index. |
blockCount | The number of blocks to write. |
kStatus_InvalidArgument | Invalid argument. |
kStatus_SDMMC_NotSupportYet | Not support now. |
kStatus_SDMMC_CardNotSupport | Card not support. |
kStatus_SDMMC_WaitWriteCompleteFailed | Send status failed. |
kStatus_SDMMC_TransferFailed | Transfer failed. |
kStatus_SDMMC_StopTransmissionFailed | Stop transmission failed. |
kStatus_Success | Operate successfully. |
status_t SD_EraseBlocks | ( | sd_card_t * | card, |
uint32_t | startBlock, | ||
uint32_t | blockCount | ||
) |
This function erases blocks of the specific card with default block size 512 bytes.
card | Card descriptor. |
startBlock | The start block index. |
blockCount | The number of blocks to erase. |
kStatus_InvalidArgument | Invalid argument. |
kStatus_SDMMC_WaitWriteCompleteFailed | Send status failed. |
kStatus_SDMMC_TransferFailed | Transfer failed. |
kStatus_SDMMC_WaitWriteCompleteFailed | Send status failed. |
kStatus_Success | Operate successfully. |