| sdps Vitis Drivers API Documentation

- Overview
- Data Structures
- APIs
- File List
- Examples

Data Structures | Macros | Functions | Variables
SDPS APIs

## Data Structures
struct | XSdPs_Config
| This typedef contains configuration information for the device. More...
struct | __attribute__
| ADMA2 32-Bit descriptor table. More...
struct | XSdPs
| The XSdPs driver instance data. More...

## Macros
#define | XSDPS_CT_ERROR 0x2L
| Command timeout flag. More...
#define | MAX_TUNING_COUNT 40U
| Maximum Tuning count. More...
#define | MAX_TIMEOUT 0x1FFFFFFFU
| Maximum Timeout. More...
#define | XSDPS_CMD8_VOL_PATTERN 0x1AAU
| CMD8 voltage pattern. More...
#define | XSDPS_RESPOCR_READY 0x80000000U
| Ready response. More...
#define | XSDPS_ACMD41_HCS 0x40000000U
| High Capacity Support. More...
#define | XSDPS_ACMD41_3V3 0x00300000U
| 3.3 voltage support More...
#define | XSDPS_CMD1_HIGH_VOL 0x00FF8000U
| CMD1 for High voltage. More...
#define | XSDPS_CMD1_DUAL_VOL 0x00FF8010U
| CMD1 for Dual voltage. More...
#define | HIGH_SPEED_SUPPORT 0x2U
| High Speed support. More...
#define | UHS_SDR12_SUPPORT 0x1U
| SDR12 support. More...
#define | UHS_SDR25_SUPPORT 0x2U
| SDR25 support. More...
#define | UHS_SDR50_SUPPORT 0x4U
| SDR50 support. More...
#define | UHS_SDR104_SUPPORT 0x8U
| SDR104 support. More...
#define | UHS_DDR50_SUPPORT 0x10U
| DDR50 support. More...
#define | WIDTH_4_BIT_SUPPORT 0x4U
| 4-bit width support More...
#define | SD_CLK_25_MHZ 25000000U
| 25MHz clock More...
#define | SD_CLK_19_MHZ 19000000U
| 19MHz clock More...
#define | SD_CLK_26_MHZ 26000000U
| 26MHz clock More...
#define | EXT_CSD_DEVICE_TYPE_BYTE 196U
| CSD Device Type byte number. More...
#define | EXT_CSD_SEC_COUNT_BYTE1 212U
| CSD Sector count byte 1. More...
#define | EXT_CSD_SEC_COUNT_BYTE2 213U
| CSD Sector count byte 2. More...
#define | EXT_CSD_SEC_COUNT_BYTE3 214U
| CSD Sector count byte 3. More...
#define | EXT_CSD_SEC_COUNT_BYTE4 215U
| CSD Sector count byte 4. More...
#define | EXT_CSD_DEVICE_TYPE_HIGH_SPEED 0x2U
| CSD Device type HS. More...
#define | EXT_CSD_DEVICE_TYPE_DDR_1V8_HIGH_SPEED 0x4U
| CSD Dev type DDR 1.8v speed. More...
#define | EXT_CSD_DEVICE_TYPE_DDR_1V2_HIGH_SPEED 0x8U
| CSD Dev type DDR 1.2v speed. More...
#define | EXT_CSD_DEVICE_TYPE_SDR_1V8_HS200 0x10U
| CSD SDR 1.8v HS200. More...
#define | EXT_CSD_DEVICE_TYPE_SDR_1V2_HS200 0x20U
| CSD SDR 1.2v HS200. More...
#define | EXT_CSD_DEVICE_TYPE_DDR_1V8_HS400 0x40U
| CSD SDR 1.8v HS400. More...
#define | EXT_CSD_DEVICE_TYPE_DDR_1V2_HS400 0x80U
| CSD SDR 1.2v HS400. More...
#define | CSD_SPEC_VER_3 0x3U
| CSD card spec ver 3. More...
#define | SCR_SPEC_VER_3 0x80U
| SCR spec ver 3. More...
#define | ADDRESS_BEYOND_32BIT 0x100000000U
| Macro used for beyond 32-bit addr. More...
#define | XSDPS_ZYNQMP_SD0_BASE 0xFF160000U
| ZynqMP SD0 Baseaddress. More...
#define | XSDPS_ZYNQMP_SD1_BASE 0xFF170000U
| ZynqMP SD1 Baseaddress. More...
#define | XSDPS_VERSAL_SD0_BASE 0xF1040000U
| Versal SD0 Baseaddress. More...
#define | XSDPS_VERSAL_SD1_BASE 0xF1050000U
| Versal SD1 Baseaddress. More...
#define | ENABLE_HS400_MODE
| Enable eMMC HS400 mode for Versal Net platform. More...

