/* This function is used to check if the Cmd and Dat buses are high.  */
s32 XSdPs_CheckBusHigh(XSdPs *InstancePtr)
/* This function is used to check if the Cmd and Dat buses are high.  */
s32 XSdPs_CheckBusHigh(XSdPs *InstancePtr)
{
    u32 Timeout = 10000;
    s32 Status;
    u32 ReadReg;
    Timeout = MAX_TIMEOUT;
    do {
        ReadReg = XSdPs_ReadReg(InstancePtr->Config.BaseAddress,
                XSDPS_PRES_STATE_OFFSET);
        Timeout = Timeout - 1;
        usleep(1);
    } while (((ReadReg & (XSDPS_PSR_CMD_SG_LVL_MASK | XSDPS_PSR_DAT30_SG_LVL_MASK))
            != (XSDPS_PSR_CMD_SG_LVL_MASK | XSDPS_PSR_DAT30_SG_LVL_MASK))
            && (Timeout != 0U));
    if (Timeout == 0U) {
        Status = XST_FAILURE;
        goto RETURN_PATH ;
    }
    Status = XST_SUCCESS;
RETURN_PATH:
    return Status;
}