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.
Revision 53:f3ea2e39a7b2, committed 2013-09-04
- Comitter:
- tass
- Date:
- Wed Sep 04 08:36:00 2013 +0000
- Parent:
- 51:ab4529a384a6
- Parent:
- 52:44834aeeec18
- Child:
- 54:edf263d0b1d8
- Commit message:
- removed _is_connected variable in TCPSocketConnection class because it was redundant. Also fixed is_connected method
Changed in this revision
--- a/EthernetInterface/EthernetInterface.cpp Mon Sep 02 08:02:21 2013 +0000 +++ b/EthernetInterface/EthernetInterface.cpp Wed Sep 04 08:36:00 2013 +0000 @@ -76,11 +76,11 @@ gateway = pico_dhcp_get_gateway(id); //if (address) ? // still needed pico_ipv4_to_string(ip_addr, address.addr); - printf("IP assigned : %s\n",ip_addr); + eth_dbg("IP assigned : %s\n",ip_addr); if (gateway.addr != 0) { pico_ipv4_to_string(gw_addr, gateway.addr); - printf("Default gateway assigned : %s\n",gw_addr); + eth_dbg("Default gateway assigned : %s\n",gw_addr); pico_ipv4_route_add(zero, zero, gateway, 1, NULL); }
--- a/Socket/TCPSocketConnection.cpp Mon Sep 02 08:02:21 2013 +0000 +++ b/Socket/TCPSocketConnection.cpp Wed Sep 04 08:36:00 2013 +0000 @@ -33,8 +33,8 @@ using std::memset; using std::memcpy; -TCPSocketConnection::TCPSocketConnection() : - _is_connected(false) { +TCPSocketConnection::TCPSocketConnection() +{ } int TCPSocketConnection::connect(const char* host, const int port) { @@ -53,18 +53,20 @@ close(); return -1; } - _is_connected = true; return 0; } bool TCPSocketConnection::is_connected(void) { - return _is_connected; + if((_ep == NULL) || (_ep->state != SOCK_CONNECTED)) + return false; + else + return true; } int TCPSocketConnection::send(char* data, int length) { int ret; - if ((_ep == NULL) || !_is_connected) + if (!is_connected()) return -1; if(is_writable()) @@ -97,7 +99,7 @@ int TCPSocketConnection::receive(char* data, int length) { int ret; - if ((_ep == NULL) || !_is_connected) + if (!is_connected()) return -1; if(is_readable())
--- a/Socket/TCPSocketConnection.h Mon Sep 02 08:02:21 2013 +0000 +++ b/Socket/TCPSocketConnection.h Wed Sep 04 08:36:00 2013 +0000 @@ -83,10 +83,6 @@ \return the number of received bytes on success (>=0) or -1 on failure */ int receive_all(char* data, int length); - -private: - bool _is_connected; - }; #endif
--- a/Socket/TCPSocketServer.cpp Mon Sep 02 08:02:21 2013 +0000 +++ b/Socket/TCPSocketServer.cpp Wed Sep 04 08:36:00 2013 +0000 @@ -87,7 +87,6 @@ return -1; //Accept failed } connection.set_blocking(true,1500); - connection._is_connected = true; pico_ipv4_to_string(address, connection._remoteHost.sin_addr.s_addr); connection.set_address(address, connection._remoteHost.sin_port); return 0;
--- a/include/arch/pico_mbed.h Mon Sep 02 08:02:21 2013 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/********************************************************************* -PicoTCP. Copyright (c) 2012 TASS Belgium NV. Some rights reserved. -See LICENSE and COPYING for usage. -Do not redistribute without a written permission by the Copyright -holders. - -File: pico_mbed.h -Author: Toon Peters -*********************************************************************/ - -#ifndef PICO_SUPPORT_MBED -#define PICO_SUPPORT_MBED - -//#include "mbed.h" -//#include "serial_api.h" - -/* -Debug needs initialization: -* void serial_init (serial_t *obj, PinName tx, PinName rx); -* void serial_baud (serial_t *obj, int baudrate); -* void serial_format (serial_t *obj, int data_bits, SerialParity parity, int stop_bits); -*/ - -#define dbg(...) -#define pico_zalloc(x) calloc(x, 1) -#define pico_free(x) free(x) - - -#define PICO_SUPPORT_MUTEX -extern void *pico_mutex_init(void); -extern void pico_mutex_lock(void*); -extern void pico_mutex_unlock(void*); - - -extern uint32_t os_time; - -static inline unsigned long PICO_TIME(void) -{ - return (unsigned long)os_time / 1000; -} - -static inline unsigned long PICO_TIME_MS(void) -{ - return (unsigned long)os_time; -} - -static inline void PICO_IDLE(void) -{ - // TODO needs implementation -} -/* -static inline void PICO_DEBUG(const char * formatter, ... ) -{ - char buffer[256]; - char *ptr; - va_list args; - va_start(args, formatter); - vsnprintf(buffer, 256, formatter, args); - ptr = buffer; - while(*ptr != '\0') - serial_putc(serial_t *obj, (int) (*(ptr++))); - va_end(args); - //TODO implement serial_t -}*/ - -#endif