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.
include/pico_stack.h@152:a3d286bf94e5, 2015-09-28 (annotated)
- Committer:
- tass
- Date:
- Mon Sep 28 13:16:18 2015 +0200
- Revision:
- 152:a3d286bf94e5
- Parent:
- 149:5f4cb161cec3
Mercurial: latest development version of PicoTCP
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tass | 68:0847e35d08a6 | 1 | /********************************************************************* |
tass | 152:a3d286bf94e5 | 2 | PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved. |
TASS Belgium NV |
131:4758606c9316 | 3 | See LICENSE and COPYING for usage. |
tass | 68:0847e35d08a6 | 4 | |
TASS Belgium NV |
131:4758606c9316 | 5 | *********************************************************************/ |
tass picotcp@tass.be | 149:5f4cb161cec3 | 6 | #ifndef INCLUDE_PICO_STACK |
tass picotcp@tass.be | 149:5f4cb161cec3 | 7 | #define INCLUDE_PICO_STACK |
tass | 68:0847e35d08a6 | 8 | #include "pico_config.h" |
tass | 68:0847e35d08a6 | 9 | #include "pico_frame.h" |
tass | 68:0847e35d08a6 | 10 | |
tass picotcp@tass.be | 149:5f4cb161cec3 | 11 | #define PICO_MAX_TIMERS 20 |
tass | 68:0847e35d08a6 | 12 | |
tass | 152:a3d286bf94e5 | 13 | #define PICO_ETH_MRU (1514u) |
tass | 152:a3d286bf94e5 | 14 | #define PICO_IP_MRU (1500u) |
tass | 68:0847e35d08a6 | 15 | |
tass | 68:0847e35d08a6 | 16 | /* ===== RECEIVING FUNCTIONS (from dev up to socket) ===== */ |
tass | 68:0847e35d08a6 | 17 | |
tass | 68:0847e35d08a6 | 18 | /* TRANSPORT LEVEL */ |
tass | 68:0847e35d08a6 | 19 | /* interface towards network */ |
tass | 70:cd218dd180e5 | 20 | int32_t pico_transport_receive(struct pico_frame *f, uint8_t proto); |
tass | 68:0847e35d08a6 | 21 | |
tass | 68:0847e35d08a6 | 22 | /* NETWORK LEVEL */ |
tass | 68:0847e35d08a6 | 23 | /* interface towards ethernet */ |
tass | 70:cd218dd180e5 | 24 | int32_t pico_network_receive(struct pico_frame *f); |
tass | 68:0847e35d08a6 | 25 | |
tass | 68:0847e35d08a6 | 26 | |
tass | 68:0847e35d08a6 | 27 | /* LOWEST LEVEL: interface towards devices. */ |
tass | 68:0847e35d08a6 | 28 | /* Device driver will call this function which returns immediately. |
tass | 68:0847e35d08a6 | 29 | * Incoming packet will be processed later on in the dev loop. |
tass picotcp@tass.be | 149:5f4cb161cec3 | 30 | * The zerocopy version will associate the current buffer to the newly created frame. |
tass picotcp@tass.be | 149:5f4cb161cec3 | 31 | * Warning: the buffer used in the zerocopy version MUST have been allocated using PICO_ZALLOC() |
tass | 68:0847e35d08a6 | 32 | */ |
tass | 70:cd218dd180e5 | 33 | int32_t pico_stack_recv(struct pico_device *dev, uint8_t *buffer, uint32_t len); |
tass picotcp@tass.be | 149:5f4cb161cec3 | 34 | int32_t pico_stack_recv_zerocopy(struct pico_device *dev, uint8_t *buffer, uint32_t len); |
tass | 152:a3d286bf94e5 | 35 | int32_t pico_stack_recv_zerocopy_ext_buffer(struct pico_device *dev, uint8_t *buffer, uint32_t len); |
tass | 152:a3d286bf94e5 | 36 | int32_t pico_stack_recv_zerocopy_ext_buffer_notify(struct pico_device *dev, uint8_t *buffer, uint32_t len, void (*notify_free)(uint8_t *buffer)); |
tass | 68:0847e35d08a6 | 37 | |
tass | 152:a3d286bf94e5 | 38 | /* ===== SENDING FUNCTIONS (from socket down to dev) ===== */ |
tass | 68:0847e35d08a6 | 39 | |
tass | 70:cd218dd180e5 | 40 | int32_t pico_network_send(struct pico_frame *f); |
tass | 152:a3d286bf94e5 | 41 | int32_t pico_sendto_dev(struct pico_frame *f); |
tass | 152:a3d286bf94e5 | 42 | |
tass | 152:a3d286bf94e5 | 43 | #ifdef PICO_SUPPORT_ETH |
tass | 70:cd218dd180e5 | 44 | int32_t pico_ethernet_send(struct pico_frame *f); |
tass | 152:a3d286bf94e5 | 45 | |
tass | 152:a3d286bf94e5 | 46 | /* The pico_ethernet_receive() function is used by |
tass | 152:a3d286bf94e5 | 47 | * those devices supporting ETH in order to push packets up |
tass | 152:a3d286bf94e5 | 48 | * into the stack. |
tass | 152:a3d286bf94e5 | 49 | */ |
tass | 152:a3d286bf94e5 | 50 | /* DATALINK LEVEL */ |
tass | 152:a3d286bf94e5 | 51 | int32_t pico_ethernet_receive(struct pico_frame *f); |
tass | 152:a3d286bf94e5 | 52 | #else |
tass | 152:a3d286bf94e5 | 53 | /* When ETH is not supported by the stack... */ |
tass | 152:a3d286bf94e5 | 54 | # define pico_ethernet_send(f) (-1) |
tass | 152:a3d286bf94e5 | 55 | # define pico_ethernet_receive(f) (-1) |
tass | 152:a3d286bf94e5 | 56 | #endif |
tass | 68:0847e35d08a6 | 57 | |
tass | 68:0847e35d08a6 | 58 | /* ----- Initialization ----- */ |
tass picotcp@tass.be | 149:5f4cb161cec3 | 59 | int pico_stack_init(void); |
tass | 68:0847e35d08a6 | 60 | |
tass | 68:0847e35d08a6 | 61 | /* ----- Loop Function. ----- */ |
tass | 68:0847e35d08a6 | 62 | void pico_stack_tick(void); |
tass | 68:0847e35d08a6 | 63 | void pico_stack_loop(void); |
tass | 68:0847e35d08a6 | 64 | |
tass | 68:0847e35d08a6 | 65 | /* ---- Notifications for stack errors */ |
tass | 68:0847e35d08a6 | 66 | int pico_notify_socket_unreachable(struct pico_frame *f); |
tass | 68:0847e35d08a6 | 67 | int pico_notify_proto_unreachable(struct pico_frame *f); |
tass | 68:0847e35d08a6 | 68 | int pico_notify_dest_unreachable(struct pico_frame *f); |
tass | 68:0847e35d08a6 | 69 | int pico_notify_ttl_expired(struct pico_frame *f); |
tass | 152:a3d286bf94e5 | 70 | int pico_notify_frag_expired(struct pico_frame *f); |
tass | 152:a3d286bf94e5 | 71 | int pico_notify_pkt_too_big(struct pico_frame *f); |
tass | 68:0847e35d08a6 | 72 | |
tass | 68:0847e35d08a6 | 73 | /* Various. */ |
tass | 70:cd218dd180e5 | 74 | struct pico_timer; |
tass | 68:0847e35d08a6 | 75 | int pico_source_is_local(struct pico_frame *f); |
tass | 152:a3d286bf94e5 | 76 | int pico_frame_dst_is_unicast(struct pico_frame *f); |
tass | 68:0847e35d08a6 | 77 | void pico_store_network_origin(void *src, struct pico_frame *f); |
tass | 128:ae39e6e81531 | 78 | struct pico_timer *pico_timer_add(pico_time expire, void (*timer)(pico_time, void *), void *arg); |
tass | 70:cd218dd180e5 | 79 | void pico_timer_cancel(struct pico_timer *t); |
tass picotcp@tass.be | 137:a1c8bfa9d691 | 80 | pico_time pico_timer_get_expire(struct pico_timer *t); |
tass | 68:0847e35d08a6 | 81 | uint32_t pico_rand(void); |
tass | 68:0847e35d08a6 | 82 | void pico_rand_feed(uint32_t feed); |
tass | 152:a3d286bf94e5 | 83 | void pico_to_lowercase(char *str); |
tass | 152:a3d286bf94e5 | 84 | int pico_address_compare(union pico_address *a, union pico_address *b, uint16_t proto); |
tass | 152:a3d286bf94e5 | 85 | int32_t pico_seq_compare(uint32_t a, uint32_t b); |
tass | 68:0847e35d08a6 | 86 | |
tass | 68:0847e35d08a6 | 87 | #endif |