NE2000 Generic Driver
[Ethernet to uC(microcontrollers)]


Detailed Description

This file is an adaption of Donald Becker's 8390 drivers, and is distributed under the same license.
Author:
SirPdC(sirpdc@gmail.com)
 #include <NE2000.h>


Data Structures

struct  net_device_stats
 Network device statistics. Akin to the 2.0 ether stats but with byte counters. More...
struct  e8390_pkt_hdr
 The per-packet-header format.This header is present on the first 4 bytes on the NIC buffer. More...

Some generic ethernet register configurations.

#define E8390_TX_IRQ_MASK   0xa
#define E8390_RX_IRQ_MASK   0x5
#define E8390_RXCONFIG   0x4
#define E8390_RXOFF   0x20
#define E8390_TXCONFIG   0x00
#define E8390_TXOFF   0x02

Register accessed at EN_CMD, the 8390 base addr.

#define E8390_STOP   0x01
#define E8390_START   0x02
#define E8390_TRANS   0x04
#define E8390_RREAD   0x08
#define E8390_RWRITE   0x10
#define E8390_NODMA   0x20
#define E8390_PAGE0   0x00
#define E8390_PAGE1   0x40
#define E8390_PAGE2   0x80

Page 0 register offsets.

#define EN0_CLDALO   0x01
#define EN0_STARTPG   0x01
#define EN0_CLDAHI   0x02
#define EN0_STOPPG   0x02
#define EN0_BOUNDARY   0x03
#define EN0_TSR   0x04
#define EN0_TPSR   0x04
#define EN0_NCR   0x05
#define EN0_TCNTLO   0x05
#define EN0_FIFO   0x06
#define EN0_TCNTHI   0x06
#define EN0_ISR   0x07
#define EN0_CRDALO   0x08
#define EN0_RSARLO   0x08
#define EN0_CRDAHI   0x09
#define EN0_RSARHI   0x09
#define EN0_RCNTLO   0x0a
#define EN0_RCNTHI   0x0b
#define EN0_RSR   0x0c
#define EN0_RXCR   0x0c
#define EN0_TXCR   0x0d
#define EN0_COUNTER0   0x0d
#define EN0_DCFG   0x0e
#define EN0_COUNTER1   0x0e
#define EN0_IMR   0x0f
#define EN0_COUNTER2   0x0f

Page 1 register offsets

#define EN1_PHYS   0x01
#define EN1_CURPAG   0x07
#define EN1_MULT   0x08

Bits in EN0_ISR - Interrupt status register

#define ENISR_RX   0x01
#define ENISR_TX   0x02
#define ENISR_RX_ERR   0x04
#define ENISR_TX_ERR   0x08
#define ENISR_OVER   0x10
#define ENISR_COUNTERS   0x20
#define ENISR_RDC   0x40
#define ENISR_RESET   0x80
#define ENISR_ALL   0x3f

Bits in EN0_DCFG - Data config register

#define ENDCFG_WTS   0x01

Bits in received packet status byte and EN0_RSR

#define ENRSR_RXOK   0x01
#define ENRSR_CRC   0x02
#define ENRSR_FAE   0x04
#define ENRSR_FO   0x08
#define ENRSR_MPA   0x10
#define ENRSR_PHY   0x20
#define ENRSR_DIS   0x40
#define ENRSR_DEF   0x80

Transmitted packet status, EN0_TSR.

#define ENTSR_PTX   0x01
#define ENTSR_ND   0x02
#define ENTSR_COL   0x04
#define ENTSR_ABT   0x08
#define ENTSR_CRS   0x10
#define ENTSR_FU   0x20
#define ENTSR_CDH   0x40
#define ENTSR_OWC   0x80

Device Driver API

void NICReset (void)
 Reset NIC by software.
void ei_init (void)
 Init Procedure to set-up NE2000 base board. We configure the board to accept broadcast frames, witch can raise ring buffer overflow's if you can't remove the frames from the buffer.
void ei_transmit (unsigned char *buf, unsigned int send_length)
 Transmit frame on the network.
unsigned int ei_poll (void)
 Poll NIC for received frames. It also check if occured ring buffer overflow and updated statistics.

