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

Overview

Implements the host controller 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 Add code to get card ID for MMC/eMMC 3.10 mn 07/09/20 Modified code to prevent removing pull up on D3 line mn 07/30/20 Read 16Bit value for Block Size Register 3.11 sk 12/01/20 Tap programming sequence updates like disable OTAPEN always, write zero to tap register for zero tap value. sk 12/17/20 Removed checking platform specific SD macros and used Baseaddress instead. 3.13 sk 08/10/21 Limit the SD operating frequency to 19MHz for Versal. 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. sk 06/03/22 Fix issue in internal clock divider calculation logic. 4.1 sk 11/10/22 Add SD/eMMC Tap delay support for Versal Net. 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 Restructured XSdPs_FrameCmd API 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.6 vlt 03/14/26 Updated BaseAddress type from u32 to UINTPTR to support 64-bit addressing. 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

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)
 Sets up the DMA for a read transfer from the SD card. More...
 
void XSdPs_SetupWriteDma (XSdPs *InstancePtr, u16 BlkCnt, u16 BlkSize, const u8 *Buff)
 Sets up the DMA for a write transfer to the SD card. More...
 
void XSdPs_Setup32ADMA2DescTbl (XSdPs *InstancePtr, u32 BlkCnt, const u8 *Buff)
 Sets up the ADMA2 descriptor table for 32-bit DMA. More...
 
void XSdPs_Setup64ADMA2DescTbl (XSdPs *InstancePtr, u32 BlkCnt, const u8 *Buff)
 Sets up the 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)
 Sets or resets the DLL. More...
 
void XSdPs_ConfigTapDelay (XSdPs *InstancePtr)
 Configures 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)
 Frames the Command register for a particular command. More...