Daniele Lacamera / USB_Ethernet

Dependents:   USBEthernet_TEST

Fork of USB_Ethernet by Daniele Lacamera

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pico_device.h Source File

pico_device.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_DEVICE 
00007 #define _INCLUDE_PICO_DEVICE 
00008 #include "pico_queue.h"
00009 #include "pico_frame.h"
00010 #include "pico_addressing.h"
00011 #include "pico_tree.h"
00012 #define MAX_DEVICE_NAME 16
00013 
00014 
00015 struct pico_ethdev {
00016   struct pico_eth mac;
00017 };
00018 
00019 struct pico_device {
00020   char name[MAX_DEVICE_NAME];
00021   uint32_t hash;
00022   uint32_t overhead;
00023   struct pico_ethdev *eth; /* Null if non-ethernet */
00024   struct pico_queue *q_in;
00025   struct pico_queue *q_out;
00026   int (*send)(struct pico_device *self, void *buf, int len); /* Send function. Return 0 if busy */
00027   int (*poll)(struct pico_device *self, int loop_score);
00028   void(*destroy)(struct pico_device *self);
00029   int (*dsr)(struct pico_device *self, int loop_score);
00030   int __serving_interrupt;
00031 };
00032 
00033 int pico_device_init(struct pico_device *dev, char *name, uint8_t *mac);
00034 void pico_device_destroy(struct pico_device *dev);
00035 int pico_devices_loop(int loop_score, int direction);
00036 struct pico_device* pico_get_device(char* name);
00037 int pico_device_broadcast(struct pico_frame * f);
00038 
00039 #endif