Defines

#define ETHER_ADDR_LEN   6
#define ETH_ZLEN   60
#define E8390_CMD   0x00
#define UPDSTATS(_STAT_)

Functions

void ei_tx_intr (void)
 We have finished a transmit: check for errors and update statistics.
void ei_tx_err (void)
 Handle transmitter error. A transmitter error has happened. Most likely excess collisions (which is a fairly normal condition).
unsigned int ei_receive (void)
 Read from NIC, ONE FRAME received. The frame readed is puted on uip_buf.
void ei_rx_overrun (void)
 Handle receiver overrun, i.e. overwrite the ring buffer because the frames were not readed. We have a receiver overrun: we have to kick the 8390 to get it started again. Problem is that you have to kick it exactly as NS prescribes in the updated datasheets, or "the NIC may act in an unpredictable manner." This includes causing "the NIC to defer indefinitely when it is stopped on a busy network." Ugh. Called with lock held. Don't call this with the interrupts off or your computer will hate you - it takes 10ms or so.
void ei_nic_write (unsigned char *buf, unsigned int count, unsigned int start_page)
 Transfer a packet from the NIC buffer to the PC Ram.
This function is based on Donald Becker driver and on AN874 -"Writing Drivers for the DP8390"..
void ei_nic_read (unsigned char *buf, unsigned int count, unsigned int ring_offset)
 Read a packet from the NIC local RAM.
This function is based on Donald Becker driver and on AN874 -"Writing Drivers for the DP8390"..
unsigned char ne_probe (void)
 Test if NIC present and dump configuration.
void nic_mem_test (void)
 Test various positions of NIC local memory. This function is very usefull for locating the correct range of NIC ring buffer!
unsigned char loopback_test (void)
 Test NIC on loopback, using only MODE1.
unsigned char pktTransmit (void)
 Loops until the Packet Transmitted bit is set in the Interrupt Status Register or exceds 10 "pool's".


Define Documentation

#define E8390_CMD   0x00
 

The command register (for all pages)

Definition at line 199 of file NE2000.h.

Referenced by ei_init(), ei_poll(), ei_receive(), ei_rx_overrun(), and ei_transmit().

#define E8390_NODMA   0x20
 

Remote DMA

Definition at line 193 of file NE2000.h.

Referenced by ei_init(), ei_nic_read(), ei_nic_write(), ei_poll(), ei_receive(), ei_rx_overrun(), and ei_transmit().

#define E8390_PAGE0   0x00
 

Select page chip registers using the two high-order bits

Definition at line 194 of file NE2000.h.

Referenced by ei_init(), ei_nic_read(), ei_nic_write(), ei_poll(), ei_receive(), and ei_rx_overrun().

#define E8390_PAGE1   0x40
 

Definition at line 195 of file NE2000.h.

Referenced by ei_init(), and ei_receive().

#define E8390_PAGE2   0x80
 

Page 3 is invalid.

Definition at line 196 of file NE2000.h.

#define E8390_RREAD   0x08
 

Remote read

Definition at line 191 of file NE2000.h.

Referenced by ei_nic_read(), and ei_nic_write().

#define E8390_RWRITE   0x10
 

Remote write

Definition at line 192 of file NE2000.h.

Referenced by ei_nic_write().

#define E8390_RX_IRQ_MASK   0x5
 

Definition at line 179 of file NE2000.h.

#define E8390_RXCONFIG   0x4
 

EN0_RXCR: broadcasts, no multicast,errors

Definition at line 180 of file NE2000.h.

Referenced by ei_init().

#define E8390_RXOFF   0x20
 

EN0_RXCR: Accept no packets

Definition at line 181 of file NE2000.h.

Referenced by ei_init().

#define E8390_START   0x02
 

Start the chip, clear reset

Definition at line 189 of file NE2000.h.

Referenced by ei_init(), ei_nic_read(), ei_nic_write(), ei_poll(), ei_rx_overrun(), and ei_transmit().

#define E8390_STOP   0x01
 

Stop and reset the chip

Definition at line 188 of file NE2000.h.

Referenced by ei_init(), and ei_rx_overrun().

