Generic DP8390 network interface family service
[Network interface drivers]

Collaboration diagram for Generic DP8390 network interface family service:

Data Structures

struct  dp_rcvhdr
 Type definition of the receive header. More...
struct  iovec_dat
struct  dpeth
struct  eth_stat
 Ethernet statistics. More...
struct  ether_addr
 Ethernet address type definition. More...
struct  iovec_t
 Type definition of the input/output vector. More...

Modules

 NE2000 network interface family

Files

file  dp8390.c
 

DP8390 network interface core implementation.


file  dp8390.h
 

DP8390 network interface definitions.


file  dp8390_drv.h
 

DP8390 network interface driver interface.


file  dp8390_module.c
 

DP8390 network interface implementation.


file  dp8390_port.h
 

DP8390 network interface types and structures ports.


file  local.h
 

Network interface probe functions.


Defines

#define wdeth_probe(dep)   (0)
#define ne_probe(dep)   (0)
#define el2_probe(dep)   (0)
#define CR_EXTRA   CR_STA
#define DP8390_IO_SIZE   0x01f
 Input/output size.
#define DP_CR   0x0
#define DP_CR   0x0
#define DP_CR   0x0
#define DP_CLDA0   0x1
#define DP_CLDA1   0x2
#define DP_BNRY   0x3
#define DP_BNRY   0x3
#define DP_TSR   0x4
#define DP_NCR   0x5
#define DP_FIFO   0x6
#define DP_ISR   0x7
#define DP_ISR   0x7
#define DP_CRDA0   0x8
#define DP_CRDA1   0x9
#define DP_DUM1   0xA
#define DP_DUM2   0xB
#define DP_RSR   0xC
#define DP_CNTR0   0xD
#define DP_CNTR1   0xE
#define DP_CNTR2   0xF
#define DP_PSTART   0x1
#define DP_PSTOP   0x2
#define DP_TPSR   0x4
#define DP_TBCR0   0x5
#define DP_TBCR1   0x6
#define DP_RSAR0   0x8
#define DP_RSAR1   0x9
#define DP_RBCR0   0xA
#define DP_RBCR1   0xB
#define DP_RCR   0xC
#define DP_TCR   0xD
#define DP_DCR   0xE
#define DP_IMR   0xF
#define DP_PAR0   0x1
#define DP_PAR1   0x2
#define DP_PAR2   0x3
#define DP_PAR3   0x4
#define DP_PAR4   0x5
#define DP_PAR5   0x6
#define DP_CURR   0x7
#define DP_MAR0   0x8
#define DP_MAR1   0x9
#define DP_MAR2   0xA
#define DP_MAR3   0xB
#define DP_MAR4   0xC
#define DP_MAR5   0xD
#define DP_MAR6   0xE
#define DP_MAR7   0xF
#define CR_STP   0x01
#define CR_STA   0x02
#define CR_TXP   0x04
#define CR_DMA   0x38
#define CR_DM_NOP   0x00
#define CR_DM_RR   0x08
#define CR_DM_RW   0x10
#define CR_DM_SP   0x18
#define CR_DM_ABORT   0x20
#define CR_PS   0xC0
#define CR_PS_P0   0x00
#define CR_PS_P1   0x40
#define CR_PS_P2   0x80
#define CR_PS_T1   0xC0
#define ISR_PRX   0x01
#define ISR_PTX   0x02
#define ISR_RXE   0x04
#define ISR_TXE   0x08
#define ISR_OVW   0x10
#define ISR_CNT   0x20
#define ISR_RDC   0x40
#define ISR_RST   0x80
#define IMR_PRXE   0x01
#define IMR_PTXE   0x02
#define IMR_RXEE   0x04
#define IMR_TXEE   0x08
#define IMR_OVWE   0x10
#define IMR_CNTE   0x20
#define IMR_RDCE   0x40
#define DCR_WTS   0x01
#define DCR_BYTEWIDE   0x00
#define DCR_WORDWIDE   0x01
#define DCR_BOS   0x02
#define DCR_LTLENDIAN   0x00
#define DCR_BIGENDIAN   0x02
#define DCR_LAS   0x04
#define DCR_BMS   0x08
#define DCR_AR   0x10
#define DCR_FTS   0x60
#define DCR_2BYTES   0x00
#define DCR_4BYTES   0x40
#define DCR_8BYTES   0x20
#define DCR_12BYTES   0x60
#define TCR_CRC   0x01
#define TCR_ELC   0x06
#define TCR_NORMAL   0x00
#define TCR_INTERNAL   0x02
#define TCR_0EXTERNAL   0x04
#define TCR_1EXTERNAL   0x06
#define TCR_ATD   0x08
#define TCR_OFST   0x10
#define TSR_PTX   0x01
#define TSR_DFR   0x02
#define TSR_COL   0x04
#define TSR_ABT   0x08
#define TSR_CRS   0x10
#define TSR_FU   0x20
#define TSR_CDH   0x40
#define TSR_OWC   0x80
#define RCR_SEP   0x01
#define RCR_AR   0x02
#define RCR_AB   0x04
#define RCR_AM   0x08
#define RCR_PRO   0x10
#define RCR_MON   0x20
#define RSR_PRX   0x01
#define RSR_CRC   0x02
#define RSR_FAE   0x04
#define RSR_FO   0x08
#define RSR_MPA   0x10
#define RSR_PHY   0x20
#define RSR_DIS   0x40
#define RSR_DFR   0x80
#define DP_PAGESIZE   256
 Page size.
