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:
Mon Sep 02 08:02:21 2013 +0000
Revision:
51:ab4529a384a6
Parent:
3:b4047e8a0123
Child:
63:97f481e33cb2
Updated from masterbranch

Who changed what in which revision?

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