#define E8390_TRANS   0x04
 

Transmit a frame

Definition at line 190 of file NE2000.h.

Referenced by ei_rx_overrun(), and ei_transmit().

#define E8390_TX_IRQ_MASK   0xa
 

For register EN0_ISR

Definition at line 178 of file NE2000.h.

#define E8390_TXCONFIG   0x00
 

EN0_TXCR: Normal transmit mode

Definition at line 182 of file NE2000.h.

Referenced by ei_init(), and ei_rx_overrun().

#define E8390_TXOFF   0x02
 

EN0_TXCR: Transmitter off

Definition at line 183 of file NE2000.h.

Referenced by ei_init(), and ei_rx_overrun().

#define EN0_BOUNDARY   0x03
 

Boundary page of ring bfr RD WR

Definition at line 207 of file NE2000.h.

Referenced by ei_init(), ei_poll(), and ei_receive().

#define EN0_CLDAHI   0x02
 

High byte of current local dma addr RD

Definition at line 205 of file NE2000.h.

#define EN0_CLDALO   0x01
 

Low byte of current local dma addr RD

Definition at line 203 of file NE2000.h.

#define EN0_COUNTER0   0x0d
 

Rcv alignment error counter RD

Definition at line 224 of file NE2000.h.

Referenced by ei_poll().

#define EN0_COUNTER1   0x0e
 

Rcv CRC error counter RD

Definition at line 226 of file NE2000.h.

Referenced by ei_poll().

#define EN0_COUNTER2   0x0f
 

Rcv missed frame error counter RD

Definition at line 228 of file NE2000.h.

Referenced by ei_poll().

#define EN0_CRDAHI   0x09
 

high byte, current remote dma address RD

Definition at line 217 of file NE2000.h.

#define EN0_CRDALO   0x08
 

low byte of current remote dma address RD

Definition at line 215 of file NE2000.h.

#define EN0_DCFG   0x0e
 

Data configuration reg WR

Definition at line 225 of file NE2000.h.

Referenced by ei_init().

#define EN0_FIFO   0x06
 

FIFO RD

Definition at line 212 of file NE2000.h.

#define EN0_IMR   0x0f
 

Interrupt mask reg WR

Definition at line 227 of file NE2000.h.

Referenced by ei_init().

#define EN0_ISR   0x07
 

Interrupt status reg RD WR

Definition at line 214 of file NE2000.h.

Referenced by ei_init(), ei_nic_write(), ei_poll(), ei_rx_overrun(), ei_transmit(), ei_tx_err(), ei_tx_intr(), and NICReset().

#define EN0_NCR   0x05
 

Number of collision reg RD

Definition at line 210 of file NE2000.h.

#define EN0_RCNTHI   0x0b
 

Remote byte count reg WR

Definition at line 220 of file NE2000.h.

Referenced by ei_init(), ei_nic_read(), ei_nic_write(), and ei_rx_overrun().

#define EN0_RCNTLO   0x0a
 

Remote byte count reg WR

Definition at line 219 of file NE2000.h.

Referenced by ei_init(), ei_nic_read(), ei_nic_write(), and ei_rx_overrun().

#define EN0_RSARHI   0x09
 

Remote start address reg 1

Definition at line 218 of file NE2000.h.

Referenced by ei_nic_read(), and ei_nic_write().

#define EN0_RSARLO   0x08
 

Remote start address reg 0

Definition at line 216 of file NE2000.h.

Referenced by ei_nic_read(), and ei_nic_write().

#define EN0_RSR   0x0c
 

rx status reg RD

Definition at line 221 of file NE2000.h.

#define EN0_RXCR   0x0c
 

RX configuration reg WR

Definition at line 222 of file NE2000.h.

Referenced by ei_init().

#define EN0_STARTPG   0x01
 

Starting page of ring bfr WR

Definition at line 204 of file NE2000.h.

Referenced by ei_init().

#define EN0_STOPPG   0x02
 

Ending page +1 of ring bfr WR

Definition at line 206 of file NE2000.h.

Referenced by ei_init().

#define EN0_TCNTHI   0x06
 

High byte of tx byte count WR

Definition at line 213 of file NE2000.h.

