Line No. | Rev | Author | Line |
---|---|---|---|
1 | 6 | kaklik | /*! \file nic.h \brief Network Interface Card (NIC) software definition. */ |
2 | //***************************************************************************** |
||
3 | // |
||
4 | // File Name : 'nic.h' |
||
5 | // Title : Network Interface Card (NIC) software definition |
||
6 | // Author : Pascal Stang |
||
7 | // Created : 8/22/2004 |
||
8 | // Revised : 7/3/2005 |
||
9 | // Version : 0.1 |
||
10 | // Target MCU : Atmel AVR series |
||
11 | // Editor Tabs : 4 |
||
12 | // |
||
13 | /// \ingroup network |
||
14 | /// \defgroup nic Network Interface Card (NIC) software definition (nic.h) |
||
15 | /// \code #include "net/nic.h" \endcode |
||
16 | /// \par Description |
||
17 | /// This is the software interface standard for network interface hardware |
||
18 | /// as used by AVRlib. Drivers for network hardware must implement these |
||
19 | /// functions to allow upper network layers to initialize the interface, |
||
20 | /// and send and receive net traffic. |
||
21 | // |
||
22 | // This code is distributed under the GNU Public License |
||
23 | // which can be found at http://www.gnu.org/licenses/gpl.txt |
||
24 | //***************************************************************************** |
||
25 | //@{ |
||
26 | |||
27 | #ifndef NIC_H |
||
28 | #define NIC_H |
||
29 | |||
30 | #include <inttypes.h> |
||
31 | |||
32 | //! Initialize network interface hardware. |
||
33 | /// Reset and bring up network interface hardware. This function should leave |
||
34 | /// the network interface ready to handle \c nicSend() and \c nicPoll() requests. |
||
35 | /// \note For some hardware, this command will take a non-negligible amount of |
||
36 | /// time (1-2 seconds). |
||
37 | void nicInit(void); |
||
38 | |||
39 | //! Send packet on network interface. |
||
40 | /// Function accepts the length (in bytes) of the data to be sent, and a pointer |
||
41 | /// to the data. This send command may assume an ethernet-like 802.3 header is at the |
||
42 | /// beginning of the packet, and contains the packet addressing information. |
||
43 | /// See net.h documentation for ethernet header format. |
||
44 | void nicSend(unsigned int len, unsigned char* packet); |
||
45 | |||
46 | //! Check network interface; return next received packet if avaialable. |
||
47 | /// Function accepts the maximum allowable packet length (in bytes), and a |
||
48 | /// pointer to the received packet buffer. Return value is the length |
||
49 | /// (in bytes) of the packet recevied, or zero if no packet is available. |
||
50 | /// Upper network layers may assume that an ethernet-like 802.3 header is at |
||
51 | /// the beginning of the packet, and contains the packet addressing information. |
||
52 | /// See net.h documentation for ethernet header format. |
||
53 | unsigned int nicPoll(unsigned int maxlen, unsigned char* packet); |
||
54 | |||
55 | //! Return the 48-bit hardware node (MAC) address of this network interface. |
||
56 | /// This function can return a MAC address read from the NIC hardware, if available. |
||
57 | /// If the hardware does not provide a MAC address, a software-defined address may be |
||
58 | /// returned. It may be acceptable to return an address that is less than 48-bits. |
||
59 | void nicGetMacAddress(uint8_t* macaddr); |
||
60 | |||
61 | //! Set the 48-bit hardware node (MAC) address of this network interface. |
||
62 | /// This function may not be supported on all hardware. |
||
63 | void nicSetMacAddress(uint8_t* macaddr); |
||
64 | |||
65 | //! Print network interface hardware registers. |
||
66 | /// Prints a formatted list of names and values of NIC registers for debugging |
||
67 | /// purposes. |
||
68 | inline void nicRegDump(void); |
||
69 | |||
70 | #endif |
||
71 | //@} |
Powered by WebSVN v2.8.3