/* Close a MCI driver instance and the underlying peripheral.  */
void MCI_Close(Mci *pMci)
/* Close a MCI driver instance and the underlying peripheral.  */
void MCI_Close(Mci *pMci)
{
    AT91S_MCI *pMciHw = pMci->pMciHw;
    SANITY_CHECK(pMci);
    SANITY_CHECK(pMciHw);
    pMci->semaphore = 1;
    pMci->pCommand = 0;
    WRITE_PMC(AT91C_BASE_PMC, PMC_PCDR, (1 << pMci->mciId));
    WRITE_MCI(pMciHw, MCI_CR, AT91C_MCI_MCIDIS);
    WRITE_MCI(pMciHw, MCI_IDR, 0xFFFFFFFF);
}