Referenced by ei_transmit().

#define EN0_TCNTLO   0x05
 

Low byte of tx byte count WR

Definition at line 211 of file NE2000.h.

Referenced by ei_transmit().

#define EN0_TPSR   0x04
 

Transmit starting page WR

Definition at line 209 of file NE2000.h.

Referenced by ei_init(), and ei_transmit().

#define EN0_TSR   0x04
 

Transmit status reg RD

Definition at line 208 of file NE2000.h.

Referenced by ei_tx_err(), and ei_tx_intr().

#define EN0_TXCR   0x0d
 

TX configuration reg WR

Definition at line 223 of file NE2000.h.

Referenced by ei_init(), and ei_rx_overrun().

#define EN1_CURPAG   0x07
 

Current memory page RD WR

Definition at line 234 of file NE2000.h.

Referenced by ei_init(), and ei_receive().

#define EN1_MULT   0x08
 

Multicast filter mask array (8 bytes) RD WR

Definition at line 235 of file NE2000.h.

#define EN1_PHYS   0x01
 

This board's physical enet addr RD WR

Definition at line 233 of file NE2000.h.

Referenced by ei_init().

#define ENDCFG_WTS   0x01
 

word transfer mode selection

Definition at line 253 of file NE2000.h.

#define ENISR_ALL   0x3f
 

Interrupts we will enable

Definition at line 248 of file NE2000.h.

#define ENISR_COUNTERS   0x20
 

Counters need emptying

Definition at line 245 of file NE2000.h.

Referenced by ei_poll().

#define ENISR_OVER   0x10
 

Receiver overwrote the ring

Definition at line 244 of file NE2000.h.

Referenced by ei_poll(), and ei_rx_overrun().

#define ENISR_RDC   0x40
 

remote dma complete

Definition at line 246 of file NE2000.h.

Referenced by ei_nic_write(), and ei_poll().

#define ENISR_RESET   0x80
 

Reset completed

Definition at line 247 of file NE2000.h.

Referenced by NICReset().

#define ENISR_RX   0x01
 

Receiver, no error

Definition at line 240 of file NE2000.h.

Referenced by ei_poll().

#define ENISR_RX_ERR   0x04
 

Receiver, with error

Definition at line 242 of file NE2000.h.

Referenced by ei_poll().

#define ENISR_TX   0x02
 

Transmitter, no error

Definition at line 241 of file NE2000.h.

Referenced by ei_rx_overrun(), ei_transmit(), and ei_tx_intr().

#define ENISR_TX_ERR   0x08
 

Transmitter, with error

Definition at line 243 of file NE2000.h.

Referenced by ei_rx_overrun(), ei_transmit(), and ei_tx_err().

#define ENRSR_CRC   0x02
 

CRC error

Definition at line 259 of file NE2000.h.

#define ENRSR_DEF   0x80
 

deferring

Definition at line 265 of file NE2000.h.

#define ENRSR_DIS   0x40
 

receiver disable. set in monitor mode

Definition at line 264 of file NE2000.h.

#define ENRSR_FAE   0x04
 

frame alignment error

Definition at line 260 of file NE2000.h.

#define ENRSR_FO   0x08
 

FIFO overrun

Definition at line 261 of file NE2000.h.

#define ENRSR_MPA   0x10
 

missed pkt

Definition at line 262 of file NE2000.h.

#define ENRSR_PHY   0x20
 

physical/multicase address

Definition at line 263 of file NE2000.h.

#define ENRSR_RXOK   0x01
 

Received a good packet

Definition at line 258 of file NE2000.h.

#define ENTSR_ABT   0x08
 

The transmit collided 16 times, and was deferred.

Definition at line 273 of file NE2000.h.

Referenced by ei_tx_err(), and ei_tx_intr().

#define ENTSR_CDH   0x40
 

The collision detect "heartbeat" signal was lost.

Definition at line 276 of file NE2000.h.

Referenced by ei_tx_err(), and ei_tx_intr().

#define ENTSR_COL   0x04
 

The transmit collided at least once.

Definition at line 272 of file NE2000.h.

Referenced by ei_tx_intr().

#define ENTSR_CRS   0x10
 