## Functions
s32 | XSdPs_CfgInitialize (XSdPs *InstancePtr, XSdPs_Config *ConfigPtr, UINTPTR EffectiveAddr)
| Initializes a specific XSdPs instance so that the driver is ready to use. More...
s32 | XSdPs_CardInitialize (XSdPs *InstancePtr)
| Initializes Card with Identification mode sequence. More...
s32 | XSdPs_ReadPolled (XSdPs *InstancePtr, u32 Arg, u32 BlkCnt, u8 *Buff)
| Performs SD read in polled mode. More...
s32 | XSdPs_WritePolled (XSdPs *InstancePtr, u32 Arg, u32 BlkCnt, const u8 *Buff)
| Performs SD write in polled mode. More...
s32 | XSdPs_Idle (XSdPs *InstancePtr)
| API to idle the SDIO Interface. More...
s32 | XSdPs_Erase (XSdPs *InstancePtr, u32 StartAddr, u32 EndAddr)
| Performs Erase operation on the given address range. More...
s32 | XSdPs_Sanitize (XSdPs *InstancePtr)
| Performs Sanitize operation on the unmapped user address range. More...
XSdPs_Config * | XSdPs_LookupConfig (u16 DeviceId)
| Looks up the device configuration based on the unique device ID. More...
s32 | XSdPs_Change_BusSpeed (XSdPs *InstancePtr)
| Sets high speed in card and host. More...
s32 | XSdPs_Change_ClkFreq (XSdPs *InstancePtr, u32 SelFreq)
| API to change clock frequency to a given value. More...
s32 | XSdPs_Pullup (XSdPs *InstancePtr)
| Sends pullup command to card before using DAT line 3(using 4-bit bus). More...
s32 | XSdPs_Get_BusWidth (XSdPs *InstancePtr, u8 *ReadBuff)
| Gets bus width support by card. More...
s32 | XSdPs_Change_BusWidth (XSdPs *InstancePtr)
| Sets bus width to 4-bit in card and host. More...
s32 | XSdPs_Get_BusSpeed (XSdPs *InstancePtr, u8 *ReadBuff)
| Gets bus speed supported by card. More...
s32 | XSdPs_Get_Mmc_ExtCsd (XSdPs *InstancePtr, u8 *ReadBuff)
| Gets EXT_CSD register of eMMC. More...
s32 | XSdPs_Set_Mmc_ExtCsd (XSdPs *InstancePtr, u32 Arg)
| Writes EXT_CSD register of eMMC. More...
s32 | XSdPs_SetBlkSize (XSdPs *InstancePtr, u16 BlkSize)
| Updates Block size for read/write operations. More...
s32 | XSdPs_Get_Status (XSdPs *InstancePtr, u8 *SdStatReg)
| Gets SD card status information. More...
s32 | XSdPs_Select_Card (XSdPs *InstancePtr)
| Selects card and sets default block size. More...
s32 | XSdPs_StartReadTransfer (XSdPs *InstancePtr, u32 Arg, u32 BlkCnt, u8 *Buff)
| Performs SD read in polled mode. More...
s32 | XSdPs_CheckReadTransfer (XSdPs *InstancePtr)
| Checks if the transfer is completed successfully. More...
s32 | XSdPs_StartWriteTransfer (XSdPs *InstancePtr, u32 Arg, u32 BlkCnt, u8 *Buff)
| Starts SD write transfer. More...
s32 | XSdPs_CheckWriteTransfer (XSdPs *InstancePtr)
| Checks for the write transfer completed. More...
s32 | XSdPs_Read (XSdPs *InstancePtr, u32 Arg, u32 BlkCnt, u8 *Buff)
| Performs SD read in polled mode. More...
s32 | XSdPs_Write (XSdPs *InstancePtr, u32 Arg, u32 BlkCnt, const u8 *Buff)
| Performs SD write in polled mode. More...
s32 | XSdPs_CheckTransferComplete (XSdPs *InstancePtr)
| Checks for the transfer complete. More...
s32 | XSdPs_IdentifyCard (XSdPs *InstancePtr)
| Identifies type of card using CMD0 + CMD1 sequence. More...
s32 | XSdPs_SdCardInitialize (XSdPs *InstancePtr)
| This function Initializes SD. More...
s32 | XSdPs_MmcCardInitialize (XSdPs *InstancePtr)
| This function initializes MMC. More...
s32 | XSdPs_CheckCardDetect (XSdPs *InstancePtr)
| Checks if the card is present or not. More...
s32 | XSdPs_CardReset (XSdPs *InstancePtr)
| Sends CMD0 to reset the card. More...
s32 | XSdPs_CardIfCond (XSdPs *InstancePtr)
| Sends command to get the card interface details. More...
s32 | XSdPs_CardOpCond (XSdPs *InstancePtr)
| Sends command to get the card operating condition. More...
s32 | XSdPs_GetCardId (XSdPs *InstancePtr)
| Gets the card ID. More...
s32 | XSdPs_GetCsd (XSdPs *InstancePtr)
| Gets the CSD register from the card. More...
s32 | XSdPs_CardSetVoltage18 (XSdPs *InstancePtr)
| Sets the card voltage to 1.8 V. More...
s32 | XSdPs_ResetConfig (XSdPs *InstancePtr)
| Configures the initial Reset. More...
void | XSdPs_HostConfig (XSdPs *InstancePtr)
| Configures the initial Host. More...
s32 | XSdPs_CheckResetDone (XSdPs *InstancePtr, u8 Value)
| Checks for Reset Done bits to be cleared after a reset assert. More...
s32 | XSdPs_SetupVoltageSwitch (XSdPs *InstancePtr)
| Sets up the voltage switch. More...
s32 | XSdPs_CheckBusHigh (XSdPs *InstancePtr)
| Check if the CMD and DAT buses are high. More...
void | XSdPs_Identify_UhsMode (XSdPs *InstancePtr, u8 *ReadBuff)
| API to Identify the supported UHS mode. More...
void | XSdPs_SetTapDelay (XSdPs *InstancePtr)
| API to set Tap Delay with respect to the speed modes. More...
s32 | XSdPs_Change_SdBusSpeed (XSdPs *InstancePtr)
| Changes the SD Bus Speed. More...
s32 | XSdPs_Change_MmcBusSpeed (XSdPs *InstancePtr)
| Changes the eMMC bus speed. More...
s32 | XSdPs_AutoTuning (XSdPs *InstancePtr)
| This function is used to do the Auto tuning. More...
void | XSdPs_SetupADMA2DescTbl (XSdPs *InstancePtr, u32 BlkCnt, const u8 *Buff)
| API to setup ADMA2 descriptor table. More...
void | XSdPs_SetupADMA2DescTbl64Bit (XSdPs *InstancePtr, u32 BlkCnt)
| API to setup ADMA2 descriptor table for 64 Bit DMA. More...
s32 | XSdPs_DllReset (XSdPs *InstancePtr)
| API to reset the DLL. More...
void | XSdPs_IdentifyEmmcMode (XSdPs *InstancePtr, const u8 *ExtCsd)
| Identifies the eMMC speed mode. More...
s32 | XSdPs_CheckEmmcTiming (XSdPs *InstancePtr, u8 *ExtCsd)
| Checks the eMMC timing. More...
s32 | XSdPs_SetClock (XSdPs *InstancePtr, u32 SelFreq)
| Sets the clock to the passed frequency. More...
s32 | XSdPs_CheckVoltage18 (XSdPs *InstancePtr)
| Checks if the voltage is set to 1.8 V or not. More...
s32 | XSdPs_SetupCmd (XSdPs *InstancePtr, u32 Arg, u32 BlkCnt)
| Initializes the command sequence. More...
s32 | XSdPs_SendCmd (XSdPs *InstancePtr, u32 Cmd)
| Initiates the Cmd transfer to SD card. More...
s32 | XSdPs_SetStartAddr (XSdPs *InstancePtr, u32 StartAddr)
| Sets the address of the first write block to be erased. More...
s32 | XSdPs_SetEndAddr (XSdPs *InstancePtr, u32 EndAddr)
| Sets the address of the last write block to be erased. More...
s32 | XSdPs_SendErase (XSdPs *InstancePtr)
| Sends Erase command to the device and wait for transfer complete. More...
void | XSdPs_SetTapDelay_SDR104 (XSdPs *InstancePtr)
| Sets the tap delay for SDR104 uhs mode. More...
void | XSdPs_SetTapDelay_SDR50 (XSdPs *InstancePtr)
| Sets the tap delay for SDR50 uhs mode. More...
void | XSdPs_SetTapDelay_DDR50 (XSdPs *InstancePtr)
| Sets the tap delay for DDR50 uhs mode. More...
void | XSdPs_SetTapDelay_SDR25 (XSdPs *InstancePtr)
| Sets the tap delay for SDR25 uhs mode. More...
s32 | XSdPs_Switch_Voltage (XSdPs *InstancePtr)
| Switches the SD card voltage from 3v3 to 1v8. More...
s32 | XSdPs_SetupTransfer (XSdPs *InstancePtr)
| Initiates the transfer to or from SD card. More...
s32 | XSdPs_Reset (XSdPs *InstancePtr, u8 Value)
| Resets the SD card. More...
void | XSdPs_SetExecTuning (XSdPs *InstancePtr)
| Sets bit to start execution of tuning. More...
s32 | XSdPs_SdModeInit (XSdPs *InstancePtr)
| Initializes SD mode. More...
s32 | XSdPs_MmcModeInit (XSdPs *InstancePtr)
| Initializes MMC mode. More...
s32 | XSdPs_EmmcModeInit (XSdPs *InstancePtr)
| Initializes eMMC mode. More...
void | XSdPs_DisableBusPower (XSdPs *InstancePtr)
| Disables the bus power. More...
void | XSdPs_EnableBusPower (XSdPs *InstancePtr)
| Enables the bus power. More...
s32 | XSdPs_SdCardEnum (XSdPs *InstancePtr)
| Enumerates the SD card. More...
s32 | XSdPs_MmcCardEnum (XSdPs *InstancePtr)
| Enumerates the MMC card. More...
s32 | XSdPs_Execute_Tuning (XSdPs *InstancePtr)
| Performs SD tuning. More...
s32 | XSdPs_EnableClock (XSdPs *InstancePtr, u16 ClockReg)
| Enables the clock. More...
s32 | XSdPs_CalcBusSpeed (XSdPs *InstancePtr, u32 *Arg)
| Calculates the bus speed. More...
void | XSdPs_SetupReadDma (XSdPs *InstancePtr, u16 BlkCnt, u16 BlkSize, u8 *Buff)
| This function is used to do the DMA transfer to or from SD card. More...
void | XSdPs_SetupWriteDma (XSdPs *InstancePtr, u16 BlkCnt, u16 BlkSize, const u8 *Buff)
| This function is used to do the DMA transfer to or from SD card. More...
void | XSdPs_Setup32ADMA2DescTbl (XSdPs *InstancePtr, u32 BlkCnt, const u8 *Buff)
| API to setup ADMA2 descriptor table for 32-bit DMA. More...
void | XSdPs_Setup64ADMA2DescTbl (XSdPs *InstancePtr, u32 BlkCnt, const u8 *Buff)
| API to setup ADMA2 descriptor table for 64-bit DMA. More...
u32 | XSdPs_CalcClock (XSdPs *InstancePtr, u32 SelFreq)
| Calculates the clock divisor value. More...
void | XSdPs_DllRstCtrl (XSdPs *InstancePtr, u8 EnRst)
| API to Set or Reset the DLL. More...
void | XSdPs_ConfigTapDelay (XSdPs *InstancePtr)
| Function to configure the Tap Delays. More...
s32 | XSdPs_SetVoltage18 (XSdPs *InstancePtr)
| Sets voltage to 1.8 V. More...
void | XSdPs_ConfigPower (XSdPs *InstancePtr)
| Configures the Power Level. More...
void | XSdPs_ConfigDma (XSdPs *InstancePtr)
| Configures the DMA. More...
void | XSdPs_ConfigInterrupt (XSdPs *InstancePtr)
| Configures the Interrupts. More...
s32 | XSdPs_CmdTransfer (XSdPs *InstancePtr, u32 Cmd, u32 Arg, u32 BlkCnt)
| Generates SD command. More...
s32 | XSdps_CheckTransferDone (XSdPs *InstancePtr)
| Checks if the transfer is completed successfully. More...
s32 | XSdPs_CheckBusIdle (XSdPs *InstancePtr, u32 Value)
| Checks if the CMD/DATA bus is idle or not. More...
u32 | XSdPs_FrameCmd (XSdPs *InstancePtr, u32 Cmd)
| This function frames the Command register for a particular command. More...

## Variables
XSdPs_Config | XSdPs_ConfigTable [XPAR_XSDPS_NUM_INSTANCES]
| XSdPs Configuration Table. More...
XSdPs_Config | XSdPs_ConfigTable []
| The configuration table for devices. More...

## Block size mask for 512 bytes
Block size mask for 512 bytes - This is the default block size.
#define | XSDPS_BLK_SIZE_512_MASK 0x200U
| Blk Size 512. More...

## SD High Speed mode configuration options
#define | SD_HS_MODE_ENABLE 1
| User configuration option to enable or disable SD HS mode. More...

## Macro Definition Documentation

#define ADDRESS_BEYOND_32BIT 0x100000000U

Macro used for beyond 32-bit addr.

Referenced by XSdPs_SetupReadDma(), and XSdPs_SetupWriteDma().

#define CSD_SPEC_VER_3 0x3U

CSD card spec ver 3.

Referenced by XSdPs_MmcCardInitialize().

#define ENABLE_HS400_MODE

Enable eMMC HS400 mode for Versal Net platform.

#define EXT_CSD_DEVICE_TYPE_BYTE 196U

CSD Device Type byte number.

Referenced by XSdPs_IdentifyEmmcMode(), and XSdPs_MmcModeInit().

#define EXT_CSD_DEVICE_TYPE_DDR_1V2_HIGH_SPEED 0x8U

CSD Dev type DDR 1.2v speed.

Referenced by XSdPs_IdentifyEmmcMode().

#define EXT_CSD_DEVICE_TYPE_DDR_1V2_HS400 0x80U

CSD SDR 1.2v HS400.

Referenced by XSdPs_IdentifyEmmcMode().

#define EXT_CSD_DEVICE_TYPE_DDR_1V8_HIGH_SPEED 0x4U

CSD Dev type DDR 1.8v speed.

Referenced by XSdPs_IdentifyEmmcMode().

#define EXT_CSD_DEVICE_TYPE_DDR_1V8_HS400 0x40U

CSD SDR 1.8v HS400.

Referenced by XSdPs_IdentifyEmmcMode().

#define EXT_CSD_DEVICE_TYPE_HIGH_SPEED 0x2U

CSD Device type HS.

Referenced by XSdPs_IdentifyEmmcMode(), and XSdPs_MmcModeInit().

#define EXT_CSD_DEVICE_TYPE_SDR_1V2_HS200 0x20U

CSD SDR 1.2v HS200.

Referenced by XSdPs_IdentifyEmmcMode().

#define EXT_CSD_DEVICE_TYPE_SDR_1V8_HS200 0x10U

CSD SDR 1.8v HS200.

Referenced by XSdPs_IdentifyEmmcMode().

