NE2000 network interface family
[Generic DP8390 network interface family service]

Collaboration diagram for NE2000 network interface family:

Files

file  ne2000.c
 

NE1000 and NE2000 network interface initialization and probe functions implementation.


file  ne2000.h
 

NE1000 and NE2000 network interface definitions.


Defines

#define N   100
 Number of bytes to transfer.
#define milli_delay(millis)   usleep((millis) * 1000)
 Sleeps for the defined millicesonds.
#define NE_DP8390   0x00
 DP8390 register offset.
#define NE_DATA   0x10
 Data register.
#define NE_RESET   0x1F
 Reset register.
#define NE1000_START   0x2000
 NE1000 data start.
#define NE1000_SIZE   0x2000
 NE1000 data size.
#define NE2000_START   0x4000
 NE2000 data start.
#define NE2000_SIZE   0x4000
 NE2000 data size.
#define inb_ne(dep, reg)   (inb(dep->de_base_port+reg))
 Reads 1 byte register.
#define outb_ne(dep, reg, data)   (outb(dep->de_base_port+reg, data))
 Writes 1 byte register.
#define inw_ne(dep, reg)   (inw(dep->de_base_port+reg))
 Reads 1 word (2 bytes) register.
#define outw_ne(dep, reg, data)   (outw(dep->de_base_port+reg, data))
 Writes 1 word (2 bytes) register.

Functions

 _PROTOTYPE (typedef int(*testf_t),(dpeth_t *dep, int pos, u8_t *pat))
 Type definition of the testing function.
static int test_8 (dpeth_t *dep, int pos, u8_t *pat)
 Tests 8 bit NE2000 network interface.
static int test_16 (dpeth_t *dep, int pos, u8_t *pat)
 Tests 16 bit NE2000 network interface.
static void ne_stop (dpeth_t *dep)
 Stops the NE2000 network interface.
void ne_init (struct dpeth *dep)
 Initializes the NE2000 network interface.
int ne_probe (dpeth_t *dep)
 Probes a NE2000 or NE1000 network interface.

Variables

u8_t pat0 [] = {0x00, 0x00, 0x00, 0x00}
 First data pattern.
u8_t pat1 [] = {0xFF, 0xFF, 0xFF, 0xFF}
 Second data pattern.
u8_t pat2 [] = {0xA5, 0x5A, 0x69, 0x96}
 Third data pattern.
u8_t pat3 [] = {0x96, 0x69, 0x5A, 0xA5}
 Fourth data pattern.

Define Documentation

#define inb_ne ( dep,
reg   )     (inb(dep->de_base_port+reg))

Reads 1 byte register.

Parameters:
[in] dep The network interface structure.
[in] reg The register offset.
Returns:
The read value.

Referenced by ne_init(), ne_probe(), ne_stop(), and test_8().

#define inw_ne ( dep,
reg   )     (inw(dep->de_base_port+reg))

Reads 1 word (2 bytes) register.

Parameters:
[in] dep The network interface structure.
[in] reg The register offset.
Returns:
The read value.

Referenced by ne_init(), and test_16().

#define milli_delay ( millis   )     usleep((millis) * 1000)

Sleeps for the defined millicesonds.

Parameters:
[in] millis The number of milliseconds to sleep.

Referenced by ne_probe(), and ne_stop().

#define N   100

Number of bytes to transfer.

Referenced by test_16(), and test_8().

#define NE1000_SIZE   0x2000

NE1000 data size.

Referenced by ne_init(), and ne_probe().

#define NE1000_START   0x2000

NE1000 data start.

Referenced by ne_init(), and ne_probe().

#define NE2000_SIZE   0x4000

NE2000 data size.

Referenced by ne_init(), and ne_probe().

#define NE2000_START   0x4000

NE2000 data start.

Referenced by ne_init(), and ne_probe().

#define NE_DATA   0x10

Data register.

Referenced by ne_init(), test_16(), and test_8().

#define NE_DP8390   0x00

DP8390 register offset.

Referenced by ne_probe().

#define NE_RESET   0x1F

Reset register.

Referenced by ne_probe(), and ne_stop().

#define outb_ne ( dep,
reg,
data   )     (outb(dep->de_base_port+reg, data))

Writes 1 byte register.

Parameters:
[in] dep The network interface structure.
[in] reg The register offset.
[in] data The value to be written.

