forked from xuos/xiuos
fixed the exception of close socket and added dhcp and dns demo
This commit is contained in:
@@ -246,7 +246,7 @@ netconn_delete(struct netconn *conn)
|
||||
} else
|
||||
#endif /* LWIP_NETCONN_FULLDUPLEX */
|
||||
{
|
||||
err = netconn_prepare_delete(conn);
|
||||
// err = netconn_prepare_delete(conn);
|
||||
}
|
||||
if (err == ERR_OK) {
|
||||
netconn_free(conn);
|
||||
|
||||
@@ -601,8 +601,14 @@ tcpip_callbackmsg_trycallback_fromisr(struct tcpip_callback_msg *msg)
|
||||
void
|
||||
tcpip_init(tcpip_init_done_fn initfunc, void *arg)
|
||||
{
|
||||
static int tcpip_flag = 0;
|
||||
lwip_init();
|
||||
|
||||
if(tcpip_flag)
|
||||
return;
|
||||
|
||||
tcpip_flag = 1;
|
||||
|
||||
tcpip_init_done = initfunc;
|
||||
tcpip_init_done_arg = arg;
|
||||
if (sys_mbox_new(&tcpip_mbox, TCPIP_MBOX_SIZE) != ERR_OK) {
|
||||
|
||||
@@ -93,6 +93,8 @@ int is_lwip_test = 0; //for lwip input thread
|
||||
|
||||
x_ticks_t lwip_sys_now;
|
||||
|
||||
static int lwip_init_flag = 0;
|
||||
|
||||
struct sys_timeouts {
|
||||
struct sys_timeo *next;
|
||||
};
|
||||
@@ -318,7 +320,7 @@ void sys_mbox_free(sys_mbox_t *mbox)
|
||||
|
||||
int sys_mbox_valid(sys_mbox_t *mbox)
|
||||
{
|
||||
if (*mbox < SYS_MBOX_NULL)
|
||||
if (*mbox <= SYS_MBOX_NULL)
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
@@ -471,10 +473,6 @@ void lwip_config_input(struct netif *net)
|
||||
{
|
||||
pthread_t th_id = 0;
|
||||
|
||||
//neglect create input thread for test
|
||||
if(is_lwip_test)
|
||||
return;
|
||||
|
||||
th_id = sys_thread_new("eth_input", lwip_input_thread, net, 4096, 15);
|
||||
|
||||
if (th_id >= 0) {
|
||||
@@ -484,8 +482,6 @@ void lwip_config_input(struct netif *net)
|
||||
}
|
||||
}
|
||||
|
||||
static int lwip_init_flag = 0;
|
||||
|
||||
void lwip_config_net(char *ip, char *mask, char *gw)
|
||||
{
|
||||
#if defined(FSL_FEATURE_SOC_LPC_ENET_COUNT) && (FSL_FEATURE_SOC_LPC_ENET_COUNT > 0)
|
||||
@@ -521,17 +517,19 @@ void lwip_config_net(char *ip, char *mask, char *gw)
|
||||
netif_set_default(&gnetif);
|
||||
netif_set_up(&gnetif);
|
||||
|
||||
lw_pr_info("\r\n************************************************\r\n");
|
||||
lw_pr_info(" Network Configuration\r\n");
|
||||
lw_pr_info("************************************************\r\n");
|
||||
lw_pr_info(" IPv4 Address : %u.%u.%u.%u\r\n", ((u8_t *)&net_ipaddr)[0], ((u8_t *)&net_ipaddr)[1],
|
||||
((u8_t *)&net_ipaddr)[2], ((u8_t *)&net_ipaddr)[3]);
|
||||
lw_pr_info(" IPv4 Subnet mask : %u.%u.%u.%u\r\n", ((u8_t *)&net_netmask)[0], ((u8_t *)&net_netmask)[1],
|
||||
((u8_t *)&net_netmask)[2], ((u8_t *)&net_netmask)[3]);
|
||||
lw_pr_info(" IPv4 Gateway : %u.%u.%u.%u\r\n", ((u8_t *)&net_gw)[0], ((u8_t *)&net_gw)[1],
|
||||
((u8_t *)&net_gw)[2], ((u8_t *)&net_gw)[3]);
|
||||
lw_pr_info("************************************************\r\n");
|
||||
|
||||
if(is_lwip_test)
|
||||
{
|
||||
lw_pr_info("\r\n************************************************\r\n");
|
||||
lw_pr_info(" Network Configuration\r\n");
|
||||
lw_pr_info("************************************************\r\n");
|
||||
lw_pr_info(" IPv4 Address : %u.%u.%u.%u\r\n", ((u8_t *)&net_ipaddr)[0], ((u8_t *)&net_ipaddr)[1],
|
||||
((u8_t *)&net_ipaddr)[2], ((u8_t *)&net_ipaddr)[3]);
|
||||
lw_pr_info(" IPv4 Subnet mask : %u.%u.%u.%u\r\n", ((u8_t *)&net_netmask)[0], ((u8_t *)&net_netmask)[1],
|
||||
((u8_t *)&net_netmask)[2], ((u8_t *)&net_netmask)[3]);
|
||||
lw_pr_info(" IPv4 Gateway : %u.%u.%u.%u\r\n", ((u8_t *)&net_gw)[0], ((u8_t *)&net_gw)[1],
|
||||
((u8_t *)&net_gw)[2], ((u8_t *)&net_gw)[3]);
|
||||
lw_pr_info("************************************************\r\n");
|
||||
}
|
||||
lwip_config_input(&gnetif);
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
#define GW_ADDR3 5
|
||||
/* USER CODE END 0 */
|
||||
|
||||
#define SYS_MBOX_NULL 0
|
||||
#define SYS_MBOX_NULL -1
|
||||
#define SYS_SEM_NULL 0
|
||||
#define SYS_MRTEX_NULL SYS_SEM_NULL
|
||||
|
||||
|
||||
Reference in New Issue
Block a user