9#define MICREL_ID (0x1610)
10#define MICREL8041_ID (0x1510)
11#define DAVICOM_ID (0xB880)
12#define AMD_ID (0x5610)
13#define NATIONAL_ID (0x5C90)
14#define NATIONAL_IEEE1588_ID (0x5CE0)
15#define MICREL8081_ID (0x1560)
24#define PHY_REG_BASIC_CTL 0x00
25#define PHY_REG_BASIC_ST 0x01
26#define PHY_REG_ID_1 0x02
27#define PHY_REG_ID_2 0x03
28#define PHY_REG_A_NEG_ADVERT 0x04
29#define PHY_REG_A_NEG_LPA 0x05
30#define PHY_REG_A_NEG_EXP 0x06
31#define PHY_REG_A_NEG_NEXT_PG 0x07
32#define PHY_REG_LP_NEXT_PG_ABIL 0x08
33#define PHY_AFE_CTL_1 0x10
34#define PHY_REG_MILL_CTL 0x14
35#define PHY_RXER_CNTR 0x15
36#define PHY_MODE_STRAP_OVER 0x16
37#define PHY_MODE_STRAP_STATUS 0x17
38#define PHY_EXPANDED_CTL 0x18
39#define PHY_REG_IRQ_CTL_ST 0x1B
40#define PHY_REG_PHY_CTL_1 0x1E
41#define PHY_REG_PHY_CTL_2 0x1F
44#define PHY_LINK_STAT 0x0004
45#define PHY_A_NEG_COMP 0x0020
46#define PHY_IRQ_DOWN_EN 0x0400
47#define PHY_IRQ_UP_EN 0x0100
49#define IP_20uint8_t_ID (0x4500)
50#define ETHER_TYPE_IP (0x0800)
51#define ETHER_TYPE_ARP (0x0806)
60#define NUM_DEBUG_RX_BUFF (8)
61#define DB_RX_MASK (0x07)
70#define FEC_RMII_10T_MODE (0x00000200)
72#include <netinterface.h>
82class EthernetVars :
public EtherLikeInterface
98 volatile EtherBD TxBD[NUM_TX_BD] __attribute__((aligned(16)));
99 volatile EtherBD RxBD[NUM_RX_BD] __attribute__((aligned(16)));
101 volatile PoolPtr RxBDpp[NUM_RX_BD] __attribute__((aligned(4)));
102 volatile PoolPtr TxBDpp[NUM_TX_BD] __attribute__((aligned(4)));
104 volatile uint8_t RxBDFlag[NUM_RX_BD] __attribute__((aligned(4)));
105 volatile uint8_t TxBDFlag[NUM_RX_BD] __attribute__((aligned(4)));
109 uint32_t LastIsrStatus;
111 volatile uint32_t RxPosts;
112 volatile uint32_t TxcPosts;
113 volatile uint32_t RxReject;
135 bool bDescriptorsReadied;
137 volatile uint32_t phy_data_pd;
138 volatile uint32_t phy_data;
140 uint32_t last_phy_read;
142 uint32_t AutoTimeOut;
145 EthernetVars(
int fec,
const char *name);
147 void ManualEthernetConfig(BOOL Speed100, BOOL FullDuplex, BOOL AutoNegotiate);
149 void SetPromiscuous(BOOL promisc);
150 inline void EnablePromiscuous() { SetPromiscuous(TRUE); }
151 inline void DisablePromiscuous() { SetPromiscuous(FALSE); }
155 virtual void send_func(
PoolPtr poolPtr);
156 virtual void kill_if();
157 virtual void EnableMulticast(
MACADR macAddress, BOOL addAddress);
158 virtual bool LinkActive();
159 virtual bool LinkDuplex();
160 virtual int LinkSpeed();
161 virtual const char *GetInterfaceName();
163 void InitializeEthernet(
bool bRegisterInterface);
165 uint32_t GetMII(uint8_t addr);
166 uint32_t GetMII(uint8_t mii_dev, uint8_t addr);
167 uint32_t SetMII(uint8_t addr, uint16_t value);
168 uint32_t SetMII(uint8_t mii_dev, uint8_t addr, uint16_t value);
171 void DoRX(
PoolPtr pp, uint16_t length);
172 int ProcessRxBuffer(
PoolPtr pp);
174 void ResetEnetPart2();
175 void ReadyDescriptors();
176 void WarmEnetReset();
177 void ProcessDuplexStatus(uint16_t phyStat);
178 void RxIsrProc(
volatile uint32_t &isr, uint32_t frameMask, uint32_t bufferMask);
179 void TxIsrProc(
volatile uint32_t &isr, uint32_t frameMask, uint32_t bufferMask);
182 void ShowLinkStatus();
183 void ShowMII(uint8_t mii_dev, uint8_t addr, PCSTR name, uint16_t mask);
184 void ShowFECRegisters();
185 void ShowPhyterMII();
187 void DebugEthernetTx(
PoolPtr pb);
188 void NMIEthernetYield(
volatile uint32_t &isr, uint32_t frameMask, uint32_t bufferMask);
189 void NMI_Eth_Transmit(
PoolPtr pb);
193void SetPromiscuous(BOOL promisc);
194inline void EnablePromiscuous()
196 SetPromiscuous(TRUE);
198inline void DisablePromiscuous()
200 SetPromiscuous(FALSE);
202void ShowESWRegisters();
209extern EthernetVars enet0;
210extern EthernetVars enet1;
216#define DEBUG_INTERFACE_MAGIC_IFNUM (0x80)
Used to store and manipulate MAC addresses.
Definition nettypes.h:69
Boolean Configuration Variable.
Definition config_obj.h:998
Counting semaphore for task synchronization and resource management.
Definition nbrtos.h:550
Main buffer structure for network and serial communication.
Definition buffers.h:90