Referenced by ne_probe(), ne_stop(), and test_8().

#define outw_ne ( dep,
reg,
data   )     (outw(dep->de_base_port+reg, data))

Writes 1 word (2 bytes) register.

Parameters:
[in] dep The network interface structure.
[in] reg The register offset.
[in] data The value to be written.

Referenced by test_16().


Function Documentation

_PROTOTYPE ( typedef int *  testf_t,
(dpeth_t *dep, int pos, u8_t *pat)   
)

Type definition of the testing function.

void ne_init ( struct dpeth dep  ) 

Initializes the NE2000 network interface.

Parameters:
[in,out] dep The network interface structure.

References CR_DM_RR, CR_PS_P0, CR_STA, debug, DEI_DEFAULT, DP_CR, DP_PAGESIZE, DP_RBCR0, DP_RBCR1, DP_RSAR0, DP_RSAR1, inb_ne, inw_ne, NE1000_SIZE, NE1000_START, NE2000_SIZE, NE2000_START, NE_DATA, outb_reg0, SENDQ_NR, and SENDQ_PAGES.

Referenced by ne_probe().

Here is the caller graph for this function:

int ne_probe ( struct dpeth dep  ) 

Probes a NE2000 or NE1000 network interface.

Parameters:
[in] dep The network interface structure.
Returns:
1 if the NE2000 network interface is present.
0 otherwise.

References CR_DM_ABORT, CR_STP, DCR_8BYTES, DCR_BMS, DCR_BYTEWIDE, DCR_WORDWIDE, DP_CR, DP_DCR, DP_ISR, DP_RCR, DP_TCR, inb_ne, inb_reg0, ISR_RST, milli_delay, NE1000_SIZE, NE1000_START, NE2000_SIZE, NE2000_START, NE_DP8390, ne_init(), NE_RESET, ne_stop(), outb_ne, outb_reg0, RCR_MON, TCR_NORMAL, test_16(), and test_8().

Here is the call graph for this function:

static void ne_stop ( dpeth_t dep  )  [static]

Stops the NE2000 network interface.

Parameters:
[in,out] dep The network interface structure.

References inb_ne, milli_delay, NE_RESET, and outb_ne.

Referenced by ne_probe().

Here is the caller graph for this function:

static int test_16 ( dpeth_t dep,
int  pos,
u8_t pat 
) [static]

Tests 16 bit NE2000 network interface.

Parameters:
[in,out] dep The network interface structure.
[in] pos The starting position.
[in] pat The data pattern to be written.
Returns:
True on success.
FALSE otherwise.

References CR_DM_RR, CR_DM_RW, CR_PS_P0, CR_STA, debug, DP_CR, DP_ISR, DP_RBCR0, DP_RBCR1, DP_RSAR0, DP_RSAR1, inb_reg0, inw_ne, ISR_RDC, memcmp, N, NE_DATA, outb_reg0, and outw_ne.

Referenced by ne_probe().

Here is the caller graph for this function:

static int test_8 ( dpeth_t dep,
int  pos,
u8_t pat 
) [static]

Tests 8 bit NE2000 network interface.

Parameters:
[in,out] dep The network interface structure.
[in] pos The starting position.
[in] pat The data pattern to be written.
Returns:
True on success.
FALSE otherwise.

References CR_DM_RR, CR_DM_RW, CR_PS_P0, CR_STA, debug, DP_CR, DP_ISR, DP_RBCR0, DP_RBCR1, DP_RSAR0, DP_RSAR1, inb_ne, inb_reg0, ISR_RDC, memcmp, N, NE_DATA, outb_ne, and outb_reg0.

Referenced by ne_probe().

Here is the caller graph for this function:


Variable Documentation

u8_t pat0[] = {0x00, 0x00, 0x00, 0x00}

First data pattern.

u8_t pat1[] = {0xFF, 0xFF, 0xFF, 0xFF}

Second data pattern.

u8_t pat2[] = {0xA5, 0x5A, 0x69, 0x96}

Third data pattern.

u8_t pat3[] = {0x96, 0x69, 0x5A, 0xA5}

Fourth data pattern.


Generated on Thu Mar 11 20:46:36 2010 for Networking and TCP/IP stack for HelenOS system by  doxygen 1.6.1