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 inb_ne | ( | dep, | |||
reg | ) | (inb(dep->de_base_port+reg)) |
Reads 1 byte register.
[in] | dep | The network interface structure. |
[in] | reg | The register offset. |
Referenced by ne_init(), ne_probe(), ne_stop(), and test_8().
#define inw_ne | ( | dep, | |||
reg | ) | (inw(dep->de_base_port+reg)) |
#define milli_delay | ( | millis | ) | usleep((millis) * 1000) |
Sleeps for the defined millicesonds.
[in] | millis | The number of milliseconds to sleep. |
Referenced by ne_probe(), and ne_stop().
#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_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.
[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.
[in] | dep | The network interface structure. |
[in] | reg | The register offset. |
[in] | data | The value to be written. |
Referenced by test_16().
Type definition of the testing function.
void ne_init | ( | struct dpeth * | dep | ) |
Initializes the NE2000 network interface.
[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().
int ne_probe | ( | struct dpeth * | dep | ) |
Probes a NE2000 or NE1000 network interface.
[in] | dep | The network interface structure. |
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().
static void ne_stop | ( | dpeth_t * | dep | ) | [static] |
Stops the NE2000 network interface.
[in,out] | dep | The network interface structure. |
References inb_ne, milli_delay, NE_RESET, and outb_ne.
Referenced by ne_probe().
Tests 16 bit NE2000 network interface.
[in,out] | dep | The network interface structure. |
[in] | pos | The starting position. |
[in] | pat | The data pattern to be written. |
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().
Tests 8 bit NE2000 network interface.
[in,out] | dep | The network interface structure. |
[in] | pos | The starting position. |
[in] | pat | The data pattern to be written. |
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().