The carrier sense was lost.

Definition at line 274 of file NE2000.h.

Referenced by ei_tx_err(), and ei_tx_intr().

#define ENTSR_FU   0x20
 

A "FIFO underrun" occured during transmit.

Definition at line 275 of file NE2000.h.

Referenced by ei_tx_err(), and ei_tx_intr().

#define ENTSR_ND   0x02
 

The transmit wasn't deferred.

Definition at line 271 of file NE2000.h.

Referenced by ei_tx_err().

#define ENTSR_OWC   0x80
 

There was an out-of-window collision.

Definition at line 277 of file NE2000.h.

Referenced by ei_tx_err(), and ei_tx_intr().

#define ENTSR_PTX   0x01
 

Packet transmitted without error

Definition at line 270 of file NE2000.h.

Referenced by ei_tx_intr().

#define ETH_ZLEN   60
 

Min. octets in frame sans FCS

Definition at line 174 of file NE2000.h.

Referenced by ei_transmit().

#define ETHER_ADDR_LEN   6
 

Length of Ethernet Address

Definition at line 173 of file NE2000.h.

#define UPDSTATS _STAT_   ) 
 

Definition at line 404 of file NE2000.h.

Referenced by ei_poll(), ei_receive(), ei_rx_overrun(), ei_transmit(), ei_tx_err(), and ei_tx_intr().


Function Documentation

void ei_init void   ) 
 

Init Procedure to set-up NE2000 base board. We configure the board to accept broadcast frames, witch can raise ring buffer overflow's if you can't remove the frames from the buffer.

Definition at line 76 of file NE2000.c.

References current_page, E8390_CMD, E8390_NODMA, E8390_PAGE0, E8390_PAGE1, E8390_RXCONFIG, E8390_RXOFF, E8390_START, E8390_STOP, E8390_TXCONFIG, E8390_TXOFF, EN0_BOUNDARY, EN0_DCFG, EN0_IMR, EN0_ISR, EN0_RCNTHI, EN0_RCNTLO, EN0_RXCR, EN0_STARTPG, EN0_STOPPG, EN0_TPSR, EN0_TXCR, EN1_CURPAG, EN1_PHYS, ioaddr, MAC1, MAC2, MAC3, MAC4, MAC5, MAC6, NICReset(), RX_START_PAGE, RX_STOP_PAGE, TX_START_PAGE, TxChar(), TxEol(), TxHex(), and TxStr_P.

Referenced by main().

void ei_nic_read unsigned char *  buf,
unsigned int  count,
unsigned int  ring_offset
 

Read a packet from the NIC local RAM.
This function is based on Donald Becker driver and on AN874 -"Writing Drivers for the DP8390"..

Parameters:
buf buffer to transfer data
count number of bytes to transfer
ring_offset starting NIC page to get data
Attention:
Becarefull with ring_offset: it's a 2 byte value and if you use BONDARY, CURR or some other 1 byte info, you must shift 8 bits to left( value << 8 ).
Warning:
The implementation is diferent for AVR and PC. With PC, if you try use insb(function to write several bytes) the PC crash's! I think it's because some NE2000 clones are't prepared to be 8 bit addressable. To overtook this problem we call several time the function inbw. With AVR, no problem!

Definition at line 854 of file NE2000.c.

References E8390_NODMA, E8390_PAGE0, E8390_RREAD, E8390_START, EN0_RCNTHI, EN0_RCNTLO, EN0_RSARHI, EN0_RSARLO, ioaddr, NE_CMD, and NE_DATAPORT.

Referenced by ei_receive(), and nic_mem_test().

void ei_nic_write unsigned char *  buf,
unsigned int  count,
unsigned int  start_page
 

Transfer a packet from the NIC buffer to the PC Ram.
This function is based on Donald Becker driver and on AN874 -"Writing Drivers for the DP8390"..

Parameters:
buf buffer to transfer data
count number of bytes to transfer
start_page starting NIC page to put data
Attention:
Becarefull with start_page: it's a 2 byte value and if you use BONDARY, CURR or some other 1 byte info, you must shift 8 bits to left( value << 8 ).
Warning:
The implementation is diferent for AVR and PC. With PC, if you try use outsb(function to write several bytes) the PC crash's! I think it's because some NE2000 clones are't prepared to be 8 bit addressable. To overtook this problem we call several time the function outbw. With AVR, no problem!

