11#include "fsl_common.h"
25#define FSL_USDHC_DRIVER_VERSION (MAKE_VERSION(2U, 8U, 2U))
29#define USDHC_MAX_BLOCK_COUNT (USDHC_BLK_ATT_BLKCNT_MASK >> USDHC_BLK_ATT_BLKCNT_SHIFT)
32#ifndef FSL_USDHC_ENABLE_SCATTER_GATHER_TRANSFER
33#define FSL_USDHC_ENABLE_SCATTER_GATHER_TRANSFER 0U
71#if defined(FSL_FEATURE_USDHC_HAS_SDR104_MODE) && (!FSL_FEATURE_USDHC_HAS_SDR104_MODE)
76#if defined(FSL_FEATURE_USDHC_HAS_SDR50_MODE) && (!FSL_FEATURE_USDHC_HAS_SDR50_MODE)
105#if defined(FSL_FEATURE_USDHC_HAS_SDR50_MODE) && (!FSL_FEATURE_USDHC_HAS_SDR50_MODE)
153#if defined(FSL_FEATURE_USDHC_HAS_SDR50_MODE) && (!FSL_FEATURE_USDHC_HAS_SDR50_MODE)
189#if defined(FSL_FEATURE_USDHC_HAS_SDR50_MODE) && (!FSL_FEATURE_USDHC_HAS_SDR50_MODE)
245#if defined(FSL_FEATURE_USDHC_HAS_SDR50_MODE) && (!FSL_FEATURE_USDHC_HAS_SDR50_MODE)
251 USDHC_AUTOCMD12_ERR_STATUS_SMP_CLK_SEL_MASK,
292 USDHC_FORCE_EVENT_FEVTAC12NE_MASK,
308#
if defined(FSL_FEATURE_USDHC_HAS_SDR50_MODE) && (!FSL_FEATURE_USDHC_HAS_SDR50_MODE)
315 (
int)(USDHC_FORCE_EVENT_FEVTAC12NE_MASK | USDHC_FORCE_EVENT_FEVTAC12TOE_MASK |
316 USDHC_FORCE_EVENT_FEVTAC12CE_MASK | USDHC_FORCE_EVENT_FEVTAC12EBE_MASK |
317 USDHC_FORCE_EVENT_FEVTAC12IE_MASK | USDHC_FORCE_EVENT_FEVTCNIBAC12E_MASK |
318 USDHC_FORCE_EVENT_FEVTCTOE_MASK | USDHC_FORCE_EVENT_FEVTCCE_MASK | USDHC_FORCE_EVENT_FEVTCEBE_MASK |
319 USDHC_FORCE_EVENT_FEVTCIE_MASK | USDHC_FORCE_EVENT_FEVTDTOE_MASK | USDHC_FORCE_EVENT_FEVTDCE_MASK |
320 USDHC_FORCE_EVENT_FEVTDEBE_MASK | USDHC_FORCE_EVENT_FEVTAC12E_MASK | USDHC_FORCE_EVENT_FEVTCINT_MASK |
405#define USDHC_ADMA1_ADDRESS_ALIGN (4096U)
407#define USDHC_ADMA1_LENGTH_ALIGN (4096U)
409#define USDHC_ADMA2_ADDRESS_ALIGN (4U)
411#define USDHC_ADMA2_LENGTH_ALIGN (4U)
453#define USDHC_ADMA1_DESCRIPTOR_ADDRESS_SHIFT (12U)
455#define USDHC_ADMA1_DESCRIPTOR_ADDRESS_MASK (0xFFFFFU)
457#define USDHC_ADMA1_DESCRIPTOR_LENGTH_SHIFT (12U)
459#define USDHC_ADMA1_DESCRIPTOR_LENGTH_MASK (0xFFFFU)
466#define USDHC_ADMA1_DESCRIPTOR_MAX_LENGTH_PER_ENTRY (USDHC_ADMA1_DESCRIPTOR_LENGTH_MASK + 1U - 4096U)
525#define USDHC_ADMA2_DESCRIPTOR_LENGTH_SHIFT (16U)
527#define USDHC_ADMA2_DESCRIPTOR_LENGTH_MASK (0xFFFFU)
529#define USDHC_ADMA2_DESCRIPTOR_MAX_LENGTH_PER_ENTRY (USDHC_ADMA2_DESCRIPTOR_LENGTH_MASK - 3U)
623#if !(defined(FSL_FEATURE_USDHC_HAS_NO_RW_BURST_LEN) && FSL_FEATURE_USDHC_HAS_NO_RW_BURST_LEN)
650#if !(defined(FSL_FEATURE_USDHC_HAS_NO_RW_BURST_LEN) && FSL_FEATURE_USDHC_HAS_NO_RW_BURST_LEN)
749#if (defined FSL_USDHC_ENABLE_SCATTER_GATHER_TRANSFER) && FSL_USDHC_ENABLE_SCATTER_GATHER_TRANSFER
778#if defined(__cplusplus)
863 const uint32_t *dataAddr,
879 uint32_t *admaTable, uint32_t admaTableWords,
const uint32_t *dataBufferAddr, uint32_t dataBytes, uint32_t flags);
894 uint32_t *admaTable, uint32_t admaTableWords,
const uint32_t *dataBufferAddr, uint32_t dataBytes, uint32_t flags);
902static inline void USDHC_EnableInternalDMA(
USDHC_Type *base,
bool enable)
906 base->MIX_CTRL |= USDHC_MIX_CTRL_DMAEN_MASK;
910 base->MIX_CTRL &= ~USDHC_MIX_CTRL_DMAEN_MASK;
911 base->PROT_CTRL &= ~USDHC_PROT_CTRL_DMASEL_MASK;
928static inline void USDHC_EnableInterruptStatus(
USDHC_Type *base, uint32_t mask)
930 base->INT_STATUS_EN |= mask;
939static inline void USDHC_DisableInterruptStatus(
USDHC_Type *base, uint32_t mask)
941 base->INT_STATUS_EN &= ~mask;
950static inline void USDHC_EnableInterruptSignal(
USDHC_Type *base, uint32_t mask)
952 base->INT_SIGNAL_EN |= mask;
961static inline void USDHC_DisableInterruptSignal(
USDHC_Type *base, uint32_t mask)
963 base->INT_SIGNAL_EN &= ~mask;
979static inline uint32_t USDHC_GetEnabledInterruptStatusFlags(
USDHC_Type *base)
981 uint32_t intStatus = base->INT_STATUS;
983 return intStatus & base->INT_SIGNAL_EN;
992static inline uint32_t USDHC_GetInterruptStatusFlags(
USDHC_Type *base)
994 return base->INT_STATUS;
1003static inline void USDHC_ClearInterruptStatusFlags(
USDHC_Type *base, uint32_t mask)
1005 base->INT_STATUS = mask;
1014static inline uint32_t USDHC_GetAutoCommand12ErrorStatusFlags(
USDHC_Type *base)
1016 return base->AUTOCMD12_ERR_STATUS;
1025static inline uint32_t USDHC_GetAdmaErrorStatusFlags(
USDHC_Type *base)
1027 return base->ADMA_ERR_STATUS & 0xFUL;
1038static inline uint32_t USDHC_GetPresentStatusFlags(
USDHC_Type *base)
1040 return base->PRES_STATE;
1064static inline void USDHC_ForceClockOn(
USDHC_Type *base,
bool enable)
1068 base->VEND_SPEC |= USDHC_VEND_SPEC_FRC_SDCLK_ON_MASK;
1072 base->VEND_SPEC &= ~USDHC_VEND_SPEC_FRC_SDCLK_ON_MASK;
1106static inline void USDHC_AssertHardwareReset(
USDHC_Type *base,
bool high)
1110 base->SYS_CTRL |= USDHC_SYS_CTRL_IPP_RST_N_MASK;
1114 base->SYS_CTRL &= ~USDHC_SYS_CTRL_IPP_RST_N_MASK;
1126 base->PROT_CTRL = ((base->PROT_CTRL & ~USDHC_PROT_CTRL_DTW_MASK) |
USDHC_PROT_CTRL_DTW(width));
1137static inline void USDHC_WriteData(
USDHC_Type *base, uint32_t data)
1139 base->DATA_BUFF_ACC_PORT = data;
1150static inline uint32_t USDHC_ReadData(
USDHC_Type *base)
1152 return base->DATA_BUFF_ACC_PORT;
1170static inline void USDHC_EnableWakeupEvent(
USDHC_Type *base, uint32_t mask,
bool enable)
1174 base->PROT_CTRL |= mask;
1178 base->PROT_CTRL &= ~mask;
1188static inline void USDHC_CardDetectByData3(
USDHC_Type *base,
bool enable)
1192 base->PROT_CTRL |= USDHC_PROT_CTRL_D3CD_MASK;
1196 base->PROT_CTRL &= ~USDHC_PROT_CTRL_D3CD_MASK;
1205static inline bool USDHC_DetectCardInsert(
USDHC_Type *base)
1217static inline void USDHC_EnableSdioControl(
USDHC_Type *base, uint32_t mask,
bool enable)
1221 base->PROT_CTRL |= mask;
1225 base->PROT_CTRL &= ~mask;
1234static inline void USDHC_SetContinueRequest(
USDHC_Type *base)
1236 base->PROT_CTRL |= USDHC_PROT_CTRL_CREQ_MASK;
1245static inline void USDHC_RequestStopAtBlockGap(
USDHC_Type *base,
bool enable)
1249 base->PROT_CTRL |= USDHC_PROT_CTRL_SABGREQ_MASK;
1253 base->PROT_CTRL &= ~USDHC_PROT_CTRL_SABGREQ_MASK;
1283static inline void USDHC_EnableMmcBoot(
USDHC_Type *base,
bool enable)
1287 base->MMC_BOOT |= USDHC_MMC_BOOT_BOOT_EN_MASK;
1291 base->MMC_BOOT &= ~USDHC_MMC_BOOT_BOOT_EN_MASK;
1301static inline void USDHC_SetForceEvent(
USDHC_Type *base, uint32_t mask)
1303 base->FORCE_EVENT = mask;
1306#if !(defined(FSL_FEATURE_USDHC_HAS_NO_VOLTAGE_SELECT) && (FSL_FEATURE_USDHC_HAS_NO_VOLTAGE_SELECT))
1313static inline void UDSHC_SelectVoltage(
USDHC_Type *base,
bool en18v)
1317 base->VEND_SPEC |= USDHC_VEND_SPEC_VSELECT_MASK;
1321 base->VEND_SPEC &= ~USDHC_VEND_SPEC_VSELECT_MASK;
1326#if defined(FSL_FEATURE_USDHC_HAS_SDR50_MODE) && (FSL_FEATURE_USDHC_HAS_SDR50_MODE)
1332static inline bool USDHC_RequestTuningForSDR50(
USDHC_Type *base)
1334 return ((base->HOST_CTRL_CAP & USDHC_HOST_CTRL_CAP_USE_TUNING_SDR50_MASK) != 0UL) ? true :
false;
1342static inline bool USDHC_RequestReTuning(
USDHC_Type *base)
1344 return ((base->PRES_STATE & USDHC_PRES_STATE_RTR_MASK) != 0UL) ? true :
false;
1354static inline void USDHC_EnableAutoTuning(
USDHC_Type *base,
bool enable)
1358 base->MIX_CTRL |= USDHC_MIX_CTRL_AUTO_TUNE_EN_MASK;
1362 base->MIX_CTRL &= ~USDHC_MIX_CTRL_AUTO_TUNE_EN_MASK;
1366#if !(defined(FSL_FEATURE_USDHC_REGISTER_HOST_CTRL_CAP_HAS_NO_RETUNING_TIME_COUNTER) && \
1367 FSL_FEATURE_USDHC_REGISTER_HOST_CTRL_CAP_HAS_NO_RETUNING_TIME_COUNTER)
1374static inline void USDHC_SetRetuningTimer(
USDHC_Type *base, uint32_t counter)
1376 base->HOST_CTRL_CAP &= ~USDHC_HOST_CTRL_CAP_TIME_COUNT_RETUNING_MASK;
1386void USDHC_EnableAutoTuningForCmdAndData(
USDHC_Type *base);
1396void USDHC_EnableManualTuning(
USDHC_Type *base,
bool enable);
1404static inline uint32_t USDHC_GetTuningDelayStatus(
USDHC_Type *base)
1406 return base->CLK_TUNE_CTRL_STATUS >> 16U;
1419status_t USDHC_SetTuningDelay(
USDHC_Type *base, uint32_t preDelay, uint32_t outDelay, uint32_t postDelay);
1438static inline void USDHC_SetStandardTuningCounter(
USDHC_Type *base, uint8_t counter)
1454void USDHC_EnableStandardTuning(
USDHC_Type *base, uint32_t tuningStartTap, uint32_t step,
bool enable);
1461static inline uint32_t USDHC_GetExecuteStdTuningStatus(
USDHC_Type *base)
1463 return (base->AUTOCMD12_ERR_STATUS & USDHC_AUTOCMD12_ERR_STATUS_EXECUTE_TUNING_MASK);
1471static inline uint32_t USDHC_CheckStdTuningResult(
USDHC_Type *base)
1473 return (base->AUTOCMD12_ERR_STATUS & USDHC_AUTOCMD12_ERR_STATUS_SMP_CLK_SEL_MASK);
1481static inline uint32_t USDHC_CheckTuningError(
USDHC_Type *base)
1483 return (base->CLK_TUNE_CTRL_STATUS &
1484 (USDHC_CLK_TUNE_CTRL_STATUS_NXT_ERR_MASK | USDHC_CLK_TUNE_CTRL_STATUS_PRE_ERR_MASK));
1497#if FSL_FEATURE_USDHC_HAS_HS400_MODE
1504static inline void USDHC_EnableHS400Mode(
USDHC_Type *base,
bool enable)
1508 base->MIX_CTRL |= USDHC_MIX_CTRL_HS400_MODE_MASK;
1512 base->MIX_CTRL &= ~USDHC_MIX_CTRL_HS400_MODE_MASK;
1521static inline void USDHC_ResetStrobeDLL(
USDHC_Type *base)
1523 base->STROBE_DLL_CTRL |= USDHC_STROBE_DLL_CTRL_STROBE_DLL_CTRL_RESET_MASK;
1532static inline void USDHC_EnableStrobeDLL(
USDHC_Type *base,
bool enable)
1536 base->STROBE_DLL_CTRL |= USDHC_STROBE_DLL_CTRL_STROBE_DLL_CTRL_ENABLE_MASK;
1540 base->STROBE_DLL_CTRL &= ~USDHC_STROBE_DLL_CTRL_STROBE_DLL_CTRL_ENABLE_MASK;
1551void USDHC_ConfigStrobeDLL(
USDHC_Type *base, uint32_t delayTarget, uint32_t updateInterval);
1560static inline void USDHC_SetStrobeDllOverride(
USDHC_Type *base, uint32_t delayTaps)
1562 base->STROBE_DLL_CTRL &= (USDHC_STROBE_DLL_CTRL_STROBE_DLL_CTRL_ENABLE_MASK |
1563 USDHC_STROBE_DLL_CTRL_STROBE_DLL_CTRL_SLV_OVERRIDE_VAL_MASK);
1565 base->STROBE_DLL_CTRL |= USDHC_STROBE_DLL_CTRL_STROBE_DLL_CTRL_SLV_OVERRIDE_MASK |
1574static inline uint32_t USDHC_GetStrobeDLLStatus(
USDHC_Type *base)
1576 return base->STROBE_DLL_STATUS;
1592 uint32_t blockCount,
1593 uint32_t blockSize);
1614#if (defined FSL_USDHC_ENABLE_SCATTER_GATHER_TRANSFER) && FSL_USDHC_ENABLE_SCATTER_GATHER_TRANSFER
1698#if defined(__cplusplus)
#define USDHC_STROBE_DLL_CTRL_STROBE_DLL_CTRL_SLV_OVERRIDE_VAL(x)
Definition: MIMXRT1166_cm4.h:90296
#define USDHC_CMD_XFR_TYP_CMDTYP(x)
Definition: MIMXRT1052.h:49198
#define USDHC_CMD_XFR_TYP_RSPTYP(x)
Definition: MIMXRT1052.h:49164
#define USDHC_PROT_CTRL_DTW(x)
Definition: MIMXRT1052.h:49436
#define USDHC_TUNING_CTRL_TUNING_COUNTER(x)
Definition: MIMXRT1052.h:50904
#define USDHC_HOST_CTRL_CAP_TIME_COUNT_RETUNING(x)
Definition: MIMXRT1052.h:50240
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:225
#define MAKE_STATUS(group, code)
Construct a status code value from a group and code number.
Definition: fsl_common.h:47
@ kStatusGroup_USDHC
Definition: fsl_common.h:137
uint8_t dataType
Definition: fsl_usdhc.h:683
enum _usdhc_card_command_type usdhc_card_command_type_t
The command type.
enum _usdhc_transfer_direction usdhc_transfer_direction_t
Data transfer direction.
usdhc_data_t *volatile data
Definition: fsl_usdhc.h:752
struct _usdhc_boot_config usdhc_boot_config_t
Data structure to configure the MMC boot feature.
_usdhc_boot_mode
MMC card boot mode.
Definition: fsl_usdhc.h:370
struct _usdhc_transfer_callback usdhc_transfer_callback_t
USDHC callback functions.
struct _usdhc_scatter_gather_data usdhc_scatter_gather_data_t
Card scatter gather data descriptor.
bool enableAutoStopAtBlockGap
Definition: fsl_usdhc.h:613
void USDHC_SetDataConfig(USDHC_Type *base, usdhc_transfer_direction_t dataDirection, uint32_t blockCount, uint32_t blockSize)
USDHC data configuration.
Definition: fsl_usdhc.c:340
USDHC_Type * base
Definition: fsl_usdhc.h:768
void(* BlockGap)(USDHC_Type *base, void *userData)
Definition: fsl_usdhc.h:732
usdhc_transfer_function_t transfer
Definition: fsl_usdhc.h:772
usdhc_card_response_type_t responseType
Definition: fsl_usdhc.h:639
usdhc_card_command_type_t type
Definition: fsl_usdhc.h:638
uint8_t dataType
Definition: fsl_usdhc.h:708
enum _usdhc_dma_mode usdhc_dma_mode_t
DMA mode.
uint32_t sdVersion
Definition: fsl_usdhc.h:598
void(* ReTuning)(USDHC_Type *base, void *userData)
Definition: fsl_usdhc.h:737
usdhc_data_t * data
Definition: fsl_usdhc.h:718
usdhc_burst_len_t burstLen
Definition: fsl_usdhc.h:651
uint32_t maxBlockLength
Definition: fsl_usdhc.h:600
usdhc_command_t * command
Definition: fsl_usdhc.h:693
usdhc_command_t *volatile command
Definition: fsl_usdhc.h:754
uint32_t * admaTable
Definition: fsl_usdhc.h:653
uint8_t readBurstLen
Definition: fsl_usdhc.h:624
void USDHC_Init(USDHC_Type *base, const usdhc_config_t *config)
USDHC module initialization function.
Definition: fsl_usdhc.c:831
uint32_t admaTableWords
Definition: fsl_usdhc.h:654
uint32_t USDHC_SetSdClock(USDHC_Type *base, uint32_t srcClock_Hz, uint32_t busClock_Hz)
Sets the SD bus clock frequency.
Definition: fsl_usdhc.c:982
bool enableIgnoreError
Definition: fsl_usdhc.h:707
uint8_t writeBurstLen
Definition: fsl_usdhc.h:625
struct _usdhc_scatter_gather_data_list usdhc_scatter_gather_data_list_t
Card scatter gather data list.
size_t blockSize
Definition: fsl_usdhc.h:684
size_t blockSize
Definition: fsl_usdhc.h:611
void(* TransferComplete)(USDHC_Type *base, usdhc_handle_t *handle, status_t status, void *userData)
Definition: fsl_usdhc.h:733
bool USDHC_SetCardActive(USDHC_Type *base, uint32_t timeout)
Sends 80 clocks to the card to set it to the active state.
Definition: fsl_usdhc.c:1103
bool USDHC_Reset(USDHC_Type *base, uint32_t mask, uint32_t timeout)
Resets the USDHC.
Definition: fsl_usdhc.c:916
status_t USDHC_TransferBlocking(USDHC_Type *base, usdhc_adma_config_t *dmaConfig, usdhc_transfer_t *transfer)
Transfers the command/data using a blocking method.
Definition: fsl_usdhc.c:1549
size_t blockSize
Definition: fsl_usdhc.h:709
status_t USDHC_SetADMA2Descriptor(uint32_t *admaTable, uint32_t admaTableWords, const uint32_t *dataBufferAddr, uint32_t dataBytes, uint32_t flags)
Sets the ADMA2 descriptor table configuration.
Definition: fsl_usdhc.c:1302
void USDHC_TransferHandleIRQ(USDHC_Type *base, usdhc_handle_t *handle)
IRQ handler for the USDHC.
Definition: fsl_usdhc.c:2417
void(* CardInserted)(USDHC_Type *base, void *userData)
Definition: fsl_usdhc.h:728
usdhc_transfer_direction_t dataDirection
Definition: fsl_usdhc.h:682
enum _usdhc_burst_len usdhc_burst_len_t
DMA transfer burst len config.
void USDHC_EnableDDRMode(USDHC_Type *base, bool enable, uint32_t nibblePos)
The enable/disable DDR mode.
Definition: fsl_usdhc.c:1126
void USDHC_SendCommand(USDHC_Type *base, usdhc_command_t *command)
Sends command function.
Definition: fsl_usdhc.c:659
_usdhc_dma_mode
DMA mode.
Definition: fsl_usdhc.h:349
usdhc_scatter_gather_data_list_t sgData
Definition: fsl_usdhc.h:686
const uint32_t * address
Definition: fsl_usdhc.h:588
usdhc_dma_mode_t dmaMode
Definition: fsl_usdhc.h:649
void USDHC_SetMmcBootConfig(USDHC_Type *base, const usdhc_boot_config_t *config)
Configures the MMC boot feature.
Definition: fsl_usdhc.c:1171
struct _usdhc_capability usdhc_capability_t
USDHC capability information.
usdhc_endian_mode_t endianMode
Definition: fsl_usdhc.h:620
bool enableAutoCommand12
Definition: fsl_usdhc.h:678
struct _usdhc_command usdhc_command_t
Card command descriptor.
uint32_t ackTimeoutCount
Definition: fsl_usdhc.h:608
uint8_t readWatermarkLevel
Definition: fsl_usdhc.h:621
bool enableAutoCommand23
Definition: fsl_usdhc.h:679
void USDHC_Deinit(USDHC_Type *base)
Deinitializes the USDHC.
Definition: fsl_usdhc.c:899
struct _usdhc_config usdhc_config_t
Data structure to initialize the USDHC.
uint32_t * rxData
Definition: fsl_usdhc.h:711
volatile uint32_t transferredWords
Definition: fsl_usdhc.h:756
void USDHC_GetCapability(USDHC_Type *base, usdhc_capability_t *capability)
Gets the capability information.
Definition: fsl_usdhc.c:942
struct _usdhc_host usdhc_host_t
USDHC host descriptor.
_usdhc_burst_len
DMA transfer burst len config.
Definition: fsl_usdhc.h:566
uint32_t index
Definition: fsl_usdhc.h:636
bool enableBootAck
Definition: fsl_usdhc.h:612
uint32_t blockCount
Definition: fsl_usdhc.h:710
uint32_t responseErrorFlags
Definition: fsl_usdhc.h:641
enum _usdhc_boot_mode usdhc_boot_mode_t
MMC card boot mode.
_usdhc_card_response_type
The command response type.
Definition: fsl_usdhc.h:391
bool enableAutoCommand23
Definition: fsl_usdhc.h:706
usdhc_config_t config
Definition: fsl_usdhc.h:770
usdhc_boot_mode_t bootMode
Definition: fsl_usdhc.h:609
struct _usdhc_adma_config usdhc_adma_config_t
ADMA configuration.
void(* SdioInterrupt)(USDHC_Type *base, void *userData)
Definition: fsl_usdhc.h:731
uint32_t response[4U]
Definition: fsl_usdhc.h:640
_usdhc_data_bus_width
Data transfer width.
Definition: fsl_usdhc.h:333
struct _usdhc_transfer usdhc_transfer_t
Transfer state.
uint32_t maxBlockCount
Definition: fsl_usdhc.h:601
bool enableAutoCommand12
Definition: fsl_usdhc.h:705
usdhc_capability_t capability
Definition: fsl_usdhc.h:771
_usdhc_card_command_type
The command type.
Definition: fsl_usdhc.h:377
enum _usdhc_data_bus_width usdhc_data_bus_width_t
Data transfer width.
uint32_t argument
Definition: fsl_usdhc.h:637
uint32_t flags
Definition: fsl_usdhc.h:602
uint8_t writeWatermarkLevel
Definition: fsl_usdhc.h:622
uint32_t attribute
Definition: fsl_usdhc.h:587
status_t USDHC_SetADMA1Descriptor(uint32_t *admaTable, uint32_t admaTableWords, const uint32_t *dataBufferAddr, uint32_t dataBytes, uint32_t flags)
Sets the ADMA1 descriptor table configuration.
Definition: fsl_usdhc.c:1215
usdhc_scatter_gather_data_t * data
Definition: fsl_usdhc.h:692
status_t USDHC_SetInternalDmaConfig(USDHC_Type *base, usdhc_adma_config_t *dmaConfig, const uint32_t *dataAddr, bool enAutoCmd23)
Internal DMA configuration. This function is used to config the USDHC DMA related registers.
Definition: fsl_usdhc.c:1413
status_t USDHC_TransferNonBlocking(USDHC_Type *base, usdhc_handle_t *handle, usdhc_adma_config_t *dmaConfig, usdhc_transfer_t *transfer)
Transfers the command/data using an interrupt and an asynchronous method.
Definition: fsl_usdhc.c:1858
usdhc_command_t * command
Definition: fsl_usdhc.h:719
_usdhc_endian_mode
Endian mode.
Definition: fsl_usdhc.h:341
struct _usdhc_adma2_descriptor usdhc_adma2_descriptor_t
Defines the ADMA2 descriptor structure.
uint32_t sourceClock_Hz
Definition: fsl_usdhc.h:769
bool enableIgnoreError
Definition: fsl_usdhc.h:680
uint32_t blockCount
Definition: fsl_usdhc.h:610
enum _usdhc_endian_mode usdhc_endian_mode_t
Endian mode.
struct _usdhc_scatter_gather_transfer usdhc_scatter_gather_transfer_t
usdhc scatter gather transfer.
usdhc_transfer_callback_t callback
Definition: fsl_usdhc.h:758
_usdhc_transfer_direction
Data transfer direction.
Definition: fsl_usdhc.h:326
uint32_t flags
Definition: fsl_usdhc.h:643
void * userData
Definition: fsl_usdhc.h:759
uint32_t usdhc_adma1_descriptor_t
Defines the ADMA1 descriptor structure.
Definition: fsl_usdhc.h:582
status_t(* usdhc_transfer_function_t)(USDHC_Type *base, usdhc_transfer_t *content)
USDHC transfer function.
Definition: fsl_usdhc.h:763
struct _usdhc_data usdhc_data_t
Card data descriptor.
void USDHC_TransferCreateHandle(USDHC_Type *base, usdhc_handle_t *handle, const usdhc_transfer_callback_t *callback, void *userData)
Creates the USDHC handle.
Definition: fsl_usdhc.c:2380
uint32_t mmcVersion
Definition: fsl_usdhc.h:599
const uint32_t * txData
Definition: fsl_usdhc.h:712
void(* CardRemoved)(USDHC_Type *base, void *userData)
Definition: fsl_usdhc.h:730
uint32_t dataTimeout
Definition: fsl_usdhc.h:619
enum _usdhc_card_response_type usdhc_card_response_type_t
The command response type.
status_t USDHC_SetAdmaTableConfig(USDHC_Type *base, usdhc_adma_config_t *dmaConfig, usdhc_data_t *dataConfig, uint32_t flags)
Sets the DMA descriptor table configuration. A high level DMA descriptor configuration function.
Definition: fsl_usdhc.c:1479
@ kUSDHC_BootModeAlternative
Definition: fsl_usdhc.h:372
@ kUSDHC_BootModeNormal
Definition: fsl_usdhc.h:371
@ kUSDHC_ResetCommand
Definition: fsl_usdhc.h:102
@ kUSDHC_ResetsAll
Definition: fsl_usdhc.h:111
@ kUSDHC_ResetAll
Definition: fsl_usdhc.h:101
@ kUSDHC_ResetTuning
Definition: fsl_usdhc.h:108
@ kUSDHC_ResetData
Definition: fsl_usdhc.h:103
@ kUSDHC_ExecuteTuning
Definition: fsl_usdhc.h:249
@ kUSDHC_TuningSampleClockSel
Definition: fsl_usdhc.h:250
@ kUSDHC_DmaModeSimple
Definition: fsl_usdhc.h:350
@ kUSDHC_ExternalDMA
Definition: fsl_usdhc.h:353
@ kUSDHC_DmaModeAdma2
Definition: fsl_usdhc.h:352
@ kUSDHC_DmaModeAdma1
Definition: fsl_usdhc.h:351
@ kUSDHC_WakeupEventOnCardInsert
Definition: fsl_usdhc.h:89
@ kUSDHC_WakeupEventsAll
Definition: fsl_usdhc.h:91
@ kUSDHC_WakeupEventOnCardInt
Definition: fsl_usdhc.h:88
@ kUSDHC_WakeupEventOnCardRemove
Definition: fsl_usdhc.h:90
@ kUSDHC_Data5LineLevelFlag
Definition: fsl_usdhc.h:169
@ kUSDHC_DataInhibitFlag
Definition: fsl_usdhc.h:145
@ kUSDHC_CommandLineLevelFlag
Definition: fsl_usdhc.h:162
@ kUSDHC_Data0LineLevelFlag
Definition: fsl_usdhc.h:164
@ kUSDHC_Data3LineLevelFlag
Definition: fsl_usdhc.h:167
@ kUSDHC_CardInsertedFlag
Definition: fsl_usdhc.h:161
@ kUSDHC_CommandInhibitFlag
Definition: fsl_usdhc.h:144
@ kUSDHC_WriteTransferActiveFlag
Definition: fsl_usdhc.h:148
@ kUSDHC_Data6LineLevelFlag
Definition: fsl_usdhc.h:170
@ kUSDHC_DelaySettingFinishedFlag
Definition: fsl_usdhc.h:158
@ kUSDHC_ReadTransferActiveFlag
Definition: fsl_usdhc.h:149
@ kUSDHC_Data2LineLevelFlag
Definition: fsl_usdhc.h:166
@ kUSDHC_ReTuningRequestFlag
Definition: fsl_usdhc.h:157
@ kUSDHC_BufferReadEnableFlag
Definition: fsl_usdhc.h:151
@ kUSDHC_DataLineActiveFlag
Definition: fsl_usdhc.h:146
@ kUSDHC_BufferWriteEnableFlag
Definition: fsl_usdhc.h:150
@ kUSDHC_SdClockStableFlag
Definition: fsl_usdhc.h:147
@ kUSDHC_Data7LineLevelFlag
Definition: fsl_usdhc.h:171
@ kUSDHC_Data4LineLevelFlag
Definition: fsl_usdhc.h:168
@ kUSDHC_Data1LineLevelFlag
Definition: fsl_usdhc.h:165
@ kStatus_USDHC_PrepareAdmaDescriptorFailed
Definition: fsl_usdhc.h:40
@ kStatus_USDHC_TransferDataFailed
Definition: fsl_usdhc.h:42
@ kStatus_USDHC_SendCommandFailed
Definition: fsl_usdhc.h:41
@ kStatus_USDHC_TransferDMAComplete
Definition: fsl_usdhc.h:49
@ kStatus_USDHC_TransferDataComplete
Definition: fsl_usdhc.h:47
@ kStatus_USDHC_ReTuningRequest
Definition: fsl_usdhc.h:44
@ kStatus_USDHC_BusyTransferring
Definition: fsl_usdhc.h:39
@ kStatus_USDHC_SendCommandSuccess
Definition: fsl_usdhc.h:48
@ kStatus_USDHC_TuningError
Definition: fsl_usdhc.h:45
@ kStatus_USDHC_DMADataAddrNotAlign
Definition: fsl_usdhc.h:43
@ kStatus_USDHC_NotSupport
Definition: fsl_usdhc.h:46
@ kUSDHC_StopAtBlockGapFlag
Definition: fsl_usdhc.h:361
@ kUSDHC_InterruptAtBlockGapFlag
Definition: fsl_usdhc.h:363
@ kUSDHC_ReadDoneNo8CLK
Definition: fsl_usdhc.h:364
@ kUSDHC_ReadWaitControlFlag
Definition: fsl_usdhc.h:362
@ kUSDHC_ExactBlockNumberReadFlag
Definition: fsl_usdhc.h:365
@ kUSDHC_EnBurstLenForINCR4816
Definition: fsl_usdhc.h:568
@ kUSDHC_EnBurstLenForINCR4816WRAP
Definition: fsl_usdhc.h:569
@ kUSDHC_EnBurstLenForINCR
Definition: fsl_usdhc.h:567
@ kUSDHC_SupportDmaFlag
Definition: fsl_usdhc.h:59
@ kUSDHC_SupportHighSpeedFlag
Definition: fsl_usdhc.h:58
@ kUSDHC_SupportV300Flag
Definition: fsl_usdhc.h:62
@ kUSDHC_SupportAdmaFlag
Definition: fsl_usdhc.h:57
@ kUSDHC_Support8BitFlag
Definition: fsl_usdhc.h:66
@ kUSDHC_SupportSDR50Flag
Definition: fsl_usdhc.h:79
@ kUSDHC_SupportV330Flag
Definition: fsl_usdhc.h:61
@ kUSDHC_SupportDDR50Flag
Definition: fsl_usdhc.h:68
@ kUSDHC_SupportV180Flag
Definition: fsl_usdhc.h:63
@ kUSDHC_SupportSDR104Flag
Definition: fsl_usdhc.h:74
@ kUSDHC_SupportSuspendResumeFlag
Definition: fsl_usdhc.h:60
@ kUSDHC_Support4BitFlag
Definition: fsl_usdhc.h:64
@ kCARD_ResponseTypeR6
Definition: fsl_usdhc.h:400
@ kCARD_ResponseTypeR7
Definition: fsl_usdhc.h:401
@ kCARD_ResponseTypeNone
Definition: fsl_usdhc.h:392
@ kCARD_ResponseTypeR1
Definition: fsl_usdhc.h:393
@ kCARD_ResponseTypeR1b
Definition: fsl_usdhc.h:394
@ kCARD_ResponseTypeR4
Definition: fsl_usdhc.h:397
@ kCARD_ResponseTypeR5
Definition: fsl_usdhc.h:398
@ kCARD_ResponseTypeR2
Definition: fsl_usdhc.h:395
@ kCARD_ResponseTypeR3
Definition: fsl_usdhc.h:396
@ kCARD_ResponseTypeR5b
Definition: fsl_usdhc.h:399
@ kUSDHC_DataBusWidth4Bit
Definition: fsl_usdhc.h:335
@ kUSDHC_DataBusWidth8Bit
Definition: fsl_usdhc.h:336
@ kUSDHC_DataBusWidth1Bit
Definition: fsl_usdhc.h:334
@ kUSDHC_CommandTypeResumeFlag
Definition: fsl_usdhc.h:121
@ kUSDHC_MultipleBlockFlag
Definition: fsl_usdhc.h:127
@ kUSDHC_CommandTypeAbortFlag
Definition: fsl_usdhc.h:122
@ kUSDHC_EnableAutoCommand12Flag
Definition: fsl_usdhc.h:125
@ kUSDHC_EnableDmaFlag
Definition: fsl_usdhc.h:118
@ kUSDHC_ResponseLength136Flag
Definition: fsl_usdhc.h:130
@ kUSDHC_EnableAutoCommand23Flag
Definition: fsl_usdhc.h:128
@ kUSDHC_EnableCrcCheckFlag
Definition: fsl_usdhc.h:134
@ kUSDHC_ResponseLength48Flag
Definition: fsl_usdhc.h:131
@ kUSDHC_DataReadFlag
Definition: fsl_usdhc.h:126
@ kUSDHC_EnableBlockCountFlag
Definition: fsl_usdhc.h:124
@ kUSDHC_ResponseLength48BusyFlag
Definition: fsl_usdhc.h:132
@ kUSDHC_DataPresentFlag
Definition: fsl_usdhc.h:136
@ kUSDHC_EnableIndexCheckFlag
Definition: fsl_usdhc.h:135
@ kUSDHC_CommandTypeSuspendFlag
Definition: fsl_usdhc.h:120
@ kCARD_CommandTypeResume
Definition: fsl_usdhc.h:380
@ kCARD_CommandTypeSuspend
Definition: fsl_usdhc.h:379
@ kCARD_CommandTypeEmpty
Definition: fsl_usdhc.h:382
@ kCARD_CommandTypeAbort
Definition: fsl_usdhc.h:381
@ kCARD_CommandTypeNormal
Definition: fsl_usdhc.h:378
@ kUSDHC_AdmaDescriptorErrorFlag
Definition: fsl_usdhc.h:262
@ kUSDHC_AdmaLenghMismatchFlag
Definition: fsl_usdhc.h:261
@ kUSDHC_AutoCommand12CrcErrorFlag
Definition: fsl_usdhc.h:237
@ kUSDHC_AutoCommand12EndBitErrorFlag
Definition: fsl_usdhc.h:236
@ kUSDHC_AutoCommand12NotIssuedFlag
Definition: fsl_usdhc.h:239
@ kUSDHC_AutoCommand12TimeoutFlag
Definition: fsl_usdhc.h:235
@ kUSDHC_AutoCommand12IndexErrorFlag
Definition: fsl_usdhc.h:238
@ kUSDHC_AutoCommand12NotExecutedFlag
Definition: fsl_usdhc.h:234
@ kUSDHC_EndianModeLittle
Definition: fsl_usdhc.h:344
@ kUSDHC_EndianModeBig
Definition: fsl_usdhc.h:342
@ kUSDHC_EndianModeHalfWordBig
Definition: fsl_usdhc.h:343
@ kUSDHC_ErrorFlag
Definition: fsl_usdhc.h:213
@ kUSDHC_DataCrcErrorFlag
Definition: fsl_usdhc.h:204
@ kUSDHC_CommandErrorFlag
Definition: fsl_usdhc.h:209
@ kUSDHC_CommandFlag
Definition: fsl_usdhc.h:220
@ kUSDHC_CommandEndBitErrorFlag
Definition: fsl_usdhc.h:201
@ kUSDHC_AutoCommand12ErrorFlag
Definition: fsl_usdhc.h:206
@ kUSDHC_AllInterruptFlags
Definition: fsl_usdhc.h:224
@ kUSDHC_DataFlag
Definition: fsl_usdhc.h:215
@ kUSDHC_CardRemovalFlag
Definition: fsl_usdhc.h:186
@ kUSDHC_TuningPassFlag
Definition: fsl_usdhc.h:195
@ kUSDHC_CardInsertionFlag
Definition: fsl_usdhc.h:185
@ kUSDHC_CardDetectFlag
Definition: fsl_usdhc.h:221
@ kUSDHC_CommandIndexErrorFlag
Definition: fsl_usdhc.h:202
@ kUSDHC_SDR104TuningFlag
Definition: fsl_usdhc.h:222
@ kUSDHC_DataDMAFlag
Definition: fsl_usdhc.h:218
@ kUSDHC_BufferWriteReadyFlag
Definition: fsl_usdhc.h:183
@ kUSDHC_BufferReadReadyFlag
Definition: fsl_usdhc.h:184
@ kUSDHC_DmaCompleteFlag
Definition: fsl_usdhc.h:182
@ kUSDHC_CommandTimeoutFlag
Definition: fsl_usdhc.h:199
@ kUSDHC_BlockGapEventFlag
Definition: fsl_usdhc.h:181
@ kUSDHC_CommandCrcErrorFlag
Definition: fsl_usdhc.h:200
@ kUSDHC_DataTimeoutFlag
Definition: fsl_usdhc.h:203
@ kUSDHC_CommandCompleteFlag
Definition: fsl_usdhc.h:179
@ kUSDHC_DataEndBitErrorFlag
Definition: fsl_usdhc.h:205
@ kUSDHC_ReTuningEventFlag
Definition: fsl_usdhc.h:194
@ kUSDHC_DataErrorFlag
Definition: fsl_usdhc.h:211
@ kUSDHC_DmaErrorFlag
Definition: fsl_usdhc.h:207
@ kUSDHC_TuningErrorFlag
Definition: fsl_usdhc.h:196
@ kUSDHC_CardInterruptFlag
Definition: fsl_usdhc.h:187
@ kUSDHC_DataCompleteFlag
Definition: fsl_usdhc.h:180
@ kUSDHC_TransferDataNormal
Definition: fsl_usdhc.h:575
@ kUSDHC_TransferDataTuning
Definition: fsl_usdhc.h:576
@ kUSDHC_TransferDataBoot
Definition: fsl_usdhc.h:577
@ kUSDHC_TransferDataBootcontinous
Definition: fsl_usdhc.h:578
@ kUSDHC_ForceEventAutoCommand12Error
Definition: fsl_usdhc.h:305
@ kUSDHC_ForceEventAutoCommand12IndexError
Definition: fsl_usdhc.h:296
@ kUSDHC_ForceEventDataTimeout
Definition: fsl_usdhc.h:302
@ kUSDHC_ForceEventAutoCommand12NotIssued
Definition: fsl_usdhc.h:297
@ kUSDHC_ForceEventsAll
Definition: fsl_usdhc.h:314
@ kUSDHC_ForceEventCommandTimeout
Definition: fsl_usdhc.h:298
@ kUSDHC_ForceEventEndBitError
Definition: fsl_usdhc.h:295
@ kUSDHC_ForceEventCommandEndBitError
Definition: fsl_usdhc.h:300
@ kUSDHC_ForceEventCommandIndexError
Definition: fsl_usdhc.h:301
@ kUSDHC_ForceEventTuningError
Definition: fsl_usdhc.h:311
@ kUSDHC_ForceEventAutoCommand12NotExecuted
Definition: fsl_usdhc.h:291
@ kUSDHC_ForceEventCommandCrcError
Definition: fsl_usdhc.h:299
@ kUSDHC_ForceEventDataEndBitError
Definition: fsl_usdhc.h:304
@ kUSDHC_ForceEventAutoCommand12Timeout
Definition: fsl_usdhc.h:293
@ kUSDHC_ForceEventDataCrcError
Definition: fsl_usdhc.h:303
@ kUSDHC_ForceEventAutoCommand12CrcError
Definition: fsl_usdhc.h:294
@ kUSDHC_ForceEventCardInt
Definition: fsl_usdhc.h:306
@ kUSDHC_ForceEventDmaError
Definition: fsl_usdhc.h:307
@ kUSDHC_TransferDirectionSend
Definition: fsl_usdhc.h:328
@ kUSDHC_TransferDirectionReceive
Definition: fsl_usdhc.h:327
@ kUSDHC_Adma1DescriptorInterrupFlag
Definition: fsl_usdhc.h:473
@ kUSDHC_Adma1DescriptorTypeLink
Definition: fsl_usdhc.h:479
@ kUSDHC_Adma1DescriptorEndFlag
Definition: fsl_usdhc.h:472
@ kUSDHC_Adma1DescriptorActivity2Flag
Definition: fsl_usdhc.h:475
@ kUSDHC_Adma1DescriptorTypeNop
Definition: fsl_usdhc.h:476
@ kUSDHC_Adma1DescriptorTypeTransfer
Definition: fsl_usdhc.h:477
@ kUSDHC_Adma1DescriptorTypeSetLength
Definition: fsl_usdhc.h:481
@ kUSDHC_Adma1DescriptorActivity1Flag
Definition: fsl_usdhc.h:474
@ kUSDHC_Adma1DescriptorValidFlag
Definition: fsl_usdhc.h:471
@ kUSDHC_AdmaErrorStateFetchDescriptor
Definition: fsl_usdhc.h:274
@ kUSDHC_AdmaErrorState
Definition: fsl_usdhc.h:282
@ kUSDHC_AdmaErrorStateTransferData
Definition: fsl_usdhc.h:277
@ kUSDHC_AdmaErrorStateInvalidDescriptor
Definition: fsl_usdhc.h:280
@ kUSDHC_AdmaErrorStateInvalidLength
Definition: fsl_usdhc.h:279
@ kUSDHC_AdmaErrorStateChangeAddress
Definition: fsl_usdhc.h:276
@ kUSDHC_AdmaErrorStateStopDma
Definition: fsl_usdhc.h:272
@ kUSDHC_AdmaDescriptorSingleFlag
Definition: fsl_usdhc.h:554
@ kUSDHC_AdmaDescriptorMultipleFlag
Definition: fsl_usdhc.h:557
@ kUSDHC_Adma2DescriptorEndFlag
Definition: fsl_usdhc.h:535
@ kUSDHC_Adma2DescriptorInterruptFlag
Definition: fsl_usdhc.h:536
@ kUSDHC_Adma2DescriptorTypeReserved
Definition: fsl_usdhc.h:541
@ kUSDHC_Adma2DescriptorValidFlag
Definition: fsl_usdhc.h:534
@ kUSDHC_Adma2DescriptorTypeNop
Definition: fsl_usdhc.h:540
@ kUSDHC_Adma2DescriptorActivity2Flag
Definition: fsl_usdhc.h:538
@ kUSDHC_Adma2DescriptorTypeLink
Definition: fsl_usdhc.h:545
@ kUSDHC_Adma2DescriptorActivity1Flag
Definition: fsl_usdhc.h:537
@ kUSDHC_Adma2DescriptorTypeTransfer
Definition: fsl_usdhc.h:543
Definition: MIMXRT1052.h:49060
Defines the ADMA2 descriptor structure.
Definition: fsl_usdhc.h:586
ADMA configuration.
Definition: fsl_usdhc.h:648
Data structure to configure the MMC boot feature.
Definition: fsl_usdhc.h:607
USDHC capability information.
Definition: fsl_usdhc.h:597
Card command descriptor.
Definition: fsl_usdhc.h:635
Data structure to initialize the USDHC.
Definition: fsl_usdhc.h:618
Card data descriptor.
Definition: fsl_usdhc.h:704
USDHC handle.
Definition: fsl_usdhc.h:748
USDHC host descriptor.
Definition: fsl_usdhc.h:767
Card scatter gather data list.
Definition: fsl_usdhc.h:663
Card scatter gather data descriptor.
Definition: fsl_usdhc.h:677
usdhc scatter gather transfer.
Definition: fsl_usdhc.h:691
USDHC callback functions.
Definition: fsl_usdhc.h:727
Transfer state.
Definition: fsl_usdhc.h:717
Definition: deflate.c:114