NetBurner 3.1
ethernet.h
1 /*NB_REVISION*/
2 
3 /*NB_COPYRIGHT*/
4 
5 #ifndef _NB_ETHERNET_H
6 #define _NB_ETHERNET_H
7 
8 #include <basictypes.h>
9 #include <buffers.h>
10 #include <nettypes.h>
11 
12 /*
13  ******************************************************************************
14  *
15  * Definitions
16  *
17  ******************************************************************************
18  */
19 
20 /*
21  EtherType Field ( Ethernet Version II )
22  ETHERNET_ETHERTYPE_IPv4 - Internet Protocol, Version 4 (IPv4)
23  ETHERNET_ETHERTYPE_ARP - Address Resolution Protocol (ARP)
24  ETHERNET_ETHERTYPE_IPv6 - Internet Protocol, Version 6 (IPv6)
25  ETHERNET_ETHERTYPE_AARP - AppleTalk Address Resolution Prot. (AARP)
26  ETHERNET_ETHERTYPE_IPX - Novell Internet Packet Exchange (IPX) (alt.)
27  ETHERNET_ETHERTYPE_EAPOL - Extensible Authorization Protocol (EAP) over LAN
28 
29 */
30 #define ETHERNET_ETHERTYPE_IPv4 (uint16_t)(0x0800)
31 #define ETHERNET_ETHERTYPE_ARP (uint16_t)(0x0806)
32 #define ETHERNET_ETHERTYPE_IPv6 (uint16_t)(0x86DD)
33 #define ETHERNET_ETHERTYPE_AARP (uint16_t)(0x80F3)
34 #define ETHERNET_ETHERTYPE_IPX (uint16_t)(0x8137)
35 #define ETHERNET_ETHERTYPE_EAPOL (uint16_t)(0x888E)
36 #define ETHERNET_ETHERTYPE_VLAN (uint16_t )( 0x8100 )
37 
38 #define IP_20BYTE_ID (0x4500)
39 
40 /*
41  ******************************************************************************
42  *
43  * Data Structures
44  *
45  ******************************************************************************
46  */
47 /*
48  Ethernet Type II Frame Header
49 
50  macAddrDst - Destination MAC address
51  macAddrSrc - Source MAC address
52  etherType - Protocol
53 
54 */
55 typedef struct _EthernetFrameHeader
56 {
57  MACADDRESS_48 destinationMacAddress;
58  MACADDRESS_48 sourceMacAddress;
59  beuint16_t etherType;
60 
61 } __attribute__((packed)) EthernetFrameHeader;
62 
63 /*
64  ******************************************************************************
65  *
66  * Routine Prototypes
67  *
68  ******************************************************************************
69  */
70 
71 /*
72  ******************************************************************************
73 
74  Initializes Ethernet Controller(s)
75 
76  Parameters:
77  None
78 
79  Return:
80  Interface number 1 thru ( MAX_INTERFACES - 1 ), 0 if not added
81 
82  Notes:
83  None
84 
85  ******************************************************************************
86  */
87 void AddEthernetInterfaces();
88 
89 /*
90  ******************************************************************************
91 
92  Set interface speed, duplex and negotiation maximumcapabilities
93 
94  Parameters:
95  speed100Mbit - TRUE up to 100Mbit, else 10Mbit
96  fullDuplex - TRUE full duplex, FALSE half duplex only
97  autoNegotiate - TRUE use autonegotiation, FALSE above settings.
98 
99  Return:
100  None
101 
102  Notes:
103  None
104 
105  ******************************************************************************
106  */
107 /* Used to Manually Configure Ethernet Speed and Duplex Settings */
108 void ManualEthernetConfig(int interface, BOOL speed100Mbit, BOOL fullDuplex, BOOL autoNegotiate);
109 
110 /*
111  ******************************************************************************
112 
113  Disables PHY for saving power. Will save close to 100mA @ 3.3V when PHY disabled.
114 
115  Parameters:
116  None
117 
118  Return:
119  None
120 
121  Notes:
122  None
123 ******************************************************************************
124  */
125 void DisablePHY(int ifn);
126 
127 /*
128  ******************************************************************************
129 
130  Used to turn the PHY back on after calling DisablePHY( );
131 
132  Parameters:
133  None
134 
135  Return:
136  None
137 
138  Notes:
139  None
140 ******************************************************************************
141  */
142 void EnablePHY(int ifn);
143 
144 // Include this macro in your userMain if you don't want the 2nd ethernet automatically turned on.
145 #define NO_AUTOMATIC_2ND_ETHERNET extern const bool bAutomatic2ndEther = false;
146 
147 #endif
NetBurner Buffers API.