sdps
Vitis Drivers API Documentation
 All Data Structures Files Functions Variables Macros Groups Pages
Overview

Data Structures

struct  XSdPs_Config
 Holds the configuration information for the device. More...
 
struct  XSdPs_Adma2Descriptor32
 Describes an entry of the ADMA2 32-bit descriptor table. More...
 
struct  XSdPs_Adma2Descriptor64
 Describes an entry of the ADMA2 64-bit descriptor table. More...
 
struct  XSdPs
 Holds 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
 Enables eMMC HS400 mode for the Versal Net platform. More...
 

Functions

XSdPs_Config * XSdPs_LookupConfig (UINTPTR BaseAddress)
 Looks up the device configuration based on the unique device ID/BaseAddress. More...
 
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 the card with the 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)
 Idles the SDIO interface. More...
 
s32 XSdPs_Change_BusSpeed (XSdPs *InstancePtr)
 Sets high speed in card and host. More...
 
s32 XSdPs_Change_ClkFreq (XSdPs *InstancePtr, u32 SelFreq)
 Changes the 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)
 Starts SD read transfer. 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_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...
 

Variables

XSdPs_Config XSdPs_ConfigTable []
 Holds the configuration table for each SDPS instance. 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

Enables eMMC HS400 mode for the 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.SD HS mode enabled.

#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
#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_CardInitialize ( XSdPs *  InstancePtr)

Initializes the card with the identification mode sequence.

Parameters
[in,out]InstancePtrPointer 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_Config::RefClk, XSdPs::Switch1v8, XSdPs_Change_ClkFreq(), XSdPs_IdentifyCard(), XSdPs_MmcCardInitialize(), and XSdPs_SdCardInitialize().

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

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

Parameters
[in,out]InstancePtrPointer to the XSdPs instance.
[in]ConfigPtrReference to a structure containing information about a specific SD device. The InstancePtr object is initialized for a specific device specified by the contents of Configuration.
[in]EffectiveAddrDevice 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 the instance is initialized. Unexpected errors may occur if the address mapping changes after the initialization. If address translation is not used, use ConfigPtr->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.
  • XST_FAILURE if host reset or initialization fails.
Note
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::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_Config::RefClk, 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
[in,out]InstancePtrPointer 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
[in]InstancePtrPointer 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 
)

Changes the clock frequency to a given value.

Parameters
[in]InstancePtrPointer to the XSdPs instance.
[in]SelFreqClock frequency in Hz.
Returns
  • XST_SUCCESS if successful.
  • XST_FAILURE if setting the clock fails.
Note
The clock frequency is changed to the value less than or equal to the given value using the permissible dividers.

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_CheckReadTransfer ( XSdPs *  InstancePtr)

Checks if the transfer is completed successfully.

Parameters
[in,out]InstancePtrPointer 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_CheckWriteTransfer ( XSdPs *  InstancePtr)

Checks for the write transfer completed.

Parameters
[in,out]InstancePtrPointer 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_Erase ( XSdPs *  InstancePtr,
u32  StartAddr,
u32  EndAddr 
)

Performs Erase operation on the given address range.

Parameters
[in,out]InstancePtrPointer to the instance to be worked on.
[in]StartAddrAddress of the first write block to be erased.
[in]EndAddrAddress 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_Config::RefClk, XSdPs::TransferMode, XSdPs_SendErase(), XSdPs_SetEndAddr(), and XSdPs_SetStartAddr().

s32 XSdPs_Get_BusSpeed ( XSdPs *  InstancePtr,
u8 *  ReadBuff 
)

Gets bus speed supported by card.

Parameters
[in,out]InstancePtrPointer to the XSdPs instance.
[out]ReadBuffBuffer to store function group support data returned by card.
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_SdModeInit().

s32 XSdPs_Get_BusWidth ( XSdPs *  InstancePtr,
u8 *  ReadBuff 
)

Gets bus width support by card.

Parameters
[in,out]InstancePtrPointer to the XSdPs instance.
[out]ReadBuffBuffer to store SCR register 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().

Referenced by XSdPs_SdModeInit().

