Add Comm Fallback
This commit is contained in:
Binary file not shown.
@@ -35,12 +35,6 @@
|
||||
#endif
|
||||
|
||||
#include "xil_cache.h"
|
||||
|
||||
#include "GPIO_Driv.h"
|
||||
#include "SPI_Driv.h"
|
||||
#include "cal_meas.h"
|
||||
#include "uart_IO.h"
|
||||
|
||||
#include "lwip/tcp.h"
|
||||
extern void tcp_tmr(void); /* declared in tcp_priv.h, not in public tcp.h */
|
||||
#include "xil_cache.h"
|
||||
@@ -49,6 +43,12 @@ extern void tcp_tmr(void); /* declared in tcp_priv.h, not in public tcp.h */
|
||||
#include "lwip/dhcp.h"
|
||||
#endif
|
||||
|
||||
#include "GPIO_Driv.h"
|
||||
#include "SPI_Driv.h"
|
||||
#include "cal_meas.h"
|
||||
#include "uart_IO.h"
|
||||
#include "lwip_server.h"
|
||||
|
||||
u8 recvbuffer[1024] = {0};
|
||||
|
||||
/* defined by each RAW mode application */
|
||||
@@ -84,6 +84,17 @@ void print_ip_settings(ip_addr_t *ip, ip_addr_t *mask, ip_addr_t *gw)
|
||||
print_ip("Gateway : ", gw);
|
||||
}
|
||||
|
||||
static int net_is_available(void)
|
||||
{
|
||||
if (echo_netif == NULL)
|
||||
return 0;
|
||||
if (!netif_is_up(echo_netif))
|
||||
return 0;
|
||||
if (echo_netif->ip_addr.addr == 0)
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int iMainCom = 1;
|
||||
@@ -150,8 +161,18 @@ int main()
|
||||
|
||||
print_ip_settings(&ipaddr, &netmask, &gw);
|
||||
|
||||
/* start the application (web server, rxtest, txtest, etc..) */
|
||||
start_application();
|
||||
|
||||
//LWIP Related Init END
|
||||
xil_printf("=====================\r\n[I] System Init Done!\r\n");
|
||||
|
||||
/* Check if network is actually available, fallback to UART if not */
|
||||
if (!net_is_available()) {
|
||||
xil_printf("[W] Network unavailable, falling back to UART\r\n");
|
||||
iMainCom = 0;
|
||||
}
|
||||
|
||||
xil_printf("=====================\r\n[I] System Init Done!=====================\r\n");
|
||||
|
||||
|
||||
|
||||
@@ -170,12 +191,7 @@ int main()
|
||||
interface_initial(CPLD_U2);
|
||||
interface_initial(CPLD_U3);
|
||||
|
||||
|
||||
|
||||
xil_printf("[I] Board Init Complete!\r\n[I] Waiting for Command...\r\n");
|
||||
|
||||
/* start the application (web server, rxtest, txtest, etc..) */
|
||||
start_application();
|
||||
xil_printf("\r\n=====================[I] Board Init Complete!\r\n=====================[I] Waiting for Command...\r\n");
|
||||
|
||||
/* receive and process Instructions */
|
||||
if (iMainCom == 1)
|
||||
|
||||
Reference in New Issue
Block a user