The MCUXpresso SDK provides a peripheral driver for the SD/MMC/SDIO card interface (sdif) module of MCUXpresso SDK devices.
Refer to the driver examples codes located at <SDK_ROOT>/boards/<BOARD>/driver_examples/sdif
|
enum | _sdif_status {
kStatus_SDIF_DescriptorBufferLenError = MAKE_STATUS(kStatusGroup_SDIF, 0U),
kStatus_SDIF_InvalidArgument = MAKE_STATUS(kStatusGroup_SDIF, 1U),
kStatus_SDIF_SyncCmdTimeout = MAKE_STATUS(kStatusGroup_SDIF, 2U),
kStatus_SDIF_SendCmdFail = MAKE_STATUS(kStatusGroup_SDIF, 3U),
kStatus_SDIF_SendCmdErrorBufferFull,
kStatus_SDIF_DMATransferFailWithFBE,
kStatus_SDIF_DMATransferDescriptorUnavailable,
kStatus_SDIF_DataTransferFail = MAKE_STATUS(kStatusGroup_SDIF, 6U),
kStatus_SDIF_ResponseError = MAKE_STATUS(kStatusGroup_SDIF, 7U),
kStatus_SDIF_DMAAddrNotAlign = MAKE_STATUS(kStatusGroup_SDIF, 8U)
} |
| SDIF status. More...
|
|
enum | _sdif_capability_flag {
kSDIF_SupportHighSpeedFlag = 0x1U,
kSDIF_SupportDmaFlag = 0x2U,
kSDIF_SupportSuspendResumeFlag = 0x4U,
kSDIF_SupportV330Flag = 0x8U,
kSDIF_Support4BitFlag = 0x10U,
kSDIF_Support8BitFlag = 0x20U
} |
| Host controller capabilities flag mask. More...
|
|
enum | _sdif_reset_type {
kSDIF_ResetController = SDIF_CTRL_CONTROLLER_RESET_MASK,
kSDIF_ResetFIFO = SDIF_CTRL_FIFO_RESET_MASK,
kSDIF_ResetDMAInterface = SDIF_CTRL_DMA_RESET_MASK,
kSDIF_ResetAll
} |
| define the reset type More...
|
|
enum | sdif_bus_width_t {
kSDIF_Bus1BitWidth = 0U,
kSDIF_Bus4BitWidth = 1U,
kSDIF_Bus8BitWidth = 2U
} |
| define the card bus width type More...
|
|
enum | _sdif_command_flags {
kSDIF_CmdResponseExpect = SDIF_CMD_RESPONSE_EXPECT_MASK,
kSDIF_CmdResponseLengthLong = SDIF_CMD_RESPONSE_LENGTH_MASK,
kSDIF_CmdCheckResponseCRC = SDIF_CMD_CHECK_RESPONSE_CRC_MASK,
kSDIF_DataExpect = SDIF_CMD_DATA_EXPECTED_MASK,
kSDIF_DataWriteToCard = SDIF_CMD_READ_WRITE_MASK,
kSDIF_DataStreamTransfer = SDIF_CMD_TRANSFER_MODE_MASK,
kSDIF_DataTransferAutoStop = SDIF_CMD_SEND_AUTO_STOP_MASK,
kSDIF_WaitPreTransferComplete,
kSDIF_TransferStopAbort = SDIF_CMD_STOP_ABORT_CMD_MASK,
kSDIF_SendInitialization,
kSDIF_CmdUpdateClockRegisterOnly,
kSDIF_CmdtoReadCEATADevice = SDIF_CMD_READ_CEATA_DEVICE_MASK,
kSDIF_CmdExpectCCS = SDIF_CMD_CCS_EXPECTED_MASK,
kSDIF_BootModeEnable = SDIF_CMD_ENABLE_BOOT_MASK,
kSDIF_BootModeExpectAck = SDIF_CMD_EXPECT_BOOT_ACK_MASK,
kSDIF_BootModeDisable = SDIF_CMD_DISABLE_BOOT_MASK,
kSDIF_BootModeAlternate = SDIF_CMD_BOOT_MODE_MASK,
kSDIF_CmdVoltageSwitch = SDIF_CMD_VOLT_SWITCH_MASK,
kSDIF_CmdDataUseHoldReg = SDIF_CMD_USE_HOLD_REG_MASK
} |
| define the command flags More...
|
|
enum | _sdif_command_type {
kCARD_CommandTypeNormal = 0U,
kCARD_CommandTypeSuspend = 1U,
kCARD_CommandTypeResume = 2U,
kCARD_CommandTypeAbort = 3U
} |
| The command type. More...
|
|
enum | _sdif_response_type {
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 | _sdif_interrupt_mask {
kSDIF_CardDetect = SDIF_INTMASK_CDET_MASK,
kSDIF_ResponseError = SDIF_INTMASK_RE_MASK,
kSDIF_CommandDone = SDIF_INTMASK_CDONE_MASK,
kSDIF_DataTransferOver = SDIF_INTMASK_DTO_MASK,
kSDIF_WriteFIFORequest = SDIF_INTMASK_TXDR_MASK,
kSDIF_ReadFIFORequest = SDIF_INTMASK_RXDR_MASK,
kSDIF_ResponseCRCError = SDIF_INTMASK_RCRC_MASK,
kSDIF_DataCRCError = SDIF_INTMASK_DCRC_MASK,
kSDIF_ResponseTimeout = SDIF_INTMASK_RTO_MASK,
kSDIF_DataReadTimeout = SDIF_INTMASK_DRTO_MASK,
kSDIF_DataStarvationByHostTimeout = SDIF_INTMASK_HTO_MASK,
kSDIF_FIFOError = SDIF_INTMASK_FRUN_MASK,
kSDIF_HardwareLockError = SDIF_INTMASK_HLE_MASK,
kSDIF_DataStartBitError = SDIF_INTMASK_SBE_MASK,
kSDIF_AutoCmdDone = SDIF_INTMASK_ACD_MASK,
kSDIF_DataEndBitError = SDIF_INTMASK_EBE_MASK,
kSDIF_SDIOInterrupt = SDIF_INTMASK_SDIO_INT_MASK_MASK,
kSDIF_CommandTransferStatus,
kSDIF_DataTransferStatus
,
kSDIF_AllInterruptStatus = 0x1FFFFU
} |
| define the interrupt mask flags More...
|
|
enum | _sdif_dma_status {
kSDIF_DMATransFinishOneDescriptor = SDIF_IDSTS_TI_MASK,
kSDIF_DMARecvFinishOneDescriptor = SDIF_IDSTS_RI_MASK,
kSDIF_DMAFatalBusError = SDIF_IDSTS_FBE_MASK,
kSDIF_DMADescriptorUnavailable = SDIF_IDSTS_DU_MASK,
kSDIF_DMACardErrorSummary = SDIF_IDSTS_CES_MASK,
kSDIF_NormalInterruptSummary = SDIF_IDSTS_NIS_MASK,
kSDIF_AbnormalInterruptSummary = SDIF_IDSTS_AIS_MASK
} |
| define the internal DMA status flags More...
|
|
enum | _sdif_dma_descriptor_flag {
kSDIF_DisableCompleteInterrupt = 0x2U,
kSDIF_DMADescriptorDataBufferEnd = 0x4U,
kSDIF_DMADescriptorDataBufferStart = 0x8U,
kSDIF_DMASecondAddrChained = 0x10U,
kSDIF_DMADescriptorEnd = 0x20U,
kSDIF_DMADescriptorOwnByDMA = (int)0x80000000
} |
| define the internal DMA descriptor flag More...
|
|
enum | sdif_dma_mode_t |
| define the internal DMA mode
|
|
|
void | SDIF_Init (SDIF_Type *base, sdif_config_t *config) |
| SDIF module initialization function. More...
|
|
void | SDIF_Deinit (SDIF_Type *base) |
| SDIF module deinit function. More...
|
|
bool | SDIF_SendCardActive (SDIF_Type *base, uint32_t timeout) |
| SDIF send initialize 80 clocks for SD card after initial. More...
|
|
static void | SDIF_EnableCardClock (SDIF_Type *base, bool enable) |
| SDIF module enable/disable card clock. More...
|
|
static void | SDIF_EnableLowPowerMode (SDIF_Type *base, bool enable) |
| SDIF module enable/disable module disable the card clock to enter low power mode when card is idle,for SDIF cards, if interrupts must be detected, clock should not be stopped. More...
|
|
static void | SDIF_EnableCardPower (SDIF_Type *base, bool enable) |
| enable/disable the card power. More...
|
|
void | SDIF_SetCardBusWidth (SDIF_Type *base, sdif_bus_width_t type) |
| set card data bus width More...
|
|
static uint32_t | SDIF_DetectCardInsert (SDIF_Type *base, bool data3) |
| SDIF module detect card insert status function. More...
|
|
uint32_t | SDIF_SetCardClock (SDIF_Type *base, uint32_t srcClock_Hz, uint32_t target_HZ) |
| Sets the card bus clock frequency. More...
|
|
bool | SDIF_Reset (SDIF_Type *base, uint32_t mask, uint32_t timeout) |
| reset the different block of the interface. More...
|
|
static uint32_t | SDIF_GetCardWriteProtect (SDIF_Type *base) |
| get the card write protect status More...
|
|
static void | SDIF_AssertHardwareReset (SDIF_Type *base) |
| toggle state on hardware reset PIN This is used which card has a reset PIN typically. More...
|
|
status_t | SDIF_SendCommand (SDIF_Type *base, sdif_command_t *cmd, uint32_t timeout) |
| send command to the card More...
|
|
static void | SDIF_EnableGlobalInterrupt (SDIF_Type *base, bool enable) |
| SDIF enable/disable global interrupt. More...
|
|
static void | SDIF_EnableInterrupt (SDIF_Type *base, uint32_t mask) |
| SDIF enable interrupt. More...
|
|
static void | SDIF_DisableInterrupt (SDIF_Type *base, uint32_t mask) |
| SDIF disable interrupt. More...
|
|
static uint32_t | SDIF_GetInterruptStatus (SDIF_Type *base) |
| SDIF get interrupt status. More...
|
|
static uint32_t | SDIF_GetEnabledInterruptStatus (SDIF_Type *base) |
| SDIF get enabled interrupt status. More...
|
|
static void | SDIF_ClearInterruptStatus (SDIF_Type *base, uint32_t mask) |
| SDIF clear interrupt status. More...
|
|
void | SDIF_TransferCreateHandle (SDIF_Type *base, sdif_handle_t *handle, sdif_transfer_callback_t *callback, void *userData) |
| Creates the SDIF handle. More...
|
|
static void | SDIF_EnableDmaInterrupt (SDIF_Type *base, uint32_t mask) |
| SDIF enable DMA interrupt. More...
|
|
static void | SDIF_DisableDmaInterrupt (SDIF_Type *base, uint32_t mask) |
| SDIF disable DMA interrupt. More...
|
|
static uint32_t | SDIF_GetInternalDMAStatus (SDIF_Type *base) |
| SDIF get internal DMA status. More...
|
|
static uint32_t | SDIF_GetEnabledDMAInterruptStatus (SDIF_Type *base) |
| SDIF get enabled internal DMA interrupt status. More...
|
|
static void | SDIF_ClearInternalDMAStatus (SDIF_Type *base, uint32_t mask) |
| SDIF clear internal DMA status. More...
|
|
status_t | SDIF_InternalDMAConfig (SDIF_Type *base, sdif_dma_config_t *config, const uint32_t *data, uint32_t dataSize) |
| SDIF internal DMA config function. More...
|
|
static void | SDIF_EnableInternalDMA (SDIF_Type *base, bool enable) |
| SDIF internal DMA enable. More...
|
|
static void | SDIF_SendReadWait (SDIF_Type *base) |
| SDIF send read wait to SDIF card function. More...
|
|
bool | SDIF_AbortReadData (SDIF_Type *base, uint32_t timeout) |
| SDIF abort the read data when SDIF card is in suspend state Once assert this bit,data state machine will be reset which is waiting for the next blocking data,used in SDIO card suspend sequence,should call after suspend cmd send. More...
|
|
static void | SDIF_EnableCEATAInterrupt (SDIF_Type *base, bool enable) |
| SDIF enable/disable CE-ATA card interrupt this bit should set together with the card register. More...
|
|
status_t | SDIF_TransferNonBlocking (SDIF_Type *base, sdif_handle_t *handle, sdif_dma_config_t *dmaConfig, sdif_transfer_t *transfer) |
| SDIF transfer function data/cmd in a non-blocking way this API should be use in interrupt mode, when use this API user must call SDIF_TransferCreateHandle first, all status check through interrupt. More...
|
|
status_t | SDIF_TransferBlocking (SDIF_Type *base, sdif_dma_config_t *dmaConfig, sdif_transfer_t *transfer) |
| SDIF transfer function data/cmd in a blocking way. More...
|
|
status_t | SDIF_ReleaseDMADescriptor (SDIF_Type *base, sdif_dma_config_t *dmaConfig) |
| SDIF release the DMA descriptor to DMA engine this function should be called when DMA descriptor unavailable status occurs. More...
|
|
void | SDIF_GetCapability (SDIF_Type *base, sdif_capability_t *capability) |
| SDIF return the controller capability. More...
|
|
static uint32_t | SDIF_GetControllerStatus (SDIF_Type *base) |
| SDIF return the controller status. More...
|
|
static void | SDIF_SendCCSD (SDIF_Type *base, bool withAutoStop) |
| SDIF send command complete signal disable to CE-ATA card. More...
|
|
void | SDIF_ConfigClockDelay (uint32_t target_HZ, uint32_t divider) |
| SDIF config the clock delay This function is used to config the cclk_in delay to sample and driver the data ,should meet the min setup time and hold time, and user need to config this parameter according to your board setting. More...
|
|