#define inb_reg0(dep, reg)   (inb(dep->de_dp8390_port+reg))
 Reads 1 byte from the zero page register.
#define outb_reg0(dep, reg, data)   (outb(dep->de_dp8390_port+reg, data))
 Writes 1 byte zero page register.
#define inb_reg1(dep, reg)   (inb(dep->de_dp8390_port+reg))
 Reads 1 byte from the first page register.
#define outb_reg1(dep, reg, data)   (outb(dep->de_dp8390_port+reg, data))
 Writes 1 byte first page register.
#define IOVEC_NR   1
#define SENDQ_NR   1
#define SENDQ_PAGES   6
#define MAX_PACKETS   4
 Maximum number of waiting packets to be sent or received.
#define DEI_DEFAULT   0x8000
#define DEF_EMPTY   0x000
#define DEF_PACK_SEND   0x001
#define DEF_PACK_RECV   0x002
#define DEF_SEND_AVAIL   0x004
#define DEF_READING   0x010
#define DEF_PROMISC   0x040
#define DEF_MULTI   0x080
#define DEF_BROAD   0x100
#define DEF_ENABLED   0x200
#define DEF_STOPPED   0x400
#define DEM_DISABLED   0x0
#define DEM_SINK   0x1
#define DEM_ENABLED   0x2
#define debug   1
#define NAME   "dp8390 network interface"
 DP8390 module name.
#define IRQ_GET_DEVICE(call)   (device_id_t) IPC_GET_METHOD(*call)
 Returns the device from the interrupt call.
#define IPC_GET_ISR(call)   (int) IPC_GET_ARG2(*call)
 Returns the interrupt status register from the interrupt call.
#define _PROTOTYPE(function, params)   function params
 Macro for difining functions.
#define OK   EOK
 Success error code.
#define memcmp(first, second, size)   bcmp((char *) (first), (char *) (second), (size))
 Compares two memory blocks.
#define inb(port)   pio_read_8((ioport8_t *) (port))
 Reads 1 byte.
#define inw(port)   pio_read_16((ioport16_t *) (port))
 Reads 1 word (2 bytes).
#define outb(port, value)   pio_write_8((ioport8_t *) (port), (value))
 Writes 1 byte.
#define outw(port, value)   pio_write_16((ioport16_t *) (port), (value))
 Writes 1 word (2 bytes).
#define panic(...)   printf("%s%s%d", __VA_ARGS__)
 Prints out the driver critical error.
#define sys_vircopy(proc, src_s, src, me, dst_s, dst, bytes)   ({memcpy((void *)(dst), (void *)(src), (bytes)); EOK;})
 Copies a memory block.
#define do_vir_insb(port, proc, dst, bytes)   insb((port), (void *)(dst), (bytes))
 Reads a memory block byte by byte.
#define do_vir_insw(port, proc, dst, bytes)   insw((port), (void *)(dst), (bytes))
 Reads a memory block word by word (2 bytes).
#define do_vir_outsb(port, proc, src, bytes)   outsb((port), (void *)(src), (bytes))
 Writes a memory block byte by byte.
#define do_vir_outsw(port, proc, src, bytes)   outsw((port), (void *)(src), (bytes))
 Writes a memory block word by word (2 bytes).
#define DL_NOMODE   0x0
#define DL_PROMISC_REQ   0x2
#define DL_MULTI_REQ   0x4
#define DL_BROAD_REQ   0x8
#define TRUE   1
 True value.
#define FALSE   0
 False value.
#define NO_NUM   0x8000
 No number value.
#define EGENERIC   EINVAL
 Generic error.
#define ETH_MIN_PACK_SIZE   60
 Minimum Ethernet packet size in bytes.
#define ETH_MAX_PACK_SIZE_TAGGED   1518
 Maximum Ethernet packet size in bytes.
#define ENABLE_WDETH   0
 WDETH switch.
#define ENABLE_NE2000   1
 NE2000 switch.
#define ENABLE_3C503   0
 3C503 switch.
#define ENABLE_PCI   0
 PCI support switch.

Typedefs

typedef struct dp_rcvhdr dp_rcvhdr_t
 Type definition of the receive header.
typedef struct iovec_dat iovec_dat_t
typedef struct dpeth dpeth_t
typedef uint8_t u8_t
 Type definition of the unsigned byte.
typedef uint16_t u16_t
 Type definition of the unsigned short.
typedef long port_t
 Type definition of a port.
typedef struct eth_stat eth_stat_t
 Ethernet statistics.
typedef struct ether_addr ether_addr_t
 Ethernet address type definition.
typedef unsigned long phys_bytes
 Type definition of the physical addresses and lengths in bytes.
typedef unsigned long vir_bytes
 Type definition of the virtual addresses and lengths in bytes.

Functions

int queue_packet (dpeth_t *dep, packet_t packet)
 Queues the outgoing packet.
static void outsb (port_t port, void *buf, size_t size)
 Reads a memory block byte by byte.
