00001 /*! \file nic.h \brief Network Interface Card (NIC) software definition. */ 00002 //***************************************************************************** 00003 // 00004 // File Name : 'nic.h' 00005 // Title : Network Interface Card (NIC) software definition 00006 // Author : Pascal Stang 00007 // Created : 8/22/2004 00008 // Revised : 7/3/2005 00009 // Version : 0.1 00010 // Target MCU : Atmel AVR series 00011 // Editor Tabs : 4 00012 // 00013 /// \ingroup network 00014 /// \defgroup nic Network Interface Card (NIC) software definition (nic.h) 00015 /// \code #include "net/nic.h" \endcode 00016 /// \par Description 00017 /// This is the software interface standard for network interface hardware 00018 /// as used by AVRlib. Drivers for network hardware must implement these 00019 /// functions to allow upper network layers to initialize the interface, 00020 /// and send and receive net traffic. 00021 // 00022 // This code is distributed under the GNU Public License 00023 // which can be found at http://www.gnu.org/licenses/gpl.txt 00024 //***************************************************************************** 00025 //@{ 00026 00027 #ifndef NIC_H 00028 #define NIC_H 00029 00030 //! Initialize network interface hardware. 00031 /// Reset and bring up network interface hardware. This function should leave 00032 /// the network interface ready to handle \c nicSend() and \c nicPoll() requests. 00033 /// \note For some hardware, this command will take a non-negligible amount of 00034 /// time (1-2 seconds). 00035 void nicInit(void); 00036 00037 //! Send packet on network interface. 00038 /// Function accepts the length (in bytes) of the data to be sent, and a pointer 00039 /// to the data. This send command may assume an ethernet-like 802.3 header is at the 00040 /// beginning of the packet, and contains the packet addressing information. 00041 /// See net.h documentation for ethernet header format. 00042 void nicSend(unsigned int len, unsigned char* packet); 00043 00044 //! Check network interface; return next received packet if avaialable. 00045 /// Function accepts the maximum allowable packet length (in bytes), and a 00046 /// pointer to the received packet buffer. Return value is the length 00047 /// (in bytes) of the packet recevied, or zero if no packet is available. 00048 /// Upper network layers may assume that an ethernet-like 802.3 header is at 00049 /// the beginning of the packet, and contains the packet addressing information. 00050 /// See net.h documentation for ethernet header format. 00051 unsigned int nicPoll(unsigned int maxlen, unsigned char* packet); 00052 00053 //! Return the 48-bit hardware node (MAC) address of this network interface. 00054 /// This function can return a MAC address read from the NIC hardware, if available. 00055 /// If the hardware does not provide a MAC address, a software-defined address may be 00056 /// returned. It may be acceptable to return an address that is less than 48-bits. 00057 void nicGetMacAddress(u08* macaddr); 00058 00059 //! Set the 48-bit hardware node (MAC) address of this network interface. 00060 /// This function may not be supported on all hardware. 00061 void nicSetMacAddress(u08* macaddr); 00062 00063 //! Print network interface hardware registers. 00064 /// Prints a formatted list of names and values of NIC registers for debugging 00065 /// purposes. 00066 inline void nicRegDump(void); 00067 00068 #endif 00069 //@}