#define EXT_CSD_SEC_COUNT_BYTE1 212U

CSD Sector count byte 1.

Referenced by XSdPs_EmmcModeInit(), and XSdPs_MmcModeInit().

#define EXT_CSD_SEC_COUNT_BYTE2 213U

CSD Sector count byte 2.

Referenced by XSdPs_EmmcModeInit(), and XSdPs_MmcModeInit().

#define EXT_CSD_SEC_COUNT_BYTE3 214U

CSD Sector count byte 3.

Referenced by XSdPs_EmmcModeInit(), and XSdPs_MmcModeInit().

#define EXT_CSD_SEC_COUNT_BYTE4 215U

CSD Sector count byte 4.

Referenced by XSdPs_EmmcModeInit(), and XSdPs_MmcModeInit().

#define HIGH_SPEED_SUPPORT 0x2U

High Speed support.

Referenced by XSdPs_SdModeInit().

#define MAX_TIMEOUT 0x1FFFFFFFU

Maximum Timeout.

Referenced by XSdPs_CheckBusHigh().

#define MAX_TUNING_COUNT 40U

Maximum Tuning count.

Referenced by XSdPs_AutoTuning().

#define SCR_SPEC_VER_3 0x80U

SCR spec ver 3.

Referenced by XSdPs_SdModeInit().

#define SD_CLK_19_MHZ 19000000U

19MHz clock

Referenced by XSdPs_SdCardEnum().

#define SD_CLK_25_MHZ 25000000U

25MHz clock

Referenced by XSdPs_SdCardEnum().

#define SD_CLK_26_MHZ 26000000U

26MHz clock

Referenced by XSdPs_MmcCardEnum().

#define SD_HS_MODE_ENABLE 1

User configuration option to enable or disable SD HS mode.

By default SD HS mode is disabled for Versal and enabled for other platforms.

#define UHS_DDR50_SUPPORT 0x10U

DDR50 support.

Referenced by XSdPs_Identify_UhsMode().

#define UHS_SDR104_SUPPORT 0x8U

SDR104 support.

Referenced by XSdPs_Identify_UhsMode().

#define UHS_SDR12_SUPPORT 0x1U

SDR12 support.

#define UHS_SDR25_SUPPORT 0x2U

SDR25 support.

Referenced by XSdPs_Identify_UhsMode().

#define UHS_SDR50_SUPPORT 0x4U

SDR50 support.

Referenced by XSdPs_Identify_UhsMode(), and XSdPs_SdModeInit().

#define WIDTH_4_BIT_SUPPORT 0x4U

4-bit width support

Referenced by XSdPs_SdModeInit().

#define XSDPS_ACMD41_3V3 0x00300000U

3.3 voltage support

Referenced by XSdPs_CardOpCond().

#define XSDPS_ACMD41_HCS 0x40000000U

High Capacity Support.

Referenced by XSdPs_CardOpCond(), and XSdPs_IdentifyCard().

#define XSDPS_BLK_SIZE_512_MASK 0x200U

Blk Size 512.

Referenced by XSdPs_GetCsd(), XSdPs_HostConfig(), XSdPs_MmcCardInitialize(), XSdPs_SdModeInit(), and XSdPs_SetupTransfer().

#define XSDPS_CMD1_DUAL_VOL 0x00FF8010U

CMD1 for Dual voltage.

#define XSDPS_CMD1_HIGH_VOL 0x00FF8000U

CMD1 for High voltage.

Referenced by XSdPs_CardOpCond(), and XSdPs_IdentifyCard().

#define XSDPS_CMD8_VOL_PATTERN 0x1AAU

CMD8 voltage pattern.

Referenced by XSdPs_CardIfCond().

#define XSDPS_CT_ERROR 0x2L

Command timeout flag.

Referenced by XSdPs_CardIfCond(), and XSdPs_CmdTransfer().

#define XSDPS_RESPOCR_READY 0x80000000U

Ready response.

Referenced by XSdPs_CardOpCond().

#define XSDPS_VERSAL_SD0_BASE 0xF1040000U

Versal SD0 Baseaddress.

#define XSDPS_VERSAL_SD1_BASE 0xF1050000U

Versal SD1 Baseaddress.

#define XSDPS_ZYNQMP_SD0_BASE 0xFF160000U

ZynqMP SD0 Baseaddress.

Referenced by XSdPs_ConfigTapDelay(), and XSdPs_DllRstCtrl().

#define XSDPS_ZYNQMP_SD1_BASE 0xFF170000U

ZynqMP SD1 Baseaddress.

## Function Documentation

s32 XSdPs_AutoTuning | ( | XSdPs * | InstancePtr | ) |

This function is used to do the Auto tuning.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs_Config::BaseAddress, XSdPs::BusWidth, XSdPs::CardType, XSdPs::Config, MAX_TUNING_COUNT, XSdPs::TransferMode, XSdPs_CmdTransfer(), and XSdPs_SetExecTuning().

Referenced by XSdPs_Execute_Tuning().

s32 XSdPs_CalcBusSpeed | ( | XSdPs * | InstancePtr,
|  | u32 * | Arg
| ) |  |

Calculates the bus speed.

Parameters

  InstancePtr | Pointer to the instance to be worked on.
  Arg | Argument to be sent along with the command. This could be address or any other information

Returns
  - XST_SUCCESS if success
  - XST_FAILURE if failure

References XSdPs::BusSpeed, XSdPs::CardType, XSdPs::IsTuningDone, and XSdPs::Mode.

Referenced by XSdPs_Change_MmcBusSpeed(), and XSdPs_Change_SdBusSpeed().

u32 XSdPs_CalcClock | ( | XSdPs * | InstancePtr,
|  | u32 | SelFreq
| ) |  |

Calculates the clock divisor value.

Parameters

  InstancePtr | Pointer to the instance to be worked on.
  SelFreq | Selected frequency

Returns
  Clock divisor value

References XSdPs::Config, XSdPs::HC_Version, and XSdPs_Config::InputClockHz.

Referenced by XSdPs_SetClock().

s32 XSdPs_CardIfCond | ( | XSdPs * | InstancePtr | ) |

Sends command to get the card interface details.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs_Config::BaseAddress, XSdPs::Card_Version, XSdPs::Config, XSDPS_CMD8_VOL_PATTERN, XSdPs_CmdTransfer(), XSDPS_CT_ERROR, and XSdPs_Reset().

Referenced by XSdPs_SdCardEnum().

s32 XSdPs_CardInitialize | ( | XSdPs * | InstancePtr | ) |

Initializes Card with Identification mode sequence.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  - XST_SUCCESS if initialization was successful
  - XST_FAILURE if failure - could be because a) SD is already initialized b) There is no card inserted c) One of the steps (commands) in the initialization cycle failed

References XSdPs::BusSpeed, XSdPs::BusWidth, XSdPs::CardType, XSdPs::Config, XSdPs::IsReady, XSdPs::Switch1v8, XSdPs_Change_ClkFreq(), XSdPs_IdentifyCard(), XSdPs_MmcCardInitialize(), and XSdPs_SdCardInitialize().

s32 XSdPs_CardOpCond | ( | XSdPs * | InstancePtr | ) |

Sends command to get the card operating condition.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs_Config::BaseAddress, XSdPs_Config::BusWidth, XSdPs::CardType, XSdPs::Config, XSdPs::HC_Version, XSdPs::HCS, XSdPs::Switch1v8, XSDPS_ACMD41_3V3, XSDPS_ACMD41_HCS, XSDPS_CMD1_HIGH_VOL, XSdPs_CmdTransfer(), XSDPS_RESPOCR_READY, and XSdPs_Switch_Voltage().

Referenced by XSdPs_MmcCardEnum(), and XSdPs_SdCardEnum().

s32 XSdPs_CardReset | ( | XSdPs * | InstancePtr | ) |

Sends CMD0 to reset the card.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs_CmdTransfer().

Referenced by XSdPs_MmcCardEnum(), and XSdPs_SdCardEnum().

s32 XSdPs_CardSetVoltage18 | ( | XSdPs * | InstancePtr | ) |

Sets the card voltage to 1.8 V.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs_Config::BaseAddress, XSdPs::Config, XSdPs_EnableClock(), and XSdPs_SetVoltage18().

Referenced by XSdPs_SdModeInit(), and XSdPs_Switch_Voltage().

s32 XSdPs_CfgInitialize | ( | XSdPs * | InstancePtr,
|  | XSdPs_Config * | ConfigPtr,
|  | UINTPTR | EffectiveAddr
| ) |  |

Initializes a specific XSdPs instance so that the driver is ready to use.

Parameters

  InstancePtr | Pointer to the XSdPs instance.
  ConfigPtr | Reference to a structure containing information about a specific SD device. This function initializes an InstancePtr object for a specific device specified by the contents of Configuration.
  EffectiveAddr | Device base address in the virtual memory address space. The caller is responsible for keeping the address mapping from EffectiveAddr to the device physical base address unchanged once this function is invoked. Unexpected errors may occur if the address mapping changes after this function is called. If address translation is not used, use ConfigPtr->Config. BaseAddress for this device.

Returns
  - XST_SUCCESS if successful.
  - XST_DEVICE_IS_STARTED if the device is already started. It must be stopped to re-initialize.

Note
  This function initializes the host controller. Initial clock of 400 KHz is set. Voltage of 3.3 V is selected as that is supported by host. Interrupts status is enabled and signal disabled by default. Default data direction is card to host and 32 bit ADMA2 is selected. Default Block size is 512 bytes.