static void outsw (port_t port, void *buf, size_t size)
 Reads a memory block word by word.
 _PROTOTYPE (static void dp_init,(dpeth_t *dep))
 _PROTOTYPE (static void dp_getblock,(dpeth_t *dep, int page, size_t offset, size_t size, void *dst))
 _PROTOTYPE (static int dp_pkt2user,(dpeth_t *dep, int page, int length))
 _PROTOTYPE (static void dp_user2nic,(dpeth_t *dep, iovec_dat_t *iovp, vir_bytes offset, int nic_addr, vir_bytes count))
 _PROTOTYPE (static void dp_nic2user,(dpeth_t *dep, int nic_addr, iovec_dat_t *iovp, vir_bytes offset, vir_bytes count))
 _PROTOTYPE (static void dp_next_iovec,(iovec_dat_t *iovp))
 _PROTOTYPE (static void reply,(dpeth_t *dep, int err, int may_block))
 _PROTOTYPE (static void get_userdata,(int user_proc, vir_bytes user_addr, vir_bytes count, void *loc_addr))
 _PROTOTYPE (static void insb,(port_t port, void *buf, size_t size))
int do_probe (dpeth_t *dep)
 Probes and initializes the network interface.
void dp8390_dump (dpeth_t *dep)
 Prints out network interface information.
int do_init (dpeth_t *dep, int mode)
 Initializes and/or starts the network interface.
void do_stop (dpeth_t *dep)
 Stops the network interface.
int do_pwrite (dpeth_t *dep, packet_t packet, int from_int)
 Sends a packet.
void dp_init (dpeth_t *dep)
static void dp_reinit (dpeth_t *dep)
static void dp_reset (dpeth_t *dep)
void dp_check_ints (dpeth_t *dep, int isr)
 Processes the interrupt.
static void dp_recv (dpeth_t *dep)
static void dp_send (dpeth_t *dep)
static void dp_getblock (dpeth_t *dep, int page, size_t offset, size_t size, void *dst)
static void dp_pio8_getblock (dpeth_t *dep, int page, size_t offset, size_t size, void *dst)
static void dp_pio16_getblock (dpeth_t *dep, int page, size_t offset, size_t size, void *dst)
static int dp_pkt2user (dpeth_t *dep, int page, int length)
static void dp_user2nic (dpeth_t *dep, iovec_dat_t *iovp, vir_bytes offset, int nic_addr, vir_bytes count)
static void dp_pio8_user2nic (dpeth_t *dep, iovec_dat_t *iovp, vir_bytes offset, int nic_addr, vir_bytes count)
static void dp_pio16_user2nic (dpeth_t *dep, iovec_dat_t *iovp, vir_bytes offset, int nic_addr, vir_bytes count)
static void dp_nic2user (dpeth_t *dep, int nic_addr, iovec_dat_t *iovp, vir_bytes offset, vir_bytes count)
static void dp_pio8_nic2user (dpeth_t *dep, int nic_addr, iovec_dat_t *iovp, vir_bytes offset, vir_bytes count)
static void dp_pio16_nic2user (dpeth_t *dep, int nic_addr, iovec_dat_t *iovp, vir_bytes offset, vir_bytes count)
static void dp_next_iovec (iovec_dat_t *iovp)
static void conf_hw (dpeth_t *dep)
static void map_hw_buffer (dpeth_t *dep)
static void reply (dpeth_t *dep, int err, int may_block)
static void get_userdata (int user_proc, vir_bytes user_addr, vir_bytes count, void *loc_addr)
static void insb (port_t port, void *buf, size_t size)
static void insw (port_t port, void *buf, size_t size)
 _PROTOTYPE (typedef void(*dp_initf_t),(struct dpeth *dep))
 _PROTOTYPE (typedef void(*dp_user2nicf_t),(struct dpeth *dep, struct iovec_dat *iovp, vir_bytes offset, int nic_addr, vir_bytes count))
 _PROTOTYPE (typedef void(*dp_nic2userf_t),(struct dpeth *dep, int nic_addr, struct iovec_dat *iovp, vir_bytes offset, vir_bytes count))
 _PROTOTYPE (typedef void(*dp_getblock_t),(struct dpeth *dep, int page, size_t offset, size_t size, void *dst))
void module_print_name (void)
 Prints the module name.
void irq_handler (ipc_callid_t iid, ipc_call_t *call)
 Handles the interrupt messages.
int change_state (device_ref device, device_state_t state)
 Changes the network interface state.
int netif_specific_message (ipc_callid_t callid, ipc_call_t *call, ipc_call_t *answer, int *answer_count)
 Processes the netif driver specific message.
int netif_get_device_stats (device_id_t device_id, device_stats_ref stats)
 Returns the device usage statistics.
int netif_get_addr_message (device_id_t device_id, measured_string_ref address)
 Returns the device local hardware address.
int netif_probe_message (device_id_t device_id, int irq, uintptr_t io)
 Probes the existence of the device.
int netif_send_message (device_id_t device_id, packet_t packet, services_t sender)
 Sends the packet queue.
int netif_start_message (device_ref device)
 Starts the device.
int netif_stop_message (device_ref device)
 Stops the device.
int netif_initialize (void)
 Initializes the specific module.
int ne_probe (struct dpeth *dep)
 Probes a NE2000 or NE1000 network interface.

Variables

static irq_cmd_t dp8390_cmds []
 DP8390 kernel interrupt command sequence.
static irq_code_t dp8390_code
 DP8390 kernel interrupt code.
netif_globals_t netif_globals
 Network interface module global data.

Define Documentation

#define _PROTOTYPE ( function,
params   )     function params

Macro for difining functions.

Parameters:
[in] function The function type and name definition.
[in] params The function parameters definition.
#define CR_DM_ABORT   0x20

Referenced by dp_init(), dp_reset(), and ne_probe().

#define CR_DM_NOP   0x00
#define CR_DM_RR   0x08
#define CR_DM_RW   0x10
#define CR_DM_SP   0x18
#define CR_DMA   0x38
#define CR_EXTRA   CR_STA

