CDC/ECM driver for mbed, based on USBDevice by mbed-official. Uses PicoTCP to access Ethernet USB device. License: GPLv2

Dependents:   USBEthernet_TEST

Fork of USB_Ethernet by Daniele Lacamera

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pico_stack.h Source File

pico_stack.h

00001 /*********************************************************************
00002 PicoTCP. Copyright (c) 2012 TASS Belgium NV. Some rights reserved.
00003 See LICENSE and COPYING for usage.
00004 
00005 *********************************************************************/
00006 #ifndef _INCLUDE_PICO_STACK
00007 #define _INCLUDE_PICO_STACK
00008 #include "pico_config.h"
00009 #include "pico_frame.h"
00010 
00011 #define PICO_MAX_TIMERS 20
00012 
00013 /* ===== RECEIVING FUNCTIONS (from dev up to socket) ===== */
00014 
00015 /* TRANSPORT LEVEL */
00016 /* interface towards network */
00017 int pico_transport_receive(struct pico_frame *f, uint8_t proto);
00018 
00019 /* NETWORK LEVEL */
00020 /* interface towards ethernet */
00021 int pico_network_receive(struct pico_frame *f);
00022 
00023 /* The pico_ethernet_receive() function is used by 
00024  * those devices supporting ETH in order to push packets up 
00025  * into the stack. 
00026  */
00027 /* DATALINK LEVEL */
00028 int pico_ethernet_receive(struct pico_frame *f);
00029 
00030 /* LOWEST LEVEL: interface towards devices. */
00031 /* Device driver will call this function which returns immediately.
00032  * Incoming packet will be processed later on in the dev loop.
00033  */
00034 int pico_stack_recv(struct pico_device *dev, uint8_t *buffer, int len);
00035 
00036 
00037 /* ===== SENDIING FUNCTIONS (from socket down to dev) ===== */
00038 
00039 int pico_transport_send(struct pico_frame *f);
00040 int pico_network_send(struct pico_frame *f);
00041 int pico_ethernet_send(struct pico_frame *f);
00042 int pico_sendto_dev(struct pico_frame *f);
00043 
00044 /* ----- Initialization ----- */
00045 void pico_stack_init(void);
00046 
00047 /* ----- Loop Function. ----- */
00048 void pico_stack_tick(void);
00049 void pico_stack_loop(void);
00050 
00051 /* ---- Notifications for stack errors */
00052 int pico_notify_socket_unreachable(struct pico_frame *f);
00053 int pico_notify_proto_unreachable(struct pico_frame *f);
00054 int pico_notify_dest_unreachable(struct pico_frame *f);
00055 int pico_notify_ttl_expired(struct pico_frame *f);
00056 
00057 /* Various. */
00058 int pico_source_is_local(struct pico_frame *f);
00059 int pico_destination_is_local(struct pico_frame *f);
00060 void pico_store_network_origin(void *src, struct pico_frame *f);
00061 void pico_timer_add(unsigned long expire, void (*timer)(unsigned long, void *), void *arg);
00062 uint32_t pico_rand(void);
00063 void pico_rand_feed(uint32_t feed);
00064 
00065 #endif