SDSPI_ConfigureCS
Default mainpageat91libmemoriessdmmcSDSPI_ConfigureCS
Description Source Call Graph
Start Line: 108
void SDSPI_ConfigureCS(SdSpi *pSdSpi, unsigned char cs, unsigned int csr)
{
    unsigned int spiMr;
    AT91S_SPI *pSpiHw = pSdSpi->pSpiHw;

    // Enable the SPI clock
    AT91C_BASE_PMC->PMC_PCER = (1 << pSdSpi->spiId);

    //TRACE_DEBUG("CSR[%d]=0x%8X\n\r", cs, csr);
    pSpiHw->SPI_CSR[cs] = csr;

//jcb to put in sendcommand
    // Write to the MR register
    spiMr = pSpiHw->SPI_MR;
    spiMr |= AT91C_SPI_PCS;
    spiMr &= ~((1 << cs) << 16);
    pSpiHw->SPI_MR = spiMr;

    // Disable the SPI clock
    AT91C_BASE_PMC->PMC_PCDR = (1 << pSdSpi->spiId);
}