/* Check NOTBUSY and DTIP bits of status register on the given MCI driver. Return value, 0 for bus ready, 1 for bus busy  */
unsigned char MCI_CheckBusy(Mci *pMci)
/* Check NOTBUSY and DTIP bits of status register on the given MCI driver. Return value, 0 for bus ready, 1 for bus busy  */
unsigned char MCI_CheckBusy(Mci *pMci)
{
    AT91S_MCI *pMciHw = pMci->pMciHw;
    volatile unsigned int status;
    MCICK_ENABLE(pMciHw);
    status = READ_MCI(pMciHw, MCI_SR);
    if(    ((status & AT91C_MCI_NOTBUSY)!=0)
        && ((status & AT91C_MCI_DTIP)==0)
        ) {
        MCICK_DISABLE(pMciHw);
        return 0;
    }
    else {
        return 1;
    }
}