41 #include "lpc43xx_dualcore_config.h"
48 #include "lwip/memp.h"
49 #include "lwip/tcpip.h"
50 #include "lwip/ip_addr.h"
51 #include "lwip/netif.h"
52 #include "lwip/timers.h"
54 #include "netif/etharp.h"
57 #include "lwip/dhcp.h"
64 #if (defined(OS_FREE_RTOS) || defined(OS_UCOS_III))
65 extern void http_server_netconn_init(
void);
78 #define UCOS_MIN_STACK_SZ 512
79 #define UCOS_BLINK_TASK_PRIORITY 12
80 #define UCOS_EVENT_TASK_PRIORITY 13
135 if (!nwif->ip_addr.addr)
return;
137 DEBUGOUT(
"IP_ADDR : %s\r\n", ipaddr_ntoa_r((
const ip_addr_t *) &nwif->ip_addr, tmp_buff, 16));
138 DEBUGOUT(
"NET_MASK : %s\r\n", ipaddr_ntoa_r((
const ip_addr_t *) &nwif->netmask, tmp_buff, 16));
139 DEBUGOUT(
"GATEWAY_IP : %s\r\n", ipaddr_ntoa_r((
const ip_addr_t *) &nwif->gw, tmp_buff, 16));
143 #if (defined(OS_FREE_RTOS) || defined(OS_UCOS_III))
162 static void lwip_app_task(
void *arg)
165 ip_addr_t ipaddr, netmask, gw;
166 volatile s32_t tcpipdone = 0;
168 static int prt_ip = 0;
172 DEBUGSTR(
"Waiting for TCPIP thread to initialize...\r\n");
176 DEBUGSTR(
"Starting LWIP HTTP server...\r\n");
180 IP4_ADDR(&gw, 0, 0, 0, 0);
181 IP4_ADDR(&ipaddr, 0, 0, 0, 0);
182 IP4_ADDR(&netmask, 0, 0, 0, 0);
184 IP4_ADDR(&gw, 10, 1, 10, 1);
185 IP4_ADDR(&ipaddr, 10, 1, 10, 234);
186 IP4_ADDR(&netmask, 255, 255, 255, 0);
193 DEBUGSTR(
"Net interface failed to initialize ..\r\n");
202 NVIC_EnableIRQ(ETHERNET_IRQn);
209 http_server_netconn_init();
223 NETIF_INIT_SNMP(&
lpc_netif, snmp_ifType_ethernet_csmacd, 100000000);
226 NETIF_INIT_SNMP(&
lpc_netif, snmp_ifType_ethernet_csmacd, 10000000);
235 tcpip_callback_with_block((tcpip_callback_fn) netif_set_link_up,
239 tcpip_callback_with_block((tcpip_callback_fn) netif_set_link_down,
289 #elif defined(OS_UCOS_III)
292 extern void lwip_init(
void);
294 ip_addr_t ipaddr, netmask, gw;
300 DEBUGSTR(
"Starting lwip_init...\r\n");
303 DEBUGSTR(
"Starting LWIP HTTP server...\r\n");
307 IP4_ADDR(&gw, 0, 0, 0, 0);
308 IP4_ADDR(&ipaddr, 0, 0, 0, 0);
309 IP4_ADDR(&netmask, 0, 0, 0, 0);
311 IP4_ADDR(&gw, 10, 1, 10, 1);
312 IP4_ADDR(&ipaddr, 10, 1, 10, 234);
313 IP4_ADDR(&netmask, 255, 255, 255, 0);
333 #if (defined(OS_FREE_RTOS) || defined(OS_UCOS_III))
345 xTaskCreate(vSetupIFTask, (
signed char *)
"SetupIFx",
346 256,
NULL, (tskIDLE_PRIORITY + 1UL),
347 (xTaskHandle *)
NULL);
350 static OS_TCB lwip_app_taskTCB;
358 (
CPU_STK *) &lwip_app_taskSTK[0],
375 static int prt_ip = 0;
385 sys_check_timeouts();
392 if (physts & PHY_LINK_CHANGED) {
393 if (physts & PHY_LINK_CONNECTED) {
395 if (physts & PHY_LINK_SPEED100) {
396 NETIF_INIT_SNMP(&
lpc_netif, snmp_ifType_ethernet_csmacd, 100000000);
399 NETIF_INIT_SNMP(&
lpc_netif, snmp_ifType_ethernet_csmacd, 10000000);
401 if (physts & PHY_LINK_FULLDUPLX) {
426 #ifdef __IAR_SYSTEMS_ICC__