Referenced by dp_recv(), and dp_reinit().

#define CR_PS   0xC0
#define CR_PS_P0   0x00
#define CR_PS_P1   0x40

Referenced by dp_init(), and dp_recv().

#define CR_PS_P2   0x80
#define CR_PS_T1   0xC0
#define CR_STA   0x02
#define CR_STP   0x01

Referenced by dp_init(), dp_reset(), and ne_probe().

#define CR_TXP   0x04
#define DCR_12BYTES   0x60
#define DCR_2BYTES   0x00
#define DCR_4BYTES   0x40
#define DCR_8BYTES   0x20

Referenced by dp_init(), and ne_probe().

#define DCR_AR   0x10
#define DCR_BIGENDIAN   0x02
#define DCR_BMS   0x08

Referenced by dp_init(), and ne_probe().

#define DCR_BOS   0x02
#define DCR_BYTEWIDE   0x00

Referenced by dp_init(), and ne_probe().

#define DCR_FTS   0x60
#define DCR_LAS   0x04
#define DCR_LTLENDIAN   0x00
#define DCR_WORDWIDE   0x01

Referenced by dp_init(), and ne_probe().

#define DCR_WTS   0x01
#define debug   1
#define DEF_BROAD   0x100

Referenced by dp_init(), and dp_reinit().

#define DEF_EMPTY   0x000

Referenced by conf_hw(), and dp_init().

#define DEF_ENABLED   0x200

Referenced by dp_init(), dp_recv(), and irq_handler().

#define DEF_MULTI   0x080

Referenced by dp_init(), and dp_reinit().

#define DEF_PACK_RECV   0x002

Referenced by dp_pkt2user().

#define DEF_PACK_SEND   0x001
#define DEF_PROMISC   0x040

Referenced by dp_init(), and dp_reinit().

#define DEF_READING   0x010
#define DEF_SEND_AVAIL   0x004
#define DEF_STOPPED   0x400

Referenced by dp_reset().

#define DEI_DEFAULT   0x8000

Referenced by ne_init().

#define DEM_DISABLED   0x0

Referenced by conf_hw(), and netif_probe_message().

#define DEM_ENABLED   0x2

Referenced by conf_hw(), and irq_handler().

#define DEM_SINK   0x1
#define DL_BROAD_REQ   0x8

Referenced by netif_start_message().

#define DL_MULTI_REQ   0x4
#define DL_NOMODE   0x0
#define DL_PROMISC_REQ   0x2
#define do_vir_insb ( port,
proc,
dst,
bytes   )     insb((port), (void *)(dst), (bytes))

Reads a memory block byte by byte.

Parameters:
[in] port The address to be written.
proc The source process. Ignored parameter.
[in] dst The destination address.
[in] bytes The block size in bytes.

Referenced by dp_pio8_nic2user().

#define do_vir_insw ( port,
proc,
dst,
bytes   )     insw((port), (void *)(dst), (bytes))

Reads a memory block word by word (2 bytes).

Parameters:
[in] port The address to be written.
proc The source process. Ignored parameter.
[in] dst The destination address.
[in] bytes The block size in bytes.

Referenced by dp_pio16_nic2user().

#define do_vir_outsb ( port,
proc,
src,
bytes   )     outsb((port), (void *)(src), (bytes))

Writes a memory block byte by byte.

Parameters:
[in] port The address to be written.
proc The source process. Ignored parameter.
[in] src The source address.
[in] bytes The block size in bytes.

Referenced by dp_pio8_user2nic().

#define do_vir_outsw ( port,
proc,
src,
bytes   )     outsw((port), (void *)(src), (bytes))

Writes a memory block word by word (2 bytes).

Parameters:
[in] port The address to be written.
proc The source process. Ignored parameter.
[in] src The source address.
[in] bytes The block size in bytes.

Referenced by dp_pio16_user2nic().

#define DP8390_IO_SIZE   0x01f

Input/output size.

Referenced by netif_probe_message().

#define DP_BNRY   0x3
#define DP_BNRY   0x3

Referenced by dp_init(), and dp_recv().

#define DP_CLDA0   0x1
#define DP_CLDA1   0x2
#define DP_CNTR0   0xD

Referenced by dp_init().

#define DP_CNTR1   0xE

Referenced by dp_init().

#define DP_CNTR2   0xF

Referenced by dp_init().

#define DP_CR   0x0
#define DP_CR   0x0
#define DP_CR   0x0
#define DP_CRDA0   0x8
#define DP_CRDA1   0x9
#define DP_CURR   0x7

Referenced by dp_init(), and dp_recv().

#define DP_DCR   0xE

Referenced by dp_init(), and ne_probe().

#define DP_DUM1   0xA
#define DP_DUM2   0xB
#define DP_FIFO   0x6
#define DP_IMR   0xF

Referenced by dp_init().

#define DP_ISR   0x7
#define DP_ISR   0x7
#define DP_MAR0   0x8

Referenced by dp_init().

#define DP_MAR1   0x9

Referenced by dp_init().

#define DP_MAR2   0xA

Referenced by dp_init().

#define DP_MAR3   0xB

Referenced by dp_init().

#define DP_MAR4   0xC

Referenced by dp_init().

#define DP_MAR5   0xD

Referenced by dp_init().

#define DP_MAR6   0xE

Referenced by dp_init().

#define DP_MAR7   0xF

Referenced by dp_init().

#define DP_NCR   0x5
#define DP_PAGESIZE   256

Page size.

