Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

# nic.h

Go to the documentation of this file.

    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 #include <inttypes.h>
    00031
    00032 //! Initialize network interface hardware.
    00033 /// Reset and bring up network interface hardware. This function should leave
    00034 /// the network interface ready to handle \c nicSend() and \c nicPoll() requests.
    00035 /// \note For some hardware, this command will take a non-negligible amount of
    00036 /// time (1-2 seconds).
    00037 void nicInit(void);
    00038
    00039 //! Send packet on network interface.
    00040 /// Function accepts the length (in bytes) of the data to be sent, and a pointer
    00041 /// to the data.  This send command may assume an ethernet-like 802.3 header is at the
    00042 /// beginning of the packet, and contains the packet addressing information.
    00043 /// See net.h documentation for ethernet header format.
    00044 void nicSend(unsigned int len, unsigned char* packet);
    00045
    00046 //! Check network interface; return next received packet if avaialable.
    00047 /// Function accepts the maximum allowable packet length (in bytes), and a
    00048 /// pointer to the received packet buffer.  Return value is the length
    00049 /// (in bytes) of the packet recevied, or zero if no packet is available.
    00050 /// Upper network layers may assume that an ethernet-like 802.3 header is at
    00051 /// the beginning of the packet, and contains the packet addressing information.
    00052 /// See net.h documentation for ethernet header format.
    00053 unsigned int nicPoll(unsigned int maxlen, unsigned char* packet);
    00054
    00055 //! Return the 48-bit hardware node (MAC) address of this network interface.
    00056 /// This function can return a MAC address read from the NIC hardware, if available.
    00057 /// If the hardware does not provide a MAC address, a software-defined address may be
    00058 /// returned.  It may be acceptable to return an address that is less than 48-bits.
    00059 void nicGetMacAddress(uint8_t* macaddr);
    00060
    00061 //! Set the 48-bit hardware node (MAC) address of this network interface.
    00062 /// This function may not be supported on all hardware.
    00063 void nicSetMacAddress(uint8_t* macaddr);
    00064
    00065 //! Print network interface hardware registers.
    00066 /// Prints a formatted list of names and values of NIC registers for debugging
    00067 /// purposes.
    00068 inline void nicRegDump(void);
    00069
    00070 #endif
    00071 //@}