Free (GPLv2) TCP/IP stack developed by TASS Belgium

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.

Committer:
tass
Date:
Thu Sep 19 13:26:14 2013 +0000
Revision:
68:0847e35d08a6
Child:
70:cd218dd180e5
Imported from masterbranch, again

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tass 68:0847e35d08a6 1 /*********************************************************************
tass 68:0847e35d08a6 2 PicoTCP. Copyright (c) 2012 TASS Belgium NV. Some rights reserved.
tass 68:0847e35d08a6 3 See LICENSE and COPYING for usage.
tass 68:0847e35d08a6 4
tass 68:0847e35d08a6 5 Authors: Daniele Lacamera
tass 68:0847e35d08a6 6 *********************************************************************/
tass 68:0847e35d08a6 7
tass 68:0847e35d08a6 8
tass 68:0847e35d08a6 9 #include "pico_device.h"
tass 68:0847e35d08a6 10 #include "pico_dev_loop.h"
tass 68:0847e35d08a6 11 #include "pico_stack.h"
tass 68:0847e35d08a6 12
tass 68:0847e35d08a6 13
tass 68:0847e35d08a6 14 #define LOOP_MTU 1500
tass 68:0847e35d08a6 15 static uint8_t l_buf[LOOP_MTU];
tass 68:0847e35d08a6 16 static int l_bufsize = 0;
tass 68:0847e35d08a6 17
tass 68:0847e35d08a6 18
tass 68:0847e35d08a6 19 static int pico_loop_send(struct pico_device *dev, void *buf, int len)
tass 68:0847e35d08a6 20 {
tass 68:0847e35d08a6 21 IGNORE_PARAMETER(dev);
tass 68:0847e35d08a6 22 if (len > LOOP_MTU)
tass 68:0847e35d08a6 23 return 0;
tass 68:0847e35d08a6 24
tass 68:0847e35d08a6 25 if (l_bufsize == 0) {
tass 68:0847e35d08a6 26 memcpy(l_buf, buf, len);
tass 68:0847e35d08a6 27 l_bufsize+=len;
tass 68:0847e35d08a6 28 return len;
tass 68:0847e35d08a6 29 }
tass 68:0847e35d08a6 30 return 0;
tass 68:0847e35d08a6 31 }
tass 68:0847e35d08a6 32
tass 68:0847e35d08a6 33 static int pico_loop_poll(struct pico_device *dev, int loop_score)
tass 68:0847e35d08a6 34 {
tass 68:0847e35d08a6 35 if (loop_score <= 0)
tass 68:0847e35d08a6 36 return 0;
tass 68:0847e35d08a6 37
tass 68:0847e35d08a6 38 if (l_bufsize > 0) {
tass 68:0847e35d08a6 39 pico_stack_recv(dev, l_buf, l_bufsize);
tass 68:0847e35d08a6 40 l_bufsize = 0;
tass 68:0847e35d08a6 41 loop_score--;
tass 68:0847e35d08a6 42 }
tass 68:0847e35d08a6 43 return loop_score;
tass 68:0847e35d08a6 44 }
tass 68:0847e35d08a6 45
tass 68:0847e35d08a6 46 /* Public interface: create/destroy. */
tass 68:0847e35d08a6 47
tass 68:0847e35d08a6 48 void pico_loop_destroy(struct pico_device *dev)
tass 68:0847e35d08a6 49 {
tass 68:0847e35d08a6 50 IGNORE_PARAMETER(dev);
tass 68:0847e35d08a6 51 }
tass 68:0847e35d08a6 52
tass 68:0847e35d08a6 53 struct pico_device *pico_loop_create(void)
tass 68:0847e35d08a6 54 {
tass 68:0847e35d08a6 55 struct pico_device *loop = pico_zalloc(sizeof(struct pico_device));
tass 68:0847e35d08a6 56 if (!loop)
tass 68:0847e35d08a6 57 return NULL;
tass 68:0847e35d08a6 58
tass 68:0847e35d08a6 59 if( 0 != pico_device_init((struct pico_device *)loop, "loop", NULL)) {
tass 68:0847e35d08a6 60 dbg ("Loop init failed.\n");
tass 68:0847e35d08a6 61 pico_loop_destroy((struct pico_device *)loop);
tass 68:0847e35d08a6 62 return NULL;
tass 68:0847e35d08a6 63 }
tass 68:0847e35d08a6 64 loop->send = pico_loop_send;
tass 68:0847e35d08a6 65 loop->poll = pico_loop_poll;
tass 68:0847e35d08a6 66 loop->destroy = pico_loop_destroy;
tass 68:0847e35d08a6 67 dbg("Device %s created.\n", loop->name);
tass 68:0847e35d08a6 68 return (struct pico_device *)loop;
tass 68:0847e35d08a6 69 }
tass 68:0847e35d08a6 70