/* This function checks if the card is present or not.  */
s32 XSdPs_CheckCardDetect(XSdPs *InstancePtr)
/* This function checks if the card is present or not.  */
s32 XSdPs_CheckCardDetect(XSdPs *InstancePtr)
{
    u32 PresentStateReg;
    s32 Status;
    if ((InstancePtr->HC_Version == XSDPS_HC_SPEC_V3) &&
                ((InstancePtr->Host_Caps & XSDPS_CAPS_SLOT_TYPE_MASK)
                == XSDPS_CAPS_EMB_SLOT)) {
        Status = XST_SUCCESS;
        goto RETURN_PATH;
    }
    if(InstancePtr->Config.CardDetect != 0U) {
        PresentStateReg = XSdPs_ReadReg(InstancePtr->Config.BaseAddress,
                XSDPS_PRES_STATE_OFFSET);
        if ((PresentStateReg & XSDPS_PSR_CARD_INSRT_MASK) == 0U)    {
            Status = XST_FAILURE;
            goto RETURN_PATH;
        }
    }
    Status = XST_SUCCESS;
RETURN_PATH:
    return Status;
}