s32 XSdPs_Get_Mmc_ExtCsd ( XSdPs *  InstancePtr,
u8 *  ReadBuff 
)

Gets EXT_CSD register of eMMC.

Parameters
[in,out]InstancePtrPointer to the XSdPs instance.
[out]ReadBuffBuffer 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
[in,out]InstancePtrPointer to the XSdPs instance.
[out]SdStatRegBuffer 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_Idle ( XSdPs *  InstancePtr)

Idles the SDIO interface.

Parameters
[in]InstancePtrPointer to the XSdPs instance.
Returns
  • XST_SUCCESS if the SDIO interface is idled.
  • XST_FAILURE if the bus does not become idle or the reset fails.

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

XSdPs_Config* XSdPs_LookupConfig ( UINTPTR  BaseAddress)

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

The XSdPs_ConfigTable[] contains the configuration info for each device in the system.

Parameters
[in]BaseAddressBase address of the device.
Returns
A pointer to the configuration found or NULL if the specified device ID/BaseAddress was not found. See xsdps.h for the definition of XSdPs_Config.
Note
In XSCT/classic flow, the device configuration is looked up by DeviceId.

References XSdPs_Config::Name, and XSdPs_ConfigTable.

s32 XSdPs_Pullup ( XSdPs *  InstancePtr)

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

Parameters
[in]InstancePtrPointer to the XSdPs instance.
Returns
  • XST_SUCCESS if successful.
  • XST_FAILURE if fail.

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

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

Performs SD read in polled mode.

Parameters
[in,out]InstancePtrPointer to the instance to be worked on.
[in]ArgAddress passed by the user that is to be sent as argument along with the command.
[in]BlkCntBlock count passed by the user.
[out]BuffPointer 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_Config::RefClk, XSdps_CheckTransferDone(), XSdPs_Read(), and XSdPs_SetupTransfer().

s32 XSdPs_Sanitize ( XSdPs *  InstancePtr)

Performs Sanitize operation on the unmapped user address range.

Parameters
[in]InstancePtrPointer 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, XSdPs_Config::RefClk, and XSdPs_Set_Mmc_ExtCsd().

s32 XSdPs_Select_Card ( XSdPs *  InstancePtr)

Selects card and sets default block size.

Parameters
[in]InstancePtrPointer 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_Set_Mmc_ExtCsd ( XSdPs *  InstancePtr,
u32  Arg 
)

Writes EXT_CSD register of eMMC.

Parameters
[in]InstancePtrPointer to the XSdPs instance.
[in]ArgArgument 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
[in,out]InstancePtrPointer to the instance to be worked on.
[in]BlkSizeBlock size passed by the user.
Returns
  • XST_SUCCESS if successful.
  • XST_FAILURE if the bus is not idle or the command fails.

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_StartReadTransfer ( XSdPs *  InstancePtr,
u32  Arg,
u32  BlkCnt,
u8 *  Buff 
)

Starts SD read transfer.

Parameters
[in,out]InstancePtrPointer to the instance to be worked on.
[in]ArgAddress passed by the user that is to be sent as argument along with the command.
[in]BlkCntBlock count passed by the user.
[out]BuffPointer 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
[in,out]InstancePtrPointer to the instance to be worked on.
[in]ArgAddress passed by the user that is to be sent as argument along with the command.
[in]BlkCntBlock count passed by the user.
[in]BuffPointer 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_WritePolled ( XSdPs *  InstancePtr,
u32  Arg,
u32  BlkCnt,
const u8 *  Buff 
)

Performs SD write in polled mode.

Parameters
[in,out]InstancePtrPointer to the instance to be worked on.
[in]ArgAddress passed by the user that is to be sent as argument along with the command.
[in]BlkCntBlock count passed by the user.
[in]BuffPointer 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_Config::RefClk, XSdps_CheckTransferDone(), XSdPs_SetupTransfer(), and XSdPs_Write().

Variable Documentation

XSdPs_Config XSdPs_ConfigTable[]

Holds the configuration table for each SDPS instance.

Holds the configuration table for each SDPS instance.

Referenced by XSdPs_LookupConfig().