Definition at line 796 of file NE2000.c.

References E8390_NODMA, E8390_PAGE0, E8390_RREAD, E8390_RWRITE, E8390_START, EN0_ISR, EN0_RCNTHI, EN0_RCNTLO, EN0_RSARHI, EN0_RSARLO, ENISR_RDC, ioaddr, NE_CMD, and NE_DATAPORT.

Referenced by ei_transmit(), and nic_mem_test().

unsigned int ei_poll void   ) 
 

Poll NIC for received frames. It also check if occured ring buffer overflow and updated statistics.

Returns:
return the number of bytes received.

Definition at line 563 of file NE2000.c.

References E8390_CMD, E8390_NODMA, E8390_PAGE0, E8390_START, ei_receive(), ei_rx_overrun(), EN0_BOUNDARY, EN0_COUNTER0, EN0_COUNTER1, EN0_COUNTER2, EN0_ISR, ENISR_COUNTERS, ENISR_OVER, ENISR_RDC, ENISR_RX, ENISR_RX_ERR, ioaddr, MAX_SERVICE, net_device_stats::rx_crc_errors, net_device_stats::rx_frame_errors, net_device_stats::rx_missed_errors, RX_START_PAGE, RX_STOP_PAGE, rxing_page, and UPDSTATS.

Referenced by main().

unsigned int ei_receive void   ) 
 

Read from NIC, ONE FRAME received. The frame readed is puted on uip_buf.

Attention:
The maximum length of frame that the NIC can receive is defined by UIP_BUFSIZE.
Returns:
return the number of bytes received.
Warning:
This function does not clear ISR flags!!
To maintain the compatibility with the NS2000 linux driver i don't use "send packet" form to get the frame. The "send packet" is much easier because it handle automatically the boundary pointer(before read and after read), but the linux driver manipulate manually. Because i don't know if the NE2000 clones suport the "send packet" i decided to use the Linux Driver form. Besides that, on this function i only get ONE frame (contrary to the linux driver that return's all the frames). This is obvious because AVR memory limitations.

Definition at line 154 of file NE2000.c.

References e8390_pkt_hdr::count, current_page, E8390_CMD, E8390_NODMA, E8390_PAGE0, E8390_PAGE1, ei_nic_read(), EN0_BOUNDARY, EN1_CURPAG, ioaddr, NELOG, NELOG_EOL, NELOG_UINT, e8390_pkt_hdr::next, net_device_stats::rx_errors, net_device_stats::rx_length_errors, RX_START_PAGE, RX_STOP_PAGE, rxing_page, e8390_pkt_hdr::status, TxChark, TxEolk, TxHexk, TxStrk_P, TxUintk, uip_buf, UIP_BUFSIZE, UPDSTATS, and VERBOSE_RX_PKT_HDR.

Referenced by ei_poll(), and ei_rx_overrun().

void ei_rx_overrun void   ) 
 

Handle receiver overrun, i.e. overwrite the ring buffer because the frames were not readed. We have a receiver overrun: we have to kick the 8390 to get it started again. Problem is that you have to kick it exactly as NS prescribes in the updated datasheets, or "the NIC may act in an unpredictable manner." This includes causing "the NIC to defer indefinitely when it is stopped on a busy network." Ugh. Called with lock held. Don't call this with the interrupts off or your computer will hate you - it takes 10ms or so.

Attention:
This function clear ISR bit associated with overrun.

Definition at line 338 of file NE2000.c.

References E8390_CMD, E8390_NODMA, E8390_PAGE0, E8390_START, E8390_STOP, E8390_TRANS, E8390_TXCONFIG, E8390_TXOFF, ei_receive(), EN0_ISR, EN0_RCNTHI, EN0_RCNTLO, EN0_TXCR, ENISR_OVER, ENISR_TX, ENISR_TX_ERR, ioaddr, NELOG, NELOG_EOL, net_device_stats::rx_over_errors, and UPDSTATS.

