Description
Source
Call Graph
Start Line: 167
void SPID_Handler(Spid *pSpid)
{
SpidCmd *pSpidCmd = pSpid->pCurrentCommand;
AT91S_SPI *pSpiHw = pSpid->pSpiHw;
volatile unsigned int spiSr;
// Read the status register
spiSr = READ_SPI(pSpiHw, SPI_SR);
if (spiSr & AT91C_SPI_RXBUFF) {
// Disable transmitter and receiver
WRITE_SPI(pSpiHw, SPI_PTCR, AT91C_PDC_RXTDIS | AT91C_PDC_TXTDIS);
// Disable the SPI clock
WRITE_PMC(AT91C_BASE_PMC, PMC_PCDR, (1 << pSpid->spiId));
// Disable buffer complete interrupt
WRITE_SPI(pSpiHw, SPI_IDR, AT91C_SPI_RXBUFF);
// Release the dataflash semaphore
pSpid->semaphore++;
// Invoke the callback associated with the current command
if (pSpidCmd && pSpidCmd->callback) {
pSpidCmd->callback(0, pSpidCmd->pArgument);
}
// Nothing must be done after. A new DF operation may have been started
// in the callback function.
}
}