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:
Tue Jul 23 14:56:17 2013 +0000
Revision:
81:6d216969b701
Parent:
29:1a47b7151851
redirected prints

Who changed what in which revision?

UserRevisionLine numberNew contents of line
daniele 29:1a47b7151851 1 /*********************************************************************
daniele 29:1a47b7151851 2 PicoTCP. Copyright (c) 2012 TASS Belgium NV. Some rights reserved.
daniele 29:1a47b7151851 3 See LICENSE and COPYING for usage.
daniele 29:1a47b7151851 4 Do not redistribute without a written permission by the Copyright
daniele 29:1a47b7151851 5 holders.
daniele 29:1a47b7151851 6
daniele 29:1a47b7151851 7 File: pico_mbed.h
daniele 29:1a47b7151851 8 Author: Toon Peters
daniele 29:1a47b7151851 9 *********************************************************************/
daniele 29:1a47b7151851 10
daniele 29:1a47b7151851 11 #ifndef PICO_SUPPORT_MBED
daniele 29:1a47b7151851 12 #define PICO_SUPPORT_MBED
daniele 29:1a47b7151851 13 #include <stdio.h>
daniele 29:1a47b7151851 14
daniele 29:1a47b7151851 15 //#include "mbed.h"
daniele 29:1a47b7151851 16 //#include "serial_api.h"
daniele 29:1a47b7151851 17
daniele 29:1a47b7151851 18 /*
daniele 29:1a47b7151851 19 Debug needs initialization:
daniele 29:1a47b7151851 20 * void serial_init (serial_t *obj, PinName tx, PinName rx);
daniele 29:1a47b7151851 21 * void serial_baud (serial_t *obj, int baudrate);
daniele 29:1a47b7151851 22 * void serial_format (serial_t *obj, int data_bits, SerialParity parity, int stop_bits);
daniele 29:1a47b7151851 23 */
daniele 29:1a47b7151851 24
daniele 29:1a47b7151851 25 #define dbg(...)
daniele 29:1a47b7151851 26 #define pico_zalloc(x) calloc(x, 1)
daniele 29:1a47b7151851 27 #define pico_free(x) free(x)
daniele 29:1a47b7151851 28
daniele 29:1a47b7151851 29 #ifdef MEMORY_MEASURE // in case, comment out the two defines above me.
daniele 29:1a47b7151851 30 extern uint32_t max_mem;
daniele 29:1a47b7151851 31 extern uint32_t cur_mem;
daniele 29:1a47b7151851 32
daniele 29:1a47b7151851 33 static inline void * pico_zalloc(int x)
daniele 29:1a47b7151851 34 {
daniele 29:1a47b7151851 35 uint32_t *ptr;
daniele 29:1a47b7151851 36 if ((cur_mem + x )> (10 * 1024))
daniele 29:1a47b7151851 37 return NULL;
daniele 29:1a47b7151851 38
daniele 29:1a47b7151851 39 ptr = (uint32_t *)calloc(x + 4, 1);
daniele 29:1a47b7151851 40 *ptr = (uint32_t)x;
daniele 29:1a47b7151851 41 cur_mem += x;
daniele 29:1a47b7151851 42 if (cur_mem > max_mem) {
daniele 29:1a47b7151851 43 max_mem = cur_mem;
tass 81:6d216969b701 44 dbg("max mem: %lu\n", max_mem);
daniele 29:1a47b7151851 45 }
daniele 29:1a47b7151851 46 return (void*)(ptr + 1);
daniele 29:1a47b7151851 47 }
daniele 29:1a47b7151851 48
daniele 29:1a47b7151851 49 static inline void pico_free(void *x)
daniele 29:1a47b7151851 50 {
daniele 29:1a47b7151851 51 uint32_t *ptr = (uint32_t*)(((uint8_t *)x) - 4);
daniele 29:1a47b7151851 52 cur_mem -= *ptr;
daniele 29:1a47b7151851 53 free(ptr);
daniele 29:1a47b7151851 54 }
daniele 29:1a47b7151851 55 #endif
daniele 29:1a47b7151851 56
daniele 29:1a47b7151851 57 #define PICO_SUPPORT_MUTEX
daniele 29:1a47b7151851 58 extern void *pico_mutex_init(void);
daniele 29:1a47b7151851 59 extern void pico_mutex_lock(void*);
daniele 29:1a47b7151851 60 extern void pico_mutex_unlock(void*);
daniele 29:1a47b7151851 61
daniele 29:1a47b7151851 62
daniele 29:1a47b7151851 63 extern uint32_t os_time;
daniele 29:1a47b7151851 64
daniele 29:1a47b7151851 65 static inline unsigned long PICO_TIME(void)
daniele 29:1a47b7151851 66 {
daniele 29:1a47b7151851 67 return (unsigned long)os_time / 1000;
daniele 29:1a47b7151851 68 }
daniele 29:1a47b7151851 69
daniele 29:1a47b7151851 70 static inline unsigned long PICO_TIME_MS(void)
daniele 29:1a47b7151851 71 {
daniele 29:1a47b7151851 72 return (unsigned long)os_time;
daniele 29:1a47b7151851 73 }
daniele 29:1a47b7151851 74
daniele 29:1a47b7151851 75 static inline void PICO_IDLE(void)
daniele 29:1a47b7151851 76 {
daniele 29:1a47b7151851 77 // TODO needs implementation
daniele 29:1a47b7151851 78 }
daniele 29:1a47b7151851 79 /*
daniele 29:1a47b7151851 80 static inline void PICO_DEBUG(const char * formatter, ... )
daniele 29:1a47b7151851 81 {
daniele 29:1a47b7151851 82 char buffer[256];
daniele 29:1a47b7151851 83 char *ptr;
daniele 29:1a47b7151851 84 va_list args;
daniele 29:1a47b7151851 85 va_start(args, formatter);
daniele 29:1a47b7151851 86 vsnprintf(buffer, 256, formatter, args);
daniele 29:1a47b7151851 87 ptr = buffer;
daniele 29:1a47b7151851 88 while(*ptr != '\0')
daniele 29:1a47b7151851 89 serial_putc(serial_t *obj, (int) (*(ptr++)));
daniele 29:1a47b7151851 90 va_end(args);
daniele 29:1a47b7151851 91 //TODO implement serial_t
daniele 29:1a47b7151851 92 }*/
daniele 29:1a47b7151851 93
daniele 29:1a47b7151851 94 #endif