References XSdPs_Config::BankNumber, XSdPs_Config::BaseAddress, XSdPs::BlkSize, XSdPs_Config::BusWidth, XSdPs_Config::CardDetect, XSdPs::Config, XSdPs_Config::DeviceId, XSdPs::Dma64BitAddr, XSdPs_Config::HasEMIO, XSdPs::HC_Version, XSdPs::Host_Caps, XSdPs_Config::InputClockHz, XSdPs::IsBusy, XSdPs_Config::IsCacheCoherent, XSdPs::IsReady, XSdPs::IsTuningDone, XSdPs::ITapDelay, XSdPs_Config::ITapDly_DDR_Clk50, XSdPs_Config::ITapDly_SDR_Clk50, XSdPs::Mode, XSdPs::OTapDelay, XSdPs_Config::OTapDly_DDR_Clk200, XSdPs_Config::OTapDly_DDR_Clk50, XSdPs_Config::OTapDly_SDR_Clk100, XSdPs_Config::OTapDly_SDR_Clk200, XSdPs_Config::OTapDly_SDR_Clk50, XSdPs::SectorCount, XSdPs::SlcrBaseAddr, XSdPs_Config::SlotType, XSdPs_Config::WriteProtect, XSdPs_HostConfig(), and XSdPs_ResetConfig().

s32 XSdPs_Change_BusSpeed | ( | XSdPs * | InstancePtr | ) |

Sets high speed in card and host.

Changes clock in host accordingly.

Parameters

  InstancePtr | Pointer to the XSdPs instance.

Returns
  - XST_SUCCESS if successful.
  - XST_FAILURE if fail.

References XSdPs_Config::BaseAddress, XSdPs::BusSpeed, XSdPs::CardType, XSdPs::Config, XSdPs::IsReady, XSdPs::IsTuningDone, XSdPs::Mode, XSdPs_Change_ClkFreq(), XSdPs_Change_MmcBusSpeed(), XSdPs_Change_SdBusSpeed(), and XSdPs_Execute_Tuning().

Referenced by XSdPs_EmmcModeInit(), XSdPs_MmcModeInit(), and XSdPs_SdModeInit().

s32 XSdPs_Change_BusWidth | ( | XSdPs * | InstancePtr | ) |

Sets bus width to 4-bit in card and host.

Parameters

  InstancePtr | Pointer to the XSdPs instance.

Returns
  - XST_SUCCESS if successful.
  - XST_FAILURE if fail.

References XSdPs_Config::BaseAddress, XSdPs_Config::BusWidth, XSdPs::BusWidth, XSdPs::CardType, XSdPs::Config, XSdPs::HC_Version, XSdPs::IsReady, XSdPs::Mode, XSdPs::RelCardAddr, XSdPs_CmdTransfer(), and XSdPs_Set_Mmc_ExtCsd().

Referenced by XSdPs_EmmcModeInit(), XSdPs_MmcModeInit(), and XSdPs_SdModeInit().

s32 XSdPs_Change_ClkFreq | ( | XSdPs * | InstancePtr,
|  | u32 | SelFreq
| ) |  |

API to change clock frequency to a given value.

Parameters

  InstancePtr | Pointer to the XSdPs instance.
  SelFreq | Clock frequency in Hz.

Returns
  None

Note
  This API will change clock frequency to the value less than or equal to the given value using the permissible dividors.

References XSdPs_Config::BaseAddress, XSdPs::CardType, XSdPs::Config, XSdPs::HC_Version, XSdPs::IsReady, XSdPs::ITapDelay, XSdPs::Mode, XSdPs::OTapDelay, XSdPs_SetClock(), and XSdPs_SetTapDelay().

Referenced by XSdPs_CardInitialize(), XSdPs_Change_BusSpeed(), XSdPs_MmcCardEnum(), and XSdPs_SdCardEnum().

s32 XSdPs_Change_MmcBusSpeed | ( | XSdPs * | InstancePtr | ) |

Changes the eMMC bus speed.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs_CalcBusSpeed(), XSdps_CheckTransferDone(), and XSdPs_CmdTransfer().

Referenced by XSdPs_Change_BusSpeed().

s32 XSdPs_Change_SdBusSpeed | ( | XSdPs * | InstancePtr | ) |

Changes the SD Bus Speed.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs_Config::BaseAddress, XSdPs::Config, XSdPs::Mode, XSdPs::Switch1v8, XSdPs_CalcBusSpeed(), XSdps_CheckTransferDone(), XSdPs_CmdTransfer(), and XSdPs_SetupReadDma().

Referenced by XSdPs_Change_BusSpeed().

s32 XSdPs_CheckBusHigh | ( | XSdPs * | InstancePtr | ) |

Check if the CMD and DAT buses are high.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs_Config::BaseAddress, XSdPs::Config, and MAX_TIMEOUT.

Referenced by XSdPs_Switch_Voltage().

s32 XSdPs_CheckBusIdle | ( | XSdPs * | InstancePtr,
|  | u32 | Value
| ) |  |

Checks if the CMD/DATA bus is idle or not.

Parameters

  InstancePtr | Pointer to the instance to be worked on.
  Value | Value to be selected Cmd bus or Dat bus.

Returns
  None

References XSdPs_Config::BaseAddress, and XSdPs::Config.

Referenced by XSdPs_Idle(), XSdPs_SetBlkSize(), and XSdPs_SetupCmd().

s32 XSdPs_CheckCardDetect | ( | XSdPs * | InstancePtr | ) |

Checks if the card is present or not.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs_Config::BaseAddress, XSdPs_Config::CardDetect, XSdPs::Config, XSdPs::HC_Version, and XSdPs::Host_Caps.

Referenced by XSdPs_MmcCardEnum(), and XSdPs_SdCardEnum().

s32 XSdPs_CheckEmmcTiming | ( | XSdPs * | InstancePtr,
|  | u8 * | ExtCsd
| ) |  |

Checks the eMMC timing.

Parameters

  InstancePtr | Pointer to the instance to be worked on.
  ExtCsd | Extended CSD register from the card.

Returns
  None

References XSdPs::Mode, and XSdPs_Get_Mmc_ExtCsd().

Referenced by XSdPs_EmmcModeInit().

s32 XSdPs_CheckReadTransfer | ( | XSdPs * | InstancePtr | ) |

Checks if the transfer is completed successfully.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  - XST_SUCCESS if transfer was successful
  - XST_FAILURE if failure
  - XST_DEVICE_BUSY - if the transfer is still in progress

References XSdPs::IsReady, and XSdPs_CheckTransferComplete().

s32 XSdPs_CheckResetDone | ( | XSdPs * | InstancePtr,
|  | u8 | Value
| ) |  |

Checks for Reset Done bits to be cleared after a reset assert.

Parameters

  InstancePtr | Pointer to the instance to be worked on.
  Value | Bits to be checked to be cleared.

Returns
  None

References XSdPs_Config::BaseAddress, and XSdPs::Config.

Referenced by XSdPs_Reset().

s32 XSdPs_CheckTransferComplete | ( | XSdPs * | InstancePtr | ) |

Checks for the transfer complete.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  - XST_SUCCESS if transfer was successful
  - XST_FAILURE if failure
  - XST_DEVICE_BUSY - if the transfer is still in progress

References XSdPs_Config::BaseAddress, XSdPs::Config, and XSdPs::IsBusy.

Referenced by XSdPs_CheckReadTransfer(), and XSdPs_CheckWriteTransfer().

s32 XSdps_CheckTransferDone | ( | XSdPs * | InstancePtr | ) |

Checks if the transfer is completed successfully.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs_Config::BaseAddress, and XSdPs::Config.

Referenced by XSdPs_Change_MmcBusSpeed(), XSdPs_Change_SdBusSpeed(), XSdPs_Get_BusSpeed(), XSdPs_Get_BusWidth(), XSdPs_Get_Mmc_ExtCsd(), XSdPs_Get_Status(), XSdPs_ReadPolled(), XSdPs_SendErase(), XSdPs_Set_Mmc_ExtCsd(), and XSdPs_WritePolled().

s32 XSdPs_CheckVoltage18 | ( | XSdPs * | InstancePtr | ) |

Checks if the voltage is set to 1.8 V or not.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  - XST_SUCCESS if voltage is 1.8V
  - XST_FAILURE if voltage is not 1.8V

References XSdPs_Config::BaseAddress, and XSdPs::Config.

Referenced by XSdPs_SetVoltage18().

s32 XSdPs_CheckWriteTransfer | ( | XSdPs * | InstancePtr | ) |

Checks for the write transfer completed.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  - XST_SUCCESS if transfer was successful
  - XST_FAILURE if failure
  - XST_DEVICE_BUSY - if the transfer is still in progress

References XSdPs::IsReady, and XSdPs_CheckTransferComplete().

s32 XSdPs_CmdTransfer | ( | XSdPs * | InstancePtr,
|  | u32 | Cmd,
|  | u32 | Arg,
|  | u32 | BlkCnt
| ) |  |

Generates SD command.

Parameters

  InstancePtr | Pointer to the instance to be worked on.
  Cmd | Command to be sent.
  Arg | Argument to be sent along with the command. This could be address or any other information
  BlkCnt | Block count passed by the user.

Returns
  - XST_SUCCESS if initialization was successful
  - XST_FAILURE if failure - could be because another transfer is in progress or command or data inhibit is set

References XSdPs_Config::BaseAddress, XSdPs::Config, XSDPS_CT_ERROR, XSdPs_SendCmd(), and XSdPs_SetupCmd().

Referenced by XSdPs_AutoTuning(), XSdPs_CardIfCond(), XSdPs_CardOpCond(), XSdPs_CardReset(), XSdPs_Change_BusWidth(), XSdPs_Change_MmcBusSpeed(), XSdPs_Change_SdBusSpeed(), XSdPs_Get_BusSpeed(), XSdPs_Get_BusWidth(), XSdPs_Get_Mmc_ExtCsd(), XSdPs_Get_Status(), XSdPs_GetCardId(), XSdPs_GetCsd(), XSdPs_IdentifyCard(), XSdPs_Pullup(), XSdPs_Read(), XSdPs_Select_Card(), XSdPs_SendErase(), XSdPs_Set_Mmc_ExtCsd(), XSdPs_SetBlkSize(), XSdPs_SetEndAddr(), XSdPs_SetStartAddr(), XSdPs_SetupVoltageSwitch(), and XSdPs_Write().

void XSdPs_ConfigDma | ( | XSdPs * | InstancePtr | ) |

