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 RTOSgeneric mbed Ethernet driverhigh performance NXP LPC1768 specific Ethernet driverMulti-threading support for mbed RTOSBerkeley sockets and integration with the New Socket APIFork of the apps running on top of the New Socket APIScheduling 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.
Diff: stack/pico_frame.c
- Revision:
- 63:97f481e33cb2
- Parent:
- 51:ab4529a384a6
--- a/stack/pico_frame.c Mon Sep 16 12:07:35 2013 +0000 +++ b/stack/pico_frame.c Thu Sep 19 12:38:53 2013 +0000 @@ -103,7 +103,7 @@ new->usage_count = uc; /* Update in-buffer pointers with offset */ - addr_diff = (int)(new->buffer - f->buffer); + addr_diff = (int)new->buffer - (int)f->buffer; new->net_hdr += addr_diff; new->transport_hdr += addr_diff; new->app_hdr += addr_diff; @@ -124,22 +124,19 @@ { uint8_t *buf = (uint8_t *) inbuf; uint16_t tmp = 0; - uint32_t sum = 0; - int i = 0; - - for(i=0; i < len; i++) { - if (i%2) { - sum += buf[i]; - } else { + uint32_t sum = 0, carry=0; + int i=0; + for(i=0; i<len; i++){ + if (i%2){ + sum+=buf[i]; + }else{ tmp = buf[i]; - sum += (tmp << 8); + sum+=( tmp << 8); } } - - while (sum >> 16) { /* a second carry is possible! */ - sum = (sum & 0x0000FFFF) + (sum >> 16); - } - return (uint16_t) (~sum); + carry = (sum&0xFFFF0000) >>16; + sum = (sum&0x0000FFFF); + return (uint16_t) ~(sum + carry) ; } uint16_t pico_dualbuffer_checksum(void *inbuf1, int len1, void *inbuf2, int len2) @@ -147,33 +144,30 @@ uint8_t *b1 = (uint8_t *) inbuf1; uint8_t *b2 = (uint8_t *) inbuf2; uint16_t tmp = 0; - uint32_t sum = 0; - int i = 0, j = 0; - - for(i=0; i < len1; i++) { - if (j%2) { - sum += b1[i]; - } else { + uint32_t sum = 0, carry=0; + int i=0, j=0; + for(i=0; i<len1; i++){ + if (j%2){ + sum+=b1[i]; + }else{ tmp = b1[i]; - sum += (tmp << 8); + sum+=( tmp << 8); } j++; } - j = 0; /* j has to be reset if len1 is odd */ - for(i=0; i < len2; i++) { - if (j%2) { - sum += b2[i]; - } else { + for(i=0; i<len2; i++){ + if (j%2){ + sum+=b2[i]; + }else{ tmp = b2[i]; - sum += (tmp << 8); + sum+=( tmp << 8); } j++; } - while (sum >> 16) { /* a second carry is possible! */ - sum = (sum & 0x0000FFFF) + (sum >> 16); - } - return (uint16_t) (~sum); + carry = (sum&0xFFFF0000) >>16; + sum = (sum&0x0000FFFF); + return (uint16_t) (~(sum + carry)) ; } uint16_t pico_dualbuffer_checksum_broken(void *inbuf1, int len1, void *inbuf2, int len2)