NE2000.h File Reference


Detailed Description

NE2000 Driver Header.

Definition in file NE2000.h.

#include <config.h>
#include "NE2000_opt.h"

Go to the source code of this file.

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".


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