lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] HTTPD is working on LWIP2.0.3


From: kevin
Subject: [lwip-users] HTTPD is working on LWIP2.0.3
Date: Tue, 17 Oct 2017 23:28:19 -0700 (MST)

Hello everyone,

I am trying to running HTTPD included in LWIP2.0.3 on FreeRTOS.
Actually, I added httpd.c, fs.c, fsdata.c(no compile) to existing echo
server project.
However, after I create a thread of httpd_init() function, the board would
not receive any packet.
Any comments, suggestions or questions are all welcome.
Thank you in advance.

Kevin

------------------ code -------------------------

int main_thread()
{
#if LWIP_DHCP==1
        int mscnt = 0;
#endif

#ifdef XPS_BOARD_ZCU102
        IicPhyReset();
#endif

        /* initialize lwIP before calling sys_thread_new */
    lwip_init();

    /* any thread using lwIP should be created using sys_thread_new */
    sys_thread_new("NW_THRD", network_thread, NULL,
                                THREAD_STACKSIZE,
                                        DEFAULT_THREAD_PRIO);

#if LWIP_DHCP==1
    while (1) {
        vTaskDelay(DHCP_FINE_TIMER_MSECS / portTICK_RATE_MS);
#if LWIP_IPV4 && LWIP_IPV6
                if (server_netif.ip_addr.u_addr.ip4.addr) {
#else
                if (server_netif.ip_addr.addr) {
#endif
                        xil_printf("DHCP request success\r\n");
                        print_ip_settings(&(server_netif.ip_addr), 
&(server_netif.netmask),
&(server_netif.gw));
                        print_echo_app_header();
                        xil_printf("\r\n");

#if     0
                        sys_thread_new("echod", echo_application_thread, 0,
                                        THREAD_STACKSIZE,
                                        DEFAULT_THREAD_PRIO);
#endif
                        break;
                }
                mscnt += DHCP_FINE_TIMER_MSECS;
                if (mscnt >= 50000) {
                        xil_printf("ERROR: DHCP request timed out\r\n");
                        xil_printf("Configuring default IP of 
192.168.1.10\r\n");
                        IP4_ADDR(&(server_netif.ip_addr),  192, 168, 0, 11);
                        IP4_ADDR(&(server_netif.netmask), 255, 255, 0,  0);
                        IP4_ADDR(&(server_netif.gw),  192, 168, 0, 1);
                        print_ip_settings(&(server_netif.ip_addr), 
&(server_netif.netmask),
&(server_netif.gw));
                        /* print all application headers */
                        xil_printf("\r\n");
                        xil_printf("%20s %6s %s\r\n", "Server", "Port", 
"Connect With..");
                        xil_printf("%20s %6s %s\r\n", "--------------------", 
"------",
"--------------------");

                        print_echo_app_header();
                        xil_printf("\r\n");
#if     0
                        sys_thread_new("echod", echo_application_thread, 0,
                                        THREAD_STACKSIZE,
                                        DEFAULT_THREAD_PRIO);
#endif
                        break;
                }
        }
#endif

    xil_printf("before httpd_init() being called !\r\n");

    /* initialize httpd after calling lwip_init() & initializing
network_thread & DHCP procedure */
#if     1
    sys_thread_new("httpd", httpd_init, NULL,
                                TCPIP_THREAD_STACKSIZE*20,
                                        DEFAULT_THREAD_PRIO);
#endif

    xil_printf("after httpd_init() being called !\r\n");

    vTaskDelete(NULL);
    return 0;
}




--
Sent from: http://lwip.100.n7.nabble.com/lwip-users-f3.html



reply via email to

[Prev in Thread] Current Thread [Next in Thread]