MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
Data Structures | |
struct | mmc_usr_param_t |
card user parameter More... | |
struct | mmc_card_t |
mmc card state More... | |
Macros | |
#define | FSL_MMC_DRIVER_VERSION (MAKE_VERSION(2U, 4U, 1U)) /*2.4.1*/ |
Middleware mmc version. More... | |
Typedefs | |
typedef void(* | mmc_io_strength_t )(uint32_t busFreq) |
card io strength control | |
Enumerations | |
enum | { kMMC_SupportHighSpeed26MHZFlag = (1U << 0U), kMMC_SupportHighSpeed52MHZFlag = (1U << 1U), kMMC_SupportHighSpeedDDR52MHZ180V300VFlag = (1 << 2U), kMMC_SupportHighSpeedDDR52MHZ120VFlag = (1 << 3U), kMMC_SupportHS200200MHZ180VFlag = (1 << 4U), kMMC_SupportHS200200MHZ120VFlag = (1 << 5U), kMMC_SupportHS400DDR200MHZ180VFlag = (1 << 6U), kMMC_SupportHS400DDR200MHZ120VFlag = (1 << 7U), kMMC_SupportHighCapacityFlag = (1U << 8U), kMMC_SupportAlternateBootFlag = (1U << 9U), kMMC_SupportDDRBootFlag = (1U << 10U), kMMC_SupportHighSpeedBootFlag = (1U << 11U), kMMC_SupportEnhanceHS400StrobeFlag = (1U << 12U) } |
MMC card flags. More... | |
MMCCARD Function | |
status_t | MMC_Init (mmc_card_t *card) |
Initializes the MMC card and host. More... | |
void | MMC_Deinit (mmc_card_t *card) |
Deinitializes the card and host. More... | |
status_t | MMC_CardInit (mmc_card_t *card) |
intialize the card. More... | |
void | MMC_CardDeinit (mmc_card_t *card) |
Deinitializes the card. More... | |
status_t | MMC_HostInit (mmc_card_t *card) |
initialize the host. More... | |
void | MMC_HostDeinit (mmc_card_t *card) |
Deinitializes the host. More... | |
void | MMC_HostReset (SDMMCHOST_CONFIG *host) |
reset the host. More... | |
void | MMC_PowerOnCard (SDMMCHOST_TYPE *base, const sdmmchost_pwr_card_t *pwr) |
power on card. More... | |
void | MMC_PowerOffCard (SDMMCHOST_TYPE *base, const sdmmchost_pwr_card_t *pwr) |
power off card. More... | |
void | MMC_SetCardPower (mmc_card_t *card, bool enable) |
set card power. More... | |
bool | MMC_CheckReadOnly (mmc_card_t *card) |
Checks if the card is read-only. More... | |
status_t | MMC_ReadBlocks (mmc_card_t *card, uint8_t *buffer, uint32_t startBlock, uint32_t blockCount) |
Reads data blocks from the card. More... | |
status_t | MMC_WriteBlocks (mmc_card_t *card, const uint8_t *buffer, uint32_t startBlock, uint32_t blockCount) |
Writes data blocks to the card. More... | |
status_t | MMC_EraseGroups (mmc_card_t *card, uint32_t startGroup, uint32_t endGroup) |
Erases groups of the card. More... | |
status_t | MMC_SelectPartition (mmc_card_t *card, mmc_access_partition_t partitionNumber) |
Selects the partition to access. More... | |
status_t | MMC_SetBootConfig (mmc_card_t *card, const mmc_boot_config_t *config) |
Configures the boot activity of the card. More... | |
status_t | MMC_StartBoot (mmc_card_t *card, const mmc_boot_config_t *mmcConfig, uint8_t *buffer, sdmmchost_boot_config_t *hostConfig) |
MMC card start boot. More... | |
status_t | MMC_SetBootConfigWP (mmc_card_t *card, uint8_t wp) |
MMC card set boot configuration write protect. More... | |
status_t | MMC_ReadBootData (mmc_card_t *card, uint8_t *buffer, sdmmchost_boot_config_t *hostConfig) |
MMC card continous read boot data. More... | |
status_t | MMC_StopBoot (mmc_card_t *card, uint32_t bootMode) |
MMC card stop boot mode. More... | |
status_t | MMC_SetBootPartitionWP (mmc_card_t *card, mmc_boot_partition_wp_t bootPartitionWP) |
MMC card set boot partition write protect. More... | |
status_t | MMC_EnableCacheControl (mmc_card_t *card, bool enable) |
MMC card cache control function. More... | |
status_t | MMC_FlushCache (mmc_card_t *card) |
MMC card cache flush function. More... | |
struct mmc_usr_param_t |
Data Fields | |
mmc_io_strength_t | ioStrength |
swicth sd io strength | |
uint32_t | maxFreq |
board support maximum frequency | |
uint32_t | capability |
board capability flag | |
struct mmc_card_t |
Define the card structure including the necessary fields to identify and describe the card.
Data Fields | |
sdmmchost_t * | host |
Host information. | |
mmc_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 |
MMC bus clock united in Hz. | |
uint32_t | relativeAddress |
Relative address of the card. | |
bool | enablePreDefinedBlockCount |
Enable PRE-DEFINED block count when read/write. | |
uint32_t | flags |
Capability flag in _mmc_card_flag. | |
uint8_t | internalBuffer [FSL_SDMMC_CARD_INTERNAL_BUFFER_SIZE] |
raw buffer used for mmc driver internal | |
uint32_t | ocr |
Raw OCR content. | |
mmc_cid_t | cid |
CID. | |
mmc_csd_t | csd |
CSD. | |
mmc_extended_csd_t | extendedCsd |
Extended CSD. | |
uint32_t | blockSize |
Card block size. | |
uint32_t | userPartitionBlocks |
Card total block number in user partition. | |
uint32_t | bootPartitionBlocks |
Boot partition size united as block size. | |
uint32_t | eraseGroupBlocks |
Erase group size united as block size. | |
mmc_access_partition_t | currentPartition |
Current access partition. | |
mmc_voltage_window_t | hostVoltageWindowVCCQ |
application must set this value according to board specific | |
mmc_voltage_window_t | hostVoltageWindowVCC |
application must set this value according to board specific | |
mmc_high_speed_timing_t | busTiming |
indicate the current work timing mode | |
mmc_data_bus_width_t | busWidth |
indicate the current work bus width | |
bool mmc_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
#define FSL_MMC_DRIVER_VERSION (MAKE_VERSION(2U, 4U, 1U)) /*2.4.1*/ |
anonymous enum |
status_t MMC_Init | ( | mmc_card_t * | card | ) |
card | Card descriptor. |
kStatus_SDMMC_HostNotReady | host is not ready. |
kStatus_SDMMC_GoIdleFailed | Go idle failed. |
kStatus_SDMMC_SendOperationConditionFailed | Send operation condition failed. |
kStatus_SDMMC_AllSendCidFailed | Send CID failed. |
kStatus_SDMMC_SetRelativeAddressFailed | Set relative address failed. |
kStatus_SDMMC_SendCsdFailed | Send CSD failed. |
kStatus_SDMMC_CardNotSupport | Card not support. |
kStatus_SDMMC_SelectCardFailed | Send SELECT_CARD command failed. |
kStatus_SDMMC_SendExtendedCsdFailed | Send EXT_CSD 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 MMC_Deinit | ( | mmc_card_t * | card | ) |
card | Card descriptor. |
status_t MMC_CardInit | ( | mmc_card_t * | card | ) |
card | Card descriptor. |
kStatus_SDMMC_HostNotReady | host is not ready. |
kStatus_SDMMC_GoIdleFailed | Go idle failed. |
kStatus_SDMMC_SendOperationConditionFailed | Send operation condition failed. |
kStatus_SDMMC_AllSendCidFailed | Send CID failed. |
kStatus_SDMMC_SetRelativeAddressFailed | Set relative address failed. |
kStatus_SDMMC_SendCsdFailed | Send CSD failed. |
kStatus_SDMMC_CardNotSupport | Card not support. |
kStatus_SDMMC_SelectCardFailed | Send SELECT_CARD command failed. |
kStatus_SDMMC_SendExtendedCsdFailed | Send EXT_CSD 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 MMC_CardDeinit | ( | mmc_card_t * | card | ) |
card | Card descriptor. |
status_t MMC_HostInit | ( | mmc_card_t * | card | ) |
This function deinitializes the specific host.
card | Card descriptor. |
void MMC_HostDeinit | ( | mmc_card_t * | card | ) |
This function deinitializes the host.
card | Card descriptor. |
void MMC_HostReset | ( | SDMMCHOST_CONFIG * | host | ) |
This function reset the specific host.
host | host descriptor. |
void MMC_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 MMC_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 |
void MMC_SetCardPower | ( | mmc_card_t * | card, |
bool | enable | ||
) |
card | card descriptor. |
enable | true is power on, false is power off. |
bool MMC_CheckReadOnly | ( | mmc_card_t * | card | ) |
card | Card descriptor. |
true | Card is read only. |
false | Card isn't read only. |
status_t MMC_ReadBlocks | ( | mmc_card_t * | card, |
uint8_t * | buffer, | ||
uint32_t | startBlock, | ||
uint32_t | blockCount | ||
) |
card | Card descriptor. |
buffer | The buffer to save data. |
startBlock | The start block index. |
blockCount | The number of blocks to read. |
kStatus_InvalidArgument | Invalid argument. |
kStatus_SDMMC_CardNotSupport | Card not support. |
kStatus_SDMMC_SetBlockCountFailed | Set block count failed. |
kStatus_SDMMC_TransferFailed | Transfer failed. |
kStatus_SDMMC_StopTransmissionFailed | Stop transmission failed. |
kStatus_Success | Operate successfully. |
status_t MMC_WriteBlocks | ( | mmc_card_t * | card, |
const uint8_t * | buffer, | ||
uint32_t | startBlock, | ||
uint32_t | blockCount | ||
) |
card | Card descriptor. |
buffer | The buffer to save data blocks. |
startBlock | Start block number to write. |
blockCount | Block count. |
kStatus_InvalidArgument | Invalid argument. |
kStatus_SDMMC_NotSupportYet | Not support now. |
kStatus_SDMMC_SetBlockCountFailed | Set block count failed. |
kStatus_SDMMC_WaitWriteCompleteFailed | Send status failed. |
kStatus_SDMMC_TransferFailed | Transfer failed. |
kStatus_SDMMC_StopTransmissionFailed | Stop transmission failed. |
kStatus_Success | Operate successfully. |
status_t MMC_EraseGroups | ( | mmc_card_t * | card, |
uint32_t | startGroup, | ||
uint32_t | endGroup | ||
) |
Erase group is the smallest erase unit in MMC card. The erase range is [startGroup, endGroup].
card | Card descriptor. |
startGroup | Start group number. |
endGroup | End group number. |
kStatus_InvalidArgument | Invalid argument. |
kStatus_SDMMC_WaitWriteCompleteFailed | Send status failed. |
kStatus_SDMMC_TransferFailed | Transfer failed. |
kStatus_Success | Operate successfully. |
status_t MMC_SelectPartition | ( | mmc_card_t * | card, |
mmc_access_partition_t | partitionNumber | ||
) |
card | Card descriptor. |
partitionNumber | The partition number. |
kStatus_SDMMC_ConfigureExtendedCsdFailed | Configure EXT_CSD failed. |
kStatus_Success | Operate successfully. |
status_t MMC_SetBootConfig | ( | mmc_card_t * | card, |
const mmc_boot_config_t * | config | ||
) |
card | Card descriptor. |
config | Boot configuration structure. |
kStatus_SDMMC_NotSupportYet | Not support now. |
kStatus_SDMMC_ConfigureExtendedCsdFailed | Configure EXT_CSD failed. |
kStatus_SDMMC_ConfigureBootFailed | Configure boot failed. |
kStatus_Success | Operate successfully. |
status_t MMC_StartBoot | ( | mmc_card_t * | card, |
const mmc_boot_config_t * | mmcConfig, | ||
uint8_t * | buffer, | ||
sdmmchost_boot_config_t * | hostConfig | ||
) |
card | Card descriptor. |
mmcConfig | mmc Boot configuration structure. |
buffer | address to recieve data. |
hostConfig | host boot configurations. |
kStatus_Fail | fail. |
kStatus_SDMMC_TransferFailed | transfer fail. |
kStatus_SDMMC_GoIdleFailed | reset card fail. |
kStatus_Success | Operate successfully. |
status_t MMC_SetBootConfigWP | ( | mmc_card_t * | card, |
uint8_t | wp | ||
) |
card | Card descriptor. |
wp | write protect value. |
status_t MMC_ReadBootData | ( | mmc_card_t * | card, |
uint8_t * | buffer, | ||
sdmmchost_boot_config_t * | hostConfig | ||
) |
card | Card descriptor. |
buffer | buffer address. |
hostConfig | host boot configurations. |
status_t MMC_StopBoot | ( | mmc_card_t * | card, |
uint32_t | bootMode | ||
) |
card | Card descriptor. |
bootMode | boot mode. |
status_t MMC_SetBootPartitionWP | ( | mmc_card_t * | card, |
mmc_boot_partition_wp_t | bootPartitionWP | ||
) |
card | Card descriptor. |
bootPartitionWP | boot partition write protect value. |
status_t MMC_EnableCacheControl | ( | mmc_card_t * | card, |
bool | enable | ||
) |
The mmc device's cache is enabled by the driver by default. The cache should in typical case reduce the access time (compared to an access to the main nonvolatile storage) for both write and read.
card | Card descriptor. |
enable | true is enable the cache, false is disable the cache. |
status_t MMC_FlushCache | ( | mmc_card_t * | card | ) |
A Flush operation refers to the requirement, from the host to the device, to write the cached data to the nonvolatile memory. Prior to a flush, the device may autonomously write data to the nonvolatile memory, but after the flush operation all data in the volatile area must be written to nonvolatile memory There is no requirement for flush due to switching between the partitions. (Note: This also implies that the cache data shall not be lost when switching between partitions). Cached data may be lost in SLEEP state, so host should flush the cache before placing the device into SLEEP state.
card | Card descriptor. |