Configures the DMA.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs_Config::BaseAddress, XSdPs::Config, and XSdPs::HC_Version.

Referenced by XSdPs_HostConfig().

void XSdPs_ConfigInterrupt | ( | XSdPs * | InstancePtr | ) |

Configures the Interrupts.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs_Config::BaseAddress, and XSdPs::Config.

Referenced by XSdPs_HostConfig().

void XSdPs_ConfigPower | ( | XSdPs * | InstancePtr | ) |

Configures the Power Level.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs_Config::BaseAddress, XSdPs::Config, and XSdPs::Host_Caps.

Referenced by XSdPs_HostConfig().

void XSdPs_ConfigTapDelay | ( | XSdPs * | InstancePtr | ) |

Function to configure the Tap Delays.

Parameters

  InstancePtr | Pointer to the XSdPs instance.

Returns
  None

References XSdPs_Config::BaseAddress, XSdPs::Config, XSdPs::ITapDelay, XSdPs::OTapDelay, XSdPs::SlcrBaseAddr, and XSDPS_ZYNQMP_SD0_BASE.

Referenced by XSdPs_SetTapDelay().

void XSdPs_DisableBusPower | ( | XSdPs * | InstancePtr | ) |

Disables the bus power.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs_Config::BaseAddress, XSdPs::Config, and XSdPs::HC_Version.

Referenced by XSdPs_Idle(), and XSdPs_ResetConfig().

s32 XSdPs_DllReset | ( | XSdPs * | InstancePtr | ) |

API to reset the DLL.

Parameters

  InstancePtr | Pointer to the XSdPs instance.

Returns
  None

References XSdPs_Config::BaseAddress, XSdPs::Config, XSdPs_DllRstCtrl(), and XSdPs_EnableClock().

Referenced by XSdPs_Execute_Tuning().

void XSdPs_DllRstCtrl | ( | XSdPs * | InstancePtr,
|  | u8 | EnRst
| ) |  |

API to Set or Reset the DLL.

Parameters

  InstancePtr | Pointer to the XSdPs instance.
  EnRst | Flag indicating whether to Assert or De-assert Reset.

Returns
  None

Note
  This API is specific to ZynqMP platform.

References XSdPs_Config::BaseAddress, XSdPs::Config, XSdPs::SlcrBaseAddr, and XSDPS_ZYNQMP_SD0_BASE.

Referenced by XSdPs_DllReset(), and XSdPs_SetTapDelay().

s32 XSdPs_EmmcModeInit | ( | XSdPs * | InstancePtr | ) |

Initializes eMMC mode.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  - XST_SUCCESS if initialization is successful
  - XST_FAILURE if failure

References XSdPs_Config::BusWidth, XSdPs::BusWidth, XSdPs::Config, EXT_CSD_SEC_COUNT_BYTE1, EXT_CSD_SEC_COUNT_BYTE2, EXT_CSD_SEC_COUNT_BYTE3, EXT_CSD_SEC_COUNT_BYTE4, XSdPs::HC_Version, XSdPs::Mode, XSdPs::SectorCount, XSdPs_Change_BusSpeed(), XSdPs_Change_BusWidth(), XSdPs_CheckEmmcTiming(), XSdPs_Get_Mmc_ExtCsd(), XSdPs_IdentifyEmmcMode(), and XSdPs_Set_Mmc_ExtCsd().

Referenced by XSdPs_MmcCardInitialize().

void XSdPs_EnableBusPower | ( | XSdPs * | InstancePtr | ) |

Enables the bus power.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs_Config::BaseAddress, XSdPs::Config, and XSdPs::HC_Version.

Referenced by XSdPs_ResetConfig().

s32 XSdPs_EnableClock | ( | XSdPs * | InstancePtr,
|  | u16 | ClockReg
| ) |  |

Enables the clock.

Parameters

  InstancePtr | Pointer to the instance to be worked on.
  ClockReg | Clock value to be set.

Returns
  - XST_SUCCESS if success
  - XST_FAILURE if failure

References XSdPs_Config::BaseAddress, and XSdPs::Config.

Referenced by XSdPs_CardSetVoltage18(), XSdPs_DllReset(), and XSdPs_SetClock().

s32 XSdPs_Erase | ( | XSdPs * | InstancePtr,
|  | u32 | StartAddr,
|  | u32 | EndAddr
| ) |  |

Performs Erase operation on the given address range.

Parameters

  InstancePtr | Pointer to the instance to be worked on.
  StartAddr | Address of the first write block to be erased.
  EndAddr | Address of the last write block of the continuous range to be erased.

Returns
  - XST_SUCCESS if erase is successful
  - XST_FAILURE if failure - could be because another transfer is in progress or card not present or erase operation failure.

References XSdPs_Config::BaseAddress, XSdPs_Config::CardDetect, XSdPs::CardSpecData, XSdPs::Config, XSdPs::HC_Version, XSdPs::Host_Caps, XSdPs::IsBusy, XSdPs::IsReady, XSdPs::TransferMode, XSdPs_SendErase(), XSdPs_SetEndAddr(), and XSdPs_SetStartAddr().

s32 XSdPs_Execute_Tuning | ( | XSdPs * | InstancePtr | ) |

Performs SD tuning.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs_AutoTuning(), and XSdPs_DllReset().

Referenced by XSdPs_Change_BusSpeed().

u32 XSdPs_FrameCmd | ( | XSdPs * | InstancePtr,
|  | u32 | Cmd
| ) |  |

This function frames the Command register for a particular command.

Parameters

  InstancePtr | Pointer to the instance to be worked on.
  Cmd | Command to be sent.

Returns
  Command register value complete with response type and data, CRC and index related flags.

Note
  This generates only the command register value i.e. the upper 16 bits of the transfer mode and command register. This value is already shifted to be upper 16 bits and can be directly OR'ed with transfer mode register value.

References XSdPs::CardType.

Referenced by XSdPs_SendCmd().

s32 XSdPs_Get_BusSpeed | ( | XSdPs * | InstancePtr,
|  | u8 * | ReadBuff
| ) |  |

Gets bus speed supported by card.

Parameters

  InstancePtr | Pointer to the XSdPs instance.
  ReadBuff | Buffer to store function group support data returned by card.

Returns
  - XST_SUCCESS if successful.
  - XST_FAILURE if fail.

Note
  None.

References XSdPs::Config, XSdPs_Config::IsCacheCoherent, XSdPs::IsReady, XSdps_CheckTransferDone(), XSdPs_CmdTransfer(), and XSdPs_SetupReadDma().

Referenced by XSdPs_SdModeInit().

s32 XSdPs_Get_BusWidth | ( | XSdPs * | InstancePtr,
|  | u8 * | ReadBuff
| ) |  |

Gets bus width support by card.

Parameters

  InstancePtr | Pointer to the XSdPs instance.
  ReadBuff | Buffer to store SCR register returned by card.

Returns
  - XST_SUCCESS if successful.
  - XST_FAILURE if fail.

Note
  None.

References XSdPs::Config, XSdPs_Config::IsCacheCoherent, XSdPs::IsReady, XSdPs::RelCardAddr, XSdps_CheckTransferDone(), XSdPs_CmdTransfer(), and XSdPs_SetupReadDma().

Referenced by XSdPs_SdModeInit().

s32 XSdPs_Get_Mmc_ExtCsd | ( | XSdPs * | InstancePtr,
|  | u8 * | ReadBuff
| ) |  |

Gets EXT_CSD register of eMMC.

Parameters

  InstancePtr | Pointer to the XSdPs instance.
  ReadBuff | Buffer to store EXT_CSD

Returns
  - XST_SUCCESS if successful.
  - XST_FAILURE if fail.

References XSdPs::Config, XSdPs_Config::IsCacheCoherent, XSdPs::IsReady, XSdps_CheckTransferDone(), XSdPs_CmdTransfer(), and XSdPs_SetupReadDma().

Referenced by XSdPs_CheckEmmcTiming(), XSdPs_EmmcModeInit(), and XSdPs_MmcModeInit().

s32 XSdPs_Get_Status | ( | XSdPs * | InstancePtr,
|  | u8 * | SdStatReg
| ) |  |

Gets SD card status information.

Parameters

  InstancePtr | Pointer to the XSdPs instance.
  SdStatReg | Buffer to store status data returned by card.

Returns
  - XST_SUCCESS if successful.
  - XST_FAILURE if fail.

References XSdPs::Config, XSdPs_Config::IsCacheCoherent, XSdPs::IsReady, XSdPs::RelCardAddr, XSdps_CheckTransferDone(), XSdPs_CmdTransfer(), and XSdPs_SetupReadDma().

s32 XSdPs_GetCardId | ( | XSdPs * | InstancePtr | ) |

Gets the card ID.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs_Config::BaseAddress, XSdPs::CardID, XSdPs::CardType, XSdPs::Config, XSdPs::RelCardAddr, and XSdPs_CmdTransfer().

Referenced by XSdPs_MmcCardEnum(), and XSdPs_SdCardEnum().

s32 XSdPs_GetCsd | ( | XSdPs * | InstancePtr | ) |

Gets the CSD register from the card.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs_Config::BaseAddress, XSdPs::Card_Version, XSdPs::CardSpecData, XSdPs::CardType, XSdPs::Config, XSdPs::RelCardAddr, XSdPs::SectorCount, XSDPS_BLK_SIZE_512_MASK, and XSdPs_CmdTransfer().

Referenced by XSdPs_MmcCardEnum(), and XSdPs_SdCardEnum().

void XSdPs_HostConfig | ( | XSdPs * | InstancePtr | ) |

Configures the initial Host.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs_Config::BaseAddress, XSdPs::Config, XSdPs::TransferMode, XSDPS_BLK_SIZE_512_MASK, XSdPs_ConfigDma(), XSdPs_ConfigInterrupt(), and XSdPs_ConfigPower().

Referenced by XSdPs_CfgInitialize().

void XSdPs_Identify_UhsMode | ( | XSdPs * | InstancePtr,
|  | u8 * | ReadBuff
| ) |  |

