调试发现程序一直停留在IRQ管脚判断的位置。
void
wlan_start(unsigned short usPatchesAvailableAtHost)
{
unsigned long ulSpiIRQState;
//
// Allocate the memory for the RX/TX data transactions: the maximal length is
// of the 1700 bytes
//
tSLInformation.pucTxCommandBuffer = wlan_tx_buffer;
//
// init spi
//
SpiOpen(SpiReceiveHandler);
//
// Check the IRQ line
//
ulSpiIRQState = tSLInformation.ReadWlanInterruptPin();
//
// ASIC 1273 chip enable: toggle WLAN EN line
//
tSLInformation.WriteWlanPin( WLAN_ENABLE );
if (ulSpiIRQState)
{
//
// wait till the IRQ line goes low
//
while(tSLInformation.ReadWlanInterruptPin() != 0)
{
}
}
else
{
//
// wait till the IRQ line goes high and than low
//
while(tSLInformation.ReadWlanInterruptPin() == 0) //一直停留在这句
{
}
while(tSLInformation.ReadWlanInterruptPin() != 0)
{
}
}
网上搜有的说可能是开关中断写的有问题。
开关中断用的官方提供的例程,未做修改。
void WlanInterruptEnable()
{
__bis_SR_register(GIE);
P2IES |= BIT3;
P2IE |= BIT3;
}
void WlanInterruptDisable()
{
P2IE &= ~BIT3;
}
有人知道是什么原因引起的吗?
已经困惑好几天了,找不到解决办法。求高人指点一下。