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_tree.c
- Revision:
- 48:40fc4462265c
- Parent:
- 6:55b47464d5bc
- Child:
- 51:ab4529a384a6
--- a/stack/pico_tree.c Thu Jul 25 09:36:23 2013 +0000 +++ b/stack/pico_tree.c Fri Aug 02 07:28:05 2013 +0000 @@ -67,9 +67,9 @@ else { if (IS_NOT_LEAF(node->parent) && AM_I_LEFT_CHILD(node)) - node = node->parent; + node = node->parent; else { - while (IS_NOT_LEAF(node->parent) && AM_I_RIGHT_CHILD(node)) + while (IS_NOT_LEAF(node->parent) && AM_I_RIGHT_CHILD(node)) node = node->parent; node = node->parent; @@ -81,18 +81,18 @@ struct pico_tree_node * pico_tree_prev(struct pico_tree_node * node) { if (IS_NOT_LEAF(node->leftChild)) { - node = node->leftChild; - while (IS_NOT_LEAF(node->rightChild)) - node = node->rightChild; + node = node->leftChild; + while (IS_NOT_LEAF(node->rightChild)) + node = node->rightChild; } else { - if (IS_NOT_LEAF(node->parent) && AM_I_RIGHT_CHILD(node)) - node = node->parent; - else { - while (IS_NOT_LEAF(node) && AM_I_LEFT_CHILD(node)) - node = node->parent; + if (IS_NOT_LEAF(node->parent) && AM_I_RIGHT_CHILD(node)) + node = node->parent; + else { + while (IS_NOT_LEAF(node) && AM_I_LEFT_CHILD(node)) + node = node->parent; - node = node->parent; - } + node = node->parent; + } } return node; } @@ -108,9 +108,9 @@ LocalKey = (IS_NOT_LEAF(tree->root) ? pico_tree_findKey(tree,key) : NULL); // if node already in, bail out if(LocalKey) - return LocalKey; + return LocalKey; else - insert = create_node(tree,key); + insert = create_node(tree,key); // search for the place to insert the new node while(IS_NOT_LEAF(temp)) @@ -127,7 +127,7 @@ if(IS_LEAF(last_node)) tree->root = insert; else{ - result = tree->compare(insert->keyValue,last_node->keyValue); + result = tree->compare(insert->keyValue,last_node->keyValue); if(result < 0) last_node->leftChild = insert; else @@ -148,13 +148,13 @@ while(IS_NOT_LEAF(found)) { - int result; - result = tree->compare(found->keyValue, key); - if(result == 0) - { - return found; - } - else if(result < 0) + int result; + result = tree->compare(found->keyValue, key); + if(result == 0) + { + return found; + } + else if(result < 0) found = found->rightChild; else found = found->leftChild; @@ -174,12 +174,12 @@ while(IS_NOT_LEAF(found)) { - int result; + int result; - result = tree->compare(found->keyValue, key); - if(result == 0) - return found->keyValue; - else if(result < 0) + result = tree->compare(found->keyValue, key); + if(result == 0) + return found->keyValue; + else if(result < 0) found = found->rightChild; else found = found->leftChild; @@ -236,11 +236,11 @@ temp = min->rightChild; if(min->parent == ltemp && IS_NOT_LEAF(temp)) - temp->parent = min; + temp->parent = min; else{ - switchNodes(tree, min, min->rightChild); - min->rightChild = ltemp->rightChild; - if(IS_NOT_LEAF(min->rightChild)) min->rightChild->parent = min; + switchNodes(tree, min, min->rightChild); + min->rightChild = ltemp->rightChild; + if(IS_NOT_LEAF(min->rightChild)) min->rightChild->parent = min; } switchNodes(tree, ltemp, min); min->leftChild = ltemp->leftChild; @@ -326,7 +326,7 @@ temp = (struct pico_tree_node *)pico_zalloc(sizeof(struct pico_tree_node)); if(!temp) - return NULL; + return NULL; temp->keyValue = key; temp->parent = &LEAF; @@ -345,9 +345,9 @@ { struct pico_tree_node* temp; - while(node->parent->color == RED) + while(node->parent->color == RED && IS_NOT_LEAF(GRANPA(node)) ) { - if(AM_I_RIGHT_CHILD(node->parent)) + if(AM_I_RIGHT_CHILD(node->parent)) { temp = GRANPA(node)->leftChild; if(temp->color == RED){ @@ -366,7 +366,7 @@ rotateToLeft(tree, GRANPA(node)); } } - else if(AM_I_LEFT_CHILD(node->parent)) + else if(AM_I_LEFT_CHILD(node->parent)) { temp = GRANPA(node)->rightChild; if(temp->color == RED){ @@ -383,7 +383,7 @@ node->parent->color = BLACK; GRANPA(node)->color = RED; rotateToRight(tree, GRANPA(node)); - } + } } } @@ -398,7 +398,7 @@ tree->root = nodeB; else if(IS_NOT_LEAF(nodeA)) - { + { if(AM_I_LEFT_CHILD(nodeA)) nodeA->parent->leftChild = nodeB; else @@ -420,7 +420,7 @@ while( node != tree->root && node->color == BLACK && IS_NOT_LEAF(node)) { - if(AM_I_LEFT_CHILD(node)){ + if(AM_I_LEFT_CHILD(node)){ temp = node->parent->rightChild; if(temp->color == RED)