API to Identify the supported UHS mode.

This API will assign the corresponding tap delay API to the Config_TapDelay pointer based on the supported bus speed.

Parameters

  InstancePtr | Pointer to the XSdPs instance.
  ReadBuff | Contains the response for CMD6

Returns
  None.

References XSdPs::Config, XSdPs_Config::InputClockHz, XSdPs::Mode, UHS_DDR50_SUPPORT, UHS_SDR104_SUPPORT, UHS_SDR25_SUPPORT, UHS_SDR50_SUPPORT, XSdPs_SetTapDelay_DDR50(), XSdPs_SetTapDelay_SDR104(), XSdPs_SetTapDelay_SDR25(), and XSdPs_SetTapDelay_SDR50().

Referenced by XSdPs_SdModeInit().

s32 XSdPs_IdentifyCard | ( | XSdPs * | InstancePtr | ) |

Identifies type of card using CMD0 + CMD1 sequence.

Parameters

  InstancePtr | Pointer to the XSdPs instance.

References XSdPs_Config::BaseAddress, XSdPs::CardType, XSdPs::Config, XSdPs::HC_Version, XSdPs::Host_Caps, XSDPS_ACMD41_HCS, XSDPS_CMD1_HIGH_VOL, XSdPs_CmdTransfer(), and XSdPs_Reset().

Referenced by XSdPs_CardInitialize().

void XSdPs_IdentifyEmmcMode | ( | XSdPs * | InstancePtr,
|  | const u8 * | ExtCsd
| ) |  |

Identifies the eMMC speed mode.

Parameters

  InstancePtr | Pointer to the instance to be worked on.
  ExtCsd | Extended CSD register from the card.

Returns
  None

References XSdPs_Config::BankNumber, XSdPs::BusWidth, XSdPs::Config, EXT_CSD_DEVICE_TYPE_BYTE, EXT_CSD_DEVICE_TYPE_DDR_1V2_HIGH_SPEED, EXT_CSD_DEVICE_TYPE_DDR_1V2_HS400, EXT_CSD_DEVICE_TYPE_DDR_1V8_HIGH_SPEED, EXT_CSD_DEVICE_TYPE_DDR_1V8_HS400, EXT_CSD_DEVICE_TYPE_HIGH_SPEED, EXT_CSD_DEVICE_TYPE_SDR_1V2_HS200, EXT_CSD_DEVICE_TYPE_SDR_1V8_HS200, XSdPs::IsTuningDone, XSdPs::ITapDelay, XSdPs_Config::ITapDly_DDR_Clk50, XSdPs_Config::ITapDly_SDR_Clk50, XSdPs::Mode, XSdPs::OTapDelay, XSdPs_Config::OTapDly_DDR_Clk50, XSdPs_Config::OTapDly_SDR_Clk200, and XSdPs_Config::OTapDly_SDR_Clk50.

Referenced by XSdPs_EmmcModeInit().

s32 XSdPs_Idle | ( | XSdPs * | InstancePtr | ) |

API to idle the SDIO Interface.

Parameters

  InstancePtr | Pointer to the XSdPs instance.

Returns
  None

References XSdPs::Config, XSdPs::IsReady, XSdPs_CheckBusIdle(), XSdPs_DisableBusPower(), and XSdPs_Reset().

XSdPs_Config * XSdPs_LookupConfig | ( | u16 | DeviceId | ) |

Looks up the device configuration based on the unique device ID.

A table contains the configuration info for each device in the system.

Parameters

  DeviceId | Contains the ID of the device to look up the configuration for.

Returns

A pointer to the configuration found or NULL if the specified device ID was not found. See xsdps.h for the definition of XSdPs_Config.

References XSdPs_ConfigTable.

s32 XSdPs_MmcCardEnum | ( | XSdPs * | InstancePtr | ) |

Enumerates the MMC card.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs::BusSpeed, SD_CLK_26_MHZ, XSdPs_CardOpCond(), XSdPs_CardReset(), XSdPs_Change_ClkFreq(), XSdPs_CheckCardDetect(), XSdPs_GetCardId(), XSdPs_GetCsd(), and XSdPs_Select_Card().

Referenced by XSdPs_MmcCardInitialize().

s32 XSdPs_MmcCardInitialize | ( | XSdPs * | InstancePtr | ) |

This function initializes MMC.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  - XST_SUCCESS if initialization was successful
  - XST_FAILURE if failure - could be because a) MMC is already initialized b) There is no card inserted c) One of the steps (commands) in the initialization cycle failed

Note
  This function initializes the SD card by following its initialization and identification state diagram. CMD0 is sent to reset card. CMD1 sent to identify voltage and high capacity support CMD2 and CMD3 are sent to obtain Card ID and Relative card address respectively. CMD9 is sent to read the card specific data.

References XSdPs_Config::BaseAddress, XSdPs::BlkSize, XSdPs::Card_Version, XSdPs::CardType, XSdPs::Config, CSD_SPEC_VER_3, XSdPs::HC_Version, XSdPs::Mode, XSDPS_BLK_SIZE_512_MASK, XSdPs_EmmcModeInit(), XSdPs_MmcCardEnum(), XSdPs_MmcModeInit(), and XSdPs_SetBlkSize().

Referenced by XSdPs_CardInitialize().

s32 XSdPs_MmcModeInit | ( | XSdPs * | InstancePtr | ) |

Initializes MMC mode.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  - XST_SUCCESS if initialization is successful
  - XST_FAILURE if failure

References XSdPs::BusWidth, EXT_CSD_DEVICE_TYPE_BYTE, EXT_CSD_DEVICE_TYPE_HIGH_SPEED, EXT_CSD_SEC_COUNT_BYTE1, EXT_CSD_SEC_COUNT_BYTE2, EXT_CSD_SEC_COUNT_BYTE3, EXT_CSD_SEC_COUNT_BYTE4, XSdPs::Mode, XSdPs::SectorCount, XSdPs_Change_BusSpeed(), XSdPs_Change_BusWidth(), and XSdPs_Get_Mmc_ExtCsd().

Referenced by XSdPs_MmcCardInitialize().

s32 XSdPs_Pullup | ( | XSdPs * | InstancePtr | ) |

Sends pullup command to card before using DAT line 3(using 4-bit bus).

Parameters

  InstancePtr | Pointer to the XSdPs instance.

Returns
  - XST_SUCCESS if successful.
  - XST_FAILURE if fail.

References XSdPs::IsReady, XSdPs::RelCardAddr, and XSdPs_CmdTransfer().

s32 XSdPs_Read | ( | XSdPs * | InstancePtr,
|  | u32 | Arg,
|  | u32 | BlkCnt,
|  | u8 * | Buff
| ) |  |

Performs SD read in polled mode.

Parameters

  InstancePtr | Pointer to the instance to be worked on.
  Arg | Address passed by the user that is to be sent as argument along with the command.
  BlkCnt | - Block count passed by the user.
  Buff | - Pointer to the data buffer for a DMA transfer.

Returns
  - XST_SUCCESS if initialization was successful
  - XST_FAILURE if failure - could be because another transfer is in progress or command or data inhibit is set

References XSdPs::BlkSize, XSdPs_CmdTransfer(), and XSdPs_SetupReadDma().

Referenced by XSdPs_ReadPolled(), and XSdPs_StartReadTransfer().

s32 XSdPs_ReadPolled | ( | XSdPs * | InstancePtr,
|  | u32 | Arg,
|  | u32 | BlkCnt,
|  | u8 * | Buff
| ) |  |

Performs SD read in polled mode.

Parameters

  InstancePtr | Pointer to the instance to be worked on.
  Arg | Address passed by the user that is to be sent as argument along with the command.
  BlkCnt | Block count passed by the user.
  Buff | Pointer to the data buffer for a DMA transfer.

Returns
  - XST_SUCCESS if initialization was successful
  - XST_FAILURE if failure - could be because another transfer is in progress or command or data inhibit is set

References XSdPs::BlkSize, XSdPs::Config, XSdPs::IsBusy, XSdPs_Config::IsCacheCoherent, XSdPs::IsReady, XSdps_CheckTransferDone(), XSdPs_Read(), and XSdPs_SetupTransfer().

s32 XSdPs_Reset | ( | XSdPs * | InstancePtr,
|  | u8 | Value
| ) |  |

Resets the SD card.

Parameters

  InstancePtr | Pointer to the instance to be worked on.
  Value | Type of reset

Returns
  - XST_SUCCESS if initialization was successful
  - XST_FAILURE if failure

References XSdPs_Config::BaseAddress, XSdPs::Config, and XSdPs_CheckResetDone().

Referenced by XSdPs_CardIfCond(), XSdPs_IdentifyCard(), XSdPs_Idle(), and XSdPs_ResetConfig().

s32 XSdPs_ResetConfig | ( | XSdPs * | InstancePtr | ) |

Configures the initial Reset.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs_Config::BaseAddress, XSdPs::Config, XSdPs::Host_Caps, XSdPs_DisableBusPower(), XSdPs_EnableBusPower(), and XSdPs_Reset().

Referenced by XSdPs_CfgInitialize().

s32 XSdPs_Sanitize | ( | XSdPs * | InstancePtr | ) |

Performs Sanitize operation on the unmapped user address range.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  - XST_SUCCESS if Sanitize is successful
  - XST_FAILURE if failure - could be because another transfer is in progress or card not present or Sanitize operation failure.

References XSdPs::Config, XSdPs::IsBusy, XSdPs::IsReady, and XSdPs_Set_Mmc_ExtCsd().

s32 XSdPs_SdCardEnum | ( | XSdPs * | InstancePtr | ) |

Enumerates the SD card.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs::BusSpeed, XSdPs::HC_Version, SD_CLK_19_MHZ, SD_CLK_25_MHZ, XSdPs_CardIfCond(), XSdPs_CardOpCond(), XSdPs_CardReset(), XSdPs_Change_ClkFreq(), XSdPs_CheckCardDetect(), XSdPs_GetCardId(), XSdPs_GetCsd(), and XSdPs_Select_Card().

