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 26 07:05:22 2013 +0000
Revision:
70:cd218dd180e5
Parent:
68:0847e35d08a6
Child:
131:4758606c9316
Update from masterbranch

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 *********************************************************************/
tass 68:0847e35d08a6 6
tass 68:0847e35d08a6 7 #define DECLARE_HEAP(type, orderby) \
tass 68:0847e35d08a6 8 struct heap_##type { \
tass 68:0847e35d08a6 9 uint32_t size; \
tass 68:0847e35d08a6 10 uint32_t n; \
tass 68:0847e35d08a6 11 type *top; \
tass 68:0847e35d08a6 12 }; \
tass 68:0847e35d08a6 13 typedef struct heap_##type heap_##type; \
tass 68:0847e35d08a6 14 static inline int heap_insert(struct heap_##type *heap, type *el) \
tass 68:0847e35d08a6 15 { \
tass 70:cd218dd180e5 16 uint32_t i; \
tass 68:0847e35d08a6 17 type * newTop; \
tass 68:0847e35d08a6 18 if (++heap->n >= heap->size) { \
tass 68:0847e35d08a6 19 newTop = pico_zalloc((heap->n + 1) * sizeof(type)); \
tass 68:0847e35d08a6 20 if(!newTop) \
tass 68:0847e35d08a6 21 return -1; \
tass 68:0847e35d08a6 22 if (heap->top) {\
tass 68:0847e35d08a6 23 memcpy(newTop,heap->top,heap->n*sizeof(type)); \
tass 68:0847e35d08a6 24 pico_free(heap->top); \
tass 68:0847e35d08a6 25 } \
tass 68:0847e35d08a6 26 heap->top = newTop; \
tass 68:0847e35d08a6 27 heap->size++; \
tass 68:0847e35d08a6 28 } \
tass 68:0847e35d08a6 29 if (heap->n == 1) { \
tass 68:0847e35d08a6 30 memcpy(&heap->top[1], el, sizeof(type)); \
tass 68:0847e35d08a6 31 return 0; \
tass 68:0847e35d08a6 32 } \
tass 68:0847e35d08a6 33 for (i = heap->n; ((i > 1) && (heap->top[i / 2].orderby > el->orderby)); i /= 2) { \
tass 68:0847e35d08a6 34 memcpy(&heap->top[i], &heap->top[i / 2], sizeof(type)); \
tass 68:0847e35d08a6 35 } \
tass 68:0847e35d08a6 36 memcpy(&heap->top[i], el, sizeof(type)); \
tass 68:0847e35d08a6 37 return 0; \
tass 68:0847e35d08a6 38 } \
tass 68:0847e35d08a6 39 static inline int heap_peek(struct heap_##type *heap, type *first) \
tass 68:0847e35d08a6 40 { \
tass 68:0847e35d08a6 41 type *last; \
tass 68:0847e35d08a6 42 uint32_t i, child; \
tass 68:0847e35d08a6 43 if(heap->n == 0) { \
tass 68:0847e35d08a6 44 return -1; \
tass 68:0847e35d08a6 45 } \
tass 68:0847e35d08a6 46 memcpy(first, &heap->top[1], sizeof(type)); \
tass 68:0847e35d08a6 47 last = &heap->top[heap->n--]; \
tass 68:0847e35d08a6 48 for(i = 1; (i * 2) <= heap->n; i = child) { \
tass 68:0847e35d08a6 49 child = 2 * i; \
tass 68:0847e35d08a6 50 if ((child != heap->n) && \
tass 68:0847e35d08a6 51 (heap->top[child + 1]).orderby \
tass 68:0847e35d08a6 52 < (heap->top[child]).orderby) \
tass 68:0847e35d08a6 53 child++; \
tass 68:0847e35d08a6 54 if (last->orderby > \
tass 68:0847e35d08a6 55 heap->top[child].orderby) \
tass 68:0847e35d08a6 56 memcpy(&heap->top[i], &heap->top[child],\
tass 68:0847e35d08a6 57 sizeof(type)); \
tass 68:0847e35d08a6 58 else \
tass 68:0847e35d08a6 59 break; \
tass 68:0847e35d08a6 60 } \
tass 68:0847e35d08a6 61 memcpy(&heap->top[i], last, sizeof(type)); \
tass 68:0847e35d08a6 62 return 0; \
tass 68:0847e35d08a6 63 } \
tass 68:0847e35d08a6 64 static inline type *heap_first(heap_##type *heap) \
tass 68:0847e35d08a6 65 { \
tass 68:0847e35d08a6 66 if (heap->n == 0) \
tass 68:0847e35d08a6 67 return NULL; \
tass 68:0847e35d08a6 68 return &heap->top[1]; \
tass 68:0847e35d08a6 69 } \
tass 68:0847e35d08a6 70 static inline heap_##type *heap_init(void) \
tass 68:0847e35d08a6 71 { \
tass 68:0847e35d08a6 72 heap_##type *p = (heap_##type *)pico_zalloc(sizeof(heap_##type)); \
tass 68:0847e35d08a6 73 return p; \
tass 68:0847e35d08a6 74 } \
tass 68:0847e35d08a6 75 static inline void heap_destroy(heap_##type *h) \
tass 68:0847e35d08a6 76 { \
tass 68:0847e35d08a6 77 pico_free(h->top); \
tass 68:0847e35d08a6 78 pico_free(h); \
tass 68:0847e35d08a6 79 } \
tass 68:0847e35d08a6 80
tass 68:0847e35d08a6 81