updated picoTCP to 1.4.0, lowered build optimization levels to -O2, improved selftest

This commit is contained in:
Joseph Henry
2017-06-05 14:26:06 -07:00
parent 47a80e8954
commit 19839eeac9
367 changed files with 107850 additions and 3813 deletions

View File

@@ -1,63 +1,69 @@
/*********************************************************************
PicoTCP. Copyright (c) 2012-2015 Altran Intelligent Systems. Some rights reserved.
See LICENSE and COPYING for usage.
PicoTCP. Copyright (c) 2012-2017 Altran Intelligent Systems. Some rights reserved.
See COPYING, LICENSE.GPLv2 and LICENSE.GPLv3 for usage.
*********************************************************************/
#ifndef INCLUDE_PICO_STACK
#define INCLUDE_PICO_STACK
#include "pico_config.h"
#include "pico_frame.h"
#include "pico_constants.h"
#define PICO_MAX_TIMERS 128
#define PICO_MAX_TIMERS 20
#define PICO_ETH_MRU (1514u)
#define PICO_IP_MRU (1500u)
/* ===== RECEIVING FUNCTIONS (from dev up to socket) ===== */
/*******************************************************************************
* TRANSPORT LAYER
******************************************************************************/
/* TRANSPORT LEVEL */
/* interface towards network */
/* From dev up to socket */
int32_t pico_transport_receive(struct pico_frame *f, uint8_t proto);
/* NETWORK LEVEL */
/* interface towards ethernet */
/*******************************************************************************
* NETWORK LAYER
******************************************************************************/
/* From socket down to dev */
int32_t pico_network_send(struct pico_frame *f);
/* From dev up to socket */
int32_t pico_network_receive(struct pico_frame *f);
#ifdef __cplusplus
extern "C" {
#endif
/*******************************************************************************
* DATALINK LAYER
******************************************************************************/
/* LOWEST LEVEL: interface towards devices. */
/* From socket down to dev */
int pico_datalink_send(struct pico_frame *f);
/* From dev up to socket */
int pico_datalink_receive(struct pico_frame *f);
/*******************************************************************************
* PHYSICAL LAYER
******************************************************************************/
/* Enqueues the frame in the device-queue. From socket down to dev */
int32_t pico_sendto_dev(struct pico_frame *f);
/* LOWEST LEVEL: interface towards stack from devices */
/* Device driver will call this function which returns immediately.
* Incoming packet will be processed later on in the dev loop.
* The zerocopy version will associate the current buffer to the newly created frame.
* Warning: the buffer used in the zerocopy version MUST have been allocated using PICO_ZALLOC()
*/
#ifdef __cplusplus
extern "C" {
#endif
int32_t pico_stack_recv(struct pico_device *dev, uint8_t *buffer, uint32_t len);
int32_t pico_stack_recv_zerocopy(struct pico_device *dev, uint8_t *buffer, uint32_t len);
int32_t pico_stack_recv_zerocopy_ext_buffer(struct pico_device *dev, uint8_t *buffer, uint32_t len);
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));
/* ===== SENDING FUNCTIONS (from socket down to dev) ===== */
int32_t pico_network_send(struct pico_frame *f);
int32_t pico_sendto_dev(struct pico_frame *f);
#ifdef PICO_SUPPORT_ETH
int32_t pico_ethernet_send(struct pico_frame *f);
/* The pico_ethernet_receive() function is used by
* those devices supporting ETH in order to push packets up
* into the stack.
*/
/* DATALINK LEVEL */
int32_t pico_ethernet_receive(struct pico_frame *f);
#else
/* When ETH is not supported by the stack... */
# define pico_ethernet_send(f) (-1)
# define pico_ethernet_receive(f) (-1)
#endif
struct pico_frame *pico_stack_recv_new_frame(struct pico_device *dev, uint8_t *buffer, uint32_t len);
/* ----- Initialization ----- */
int pico_stack_init(void);
@@ -93,6 +99,8 @@ int pico_source_is_local(struct pico_frame *f);
int pico_frame_dst_is_unicast(struct pico_frame *f);
void pico_store_network_origin(void *src, struct pico_frame *f);
uint32_t pico_timer_add(pico_time expire, void (*timer)(pico_time, void *), void *arg);
uint32_t pico_timer_add_hashed(pico_time expire, void (*timer)(pico_time, void *), void *arg, uint32_t hash);
void pico_timer_cancel_hashed(uint32_t hash);
void pico_timer_cancel(uint32_t id);
uint32_t pico_rand(void);
void pico_rand_feed(uint32_t feed);