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.
modules/pico_mm.h@155:a70f34550c34, 2016-01-28 (annotated)
- Committer:
- tass
- Date:
- Thu Jan 28 15:12:00 2016 +0100
- Revision:
- 155:a70f34550c34
- Parent:
- 152:a3d286bf94e5
Adding TCP flag for FIN.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tass picotcp@tass.be | 149:5f4cb161cec3 | 1 | /********************************************************************* |
tass | 152:a3d286bf94e5 | 2 | PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved. |
tass picotcp@tass.be | 149:5f4cb161cec3 | 3 | See LICENSE and COPYING for usage. |
tass picotcp@tass.be | 149:5f4cb161cec3 | 4 | |
tass picotcp@tass.be | 149:5f4cb161cec3 | 5 | Authors: Gustav Janssens, Jonas Van Nieuwenberg, Sam Van Den Berge |
tass picotcp@tass.be | 149:5f4cb161cec3 | 6 | *********************************************************************/ |
tass picotcp@tass.be | 149:5f4cb161cec3 | 7 | |
tass picotcp@tass.be | 149:5f4cb161cec3 | 8 | |
tass picotcp@tass.be | 149:5f4cb161cec3 | 9 | #ifndef _INCLUDE_PICO_MM |
tass picotcp@tass.be | 149:5f4cb161cec3 | 10 | #define _INCLUDE_PICO_MM |
tass picotcp@tass.be | 149:5f4cb161cec3 | 11 | |
tass | 152:a3d286bf94e5 | 12 | #include "pico_config.h" |
tass picotcp@tass.be | 149:5f4cb161cec3 | 13 | |
tass picotcp@tass.be | 149:5f4cb161cec3 | 14 | /* |
tass picotcp@tass.be | 149:5f4cb161cec3 | 15 | * Memory init function, this will create a memory manager instance |
tass picotcp@tass.be | 149:5f4cb161cec3 | 16 | * A memory_manager page will be created, along with one page of memory |
tass picotcp@tass.be | 149:5f4cb161cec3 | 17 | * Memory can be asked for via the pico_mem_zalloc function |
tass picotcp@tass.be | 149:5f4cb161cec3 | 18 | * More memory will be allocated to the memory manager according to its needs |
tass picotcp@tass.be | 149:5f4cb161cec3 | 19 | * A maximum amount of memory of uint32_t memsize can be allocated |
tass picotcp@tass.be | 149:5f4cb161cec3 | 20 | */ |
tass picotcp@tass.be | 149:5f4cb161cec3 | 21 | void pico_mem_init(uint32_t memsize); |
tass picotcp@tass.be | 149:5f4cb161cec3 | 22 | /* |
tass picotcp@tass.be | 149:5f4cb161cec3 | 23 | * Memory deinit function, this will free all memory occupied by the current |
tass picotcp@tass.be | 149:5f4cb161cec3 | 24 | * memory manager instance. |
tass picotcp@tass.be | 149:5f4cb161cec3 | 25 | */ |
tass picotcp@tass.be | 150:551effcf6a39 | 26 | void pico_mem_deinit(void); |
tass picotcp@tass.be | 149:5f4cb161cec3 | 27 | /* |
tass picotcp@tass.be | 149:5f4cb161cec3 | 28 | * Zero-initialized malloc function, will reserve a memory segment of length uint32_t len |
tass picotcp@tass.be | 149:5f4cb161cec3 | 29 | * This memory will be quickly allocated in a slab of fixed size if possible |
tass picotcp@tass.be | 149:5f4cb161cec3 | 30 | * or less optimally in the heap for a small variable size |
tass picotcp@tass.be | 149:5f4cb161cec3 | 31 | * The fixed size of the slabs can be changed dynamically via a statistics engine |
tass picotcp@tass.be | 149:5f4cb161cec3 | 32 | */ |
tass picotcp@tass.be | 149:5f4cb161cec3 | 33 | void*pico_mem_zalloc(size_t len); |
tass picotcp@tass.be | 149:5f4cb161cec3 | 34 | /* |
tass picotcp@tass.be | 149:5f4cb161cec3 | 35 | * Free function, free a block of memory pointed to by ptr. |
tass picotcp@tass.be | 149:5f4cb161cec3 | 36 | * Unused memory is only returned to the system's control by pico_mem_cleanup |
tass picotcp@tass.be | 149:5f4cb161cec3 | 37 | */ |
tass picotcp@tass.be | 149:5f4cb161cec3 | 38 | void pico_mem_free(void*ptr); |
tass picotcp@tass.be | 149:5f4cb161cec3 | 39 | /* |
tass picotcp@tass.be | 149:5f4cb161cec3 | 40 | * This cleanup function will be provided by the memory manager |
tass picotcp@tass.be | 149:5f4cb161cec3 | 41 | * It can be called during processor downtime |
tass picotcp@tass.be | 149:5f4cb161cec3 | 42 | * This function will return unused pages to the system's control |
tass picotcp@tass.be | 149:5f4cb161cec3 | 43 | * Pages are unused if they no longer contain slabs or heap, and they have been idle for a longer time |
tass picotcp@tass.be | 149:5f4cb161cec3 | 44 | */ |
tass picotcp@tass.be | 149:5f4cb161cec3 | 45 | void pico_mem_cleanup(uint32_t timestamp); |
tass picotcp@tass.be | 149:5f4cb161cec3 | 46 | |
tass picotcp@tass.be | 149:5f4cb161cec3 | 47 | |
tass picotcp@tass.be | 149:5f4cb161cec3 | 48 | |
tass picotcp@tass.be | 149:5f4cb161cec3 | 49 | #ifdef PICO_SUPPORT_MM_PROFILING |
tass picotcp@tass.be | 149:5f4cb161cec3 | 50 | /*********************************************************************************************************************** |
tass picotcp@tass.be | 149:5f4cb161cec3 | 51 | *********************************************************************************************************************** |
tass picotcp@tass.be | 149:5f4cb161cec3 | 52 | MEMORY PROFILING FUNCTIONS |
tass picotcp@tass.be | 149:5f4cb161cec3 | 53 | *********************************************************************************************************************** |
tass picotcp@tass.be | 149:5f4cb161cec3 | 54 | ***********************************************************************************************************************/ |
tass picotcp@tass.be | 149:5f4cb161cec3 | 55 | /* General info struct */ |
tass picotcp@tass.be | 149:5f4cb161cec3 | 56 | struct profiling_data |
tass picotcp@tass.be | 149:5f4cb161cec3 | 57 | { |
tass picotcp@tass.be | 149:5f4cb161cec3 | 58 | uint32_t free_heap_space; |
tass picotcp@tass.be | 149:5f4cb161cec3 | 59 | uint32_t free_slab_space; |
tass picotcp@tass.be | 149:5f4cb161cec3 | 60 | uint32_t used_heap_space; |
tass picotcp@tass.be | 149:5f4cb161cec3 | 61 | uint32_t used_slab_space; |
tass picotcp@tass.be | 149:5f4cb161cec3 | 62 | }; |
tass picotcp@tass.be | 149:5f4cb161cec3 | 63 | |
tass picotcp@tass.be | 149:5f4cb161cec3 | 64 | /* |
tass picotcp@tass.be | 149:5f4cb161cec3 | 65 | * This function fills up a struct with used and free slab and heap space in the memory manager |
tass picotcp@tass.be | 149:5f4cb161cec3 | 66 | * The user is responsible for resource managment |
tass picotcp@tass.be | 149:5f4cb161cec3 | 67 | */ |
tass picotcp@tass.be | 149:5f4cb161cec3 | 68 | void pico_mem_profile_collect_data(struct profiling_data*profiling_page_struct); |
tass picotcp@tass.be | 149:5f4cb161cec3 | 69 | |
tass picotcp@tass.be | 149:5f4cb161cec3 | 70 | /* |
tass picotcp@tass.be | 149:5f4cb161cec3 | 71 | * This function prints the general structure of the memory manager |
tass picotcp@tass.be | 149:5f4cb161cec3 | 72 | * Printf in this function can be rerouted to send this data over a serial port, or to write it away to memory |
tass picotcp@tass.be | 149:5f4cb161cec3 | 73 | */ |
tass picotcp@tass.be | 150:551effcf6a39 | 74 | void pico_mem_profile_scan_data(void); |
tass picotcp@tass.be | 149:5f4cb161cec3 | 75 | |
tass picotcp@tass.be | 149:5f4cb161cec3 | 76 | /* |
tass picotcp@tass.be | 149:5f4cb161cec3 | 77 | * This function returns the total size that the manager has received from the system |
tass picotcp@tass.be | 149:5f4cb161cec3 | 78 | * This can give an indication of the total system resource commitment, but keep in mind that |
tass picotcp@tass.be | 149:5f4cb161cec3 | 79 | * there can be many free blocks in this "used" size |
tass picotcp@tass.be | 149:5f4cb161cec3 | 80 | * Together with pico_mem_profile_collect_data, this can give a good estimation of the total |
tass picotcp@tass.be | 149:5f4cb161cec3 | 81 | * resource commitment |
tass picotcp@tass.be | 149:5f4cb161cec3 | 82 | */ |
tass picotcp@tass.be | 150:551effcf6a39 | 83 | uint32_t pico_mem_profile_used_size(void); |
tass picotcp@tass.be | 149:5f4cb161cec3 | 84 | |
tass picotcp@tass.be | 149:5f4cb161cec3 | 85 | /* |
tass picotcp@tass.be | 149:5f4cb161cec3 | 86 | * This function returns a pointer to page 0, the main memory manager housekeeping (struct pico_mem_manager). |
tass picotcp@tass.be | 149:5f4cb161cec3 | 87 | * This can be used to collect data about the memory in user defined functions. |
tass picotcp@tass.be | 149:5f4cb161cec3 | 88 | * Use with care! |
tass picotcp@tass.be | 149:5f4cb161cec3 | 89 | */ |
tass picotcp@tass.be | 150:551effcf6a39 | 90 | void*pico_mem_profile_manager(void); |
tass picotcp@tass.be | 149:5f4cb161cec3 | 91 | |
tass picotcp@tass.be | 149:5f4cb161cec3 | 92 | /* |
tass picotcp@tass.be | 149:5f4cb161cec3 | 93 | * paramter manager is a pointer to a struct pico_mem_manager |
tass picotcp@tass.be | 149:5f4cb161cec3 | 94 | */ |
tass picotcp@tass.be | 149:5f4cb161cec3 | 95 | void pico_mem_init_profiling(void*manager, uint32_t memsize); |
tass picotcp@tass.be | 149:5f4cb161cec3 | 96 | #endif /* PICO_SUPPORT_MM_PROFILING */ |
tass picotcp@tass.be | 149:5f4cb161cec3 | 97 | |
tass picotcp@tass.be | 149:5f4cb161cec3 | 98 | #endif /* _INCLUDE_PICO_MM */ |