]> git.karo-electronics.de Git - karo-tx-redboot.git/blobdiff - packages/net/lwip_tcpip/v2_0/tests/httpd.c
unified MX27, MX25, MX37 trees
[karo-tx-redboot.git] / packages / net / lwip_tcpip / v2_0 / tests / httpd.c
index 0df6070c44b463bbb03890eeda4a37866177cb83..65fe7f3fe0ccd663630c2527dcf2a9c538488522 100644 (file)
  */
 
 #include "lwip/debug.h"
-
 #include "lwip/stats.h"
-
 #include "lwip/tcp.h"
+#include <cyg/infra/testcase.h>
+
+#ifdef CYGPKG_LWIP_TCP
 
 struct http_state {
-  char *file;
+  const char *file;
   u32_t left;
   u8_t retries;
 };
@@ -171,7 +172,7 @@ http_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
          }
        }
 
-       hs->file = &sdata;
+       hs->file = sdata;
        hs->left = sizeof(sdata);
 
        pbuf_free(p);
@@ -256,8 +257,9 @@ static cyg_thread thread_data;
 static cyg_handle_t thread_handle;
 
 void
-cyg_user_start(void)
+httpd_main(void)
 {
+    CYG_TEST_INIT();
     // Create a main thread, so we can run the scheduler and have time 'pass'
     cyg_thread_create(10,                // Priority - just a number
                       tmain,          // entry
@@ -269,5 +271,26 @@ cyg_user_start(void)
                       &thread_data       // Thread data structure
             );
     cyg_thread_resume(thread_handle);  // Start it
+    cyg_scheduler_start();
+    CYG_TEST_FAIL_FINISH("Not reached");
+}
+
+externC void
+cyg_start( void )
+{
+    httpd_main();
+}
+
+#else // def CYGPKG_LWIP_TCP
+#define N_A_MSG "TCP support disabled"
+#endif // def CYGFUN_KERNEL_API_C
+
+#ifdef N_A_MSG
+externC void
+cyg_start( void )
+{
+    CYG_TEST_INIT();
+    CYG_TEST_NA(N_A_MSG);
 }
+#endif // N_A_MSG