![]() |
MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
The MCUXpresso SDK provides a peripheral driver for the Secure Digital Host Controller (SDHC) module of MCUXpresso SDK devices.
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/sdhc
Data Structures | |
struct | sdhc_adma2_descriptor_t |
Defines the ADMA2 descriptor structure. More... | |
struct | sdhc_capability_t |
SDHC capability information. More... | |
struct | sdhc_transfer_config_t |
Card transfer configuration. More... | |
struct | sdhc_boot_config_t |
Data structure to configure the MMC boot feature. More... | |
struct | sdhc_config_t |
Data structure to initialize the SDHC. More... | |
struct | sdhc_data_t |
Card data descriptor. More... | |
struct | sdhc_command_t |
Card command descriptor. More... | |
struct | sdhc_transfer_t |
Transfer state. More... | |
struct | sdhc_transfer_callback_t |
SDHC callback functions. More... | |
struct | sdhc_handle_t |
SDHC handle. More... | |
struct | sdhc_host_t |
SDHC host descriptor. More... | |
Macros | |
#define | SDHC_MAX_BLOCK_COUNT (SDHC_BLKATTR_BLKCNT_MASK >> SDHC_BLKATTR_BLKCNT_SHIFT) |
Maximum block count can be set one time. | |
#define | SDHC_ADMA1_ADDRESS_ALIGN (4096U) |
The alignment size for ADDRESS filed in ADMA1's descriptor. | |
#define | SDHC_ADMA1_LENGTH_ALIGN (4096U) |
The alignment size for LENGTH field in ADMA1's descriptor. | |
#define | SDHC_ADMA2_ADDRESS_ALIGN (4U) |
The alignment size for ADDRESS field in ADMA2's descriptor. | |
#define | SDHC_ADMA2_LENGTH_ALIGN (4U) |
The alignment size for LENGTH filed in ADMA2's descriptor. | |
#define | SDHC_ADMA1_DESCRIPTOR_ADDRESS_SHIFT (12U) |
The bit shift for ADDRESS filed in ADMA1's descriptor. | |
#define | SDHC_ADMA1_DESCRIPTOR_ADDRESS_MASK (0xFFFFFU) |
The bit mask for ADDRESS field in ADMA1's descriptor. | |
#define | SDHC_ADMA1_DESCRIPTOR_LENGTH_SHIFT (12U) |
The bit shift for LENGTH filed in ADMA1's descriptor. | |
#define | SDHC_ADMA1_DESCRIPTOR_LENGTH_MASK (0xFFFFU) |
The mask for LENGTH field in ADMA1's descriptor. | |
#define | SDHC_ADMA1_DESCRIPTOR_MAX_LENGTH_PER_ENTRY (SDHC_ADMA1_DESCRIPTOR_LENGTH_MASK + 1U) |
The maximum value of LENGTH filed in ADMA1's descriptor. | |
#define | SDHC_ADMA2_DESCRIPTOR_LENGTH_SHIFT (16U) |
The bit shift for LENGTH field in ADMA2's descriptor. | |
#define | SDHC_ADMA2_DESCRIPTOR_LENGTH_MASK (0xFFFFUL) |
The bit mask for LENGTH field in ADMA2's descriptor. | |
#define | SDHC_ADMA2_DESCRIPTOR_MAX_LENGTH_PER_ENTRY (SDHC_ADMA2_DESCRIPTOR_LENGTH_MASK) |
The maximum value of LENGTH field in ADMA2's descriptor. | |
Typedefs | |
typedef uint32_t | sdhc_adma1_descriptor_t |
Defines the adma1 descriptor structure. More... | |
typedef status_t(* | sdhc_transfer_function_t )(SDHC_Type *base, sdhc_transfer_t *content) |
SDHC transfer function. More... | |
Enumerations | |
enum | { kStatus_SDHC_BusyTransferring = MAKE_STATUS(kStatusGroup_SDHC, 0U), kStatus_SDHC_PrepareAdmaDescriptorFailed = MAKE_STATUS(kStatusGroup_SDHC, 1U), kStatus_SDHC_SendCommandFailed = MAKE_STATUS(kStatusGroup_SDHC, 2U), kStatus_SDHC_TransferDataFailed = MAKE_STATUS(kStatusGroup_SDHC, 3U), kStatus_SDHC_DMADataBufferAddrNotAlign } |
_sdhc_status SDHC status More... | |
enum | { kSDHC_SupportAdmaFlag = SDHC_HTCAPBLT_ADMAS_MASK, kSDHC_SupportHighSpeedFlag = SDHC_HTCAPBLT_HSS_MASK, kSDHC_SupportDmaFlag = SDHC_HTCAPBLT_DMAS_MASK, kSDHC_SupportSuspendResumeFlag = SDHC_HTCAPBLT_SRS_MASK, kSDHC_SupportV330Flag = SDHC_HTCAPBLT_VS33_MASK, kSDHC_Support4BitFlag = (SDHC_HTCAPBLT_MBL_SHIFT << 0U), kSDHC_Support8BitFlag = (SDHC_HTCAPBLT_MBL_SHIFT << 1U) } |
_sdhc_capability_flag Host controller capabilities flag mask More... | |
enum | { kSDHC_WakeupEventOnCardInt = SDHC_PROCTL_WECINT_MASK, kSDHC_WakeupEventOnCardInsert = SDHC_PROCTL_WECINS_MASK, kSDHC_WakeupEventOnCardRemove = SDHC_PROCTL_WECRM_MASK, kSDHC_WakeupEventsAll } |
_sdhc_wakeup_event Wakeup event mask More... | |
enum | { kSDHC_ResetAll = SDHC_SYSCTL_RSTA_MASK, kSDHC_ResetCommand = SDHC_SYSCTL_RSTC_MASK, kSDHC_ResetData = SDHC_SYSCTL_RSTD_MASK, kSDHC_ResetsAll = (kSDHC_ResetAll | kSDHC_ResetCommand | kSDHC_ResetData) } |
_sdhc_reset Reset type mask More... | |
enum | { kSDHC_EnableDmaFlag = SDHC_XFERTYP_DMAEN_MASK, kSDHC_CommandTypeSuspendFlag = (SDHC_XFERTYP_CMDTYP(1U)), kSDHC_CommandTypeResumeFlag = (SDHC_XFERTYP_CMDTYP(2U)), kSDHC_CommandTypeAbortFlag = (SDHC_XFERTYP_CMDTYP(3U)), kSDHC_EnableBlockCountFlag = SDHC_XFERTYP_BCEN_MASK, kSDHC_EnableAutoCommand12Flag = SDHC_XFERTYP_AC12EN_MASK, kSDHC_DataReadFlag = SDHC_XFERTYP_DTDSEL_MASK, kSDHC_MultipleBlockFlag = SDHC_XFERTYP_MSBSEL_MASK, kSDHC_ResponseLength136Flag = SDHC_XFERTYP_RSPTYP(1U), kSDHC_ResponseLength48Flag = SDHC_XFERTYP_RSPTYP(2U), kSDHC_ResponseLength48BusyFlag = SDHC_XFERTYP_RSPTYP(3U), kSDHC_EnableCrcCheckFlag = SDHC_XFERTYP_CCCEN_MASK, kSDHC_EnableIndexCheckFlag = SDHC_XFERTYP_CICEN_MASK, kSDHC_DataPresentFlag = SDHC_XFERTYP_DPSEL_MASK } |
_sdhc_transfer_flag Transfer flag mask More... | |
enum | { kSDHC_CommandInhibitFlag = SDHC_PRSSTAT_CIHB_MASK, kSDHC_DataInhibitFlag = SDHC_PRSSTAT_CDIHB_MASK, kSDHC_DataLineActiveFlag = SDHC_PRSSTAT_DLA_MASK, kSDHC_SdClockStableFlag = SDHC_PRSSTAT_SDSTB_MASK, kSDHC_WriteTransferActiveFlag = SDHC_PRSSTAT_WTA_MASK, kSDHC_ReadTransferActiveFlag = SDHC_PRSSTAT_RTA_MASK, kSDHC_BufferWriteEnableFlag = SDHC_PRSSTAT_BWEN_MASK, kSDHC_BufferReadEnableFlag = SDHC_PRSSTAT_BREN_MASK, kSDHC_CardInsertedFlag = SDHC_PRSSTAT_CINS_MASK, kSDHC_CommandLineLevelFlag = SDHC_PRSSTAT_CLSL_MASK, kSDHC_Data0LineLevelFlag = (1U << 24U), kSDHC_Data1LineLevelFlag = (1U << 25U), kSDHC_Data2LineLevelFlag = (1U << 26U), kSDHC_Data3LineLevelFlag = (1U << 27U), kSDHC_Data4LineLevelFlag = (1U << 28U), kSDHC_Data5LineLevelFlag = (1U << 29U), kSDHC_Data6LineLevelFlag = (1U << 30U), kSDHC_Data7LineLevelFlag = (int)(1U << 31U) } |
_sdhc_present_status_flag Present status flag mask More... | |
enum | { kSDHC_CommandCompleteFlag = SDHC_IRQSTAT_CC_MASK, kSDHC_DataCompleteFlag = SDHC_IRQSTAT_TC_MASK, kSDHC_BlockGapEventFlag = SDHC_IRQSTAT_BGE_MASK, kSDHC_DmaCompleteFlag = SDHC_IRQSTAT_DINT_MASK, kSDHC_BufferWriteReadyFlag = SDHC_IRQSTAT_BWR_MASK, kSDHC_BufferReadReadyFlag = SDHC_IRQSTAT_BRR_MASK, kSDHC_CardInsertionFlag = SDHC_IRQSTAT_CINS_MASK, kSDHC_CardRemovalFlag = SDHC_IRQSTAT_CRM_MASK, kSDHC_CardInterruptFlag = SDHC_IRQSTAT_CINT_MASK, kSDHC_CommandTimeoutFlag = SDHC_IRQSTAT_CTOE_MASK, kSDHC_CommandCrcErrorFlag = SDHC_IRQSTAT_CCE_MASK, kSDHC_CommandEndBitErrorFlag = SDHC_IRQSTAT_CEBE_MASK, kSDHC_CommandIndexErrorFlag = SDHC_IRQSTAT_CIE_MASK, kSDHC_DataTimeoutFlag = SDHC_IRQSTAT_DTOE_MASK, kSDHC_DataCrcErrorFlag = SDHC_IRQSTAT_DCE_MASK, kSDHC_DataEndBitErrorFlag = SDHC_IRQSTAT_DEBE_MASK, kSDHC_AutoCommand12ErrorFlag = SDHC_IRQSTAT_AC12E_MASK, kSDHC_DmaErrorFlag = SDHC_IRQSTAT_DMAE_MASK, kSDHC_CommandErrorFlag, kSDHC_DataErrorFlag, kSDHC_ErrorFlag = (kSDHC_CommandErrorFlag | kSDHC_DataErrorFlag | kSDHC_DmaErrorFlag), kSDHC_DataFlag, kSDHC_DataDMAFlag = (kSDHC_DataCompleteFlag | kSDHC_DataErrorFlag | kSDHC_DmaErrorFlag), kSDHC_CommandFlag = (kSDHC_CommandErrorFlag | kSDHC_CommandCompleteFlag), kSDHC_CardDetectFlag = (kSDHC_CardInsertionFlag | kSDHC_CardRemovalFlag), kSDHC_AllInterruptFlags } |
_sdhc_interrupt_status_flag Interrupt status flag mask More... | |
enum | { kSDHC_AutoCommand12NotExecutedFlag = SDHC_AC12ERR_AC12NE_MASK, kSDHC_AutoCommand12TimeoutFlag = SDHC_AC12ERR_AC12TOE_MASK, kSDHC_AutoCommand12EndBitErrorFlag = SDHC_AC12ERR_AC12EBE_MASK, kSDHC_AutoCommand12CrcErrorFlag = SDHC_AC12ERR_AC12CE_MASK, kSDHC_AutoCommand12IndexErrorFlag = SDHC_AC12ERR_AC12IE_MASK, kSDHC_AutoCommand12NotIssuedFlag = SDHC_AC12ERR_CNIBAC12E_MASK } |
_sdhc_auto_command12_error_status_flag Auto CMD12 error status flag mask More... | |
enum | { kSDHC_AdmaLenghMismatchFlag = SDHC_ADMAES_ADMALME_MASK, kSDHC_AdmaDescriptorErrorFlag = SDHC_ADMAES_ADMADCE_MASK } |
_sdhc_adma_error_status_flag ADMA error status flag mask More... | |
enum | sdhc_adma_error_state_t { kSDHC_AdmaErrorStateStopDma = 0x00U, kSDHC_AdmaErrorStateFetchDescriptor = 0x01U, kSDHC_AdmaErrorStateChangeAddress = 0x02U, kSDHC_AdmaErrorStateTransferData = 0x03U } |
ADMA error state. More... | |
enum | { kSDHC_ForceEventAutoCommand12NotExecuted = SDHC_FEVT_AC12NE_MASK, kSDHC_ForceEventAutoCommand12Timeout = SDHC_FEVT_AC12TOE_MASK, kSDHC_ForceEventAutoCommand12CrcError = SDHC_FEVT_AC12CE_MASK, kSDHC_ForceEventEndBitError = SDHC_FEVT_AC12EBE_MASK, kSDHC_ForceEventAutoCommand12IndexError = SDHC_FEVT_AC12IE_MASK, kSDHC_ForceEventAutoCommand12NotIssued = SDHC_FEVT_CNIBAC12E_MASK, kSDHC_ForceEventCommandTimeout = SDHC_FEVT_CTOE_MASK, kSDHC_ForceEventCommandCrcError = SDHC_FEVT_CCE_MASK, kSDHC_ForceEventCommandEndBitError = SDHC_FEVT_CEBE_MASK, kSDHC_ForceEventCommandIndexError = SDHC_FEVT_CIE_MASK, kSDHC_ForceEventDataTimeout = SDHC_FEVT_DTOE_MASK, kSDHC_ForceEventDataCrcError = SDHC_FEVT_DCE_MASK, kSDHC_ForceEventDataEndBitError = SDHC_FEVT_DEBE_MASK, kSDHC_ForceEventAutoCommand12Error = SDHC_FEVT_AC12E_MASK, kSDHC_ForceEventCardInt = (int)SDHC_FEVT_CINT_MASK, kSDHC_ForceEventDmaError = SDHC_FEVT_DMAE_MASK, kSDHC_ForceEventsAll } |
_sdhc_force_event Force event bit position More... | |
enum | sdhc_data_bus_width_t { kSDHC_DataBusWidth1Bit = 0U, kSDHC_DataBusWidth4Bit = 1U, kSDHC_DataBusWidth8Bit = 2U } |
Data transfer width. More... | |
enum | sdhc_endian_mode_t { kSDHC_EndianModeBig = 0U, kSDHC_EndianModeHalfWordBig = 1U, kSDHC_EndianModeLittle = 2U } |
Endian mode. More... | |
enum | sdhc_dma_mode_t { kSDHC_DmaModeNo = 0U, kSDHC_DmaModeAdma1 = 1U, kSDHC_DmaModeAdma2 = 2U } |
DMA mode. More... | |
enum | { kSDHC_StopAtBlockGapFlag = 0x01, kSDHC_ReadWaitControlFlag = 0x02, kSDHC_InterruptAtBlockGapFlag = 0x04, kSDHC_ExactBlockNumberReadFlag = 0x08 } |
_sdhc_sdio_control_flag SDIO control flag mask More... | |
enum | sdhc_boot_mode_t { kSDHC_BootModeNormal = 0U, kSDHC_BootModeAlternative = 1U } |
MMC card boot mode. More... | |
enum | sdhc_card_command_type_t { kCARD_CommandTypeNormal = 0U, kCARD_CommandTypeSuspend = 1U, kCARD_CommandTypeResume = 2U, kCARD_CommandTypeAbort = 3U } |
The command type. More... | |
enum | sdhc_card_response_type_t { kCARD_ResponseTypeNone = 0U, kCARD_ResponseTypeR1 = 1U, kCARD_ResponseTypeR1b = 2U, kCARD_ResponseTypeR2 = 3U, kCARD_ResponseTypeR3 = 4U, kCARD_ResponseTypeR4 = 5U, kCARD_ResponseTypeR5 = 6U, kCARD_ResponseTypeR5b = 7U, kCARD_ResponseTypeR6 = 8U, kCARD_ResponseTypeR7 = 9U } |
The command response type. More... | |
enum | { kSDHC_Adma1DescriptorValidFlag = (1U << 0U), kSDHC_Adma1DescriptorEndFlag = (1U << 1U), kSDHC_Adma1DescriptorInterrupFlag = (1U << 2U), kSDHC_Adma1DescriptorActivity1Flag = (1U << 4U), kSDHC_Adma1DescriptorActivity2Flag = (1U << 5U), kSDHC_Adma1DescriptorTypeNop = (kSDHC_Adma1DescriptorValidFlag), kSDHC_Adma1DescriptorTypeTransfer, kSDHC_Adma1DescriptorTypeLink, kSDHC_Adma1DescriptorTypeSetLength } |
_sdhc_adma1_descriptor_flag The mask for the control/status field in ADMA1 descriptor More... | |
enum | { kSDHC_Adma2DescriptorValidFlag = (1U << 0U), kSDHC_Adma2DescriptorEndFlag = (1U << 1U), kSDHC_Adma2DescriptorInterruptFlag = (1U << 2U), kSDHC_Adma2DescriptorActivity1Flag = (1U << 4U), kSDHC_Adma2DescriptorActivity2Flag = (1U << 5U), kSDHC_Adma2DescriptorTypeNop = (kSDHC_Adma2DescriptorValidFlag), kSDHC_Adma2DescriptorTypeReserved, kSDHC_Adma2DescriptorTypeTransfer, kSDHC_Adma2DescriptorTypeLink } |
_sdhc_adma2_descriptor_flag ADMA1 descriptor control and status mask More... | |
Driver version | |
#define | FSL_SDHC_DRIVER_VERSION (MAKE_VERSION(2U, 1U, 10U)) |
Driver version 2.1.10. More... | |
Initialization and deinitialization | |
void | SDHC_Init (SDHC_Type *base, const sdhc_config_t *config) |
SDHC module initialization function. More... | |
void | SDHC_Deinit (SDHC_Type *base) |
Deinitializes the SDHC. More... | |
bool | SDHC_Reset (SDHC_Type *base, uint32_t mask, uint32_t timeout) |
Resets the SDHC. More... | |
DMA Control | |
status_t | SDHC_SetAdmaTableConfig (SDHC_Type *base, sdhc_dma_mode_t dmaMode, uint32_t *table, uint32_t tableWords, const uint32_t *data, uint32_t dataBytes) |
Sets the ADMA descriptor table configuration. More... | |
Interrupts | |
static void | SDHC_EnableInterruptStatus (SDHC_Type *base, uint32_t mask) |
Enables the interrupt status. More... | |
static void | SDHC_DisableInterruptStatus (SDHC_Type *base, uint32_t mask) |
Disables the interrupt status. More... | |
static void | SDHC_EnableInterruptSignal (SDHC_Type *base, uint32_t mask) |
Enables the interrupt signal corresponding to the interrupt status flag. More... | |
static void | SDHC_DisableInterruptSignal (SDHC_Type *base, uint32_t mask) |
Disables the interrupt signal corresponding to the interrupt status flag. More... | |
Status | |
static uint32_t | SDHC_GetEnabledInterruptStatusFlags (SDHC_Type *base) |
Gets the enabled interrupt status. More... | |
static uint32_t | SDHC_GetInterruptStatusFlags (SDHC_Type *base) |
Gets the current interrupt status. More... | |
static void | SDHC_ClearInterruptStatusFlags (SDHC_Type *base, uint32_t mask) |
Clears a specified interrupt status. More... | |
static uint32_t | SDHC_GetAutoCommand12ErrorStatusFlags (SDHC_Type *base) |
Gets the status of auto command 12 error. More... | |
static uint32_t | SDHC_GetAdmaErrorStatusFlags (SDHC_Type *base) |
Gets the status of the ADMA error. More... | |
static uint32_t | SDHC_GetPresentStatusFlags (SDHC_Type *base) |
Gets a present status. More... | |
Bus Operations | |
void | SDHC_GetCapability (SDHC_Type *base, sdhc_capability_t *capability) |
Gets the capability information. More... | |
static void | SDHC_EnableSdClock (SDHC_Type *base, bool enable) |
Enables or disables the SD bus clock. More... | |
uint32_t | SDHC_SetSdClock (SDHC_Type *base, uint32_t srcClock_Hz, uint32_t busClock_Hz) |
Sets the SD bus clock frequency. More... | |
bool | SDHC_SetCardActive (SDHC_Type *base, uint32_t timeout) |
Sends 80 clocks to the card to set it to the active state. More... | |
static void | SDHC_SetDataBusWidth (SDHC_Type *base, sdhc_data_bus_width_t width) |
Sets the data transfer width. More... | |
static void | SDHC_CardDetectByData3 (SDHC_Type *base, bool enable) |
detect card insert status. More... | |
void | SDHC_SetTransferConfig (SDHC_Type *base, const sdhc_transfer_config_t *config) |
Sets the card transfer-related configuration. More... | |
static uint32_t | SDHC_GetCommandResponse (SDHC_Type *base, uint32_t index) |
Gets the command response. More... | |
static void | SDHC_WriteData (SDHC_Type *base, uint32_t data) |
Fills the data port. More... | |
static uint32_t | SDHC_ReadData (SDHC_Type *base) |
Retrieves the data from the data port. More... | |
static void | SDHC_EnableWakeupEvent (SDHC_Type *base, uint32_t mask, bool enable) |
Enables or disables a wakeup event in low-power mode. More... | |
static void | SDHC_EnableCardDetectTest (SDHC_Type *base, bool enable) |
Enables or disables the card detection level for testing. More... | |
static void | SDHC_SetCardDetectTestLevel (SDHC_Type *base, bool high) |
Sets the card detection test level. More... | |
void | SDHC_EnableSdioControl (SDHC_Type *base, uint32_t mask, bool enable) |
Enables or disables the SDIO card control. More... | |
static void | SDHC_SetContinueRequest (SDHC_Type *base) |
Restarts a transaction which has stopped at the block GAP for the SDIO card. More... | |
void | SDHC_SetMmcBootConfig (SDHC_Type *base, const sdhc_boot_config_t *config) |
Configures the MMC boot feature. More... | |
static void | SDHC_SetForceEvent (SDHC_Type *base, uint32_t mask) |
Forces generating events according to the given mask. More... | |
Transactional | |
status_t | SDHC_TransferBlocking (SDHC_Type *base, uint32_t *admaTable, uint32_t admaTableWords, sdhc_transfer_t *transfer) |
Transfers the command/data using a blocking method. More... | |
void | SDHC_TransferCreateHandle (SDHC_Type *base, sdhc_handle_t *handle, const sdhc_transfer_callback_t *callback, void *userData) |
Creates the SDHC handle. More... | |
status_t | SDHC_TransferNonBlocking (SDHC_Type *base, sdhc_handle_t *handle, uint32_t *admaTable, uint32_t admaTableWords, sdhc_transfer_t *transfer) |
Transfers the command/data using an interrupt and an asynchronous method. More... | |
void | SDHC_TransferHandleIRQ (SDHC_Type *base, sdhc_handle_t *handle) |
IRQ handler for the SDHC. More... | |
struct sdhc_adma2_descriptor_t |
struct sdhc_capability_t |
Defines a structure to save the capability information of SDHC.
Data Fields | |
uint32_t | specVersion |
Specification version. | |
uint32_t | vendorVersion |
Vendor version. | |
uint32_t | maxBlockLength |
Maximum block length united as byte. | |
uint32_t | maxBlockCount |
Maximum block count can be set one time. | |
uint32_t | flags |
Capability flags to indicate the support information(_sdhc_capability_flag) | |
struct sdhc_transfer_config_t |
Define structure to configure the transfer-related command index/argument/flags and data block size/data block numbers. This structure needs to be filled each time a command is sent to the card.
Data Fields | |
size_t | dataBlockSize |
Data block size. | |
uint32_t | dataBlockCount |
Data block count. | |
uint32_t | commandArgument |
Command argument. | |
uint32_t | commandIndex |
Command index. | |
uint32_t | flags |
Transfer flags(_sdhc_transfer_flag) | |
struct sdhc_boot_config_t |
Data Fields | |
uint32_t | ackTimeoutCount |
Timeout value for the boot ACK. More... | |
sdhc_boot_mode_t | bootMode |
Boot mode selection. More... | |
uint32_t | blockCount |
Stop at block gap value of automatic mode. More... | |
bool | enableBootAck |
Enable or disable boot ACK. | |
bool | enableBoot |
Enable or disable fast boot. | |
bool | enableAutoStopAtBlockGap |
Enable or disable auto stop at block gap function in boot period. | |
uint32_t sdhc_boot_config_t::ackTimeoutCount |
The available range is 0 ~ 15.
sdhc_boot_mode_t sdhc_boot_config_t::bootMode |
uint32_t sdhc_boot_config_t::blockCount |
Available range is 0 ~ 65535.
struct sdhc_config_t |
Data Fields | |
bool | cardDetectDat3 |
Enable DAT3 as card detection pin. | |
sdhc_endian_mode_t | endianMode |
Endian mode. | |
sdhc_dma_mode_t | dmaMode |
DMA mode. | |
uint32_t | readWatermarkLevel |
Watermark level for DMA read operation. More... | |
uint32_t | writeWatermarkLevel |
Watermark level for DMA write operation. More... | |
uint32_t sdhc_config_t::readWatermarkLevel |
Available range is 1 ~ 128.
uint32_t sdhc_config_t::writeWatermarkLevel |
Available range is 1 ~ 128.
struct sdhc_data_t |
Defines a structure to contain data-related attribute. 'enableIgnoreError' is used for the case that upper card driver want to ignore the error event to read/write all the data not to stop read/write immediately when error event happen for example bus testing procedure for MMC card.
Data Fields | |
bool | enableAutoCommand12 |
Enable auto CMD12. | |
bool | enableIgnoreError |
Enable to ignore error event to read/write all the data. | |
size_t | blockSize |
Block size. | |
uint32_t | blockCount |
Block count. | |
uint32_t * | rxData |
Buffer to save data read. | |
const uint32_t * | txData |
Data buffer to write. | |
struct sdhc_command_t |
Define card command-related attribute.
Data Fields | |
uint32_t | index |
Command index. | |
uint32_t | argument |
Command argument. | |
sdhc_card_command_type_t | type |
Command type. | |
sdhc_card_response_type_t | responseType |
Command response type. | |
uint32_t | response [4U] |
Response for this command. | |
uint32_t | responseErrorFlags |
response error flag, the flag which need to check the command reponse | |
struct sdhc_transfer_t |
Data Fields | |
sdhc_data_t * | data |
Data to transfer. | |
sdhc_command_t * | command |
Command to send. | |
struct sdhc_transfer_callback_t |
Data Fields | |
void(* | CardInserted )(SDHC_Type *base, void *userData) |
Card inserted occurs when DAT3/CD pin is for card detect. | |
void(* | CardRemoved )(SDHC_Type *base, void *userData) |
Card removed occurs. | |
void(* | SdioInterrupt )(SDHC_Type *base, void *userData) |
SDIO card interrupt occurs. | |
void(* | SdioBlockGap )(SDHC_Type *base, void *userData) |
SDIO card stopped at block gap occurs. | |
void(* | TransferComplete )(SDHC_Type *base, sdhc_handle_t *handle, status_t status, void *userData) |
Transfer complete callback. | |
struct _sdhc_handle |
SDHC handle typedef.
Defines the structure to save the SDHC state information and callback function. The detailed interrupt status when sending a command or transfering data can be obtained from the interruptFlags field by using the mask defined in sdhc_interrupt_flag_t.
Data Fields | |
sdhc_data_t *volatile | data |
Data to transfer. | |
sdhc_command_t *volatile | command |
Command to send. | |
volatile uint32_t | transferredWords |
Words transferred by DATAPORT way. | |
sdhc_transfer_callback_t | callback |
Callback function. | |
void * | userData |
Parameter for transfer complete callback. | |
struct sdhc_host_t |
Data Fields | |
SDHC_Type * | base |
SDHC peripheral base address. | |
uint32_t | sourceClock_Hz |
SDHC source clock frequency united in Hz. | |
sdhc_config_t | config |
SDHC configuration. | |
sdhc_capability_t | capability |
SDHC capability information. | |
sdhc_transfer_function_t | transfer |
SDHC transfer function. | |
#define FSL_SDHC_DRIVER_VERSION (MAKE_VERSION(2U, 1U, 10U)) |
typedef uint32_t sdhc_adma1_descriptor_t |
typedef status_t(* sdhc_transfer_function_t)(SDHC_Type *base, sdhc_transfer_t *content) |
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
enum sdhc_endian_mode_t |
enum sdhc_dma_mode_t |
anonymous enum |
enum sdhc_boot_mode_t |
Define the command response type from card to host controller.
anonymous enum |
anonymous enum |
void SDHC_Init | ( | SDHC_Type * | base, |
const sdhc_config_t * | config | ||
) |
Configures the SDHC according to the user configuration.
Example:
base | SDHC peripheral base address. |
config | SDHC configuration information. |
kStatus_Success | Operate successfully. |
void SDHC_Deinit | ( | SDHC_Type * | base | ) |
base | SDHC peripheral base address. |
bool SDHC_Reset | ( | SDHC_Type * | base, |
uint32_t | mask, | ||
uint32_t | timeout | ||
) |
base | SDHC peripheral base address. |
mask | The reset type mask(_sdhc_reset). |
timeout | Timeout for reset. |
true | Reset successfully. |
false | Reset failed. |
status_t SDHC_SetAdmaTableConfig | ( | SDHC_Type * | base, |
sdhc_dma_mode_t | dmaMode, | ||
uint32_t * | table, | ||
uint32_t | tableWords, | ||
const uint32_t * | data, | ||
uint32_t | dataBytes | ||
) |
base | SDHC peripheral base address. |
dmaMode | DMA mode. |
table | ADMA table address. |
tableWords | ADMA table buffer length united as Words. |
data | Data buffer address. |
dataBytes | Data length united as bytes. |
kStatus_OutOfRange | ADMA descriptor table length isn't enough to describe data. |
kStatus_Success | Operate successfully. |
|
inlinestatic |
base | SDHC peripheral base address. |
mask | Interrupt status flags mask(_sdhc_interrupt_status_flag). |
|
inlinestatic |
base | SDHC peripheral base address. |
mask | The interrupt status flags mask(_sdhc_interrupt_status_flag). |
|
inlinestatic |
base | SDHC peripheral base address. |
mask | The interrupt status flags mask(_sdhc_interrupt_status_flag). |
|
inlinestatic |
base | SDHC peripheral base address. |
mask | The interrupt status flags mask(_sdhc_interrupt_status_flag). |
|
inlinestatic |
base | SDHC peripheral base address. |
|
inlinestatic |
base | SDHC peripheral base address. |
|
inlinestatic |
base | SDHC peripheral base address. |
mask | The interrupt status flags mask(_sdhc_interrupt_status_flag). |
|
inlinestatic |
base | SDHC peripheral base address. |
|
inlinestatic |
base | SDHC peripheral base address. |
|
inlinestatic |
This function gets the present SDHC's status except for an interrupt status and an error status.
base | SDHC peripheral base address. |
void SDHC_GetCapability | ( | SDHC_Type * | base, |
sdhc_capability_t * | capability | ||
) |
base | SDHC peripheral base address. |
capability | Structure to save capability information. |
|
inlinestatic |
base | SDHC peripheral base address. |
enable | True to enable, false to disable. |
uint32_t SDHC_SetSdClock | ( | SDHC_Type * | base, |
uint32_t | srcClock_Hz, | ||
uint32_t | busClock_Hz | ||
) |
base | SDHC peripheral base address. |
srcClock_Hz | SDHC source clock frequency united in Hz. |
busClock_Hz | SD bus clock frequency united in Hz. |
bool SDHC_SetCardActive | ( | SDHC_Type * | base, |
uint32_t | timeout | ||
) |
This function must be called each time the card is inserted to ensure that the card can receive the command correctly.
base | SDHC peripheral base address. |
timeout | Timeout to initialize card. |
true | Set card active successfully. |
false | Set card active failed. |
|
inlinestatic |
base | SDHC peripheral base address. |
width | Data transfer width. |
|
inlinestatic |
base | SDHC peripheral base address. |
enable/disable | flag |
void SDHC_SetTransferConfig | ( | SDHC_Type * | base, |
const sdhc_transfer_config_t * | config | ||
) |
This function fills the card transfer-related command argument/transfer flag/data size. The command and data are sent by SDHC after calling this function.
Example:
base | SDHC peripheral base address. |
config | Command configuration structure. |
|
inlinestatic |
base | SDHC peripheral base address. |
index | The index of response register, range from 0 to 3. |
|
inlinestatic |
This function is used to implement the data transfer by Data Port instead of DMA.
base | SDHC peripheral base address. |
data | The data about to be sent. |
|
inlinestatic |
This function is used to implement the data transfer by Data Port instead of DMA.
base | SDHC peripheral base address. |
|
inlinestatic |
base | SDHC peripheral base address. |
mask | Wakeup events mask(_sdhc_wakeup_event). |
enable | True to enable, false to disable. |
|
inlinestatic |
base | SDHC peripheral base address. |
enable | True to enable, false to disable. |
|
inlinestatic |
This function sets the card detection test level to indicate whether the card is inserted into the SDHC when DAT[3]/ CD pin is selected as a card detection pin. This function can also assert the pin logic when DAT[3]/CD pin is selected as the card detection pin.
base | SDHC peripheral base address. |
high | True to set the card detect level to high. |
void SDHC_EnableSdioControl | ( | SDHC_Type * | base, |
uint32_t | mask, | ||
bool | enable | ||
) |
base | SDHC peripheral base address. |
mask | SDIO card control flags mask(_sdhc_sdio_control_flag). |
enable | True to enable, false to disable. |
|
inlinestatic |
base | SDHC peripheral base address. |
void SDHC_SetMmcBootConfig | ( | SDHC_Type * | base, |
const sdhc_boot_config_t * | config | ||
) |
Example:
base | SDHC peripheral base address. |
config | The MMC boot configuration information. |
|
inlinestatic |
base | SDHC peripheral base address. |
mask | The force events mask(_sdhc_force_event). |
status_t SDHC_TransferBlocking | ( | SDHC_Type * | base, |
uint32_t * | admaTable, | ||
uint32_t | admaTableWords, | ||
sdhc_transfer_t * | transfer | ||
) |
This function waits until the command response/data is received or the SDHC encounters an error by polling the status flag. This function support non word align data addr transfer support, if data buffer addr is not align in DMA mode, the API will continue finish the transfer by polling IO directly The application must not call this API in multiple threads at the same time. Because of that this API doesn't support the re-entry mechanism.
base | SDHC peripheral base address. |
admaTable | ADMA table address, can't be null if transfer way is ADMA1/ADMA2. |
admaTableWords | ADMA table length united as words, can't be 0 if transfer way is ADMA1/ADMA2. |
transfer | Transfer content. |
kStatus_InvalidArgument | Argument is invalid. |
kStatus_SDHC_PrepareAdmaDescriptorFailed | Prepare ADMA descriptor failed. |
kStatus_SDHC_SendCommandFailed | Send command failed. |
kStatus_SDHC_TransferDataFailed | Transfer data failed. |
kStatus_Success | Operate successfully. |
void SDHC_TransferCreateHandle | ( | SDHC_Type * | base, |
sdhc_handle_t * | handle, | ||
const sdhc_transfer_callback_t * | callback, | ||
void * | userData | ||
) |
base | SDHC peripheral base address. |
handle | SDHC handle pointer. |
callback | Structure pointer to contain all callback functions. |
userData | Callback function parameter. |
status_t SDHC_TransferNonBlocking | ( | SDHC_Type * | base, |
sdhc_handle_t * | handle, | ||
uint32_t * | admaTable, | ||
uint32_t | admaTableWords, | ||
sdhc_transfer_t * | transfer | ||
) |
This function sends a command and data and returns immediately. It doesn't wait the transfer complete or encounter an error. This function support non word align data addr transfer support, if data buffer addr is not align in DMA mode, the API will continue finish the transfer by polling IO directly The application must not call this API in multiple threads at the same time. Because of that this API doesn't support the re-entry mechanism.
base | SDHC peripheral base address. |
handle | SDHC handle. |
admaTable | ADMA table address, can't be null if transfer way is ADMA1/ADMA2. |
admaTableWords | ADMA table length united as words, can't be 0 if transfer way is ADMA1/ADMA2. |
transfer | Transfer content. |
kStatus_InvalidArgument | Argument is invalid. |
kStatus_SDHC_BusyTransferring | Busy transferring. |
kStatus_SDHC_PrepareAdmaDescriptorFailed | Prepare ADMA descriptor failed. |
kStatus_Success | Operate successfully. |
void SDHC_TransferHandleIRQ | ( | SDHC_Type * | base, |
sdhc_handle_t * | handle | ||
) |
This function deals with the IRQs on the given host controller.
base | SDHC peripheral base address. |
handle | SDHC handle. |