Referenced by ne_init().

#define DP_PAR0   0x1

Referenced by dp_init().

#define DP_PAR1   0x2

Referenced by dp_init().

#define DP_PAR2   0x3

Referenced by dp_init().

#define DP_PAR3   0x4

Referenced by dp_init().

#define DP_PAR4   0x5

Referenced by dp_init().

#define DP_PAR5   0x6

Referenced by dp_init().

#define DP_PSTART   0x1

Referenced by dp_init().

#define DP_PSTOP   0x2

Referenced by dp_init().

#define DP_RBCR0   0xA
#define DP_RBCR1   0xB
#define DP_RCR   0xC

Referenced by dp_init(), dp_reinit(), and ne_probe().

#define DP_RSAR0   0x8
#define DP_RSAR1   0x9
#define DP_RSR   0xC
#define DP_TBCR0   0x5
#define DP_TBCR1   0x6
#define DP_TCR   0xD

Referenced by dp_init(), dp_reset(), and ne_probe().

#define DP_TPSR   0x4
#define DP_TSR   0x4
#define EGENERIC   EINVAL

Generic error.

#define el2_probe ( dep   )     (0)

Referenced by conf_hw().

#define ENABLE_3C503   0

3C503 switch.

#define ENABLE_NE2000   1

NE2000 switch.

#define ENABLE_PCI   0

PCI support switch.

#define ENABLE_WDETH   0

WDETH switch.

#define ETH_MAX_PACK_SIZE_TAGGED   1518

Maximum Ethernet packet size in bytes.

#define ETH_MIN_PACK_SIZE   60

Minimum Ethernet packet size in bytes.

Referenced by dp_recv().

#define FALSE   0

False value.

Referenced by dp_recv(), and netif_send_message().

#define IMR_CNTE   0x20

Referenced by dp_init().

#define IMR_OVWE   0x10

Referenced by dp_init().

#define IMR_PRXE   0x01

Referenced by dp_init().

#define IMR_PTXE   0x02

Referenced by dp_init().

#define IMR_RDCE   0x40
#define IMR_RXEE   0x04

Referenced by dp_init().

#define IMR_TXEE   0x08

Referenced by dp_init().

#define inb ( port   )     pio_read_8((ioport8_t *) (port))

Reads 1 byte.

Parameters:
[in] port The address to be read.
Returns:
The read value.

Referenced by insb().

#define inb_reg0 ( dep,
reg   )     (inb(dep->de_dp8390_port+reg))

Reads 1 byte from the zero page register.

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

Referenced by dp_init(), dp_pio16_user2nic(), dp_pio8_user2nic(), dp_recv(), dp_reset(), ne_probe(), test_16(), and test_8().

#define inb_reg1 ( dep,
reg   )     (inb(dep->de_dp8390_port+reg))

Reads 1 byte from the first page register.

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

Referenced by dp_recv().

#define inw ( port   )     pio_read_16((ioport16_t *) (port))

Reads 1 word (2 bytes).

Parameters:
[in] port The address to be read.
Returns:
The read value.

Referenced by dp_pio16_nic2user(), and insw().

#define IOVEC_NR   1
#define IPC_GET_ISR ( call   )     (int) IPC_GET_ARG2(*call)

Returns the interrupt status register from the interrupt call.

Parameters:
[in] call The interrupt call.

Referenced by irq_handler().

#define IRQ_GET_DEVICE ( call   )     (device_id_t) IPC_GET_METHOD(*call)

Returns the device from the interrupt call.

Parameters:
[in] call The interrupt call.

Referenced by irq_handler().

#define ISR_CNT   0x20
#define ISR_OVW   0x10
#define ISR_PRX   0x01
#define ISR_PTX   0x02
#define ISR_RDC   0x40

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

#define ISR_RST   0x80

Referenced by dp_reset(), and ne_probe().

#define ISR_RXE   0x04
#define ISR_TXE   0x08
#define MAX_PACKETS   4

Maximum number of waiting packets to be sent or received.

Referenced by dp_pkt2user(), and queue_packet().

#define memcmp ( first,
second,
size   )     bcmp((char *) (first), (char *) (second), (size))

Compares two memory blocks.

Parameters:
[in] first The first memory block.
[in] second The second memory block.
[in] size The blocks size in bytes.
Returns:
0 if equeal.
-1 if the first is greater than the second.
1 if the second is greater than the first.

Referenced by test_16(), and test_8().

#define NAME   "dp8390 network interface"

DP8390 module name.

#define ne_probe ( dep   )     (0)

Referenced by conf_hw().

#define NO_NUM   0x8000

No number value.

Referenced by dp_pio16_user2nic(), and dp_pio8_user2nic().

#define OK   EOK
#define outb ( port,
value   )     pio_write_8((ioport8_t *) (port), (value))

Writes 1 byte.

Parameters:
[in] port The address to be written.
[in] value The value to be written.

Referenced by outsb().

#define outb_reg0 ( dep,
reg,
data   )     (outb(dep->de_dp8390_port+reg, data))

Writes 1 byte zero page register.

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

Referenced by dp_init(), dp_pio16_getblock(), dp_pio16_nic2user(), dp_pio16_user2nic(), dp_pio8_getblock(), dp_pio8_nic2user(), dp_pio8_user2nic(), dp_recv(), dp_reinit(), dp_reset(), ne_init(), ne_probe(), test_16(), and test_8().

#define outb_reg1 ( dep,
reg,
data   )     (outb(dep->de_dp8390_port+reg, data))

