Daniele Lacamera / PicoTCP Featured

Dependents:   lpc1768-picotcp-demo ZeroMQ_PicoTCP_Publisher_demo TCPSocket_HelloWorld_PicoTCP Pico_TCP_UDP_Test ... more

PicoTCP. Copyright (c) 2013 TASS Belgium NV.

Released under the GNU General Public License, version 2.

Different licensing models may exist, at the sole discretion of the Copyright holders.

Official homepage: http://www.picotcp.com

Bug tracker: https://github.com/tass-belgium/picotcp/issues

Development steps:

  • initial integration with mbed RTOS
  • generic mbed Ethernet driver
  • high performance NXP LPC1768 specific Ethernet driver
  • Multi-threading support for mbed RTOS
  • Berkeley sockets and integration with the New Socket API
  • Fork of the apps running on top of the New Socket API
  • Scheduling optimizations
  • Debugging/benchmarking/testing

Demo application (measuring TCP sender performance):

Import programlpc1768-picotcp-demo

A PicoTCP demo app testing the ethernet throughput on the lpc1768 mbed board.

Revision:
137:a1c8bfa9d691
Parent:
134:cc4e6d2654d9
Child:
138:0a7a449980e6
--- a/stack/pico_arp.c	Fri Jan 17 10:13:51 2014 +0100
+++ b/stack/pico_arp.c	Fri Feb 07 11:21:12 2014 +0100
@@ -31,7 +31,7 @@
 static int pending_timer_on = 0;
 static int max_arp_reqs = PICO_ARP_MAX_RATE;
 
-void check_pending(pico_time now, void *_unused)
+static void check_pending(pico_time now, void *_unused)
 {
     struct pico_frame *f = pico_dequeue(&pending);
     IGNORE_PARAMETER(now);
@@ -41,8 +41,7 @@
         return;
     }
 
-    if(pico_ethernet_send(f) > 0)
-        pico_frame_discard(f);
+    pico_ethernet_send(f);
 
     pico_timer_add(PICO_ARP_RETRY, &check_pending, NULL);
 }
@@ -154,6 +153,10 @@
     struct pico_ipv4_hdr *hdr = (struct pico_ipv4_hdr *) f->net_hdr;
     struct pico_ipv4_link *l;
 
+#ifndef PICO_SUPPORT_IPV4
+    return NULL;
+#endif
+
     l = pico_ipv4_link_get(&hdr->dst);
     if(l) {
         /* address belongs to ourself */
@@ -204,7 +207,7 @@
 }
 #endif
 
-void arp_expire(pico_time now, void *_stale)
+static void arp_expire(pico_time now, void *_stale)
 {
     struct pico_arp *stale = (struct pico_arp *) _stale;
     IGNORE_PARAMETER(now);
@@ -214,7 +217,7 @@
 
 }
 
-void pico_arp_add_entry(struct pico_arp *entry)
+static void pico_arp_add_entry(struct pico_arp *entry)
 {
     entry->arp_status = PICO_ARP_STATUS_REACHABLE;
     entry->timestamp  = PICO_TIME();
@@ -250,12 +253,17 @@
     struct pico_eth_hdr *eh;
     int ret = -1;
     hdr = (struct pico_arp_hdr *) f->net_hdr;
-    me.addr = hdr->dst.addr;
     eh = (struct pico_eth_hdr *)f->datalink_hdr;
 
     if (!hdr)
         goto end;
 
+#ifndef PICO_SUPPORT_IPV4
+    goto end;
+#endif
+
+    me.addr = hdr->dst.addr;
+
     /* Validate the incoming arp packet */
 
     /* Check the hardware type and protocol */
@@ -355,21 +363,27 @@
     struct pico_frame *q = pico_frame_alloc(PICO_SIZE_ETHHDR + PICO_SIZE_ARPHDR);
     struct pico_eth_hdr *eh;
     struct pico_arp_hdr *ah;
-    struct pico_ip4 *src=NULL;
+    struct pico_ip4 *src = NULL;
     int ret;
 
+    if (!q)
+        return -1;
+
+#ifndef PICO_SUPPORT_IPV4
+    return -1;
+#endif
+
     if (type == PICO_ARP_QUERY)
     {
         src = pico_ipv4_source_find(dst);
-        if (!src)
+        if (!src) {
+            pico_frame_discard(q);
             return -1;
+        }
     }
 
     arp_dbg("QUERY: %08x\n", dst->addr);
 
-    if (!q)
-        return -1;
-
     eh = (struct pico_eth_hdr *)q->start;
     ah = (struct pico_arp_hdr *) (q->start + PICO_SIZE_ETHHDR);