mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Make wlan_start timeout
This commit is contained in:
parent
95b36965ec
commit
43758d1a67
@ -141,7 +141,7 @@ extern void wlan_init( tWlanCB sWlanCB,
|
||||
//!
|
||||
//
|
||||
//*****************************************************************************
|
||||
extern void wlan_start(unsigned short usPatchesAvailableAtHost);
|
||||
extern int wlan_start(unsigned short usPatchesAvailableAtHost);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
|
||||
@ -251,12 +251,13 @@ void SpiReceiveHandler(void *pvBuffer)
|
||||
//!
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
void
|
||||
#define TIMEOUT (500000)
|
||||
int
|
||||
wlan_start(unsigned short usPatchesAvailableAtHost)
|
||||
{
|
||||
|
||||
unsigned long ulSpiIRQState;
|
||||
unsigned long volatile timeout;
|
||||
|
||||
tSLInformation.NumberOfSentPackets = 0;
|
||||
tSLInformation.NumberOfReleasedPackets = 0;
|
||||
@ -281,30 +282,41 @@ wlan_start(unsigned short usPatchesAvailableAtHost)
|
||||
// ASIC 1273 chip enable: toggle WLAN EN line
|
||||
tSLInformation.WriteWlanPin( WLAN_ENABLE );
|
||||
|
||||
timeout = TIMEOUT;
|
||||
if (ulSpiIRQState)
|
||||
{
|
||||
// wait till the IRQ line goes low
|
||||
while(tSLInformation.ReadWlanInterruptPin() != 0)
|
||||
while(tSLInformation.ReadWlanInterruptPin() != 0 && --timeout)
|
||||
{
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// wait till the IRQ line goes high and than low
|
||||
while(tSLInformation.ReadWlanInterruptPin() == 0)
|
||||
while(tSLInformation.ReadWlanInterruptPin() == 0 && --timeout)
|
||||
{
|
||||
}
|
||||
|
||||
while(tSLInformation.ReadWlanInterruptPin() != 0)
|
||||
|
||||
if (timeout == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
timeout = TIMEOUT;
|
||||
while(tSLInformation.ReadWlanInterruptPin() != 0 && --timeout)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (timeout ==0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
SimpleLink_Init_Start(usPatchesAvailableAtHost);
|
||||
|
||||
// Read Buffer's size and finish
|
||||
hci_command_send(HCI_CMND_READ_BUFFER_SIZE, tSLInformation.pucTxCommandBuffer, 0);
|
||||
SimpleLinkWaitEvent(HCI_CMND_READ_BUFFER_SIZE, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user