Referenced by XSdPs_SdCardInitialize().

s32 XSdPs_SdCardInitialize | ( | XSdPs * | InstancePtr | ) |

This function Initializes SD.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  - XST_SUCCESS if initialization was successful
  - XST_FAILURE if failure - could be because a) SD is already initialized b) There is no card inserted c) One of the steps (commands) in the initialization cycle failed

Note
  This function initializes the SD card by following its initialization and identification state diagram. CMD0 is sent to reset card. CMD8 and ACDM41 are sent to identify voltage and high capacity support CMD2 and CMD3 are sent to obtain Card ID and Relative card address respectively. CMD9 is sent to read the card specific data.

References XSdPs_Config::BusWidth, XSdPs::Config, XSdPs_SdCardEnum(), and XSdPs_SdModeInit().

Referenced by XSdPs_CardInitialize().

s32 XSdPs_SdModeInit | ( | XSdPs * | InstancePtr | ) |

Initializes SD mode.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  - XST_SUCCESS if initialization is successful
  - XST_FAILURE if failure

References XSdPs_Config::BusWidth, XSdPs::BusWidth, XSdPs::Config, HIGH_SPEED_SUPPORT, XSdPs::ITapDelay, XSdPs_Config::ITapDly_SDR_Clk50, XSdPs::Mode, XSdPs::OTapDelay, XSdPs_Config::OTapDly_SDR_Clk50, SCR_SPEC_VER_3, XSdPs_Config::SlotType, XSdPs::Switch1v8, UHS_SDR50_SUPPORT, WIDTH_4_BIT_SUPPORT, XSDPS_BLK_SIZE_512_MASK, XSdPs_CardSetVoltage18(), XSdPs_Change_BusSpeed(), XSdPs_Change_BusWidth(), XSdPs_Get_BusSpeed(), XSdPs_Get_BusWidth(), XSdPs_Identify_UhsMode(), and XSdPs_SetBlkSize().

Referenced by XSdPs_SdCardInitialize().

s32 XSdPs_Select_Card | ( | XSdPs * | InstancePtr | ) |

Selects card and sets default block size.

Parameters

  InstancePtr | Pointer to the XSdPs instance.

Returns
  - XST_SUCCESS if successful.
  - XST_FAILURE if fail.
  - XSDPS_CT_ERROR if Command Transfer fail.

References XSdPs::IsReady, XSdPs::RelCardAddr, and XSdPs_CmdTransfer().

Referenced by XSdPs_MmcCardEnum(), and XSdPs_SdCardEnum().

s32 XSdPs_SendCmd | ( | XSdPs * | InstancePtr,
|  | u32 | Cmd
| ) |  |

Initiates the Cmd transfer to SD card.

Parameters

  InstancePtr | Pointer to the instance to be worked on.
  Cmd | Command to be sent

Returns
  - XST_SUCCESS if initialization was successful
  - XST_FAILURE if failure

References XSdPs_Config::BaseAddress, XSdPs::Config, XSdPs::TransferMode, and XSdPs_FrameCmd().

Referenced by XSdPs_CmdTransfer().

s32 XSdPs_SendErase | ( | XSdPs * | InstancePtr | ) |

Sends Erase command to the device and wait for transfer complete.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  - XST_SUCCESS if erase operation is successful
  - XST_FAILURE if failure - could be because erase operation failed.

References XSdps_CheckTransferDone(), and XSdPs_CmdTransfer().

Referenced by XSdPs_Erase().

s32 XSdPs_Set_Mmc_ExtCsd | ( | XSdPs * | InstancePtr,
|  | u32 | Arg
| ) |  |

Writes EXT_CSD register of eMMC.

Parameters

  InstancePtr | Pointer to the XSdPs instance.
  Arg | Argument to be sent along with the command.

Returns
  - XST_SUCCESS if successful.
  - XST_FAILURE if fail.

References XSdPs::IsReady, XSdps_CheckTransferDone(), and XSdPs_CmdTransfer().

Referenced by XSdPs_Change_BusWidth(), XSdPs_EmmcModeInit(), and XSdPs_Sanitize().

s32 XSdPs_SetBlkSize | ( | XSdPs * | InstancePtr,
|  | u16 | BlkSize
| ) |  |

Updates Block size for read/write operations.

Parameters

  InstancePtr | Pointer to the instance to be worked on.
  BlkSize | Block size passed by the user.

Returns
  None

References XSdPs_Config::BaseAddress, XSdPs::BlkSize, XSdPs::Config, XSdPs::IsReady, XSdPs_CheckBusIdle(), and XSdPs_CmdTransfer().

Referenced by XSdPs_MmcCardInitialize(), XSdPs_SdModeInit(), and XSdPs_SetupTransfer().

s32 XSdPs_SetClock | ( | XSdPs * | InstancePtr,
|  | u32 | SelFreq
| ) |  |

Sets the clock to the passed frequency.

Parameters

  InstancePtr | Pointer to the instance to be worked on.
  SelFreq | Selected frequency

Returns
  None

References XSdPs_Config::BaseAddress, XSdPs::CardType, XSdPs::Config, XSdPs::Mode, XSdPs_CalcClock(), and XSdPs_EnableClock().

Referenced by XSdPs_Change_ClkFreq().

s32 XSdPs_SetEndAddr | ( | XSdPs * | InstancePtr,
|  | u32 | EndAddr
| ) |  |

Sets the address of the last write block to be erased.

Parameters

  InstancePtr | Pointer to the instance to be worked on.
  EndAddr | Address of the last write block.

Returns
  - XST_SUCCESS if Set End Address is successful.
  - XST_FAILURE if failure - could be because failed to set EndAddr.

References XSdPs::CardType, and XSdPs_CmdTransfer().

Referenced by XSdPs_Erase().

void XSdPs_SetExecTuning | ( | XSdPs * | InstancePtr | ) |

Sets bit to start execution of tuning.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs_Config::BaseAddress, and XSdPs::Config.

Referenced by XSdPs_AutoTuning().

s32 XSdPs_SetStartAddr | ( | XSdPs * | InstancePtr,
|  | u32 | StartAddr
| ) |  |

Sets the address of the first write block to be erased.

Parameters

  InstancePtr | Pointer to the instance to be worked on.
  StartAddr | Address of the first write block.

Returns
  - XST_SUCCESS if Set start Address is successful
  - XST_FAILURE if failure - could be because failed to set EndAddr.

References XSdPs::CardType, and XSdPs_CmdTransfer().

Referenced by XSdPs_Erase().

void XSdPs_SetTapDelay | ( | XSdPs * | InstancePtr | ) |

API to set Tap Delay with respect to the speed modes.

Parameters

  InstancePtr | Pointer to the XSdPs instance.

Returns
  None

References XSdPs::Mode, XSdPs_ConfigTapDelay(), and XSdPs_DllRstCtrl().

Referenced by XSdPs_Change_ClkFreq().

void XSdPs_SetTapDelay_DDR50 | ( | XSdPs * | InstancePtr | ) |

Sets the tap delay for DDR50 uhs mode.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs::Config, XSdPs::ITapDelay, XSdPs_Config::ITapDly_DDR_Clk50, XSdPs::OTapDelay, XSdPs_Config::OTapDly_DDR_Clk50, and XSdPs_Config::SlotType.

Referenced by XSdPs_Identify_UhsMode().

void XSdPs_SetTapDelay_SDR104 | ( | XSdPs * | InstancePtr | ) |

Sets the tap delay for SDR104 uhs mode.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs_Config::BankNumber, XSdPs::Config, XSdPs::OTapDelay, and XSdPs_Config::OTapDly_SDR_Clk200.

Referenced by XSdPs_Identify_UhsMode().

void XSdPs_SetTapDelay_SDR25 | ( | XSdPs * | InstancePtr | ) |

Sets the tap delay for SDR25 uhs mode.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs::Config, XSdPs::ITapDelay, XSdPs_Config::ITapDly_SDR_Clk50, XSdPs::OTapDelay, XSdPs_Config::OTapDly_SDR_Clk50, and XSdPs_Config::SlotType.

Referenced by XSdPs_Identify_UhsMode().

void XSdPs_SetTapDelay_SDR50 | ( | XSdPs * | InstancePtr | ) |

Sets the tap delay for SDR50 uhs mode.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs::Config, XSdPs::OTapDelay, and XSdPs_Config::OTapDly_SDR_Clk100.

Referenced by XSdPs_Identify_UhsMode().

void XSdPs_Setup32ADMA2DescTbl | ( | XSdPs * | InstancePtr,
|  | u32 | BlkCnt,
|  | const u8 * | Buff
| ) |  |

API to setup ADMA2 descriptor table for 32-bit DMA.

Parameters

  InstancePtr | Pointer to the XSdPs instance.
  BlkCnt | Block count.
  Buff | Pointer to data buffer.

Returns
  None

References XSdPs_Config::BaseAddress, XSdPs::Config, and XSdPs_Config::IsCacheCoherent.

Referenced by XSdPs_SetupADMA2DescTbl().

void XSdPs_Setup64ADMA2DescTbl | ( | XSdPs * | InstancePtr,
|  | u32 | BlkCnt,
|  | const u8 * | Buff
| ) |  |

API to setup ADMA2 descriptor table for 64-bit DMA.

Parameters

  InstancePtr | Pointer to the XSdPs instance.
  BlkCnt | Block count.
  Buff | Pointer to data buffer.

Returns
  None

References XSdPs_Config::BaseAddress, XSdPs::Config, and XSdPs_Config::IsCacheCoherent.

Referenced by XSdPs_SetupADMA2DescTbl().

void XSdPs_SetupADMA2DescTbl | ( | XSdPs * | InstancePtr,
|  | u32 | BlkCnt,
|  | const u8 * | Buff
| ) |  |

API to setup ADMA2 descriptor table.

Parameters

  InstancePtr | Pointer to the XSdPs instance.
  BlkCnt | Block count.
  Buff | Pointer to data buffer.

Returns
  None