Referenced by ei_poll().

void ei_transmit unsigned char *  buf,
unsigned int  send_length
 

Transmit frame on the network.

Parameters:
buf vector with the frame
send_length frame length
In our solution the communication with the NIC is based on polling. We have to adapt the linux device driver merging the ei_interruption(tx part) and ei_start_xmit. The ei_transmit does:
  1. Append pad bytes for short frames.
  2. If the NIC was previous transmitting, wait( in polling) until it finishes.
  3. Acknowledge the flag Transmit Ok or Transmit Error on ISR.
  4. Upload the frame to the NIC.
  5. Load transmit parameters(number of bytes to transmit and NIC memory page) and Order NIC to transmit.
  6. Update statistics.

Definition at line 499 of file NE2000.c.

References E8390_CMD, E8390_NODMA, E8390_START, E8390_TRANS, ei_nic_write(), ei_tx_err(), ei_tx_intr(), EN0_ISR, EN0_TCNTHI, EN0_TCNTLO, EN0_TPSR, ENISR_TX, ENISR_TX_ERR, ETH_ZLEN, ioaddr, net_device_stats::tx_bytes, TX_START_PAGE, TxChark, TxEolk, TxStrk_P, and UPDSTATS.

Referenced by main().

void ei_tx_err void   ) 
 

Handle transmitter error. A transmitter error has happened. Most likely excess collisions (which is a fairly normal condition).

Definition at line 408 of file NE2000.c.

References EN0_ISR, EN0_TSR, ENISR_TX_ERR, ENTSR_ABT, ENTSR_CDH, ENTSR_CRS, ENTSR_FU, ENTSR_ND, ENTSR_OWC, ioaddr, net_device_stats::tx_carrier_errors, net_device_stats::tx_errors, net_device_stats::tx_heartbeat_errors, net_device_stats::tx_window_errors, TxEolk, TxHexk, TxStrk_P, and UPDSTATS.

Referenced by ei_transmit().

void ei_tx_intr void   ) 
 

We have finished a transmit: check for errors and update statistics.

Definition at line 449 of file NE2000.c.

References net_device_stats::collisions, EN0_ISR, EN0_TSR, ENISR_TX, ENTSR_ABT, ENTSR_CDH, ENTSR_COL, ENTSR_CRS, ENTSR_FU, ENTSR_OWC, ENTSR_PTX, ioaddr, e8390_pkt_hdr::status, net_device_stats::tx_aborted_errors, net_device_stats::tx_carrier_errors, net_device_stats::tx_errors, net_device_stats::tx_fifo_errors, net_device_stats::tx_heartbeat_errors, net_device_stats::tx_packets, net_device_stats::tx_window_errors, TxEolk, TxStrk_P, and UPDSTATS.

Referenced by ei_transmit().

unsigned char loopback_test void   ) 
 

Test NIC on loopback, using only MODE1.

Attention:
you must define NE_LOOPBACK on <config.h> to compile de function

Referenced by main().

unsigned char ne_probe void   ) 
 

Test if NIC present and dump configuration.

Warning:
Use ui_buf to store temporary SA_PROM content.
Attention:
you must define NE_PROBE on <config.h> to compile de function

Referenced by main().

void nic_mem_test void   ) 
 

Test various positions of NIC local memory. This function is very usefull for locating the correct range of NIC ring buffer!

Warning:
Assumes that the the loopback or the ei_init was called before transmit frame on the network.

Definition at line 1006 of file NE2000.c.

References ei_nic_read(), ei_nic_write(), TxChar(), TxEol(), TxHex(), TxStr(), and uip_buf.

Referenced by main().

void NICReset void   ) 
 

Reset NIC by software.

Definition at line 631 of file NE2000.c.

References EN0_ISR, ENISR_RESET, ioaddr, NE_RESET, NELOG, and NELOG_EOL.

Referenced by ei_init().

unsigned char pktTransmit void   ) 
 

Loops until the Packet Transmitted bit is set in the Interrupt Status Register or exceds 10 "pool's".


Generated on Fri Jan 6 22:23:19 2006 for EtherProgs by  doxygen 1.4.5