Writes 1 byte first page register.

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

Referenced by dp_init().

#define outw ( port,
value   )     pio_write_16((ioport16_t *) (port), (value))

Writes 1 word (2 bytes).

Parameters:
[in] port The address to be written.
[in] value The value to be written.

Referenced by dp_pio16_user2nic(), and outsw().

#define panic ( ...   )     printf("%s%s%d", __VA_ARGS__)

Prints out the driver critical error.

Does not call the system panic().

Referenced by dp_nic2user(), dp_pio16_nic2user(), dp_pio16_user2nic(), dp_pio8_user2nic(), dp_user2nic(), and get_userdata().

#define RCR_AB   0x04

Referenced by dp_init(), and dp_reinit().

#define RCR_AM   0x08

Referenced by dp_init(), and dp_reinit().

#define RCR_AR   0x02
#define RCR_MON   0x20

Referenced by ne_probe().

#define RCR_PRO   0x10

Referenced by dp_init(), and dp_reinit().

#define RCR_SEP   0x01
#define RSR_CRC   0x02
#define RSR_DFR   0x80
#define RSR_DIS   0x40
#define RSR_FAE   0x04
#define RSR_FO   0x08

Referenced by dp_recv().

#define RSR_MPA   0x10
#define RSR_PHY   0x20
#define RSR_PRX   0x01

Referenced by dp_recv().

#define SENDQ_NR   1

Referenced by ne_init().

#define SENDQ_PAGES   6

Referenced by ne_init().

#define sys_vircopy ( proc,
src_s,
src,
me,
dst_s,
dst,
bytes   )     ({memcpy((void *)(dst), (void *)(src), (bytes)); EOK;})

Copies a memory block.

Parameters:
proc The source process. Ignored parameter.
src_s Ignored parameter.
[in] src The source address.
me The current proces. Ignored parameter.
dst_s Ignored parameter.
[in] dst The destination address.
[in] bytes The block size in bytes.
Returns:
EOK.

Referenced by dp_nic2user(), dp_pio16_nic2user(), dp_pio16_user2nic(), dp_user2nic(), and get_userdata().

#define TCR_0EXTERNAL   0x04
#define TCR_1EXTERNAL   0x06

Referenced by dp_reset().

#define TCR_ATD   0x08
#define TCR_CRC   0x01
#define TCR_ELC   0x06
#define TCR_INTERNAL   0x02

Referenced by dp_init().

#define TCR_NORMAL   0x00

Referenced by dp_init(), dp_reset(), and ne_probe().

#define TCR_OFST   0x10

Referenced by dp_reset().

#define TRUE   1

True value.

Referenced by dp_recv(), and dp_send().

#define TSR_ABT   0x08
#define TSR_CDH   0x40
#define TSR_COL   0x04
#define TSR_CRS   0x10
#define TSR_DFR   0x02
#define TSR_FU   0x20
#define TSR_OWC   0x80
#define TSR_PTX   0x01
#define wdeth_probe ( dep   )     (0)

Referenced by conf_hw().


Typedef Documentation

typedef struct dp_rcvhdr dp_rcvhdr_t

Type definition of the receive header.

typedef struct dpeth dpeth_t
typedef struct eth_stat eth_stat_t

Ethernet statistics.

typedef struct ether_addr ether_addr_t

Ethernet address type definition.

typedef struct iovec_dat iovec_dat_t
typedef unsigned long phys_bytes

Type definition of the physical addresses and lengths in bytes.

typedef long port_t

Type definition of a port.

typedef uint16_t u16_t

Type definition of the unsigned short.

typedef uint8_t u8_t

Type definition of the unsigned byte.

typedef unsigned long vir_bytes

Type definition of the virtual addresses and lengths in bytes.


Function Documentation

