各位大哥~小弟在研究2440 SPI 中断模式传送,对中断服务程序不是很理解,望各位指教下~
程序如下:
void __irq Spi_Int(void)
{
unsigned int status;
ClearPending(BIT_SPI0);
status=rSPSTA0;
if(rSPSTA0&0x6)
Uart_Printf("Data Collision or Multi Master Error(0x%x)!!!\n", status);
while(!(rSPSTA0&0x1)); //Check ready state
*spiRxStr++=rSPRDAT0; //First Rx data is garbage data
if(*spiTxStr!='\0')
rSPTDAT0=*spiTxStr++;
else
{
rINTMSK|=BIT_SPI0;
endSpiTx=1;
}
} |