References XSdPs::HC_Version, XSdPs_Setup32ADMA2DescTbl(), and XSdPs_Setup64ADMA2DescTbl().

Referenced by XSdPs_SetupReadDma(), and XSdPs_SetupWriteDma().

void XSdPs_SetupADMA2DescTbl64Bit | ( | XSdPs * | InstancePtr,
|  | u32 | BlkCnt
| ) |  |

API to setup ADMA2 descriptor table for 64 Bit DMA.

Parameters

  InstancePtr | Pointer to the XSdPs instance.
  BlkCnt | Block count.

Returns
  None

References XSdPs_Config::BaseAddress, XSdPs::Config, XSdPs::Dma64BitAddr, and XSdPs_Config::IsCacheCoherent.

Referenced by XSdPs_SetupReadDma(), and XSdPs_SetupWriteDma().

s32 XSdPs_SetupCmd | ( | XSdPs * | InstancePtr,
|  | u32 | Arg,
|  | u32 | BlkCnt
| ) |  |

Initializes the command sequence.

Parameters

  InstancePtr | Pointer to the instance to be worked on.
  Arg | Address passed by the user that is to be sent as argument along with the command.
  BlkCnt | - Block count passed by the user.

Returns
  None

References XSdPs_Config::BaseAddress, XSdPs::Config, and XSdPs_CheckBusIdle().

Referenced by XSdPs_CmdTransfer().

void XSdPs_SetupReadDma | ( | XSdPs * | InstancePtr,
|  | u16 | BlkCnt,
|  | u16 | BlkSize,
|  | u8 * | Buff
| ) |  |

This function is used to do the DMA transfer to or from SD card.

Parameters

  InstancePtr | Pointer to the instance to be worked on.
  BlkCnt | Block count passed by the user.
  BlkSize | Block size passed by the user.
  Buff | Pointer to the data buffer for a DMA transfer.

Returns
  - XST_SUCCESS if initialization was successful
  - XST_FAILURE if failure - could be because another transfer is in progress or command or data inhibit is set

References ADDRESS_BEYOND_32BIT, XSdPs_Config::BaseAddress, XSdPs::Config, XSdPs::Dma64BitAddr, XSdPs_Config::IsCacheCoherent, XSdPs::TransferMode, XSdPs_SetupADMA2DescTbl(), and XSdPs_SetupADMA2DescTbl64Bit().

Referenced by XSdPs_Change_SdBusSpeed(), XSdPs_Get_BusSpeed(), XSdPs_Get_BusWidth(), XSdPs_Get_Mmc_ExtCsd(), XSdPs_Get_Status(), and XSdPs_Read().

s32 XSdPs_SetupTransfer | ( | XSdPs * | InstancePtr | ) |

Initiates the transfer to or from SD card.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  - XST_SUCCESS if initialization was successful
  - XST_FAILURE if failure

References XSdPs_Config::BaseAddress, XSdPs_Config::CardDetect, XSdPs::Config, XSdPs::HC_Version, XSdPs::Host_Caps, XSDPS_BLK_SIZE_512_MASK, and XSdPs_SetBlkSize().

Referenced by XSdPs_ReadPolled(), XSdPs_StartReadTransfer(), XSdPs_StartWriteTransfer(), and XSdPs_WritePolled().

s32 XSdPs_SetupVoltageSwitch | ( | XSdPs * | InstancePtr | ) |

Sets up the voltage switch.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  None

References XSdPs_Config::BaseAddress, XSdPs::Config, and XSdPs_CmdTransfer().

Referenced by XSdPs_Switch_Voltage().

void XSdPs_SetupWriteDma | ( | XSdPs * | InstancePtr,
|  | u16 | BlkCnt,
|  | u16 | BlkSize,
|  | const u8 * | Buff
| ) |  |

This function is used to do the DMA transfer to or from SD card.

Parameters

  InstancePtr | Pointer to the instance to be worked on.
  BlkCnt | Block count passed by the user.
  BlkSize | Block size passed by the user.
  Buff | Pointer to the data buffer for a DMA transfer.

Returns
  - XST_SUCCESS if initialization was successful
  - XST_FAILURE if failure - could be because another transfer is in progress or command or data inhibit is set

References ADDRESS_BEYOND_32BIT, XSdPs_Config::BaseAddress, XSdPs::Config, XSdPs::Dma64BitAddr, XSdPs_Config::IsCacheCoherent, XSdPs::TransferMode, XSdPs_SetupADMA2DescTbl(), and XSdPs_SetupADMA2DescTbl64Bit().

Referenced by XSdPs_Write().

s32 XSdPs_SetVoltage18 | ( | XSdPs * | InstancePtr | ) |

Sets voltage to 1.8 V.

Parameters

  InstancePtr | Pointer to the instance to be worked on.

Returns
  - XST_SUCCESS if successful
  - XST_FAILURE if failure

References XSdPs_Config::BaseAddress, XSdPs::Config, and XSdPs_CheckVoltage18().

Referenced by XSdPs_CardSetVoltage18().

s32 XSdPs_StartReadTransfer | ( | XSdPs * | InstancePtr,
|  | u32 | Arg,
|  | u32 | BlkCnt,
|  | u8 * | Buff
| ) |  |

Performs SD read in polled mode.

Parameters

  InstancePtr | Pointer to the instance to be worked on.
  Arg | Address passed by the user that is to be sent as argument along with the command.
  BlkCnt | Block count passed by the user.
  Buff | Pointer to the data buffer for a DMA transfer.

Returns
  - XST_SUCCESS if Transfer initialization was successful
  - XST_FAILURE if failure - could be because another transfer is in progress or command or data inhibit is set

References XSdPs::IsBusy, XSdPs::IsReady, XSdPs_Read(), and XSdPs_SetupTransfer().

s32 XSdPs_StartWriteTransfer | ( | XSdPs * | InstancePtr,
|  | u32 | Arg,
|  | u32 | BlkCnt,
|  | u8 * | Buff
| ) |  |

Starts SD write transfer.

Parameters

  InstancePtr | Pointer to the instance to be worked on.
  Arg | Address passed by the user that is to be sent as argument along with the command.
  BlkCnt | Block count passed by the user.
  Buff | Pointer to the data buffer for a DMA transfer.

Returns
  - XST_SUCCESS if Transfer initialization was successful
  - XST_FAILURE if failure - could be because another transfer is in progress or command or data inhibit is set

References XSdPs::IsBusy, XSdPs::IsReady, XSdPs_SetupTransfer(), and XSdPs_Write().

s32 XSdPs_Switch_Voltage | ( | XSdPs * | InstancePtr | ) |

Switches the SD card voltage from 3v3 to 1v8.

Parameters

  InstancePtr | Pointer to the XSdPs instance.

References XSdPs_CardSetVoltage18(), XSdPs_CheckBusHigh(), and XSdPs_SetupVoltageSwitch().

Referenced by XSdPs_CardOpCond().

s32 XSdPs_Write | ( | XSdPs * | InstancePtr,
|  | u32 | Arg,
|  | u32 | BlkCnt,
|  | const u8 * | Buff
| ) |  |

Performs SD write in polled mode.

Parameters

  InstancePtr | Pointer to the instance to be worked on.
  Arg | Address passed by the user that is to be sent as argument along with the command.
  BlkCnt | - Block count passed by the user.
  Buff | - Pointer to the data buffer for a DMA transfer.

Returns
  - XST_SUCCESS if initialization was successful
  - XST_FAILURE if failure - could be because another transfer is in progress or command or data inhibit is set

References XSdPs::BlkSize, XSdPs_CmdTransfer(), and XSdPs_SetupWriteDma().

Referenced by XSdPs_StartWriteTransfer(), and XSdPs_WritePolled().

s32 XSdPs_WritePolled | ( | XSdPs * | InstancePtr,
|  | u32 | Arg,
|  | u32 | BlkCnt,
|  | const u8 * | Buff
| ) |  |

Performs SD write in polled mode.

Parameters

  InstancePtr | Pointer to the instance to be worked on.
  Arg | Address passed by the user that is to be sent as argument along with the command.
  BlkCnt | Block count passed by the user.
  Buff | Pointer to the data buffer for a DMA transfer.

Returns
  - XST_SUCCESS if initialization was successful
  - XST_FAILURE if failure - could be because another transfer is in progress or command or data inhibit is set

References XSdPs::Config, XSdPs::IsBusy, XSdPs::IsReady, XSdps_CheckTransferDone(), XSdPs_SetupTransfer(), and XSdPs_Write().

## Variable Documentation

XSdPs_Config XSdPs_ConfigTable[]

Initial value:
=
{
{
XPAR_XSDPS_0_DEVICE_ID,
XPAR_XSDPS_0_BASEADDR,
XPAR_XSDPS_0_SDIO_CLK_FREQ_HZ,
XPAR_XSDPS_0_HAS_CD,
XPAR_XSDPS_0_HAS_WP,
XPAR_XSDPS_0_BUS_WIDTH,
XPAR_XSDPS_0_MIO_BANK,
XPAR_XSDPS_0_HAS_EMIO,
XPAR_XSDPS_0_SLOT_TYPE,
XPAR_XSDPS_0_IS_CACHE_COHERENT,
XPAR_XSDPS_0_CLK_50_SDR_ITAP_DLY,
XPAR_XSDPS_0_CLK_50_SDR_OTAP_DLY,
XPAR_XSDPS_0_CLK_50_DDR_ITAP_DLY,
XPAR_XSDPS_0_CLK_50_DDR_OTAP_DLY,
XPAR_XSDPS_0_CLK_100_SDR_OTAP_DLY,
XPAR_XSDPS_0_CLK_200_SDR_OTAP_DLY,
XPAR_XSDPS_0_CLK_200_DDR_OTAP_DLY
}
}

The configuration table for devices.

XSdPs Configuration Table.

Referenced by XSdPs_LookupConfig().

XSdPs_Config XSdPs_ConfigTable[XPAR_XSDPS_NUM_INSTANCES]

XSdPs Configuration Table.

XSdPs Configuration Table.

Referenced by XSdPs_LookupConfig().