_PROTOTYPE ( typedef void *  dp_getblock_t,
(struct dpeth *dep, int page, size_t offset, size_t size, void *dst)   
)
_PROTOTYPE ( typedef void *  dp_nic2userf_t,
(struct dpeth *dep, int nic_addr, struct iovec_dat *iovp, vir_bytes offset, vir_bytes count  
)
_PROTOTYPE ( typedef void *  dp_user2nicf_t,
(struct dpeth *dep, struct iovec_dat *iovp, vir_bytes offset, int nic_addr, vir_bytes count  
)
_PROTOTYPE ( typedef void *  dp_initf_t,
(struct dpeth *dep)   
)
_PROTOTYPE ( static void  insb,
(port_t port, void *buf, size_t size)   
)
_PROTOTYPE ( static void  get_userdata,
(int user_proc, vir_bytes user_addr, vir_bytes count, void *loc_addr)   
)
_PROTOTYPE ( static void  reply,
(dpeth_t *dep, int err, int may_block)   
)
_PROTOTYPE ( static void  dp_next_iovec,
(iovec_dat_t *iovp)   
)
_PROTOTYPE ( static void  dp_nic2user,
(dpeth_t *dep, int nic_addr, iovec_dat_t *iovp, vir_bytes offset, vir_bytes count  
)
_PROTOTYPE ( static void  dp_user2nic,
(dpeth_t *dep, iovec_dat_t *iovp, vir_bytes offset, int nic_addr, vir_bytes count  
)
_PROTOTYPE ( static int  dp_pkt2user,
(dpeth_t *dep, int page, int length)   
)
_PROTOTYPE ( static void  dp_getblock,
(dpeth_t *dep, int page, size_t offset, size_t size, void *dst)   
)
_PROTOTYPE ( static void  dp_init,
(dpeth_t *dep)   
)
int change_state ( device_ref  device,
device_state_t  state 
)

Changes the network interface state.

Parameters:
[in,out] device The network interface.
[in] state The new state.
Returns:
The new state.

References NETIF_ACTIVE, and netif_device::state.

Referenced by netif_start_message(), and netif_stop_message().

Here is the caller graph for this function:

static void conf_hw ( dpeth_t dep  )  [static]
int do_init ( dpeth_t dep,
int  mode 
)

Initializes and/or starts the network interface.

Parameters:
[in,out] dep The network interface structure.
[in] mode The state mode.
Returns:
EOK on success.
EXDEV if the network interface is disabled.

Referenced by netif_start_message().

Here is the caller graph for this function:

int do_probe ( dpeth_t dep  ) 

Probes and initializes the network interface.

Parameters:
[in,out] dep The network interface structure.
Returns:
EOK on success.
EXDEV if the network interface was not recognized.

Referenced by netif_probe_message().

Here is the caller graph for this function:

int do_pwrite ( dpeth_t dep,
packet_t  packet,
int  from_int 
)

Sends a packet.

Parameters:
[in,out] dep The network interface structure.
[in] packet The packet t be sent.
[in] from_int The value indicating whether the sending is initialized from the interrupt handler.
Returns:

Referenced by dp_send(), and netif_send_message().

Here is the caller graph for this function:

void do_stop ( dpeth_t dep  ) 

Stops the network interface.

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

Referenced by netif_stop_message().

Here is the caller graph for this function:

void dp8390_dump ( dpeth_t dep  ) 

Prints out network interface information.

Parameters:
[in] dep The network interface structure.
void dp_check_ints ( dpeth_t dep,
int  isr 
)

Processes the interrupt.

Parameters:
[in,out] dep The network interface structure.
[in] isr The interrupt status register.

Referenced by irq_handler().

Here is the caller graph for this function:

static void dp_getblock ( dpeth_t dep,
int  page,
size_t  offset,
size_t  size,
void *  dst 
) [static]
void dp_init ( dpeth_t dep  ) 
static void dp_next_iovec ( iovec_dat_t iovp  )  [static]

References get_userdata(), and IOVEC_NR.

Referenced by dp_nic2user(), dp_pio16_nic2user(), dp_pio16_user2nic(), dp_pio8_nic2user(), dp_pio8_user2nic(), and dp_user2nic().

Here is the call graph for this function:

Here is the caller graph for this function:

static void dp_nic2user ( dpeth_t dep,
int  nic_addr,
iovec_dat_t iovp,
vir_bytes  offset,
vir_bytes  count 
) [static]
static void dp_pio16_getblock ( dpeth_t dep,
int  page,
size_t  offset,
size_t  size,
void *  dst 
) [static]

References CR_DM_RR, CR_PS_P0, CR_STA, DP_CR, DP_RBCR0, DP_RBCR1, DP_RSAR0, DP_RSAR1, insw(), and outb_reg0.

Here is the call graph for this function:

static void dp_pio16_nic2user ( dpeth_t dep,
int  nic_addr,
iovec_dat_t iovp,
vir_bytes  offset,
vir_bytes  count 
) [static]
static void dp_pio16_user2nic ( dpeth_t dep,
iovec_dat_t iovp,
vir_bytes  offset,
int  nic_addr,
vir_bytes  count 
) [static]
static void dp_pio8_getblock ( dpeth_t dep,
int  page,
size_t  offset,
size_t  size,
void *  dst 
) [static]

References CR_DM_RR, CR_PS_P0, CR_STA, DP_CR, DP_RBCR0, DP_RBCR1, DP_RSAR0, DP_RSAR1, insb(), and outb_reg0.

Here is the call graph for this function:

static void dp_pio8_nic2user ( dpeth_t dep,
int  nic_addr,
iovec_dat_t iovp,
vir_bytes  offset,
vir_bytes  count 
) [static]
static void dp_pio8_user2nic ( dpeth_t dep,
iovec_dat_t iovp,
vir_bytes  offset,
int  nic_addr,
vir_bytes  count 
) [static]
static int dp_pkt2user ( dpeth_t dep,
int  page,
int  length 
) [static]

References count, DEF_PACK_RECV, MAX_PACKETS, netif_packet_get_1(), netif_pq_release(), OK, packet_get_id(), packet_suffix(), and pq_add().

Referenced by dp_recv().

Here is the call graph for this function:

Here is the caller graph for this function:

static void dp_recv ( dpeth_t dep  )  [static]
static void dp_reinit ( dpeth_t dep  )  [static]
static void dp_reset ( dpeth_t dep  )  [static]
static void dp_send ( dpeth_t dep  )  [static]

References do_pwrite(), netif_pq_release(), packet_get_id(), pq_detach(), and TRUE.

Here is the call graph for this function:

static void dp_user2nic ( dpeth_t dep,
iovec_dat_t iovp,
vir_bytes  offset,
int  nic_addr,
vir_bytes  count 
) [static]
static void get_userdata ( int  user_proc,
vir_bytes  user_addr,
vir_bytes  count,
void *  loc_addr 
) [static]

References OK, panic, and sys_vircopy.

Referenced by dp_next_iovec().

Here is the caller graph for this function:

static void insb ( port_t  port,
void *  buf,
size_t  size 
) [static]

References inb.

Referenced by dp_pio8_getblock().

Here is the caller graph for this function:

static void insw ( port_t  port,
void *  buf,
size_t  size 
) [static]

References inw.

Referenced by dp_pio16_getblock().

Here is the caller graph for this function:

void irq_handler ( ipc_callid_t  iid,
ipc_call_t *  call 
)

Handles the interrupt messages.

This is the interrupt handler callback function.

Parameters:
[in] iid The interrupt message identifier.
[in] call The interrupt message.

References dpeth::de_flags, dpeth::de_int_pending, dpeth::de_mode, DEF_ENABLED, DEM_ENABLED, dp_check_ints(), find_device(), IPC_GET_ISR, IRQ_GET_DEVICE, netif_globals::lock, netif_device::nil_phone, nil_received_msg(), packet_get_data(), packet_get_data_length(), packet_get_id(), dpeth::received_count, dpeth::received_queue, and netif_device::specific.

Referenced by netif_initialize().

Here is the call graph for this function:

Here is the caller graph for this function:

static void map_hw_buffer ( dpeth_t dep  )  [static]

References debug.

Referenced by dp_init().

Here is the caller graph for this function:

void module_print_name ( void   ) 

Prints the module name.

See also:
NAME

References NAME.

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:

int netif_get_addr_message ( device_id_t  device_id,
measured_string_ref  address 
)

Returns the device local hardware address.

Parameters:
[in] device_id The device identifier.
[out] address The device local hardware address.
Returns:
EOK on success.
EBADMEM if the address parameter is NULL.
ENOENT if there no such device.
Other error codes as defined for the find_device() function.
Other error codes as defined for the specific module message implementation.
int netif_get_device_stats ( device_id_t  device_id,
device_stats_ref  stats 
)

Returns the device usage statistics.

Parameters:
[in] device_id The device identifier.
[out] stats The device usage statistics.
Returns:
EOK on success.
Other error codes as defined for the find_device() function.
Other error codes as defined for the specific module message implementation.
int netif_initialize ( void   ) 

Initializes the specific module.

int netif_probe_message ( device_id_t  device_id,
int  irq,
uintptr_t  io 
)

Probes the existence of the device.

Parameters:
[in] device_id The device identifier.
[in] irq The device interrupt number.
[in] io The device input/output address.
Returns:
EOK on success.
Other error codes as defined for the find_device() function.
Other error codes as defined for the specific module message implementation.
int netif_send_message ( device_id_t  device_id,
packet_t  packet,
services_t  sender 
)

Sends the packet queue.

Parameters:
[in] device_id The device identifier.
[in] packet The packet queue.
[in] sender The sending module service.
Returns:
EOK on success.
EFORWARD if the device is not active (in the NETIF_ACTIVE state).
Other error codes as defined for the find_device() function.
Other error codes as defined for the specific module message implementation.
int netif_specific_message ( ipc_callid_t  callid,
ipc_call_t *  call,
ipc_call_t *  answer,
int *  answer_count 
)

Processes the netif driver specific message.

This function is called for uncommon messages received by the netif skeleton.

Parameters:
[in] callid The message identifier.
[in] call The message parameters.
[out] answer The message answer parameters.
[out] answer_count The last parameter for the actual answer in the answer parameter.
Returns:
EOK on success.
ENOTSUP if the message is not known.
Other error codes as defined for the specific module message implementation.
int netif_start_message ( device_ref  device  ) 

Starts the device.

Parameters:
[in] device The device structure.
Returns:
EOK on success.
Other error codes as defined for the find_device() function.
Other error codes as defined for the specific module message implementation.
int netif_stop_message ( device_ref  device  ) 

Stops the device.

Parameters:
[in] device The device structure.
Returns:
EOK on success.
Other error codes as defined for the find_device() function.
Other error codes as defined for the specific module message implementation.
static void outsb ( port_t  port,
void *  buf,
size_t  size 
) [static]

Reads a memory block byte by byte.

Parameters:
[in] port The source address.
[out] buf The destination buffer.
[in] size The memory block size in bytes.

References outb.

static void outsw ( port_t  port,
void *  buf,
size_t  size 
) [static]

Reads a memory block word by word.

Parameters:
[in] port The source address.
[out] buf The destination buffer.
[in] size The memory block size in bytes.

References outw.

int queue_packet ( dpeth_t dep,
packet_t  packet 
)

Queues the outgoing packet.

Parameters:
[in] dep The network interface structure.
[in] packet The outgoing packet.
Returns:
EOK on success.
EINVAL

References MAX_PACKETS, netif_pq_release(), dpeth::packet_count, packet_get_id(), dpeth::packet_queue, pq_add(), and pq_next().

Here is the call graph for this function:

static void reply ( dpeth_t dep,
int  err,
int  may_block 
) [static]

Referenced by icmp_echo(), icmp_process_echo_reply(), and main().

Here is the caller graph for this function:


Variable Documentation

irq_cmd_t dp8390_cmds[] [static]
Initial value:
 {
  { .cmd = CMD_PIO_READ_8,
    .addr = NULL,
    .dstarg = 2
  },
  {
    .cmd = CMD_PREDICATE,
    .value = 1,
    .srcarg = 2
  },
  {
    .cmd = CMD_ACCEPT
  }
}

DP8390 kernel interrupt command sequence.

Referenced by netif_start_message().

irq_code_t dp8390_code [static]
Initial value:
 {
  sizeof(dp8390_cmds) / sizeof(irq_cmd_t),
  dp8390_cmds
}

DP8390 kernel interrupt code.

Referenced by netif_start_message().

Network interface module global data.


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