sdps
Vitis Drivers API Documentation
 All Data Structures Files Functions Variables Macros Groups Pages
xsdps_card.c File Reference

Overview

Implements the card interface functions of the XSdPs driver.

See xsdps.h for a detailed description of the device and driver.

MODIFICATION HISTORY:
Ver   Who    Date     Changes


3.9 mn 03/03/20 Restructured the code for more readability and modularity mn 03/16/20 Move XSdPs_Select_Card API to User APIs 3.10 mn 06/05/20 Check Transfer completion separately from XSdPs_Read and XSdPs_Write APIs mn 10/15/20 Modify power cycle API to poll for SD bus lines to go low for versal platform 3.12 sk 01/28/21 Added support for non-blocking write. sk 02/12/21 Fix the issue in reading CID and CSD. 3.14 sk 10/22/21 Add support for Erase feature. mn 11/28/21 Fix MISRA-C violations. sk 01/10/22 Add support to read slot_type parameter. 4.0 sk 02/25/22 Add support for eMMC5.1. sk 04/07/22 Add support to read custom tap delay values from design for SD/eMMC. 4.1 sk 11/10/22 Add SD/eMMC Tap delay support for Versal Net. 4.1 sa 01/03/23 Report error if Transfer size is greater than 2MB. sa 01/04/23 Update register bit polling logic to use Xil_WaitForEvent/ Xil_WaitForEvents API. sa 01/25/23 Use instance structure to store DMA descriptor tables. 4.2 ap 08/09/23 reordered function XSdPs_Identify_UhsMode. 4.3 ap 12/22/23 Add support to read custom HS400 tap delay value from design for eMMC. 4.5 sk 10/28/25 Update IsCacheCoherent logic to include EL1_NS mode. 4.7 vn 07/30/26 Fix Doxygen warnings 4.7 tb 10/01/26 Align Doxygen comments with AMD documentation standards

#include "xsdps_core.h"

Functions

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 the type of card using the CMD0 + CMD1 sequence. More...
 
s32 XSdPs_SdCardInitialize (XSdPs *InstancePtr)
 Initializes the SD card. More...
 
s32 XSdPs_MmcCardInitialize (XSdPs *InstancePtr)
 Initializes the 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)
 Checks if the CMD and DAT buses are high. More...
 
void XSdPs_Identify_UhsMode (XSdPs *InstancePtr, u8 *ReadBuff)
 Identifies the supported UHS mode. More...
 
void XSdPs_SetTapDelay (XSdPs *InstancePtr)
 Sets the 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)
 Performs the Auto tuning. More...
 
void XSdPs_SetupADMA2DescTbl (XSdPs *InstancePtr, u32 BlkCnt, const u8 *Buff)
 Sets up the ADMA2 descriptor table. More...
 
void XSdPs_SetupADMA2DescTbl64Bit (XSdPs *InstancePtr, u32 BlkCnt)
 Sets up the ADMA2 descriptor table for 64 Bit DMA. More...
 
s32 XSdPs_DllReset (XSdPs *InstancePtr)
 Resets 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 waits for transfer complete. More...