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:
Fri May 17 12:09:59 2013 +0000
Revision:
1:cfe8984a32b4
Parent:
libraries/picotcp/modules/pico_dev_loop.c@0:d7f2341ab245
Update for smaller SOCKETQ

Who changed what in which revision?

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