The KSDK provides a peripheral driver for the Secured Digital Host Controller (SDHC) module of Kinetis devices.
|
enum | _sdhc_status {
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)
} |
| SDHC status. More...
|
|
enum | _sdhc_capability_flag {
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)
} |
| Host controller capabilities flag mask. More...
|
|
enum | _sdhc_wakeup_event {
kSDHC_WakeupEventOnCardInt = SDHC_PROCTL_WECINT_MASK,
kSDHC_WakeupEventOnCardInsert = SDHC_PROCTL_WECINS_MASK,
kSDHC_WakeupEventOnCardRemove = SDHC_PROCTL_WECRM_MASK,
kSDHC_WakeupEventsAll
} |
| Wakeup event mask. More...
|
|
enum | _sdhc_reset {
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)
} |
| Reset type mask. More...
|
|
enum | _sdhc_transfer_flag {
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
} |
| Transfer flag mask. More...
|
|
enum | _sdhc_present_status_flag {
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 = (1U << 31U)
} |
| Present status flag mask. More...
|
|
enum | _sdhc_interrupt_status_flag {
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_CommandFlag = (kSDHC_CommandErrorFlag | kSDHC_CommandCompleteFlag),
kSDHC_CardDetectFlag = (kSDHC_CardInsertionFlag | kSDHC_CardRemovalFlag),
kSDHC_AllInterruptFlags
} |
| Interrupt status flag mask. More...
|
|
enum | _sdhc_auto_command12_error_status_flag {
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
} |
| Auto CMD12 error status flag mask. More...
|
|
enum | _sdhc_adma_error_status_flag {
kSDHC_AdmaLenghMismatchFlag = SDHC_ADMAES_ADMALME_MASK,
kSDHC_AdmaDescriptorErrorFlag = SDHC_ADMAES_ADMADCE_MASK
} |
| 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 | _sdhc_force_event {
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 = SDHC_FEVT_CINT_MASK,
kSDHC_ForceEventDmaError = SDHC_FEVT_DMAE_MASK,
kSDHC_ForceEventsAll
} |
| Force event mask. 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 | _sdhc_sdio_control_flag {
kSDHC_StopAtBlockGapFlag = 0x01,
kSDHC_ReadWaitControlFlag = 0x02,
kSDHC_InterruptAtBlockGapFlag = 0x04,
kSDHC_ExactBlockNumberReadFlag = 0x08
} |
| SDIO control flag mask. More...
|
|
enum | sdhc_boot_mode_t {
kSDHC_BootModeNormal = 0U,
kSDHC_BootModeAlternative = 1U
} |
| MMC card boot mode. More...
|
|
enum | sdhc_command_type_t {
kSDHC_CommandTypeNormal = 0U,
kSDHC_CommandTypeSuspend = 1U,
kSDHC_CommandTypeResume = 2U,
kSDHC_CommandTypeAbort = 3U
} |
| The command type. More...
|
|
enum | sdhc_response_type_t {
kSDHC_ResponseTypeNone = 0U,
kSDHC_ResponseTypeR1 = 1U,
kSDHC_ResponseTypeR1b = 2U,
kSDHC_ResponseTypeR2 = 3U,
kSDHC_ResponseTypeR3 = 4U,
kSDHC_ResponseTypeR4 = 5U,
kSDHC_ResponseTypeR5 = 6U,
kSDHC_ResponseTypeR5b = 7U,
kSDHC_ResponseTypeR6 = 8U,
kSDHC_ResponseTypeR7 = 9U
} |
| The command response type. More...
|
|
enum | _sdhc_adma1_descriptor_flag {
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
} |
| The mask for the control/status field in ADMA1 descriptor. More...
|
|
enum | _sdhc_adma2_descriptor_flag {
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
} |
| ADMA1 descriptor control and status mask. More...
|
|
|
void | SDHC_GetCapability (SDHC_Type *base, sdhc_capability_t *capability) |
| Get the capability information. More...
|
|
static void | SDHC_EnableSdClock (SDHC_Type *base, bool enable) |
| Enable or disable SD bus clock. More...
|
|
uint32_t | SDHC_SetSdClock (SDHC_Type *base, uint32_t srcClock_Hz, uint32_t busClock_Hz) |
| Set SD bus clock frequency. More...
|
|
bool | SDHC_SetCardActive (SDHC_Type *base, uint32_t timeout) |
| Send 80 clocks to the card to set it to be active state. More...
|
|
static void | SDHC_SetDataBusWidth (SDHC_Type *base, sdhc_data_bus_width_t width) |
| Set the data transfer width. More...
|
|
void | SDHC_SetTransferConfig (SDHC_Type *base, const sdhc_transfer_config_t *config) |
| Set card transfer-related configuration. More...
|
|
static uint32_t | SDHC_GetCommandResponse (SDHC_Type *base, uint32_t index) |
| Get the command response. More...
|
|
static void | SDHC_WriteData (SDHC_Type *base, uint32_t data) |
| Fill the the data port. More...
|
|
static uint32_t | SDHC_ReadData (SDHC_Type *base) |
| Retrieve the data from the data port. More...
|
|
static void | SDHC_EnableWakeupEvent (SDHC_Type *base, uint32_t mask, bool enable) |
| Enable or disable wakeup event in low power mode. More...
|
|
static void | SDHC_EnableCardDetectTest (SDHC_Type *base, bool enable) |
| Enable or disable card detection level for test. More...
|
|
static void | SDHC_SetCardDetectTestLevel (SDHC_Type *base, bool high) |
| Set card detection test level. More...
|
|
void | SDHC_EnableSdioControl (SDHC_Type *base, uint32_t mask, bool enable) |
| Enable or disable SDIO card control. More...
|
|
static void | SDHC_SetContinueRequest (SDHC_Type *base) |
| Restart a transaction which has stopped at the block gap for SDIO card. More...
|
|
void | SDHC_SetMmcBootConfig (SDHC_Type *base, const sdhc_boot_config_t *config) |
| Configure the MMC boot feature. More...
|
|
static void | SDHC_SetForceEvent (SDHC_Type *base, uint32_t mask) |
| Force to generate events according to the given mask. More...
|
|
|
status_t | SDHC_TransferBlocking (SDHC_Type *base, uint32_t *admaTable, uint32_t admaTableWords, sdhc_transfer_t *transfer) |
| Transfer command/data using blocking way. More...
|
|
void | SDHC_TransferCreateHandle (SDHC_Type *base, sdhc_handle_t *handle, const sdhc_transfer_callback_t *callback, void *userData) |
| Create 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) |
| Transfer command/data using interrupt and asynchronous way. More...
|
|
void | SDHC_TransferHandleIRQ (SDHC_Type *base, sdhc_handle_t *handle) |
| IRQ handler for SDHC. More...
|
|