uIP 1.0 based webserver for LPC1114 + ENC28J60

Dependencies:   mbed TMP102

Revision:
3:a2715e9c7737
Parent:
2:4da9ed411bdc
--- a/main.cpp	Sat Jun 21 11:54:24 2014 +0000
+++ b/main.cpp	Mon Jun 30 16:00:08 2014 +0000
@@ -18,7 +18,15 @@
     => /dev-enc28j60/tapdev.cpp
 */
 
+//Serial pc(USBTX, USBRX); // tx, rx
+//RawSerial pc(USBTX, USBRX); // tx, rx
+
 int main() {
+  //pc.baud(9600);
+  //pc.baud(115200);
+  
+  wait_ms(100);
+  
   int i;
   uip_ipaddr_t ipaddr;
   Timer periodic_timer, arp_timer;
@@ -37,12 +45,12 @@
   struct uip_eth_addr mac = {UIP_ETHADDR0, UIP_ETHADDR1, UIP_ETHADDR2, UIP_ETHADDR3, UIP_ETHADDR4, UIP_ETHADDR5};
   uip_setethaddr(mac);
 
-  uip_ipaddr(ipaddr, 192,168,0,12);
-  uip_sethostaddr(ipaddr);
-  uip_ipaddr(ipaddr, 192,168,0,1);
-  uip_setdraddr(ipaddr);
-  uip_ipaddr(ipaddr, 255,255,255,0);
-  uip_setnetmask(ipaddr);
+  uip_ipaddr(&ipaddr, 192,168,0,12);
+  uip_sethostaddr(&ipaddr);
+  uip_ipaddr(&ipaddr, 192,168,0,1);
+  uip_setdraddr(&ipaddr);
+  uip_ipaddr(&ipaddr, 255,255,255,0);
+  uip_setnetmask(&ipaddr);
 
   printf("httpd_init()\n");
   httpd_init();
@@ -77,7 +85,7 @@
     if(uip_len > 0) {
       //printf("recv = %d\n", uip_len);
       
-      if(BUF->type == htons(UIP_ETHTYPE_IP)) {
+      if(BUF->type == UIP_HTONS(UIP_ETHTYPE_IP)) {
         uip_arp_ipin();
         uip_input();
         /* If the above function invocation resulted in data that
@@ -87,7 +95,7 @@
           uip_arp_out();
           tapdev_send();
         }
-      } else if(BUF->type == htons(UIP_ETHTYPE_ARP)) {
+      } else if(BUF->type == UIP_HTONS(UIP_ETHTYPE_ARP)) {
         uip_arp_arpin();
         /* If the above function invocation resulted in data that
            should be sent out on the network, the global variable