UbixOS V2 2.0

Data Structures | Macros | Typedefs | Functions | Variables
ne2k.h File Reference
`#include <sys/types.h>`
`#include <sys/device.old.h>`
Include dependency graph for ne2k.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Data Structures
struct | dp_rcvhdr
union | etheraddr

## Macros
#define | DEF_ENABLED 0x200
#define | DP_CNTR0 0xD /* Tally Counter 0 */
#define | DP_CNTR1 0xE /* Tally Counter 1 */
#define | DP_CNTR2 0xF /* Tally Counter 2 */
#define | DP_CURR 0x7 /* Current Page Register */
#define | DP_MAR0 0x8 /* Multicast Address Register 0 */
#define | DP_MAR1 0x9 /* Multicast Address Register 1 */
#define | DP_MAR2 0xA /* Multicast Address Register 2 */
#define | DP_MAR3 0xB /* Multicast Address Register 3 */
#define | DP_MAR4 0xC /* Multicast Address Register 4 */
#define | DP_MAR5 0xD /* Multicast Address Register 5 */
#define | DP_MAR6 0xE /* Multicast Address Register 6 */
#define | DP_MAR7 0xF /* Multicast Address Register 7 */
#define | DP_PAGESIZE 256
#define | E8390_CMD 0x00
#define | E8390_NODMA 0x20
#define | E8390_PAGE0 0x00
#define | E8390_PAGE1 0x40
#define | E8390_RREAD 0x08
#define | E8390_RWRITE 0x10
#define | E8390_RXCONFIG 0x04
#define | E8390_RXOFF 0x20
#define | E8390_START 0x02
#define | E8390_STOP 0x01
#define | E8390_TXCONFIG 0x00
#define | E8390_TXOFF 0x00
#define | EN0_BOUNDARY 0x03
#define | EN0_COUNTER0 0x0d
#define | EN0_DCFG 0x0e
#define | EN0_IMR 0x0f
#define | EN0_ISR 0x07
#define | EN0_RCNTHI 0x0b
#define | EN0_RCNTLO 0x0a
#define | EN0_RSARHI 0x09
#define | EN0_RSARLO 0x08
#define | EN0_RXCR 0x0c
#define | EN0_STARTPG 0x01
#define | EN0_STOPPG 0x02
#define | EN0_TPSR 0x04
#define | EN0_TXCR 0x0D
#define | EN1_CURPAG 0x07
#define | EN1_MULT 0x08
#define | EN1_PHYS 0x01
#define | ENDCFG_WTS 0x01
#define | ENISR_ALL 0x3f
#define | ether_addr ether_addr_t
#define | NE1SM_START_PG 0x20
#define | NE1SM_STOP_PG 0x40
#define | NE_BNRY 0x03
#define | NE_CMD 0x00
#define | NE_CURRENT 0x07
#define | NE_DATAPORT 0x10
#define | NE_DCR 0x0E
#define | NE_DCR_AR 0x10
#define | NE_DCR_FT0 0x20
#define | NE_DCR_FT1 0x40
#define | NE_DCR_LS 0x08
#define | NE_DCR_WTS 0x01
#define | NE_IMR 0x0F
#define | NE_ISR 0x07
#define | NE_PSTART 0x01
#define | NE_PSTOP 0x02
#define | NE_RBCR0 0x0A
#define | NE_RBCR1 0x0B
#define | NE_RCR 0x0C
#define | NE_TCR 0x0D
#define | NE_TPSR 0x04
#define | NESM_START_PG 0x40
#define | NESM_STOP_PG 0x80
#define | OK 0
#define | RSR_FO 0x08
#define | RSR_PRX 0x01
#define | startPage 0x4C
#define | stopPage 0x80
#define | TX_1X_PAGES 6
#define | TX_2X_PAGES 12
#define | TX_PAGES (dev->priv->pingPong ? TX_2X_PAGES : TX_1X_PAGES)

## Typedefs
typedef struct dp_rcvhdr | dp_rcvhdr_t
typedef union etheraddr | ether_addr_t

## Functions
int | ne2k_init ()
struct nicBuffer * | ne2kAllocBuffer (int)
int | ne2kDevInit (struct device *)
void | ne2kFreeBuffer (struct nicBuffer *)
struct nicBuffer * | ne2kGetBuffer ()
void | ne2kHandler ()
void | ne2kISR ()
int | ne2kProbe (int, struct device *)
int | NICtoPC (struct device *dev, void *packet, int length, int nic_addr)
void | NS8390_init (struct device *dev, int startp)
int | PCtoNIC (struct device *dev, void *packet, int length)

## Variables
char * | nicPacket
uInt32 | packetLength

## Macro Definition Documentation

## ◆ DEF_ENABLED

#define DEF_ENABLED 0x200

Definition at line 52 of file ne2k.h.

## ◆ DP_CNTR0

#define DP_CNTR0 0xD /* Tally Counter 0 */

Definition at line 142 of file ne2k.h.

## ◆ DP_CNTR1

#define DP_CNTR1 0xE /* Tally Counter 1 */

Definition at line 143 of file ne2k.h.

## ◆ DP_CNTR2

#define DP_CNTR2 0xF /* Tally Counter 2 */

Definition at line 144 of file ne2k.h.

## ◆ DP_CURR

#define DP_CURR 0x7 /* Current Page Register */

Definition at line 132 of file ne2k.h.

## ◆ DP_MAR0

#define DP_MAR0 0x8 /* Multicast Address Register 0 */

Definition at line 133 of file ne2k.h.

## ◆ DP_MAR1

#define DP_MAR1 0x9 /* Multicast Address Register 1 */

Definition at line 134 of file ne2k.h.

## ◆ DP_MAR2

#define DP_MAR2 0xA /* Multicast Address Register 2 */

Definition at line 135 of file ne2k.h.

## ◆ DP_MAR3

#define DP_MAR3 0xB /* Multicast Address Register 3 */

Definition at line 136 of file ne2k.h.

## ◆ DP_MAR4

#define DP_MAR4 0xC /* Multicast Address Register 4 */

Definition at line 137 of file ne2k.h.

## ◆ DP_MAR5

#define DP_MAR5 0xD /* Multicast Address Register 5 */

Definition at line 138 of file ne2k.h.

## ◆ DP_MAR6

#define DP_MAR6 0xE /* Multicast Address Register 6 */

Definition at line 139 of file ne2k.h.

## ◆ DP_MAR7

#define DP_MAR7 0xF /* Multicast Address Register 7 */

Definition at line 140 of file ne2k.h.

## ◆ DP_PAGESIZE

#define DP_PAGESIZE 256

Definition at line 147 of file ne2k.h.

## ◆ E8390_CMD

#define E8390_CMD 0x00

Definition at line 88 of file ne2k.h.

## ◆ E8390_NODMA

#define E8390_NODMA 0x20

Definition at line 85 of file ne2k.h.

## ◆ E8390_PAGE0

#define E8390_PAGE0 0x00

Definition at line 86 of file ne2k.h.

## ◆ E8390_PAGE1

#define E8390_PAGE1 0x40

Definition at line 87 of file ne2k.h.

## ◆ E8390_RREAD

#define E8390_RREAD 0x08

Definition at line 90 of file ne2k.h.

## ◆ E8390_RWRITE

#define E8390_RWRITE 0x10

Definition at line 91 of file ne2k.h.

## ◆ E8390_RXCONFIG

#define E8390_RXCONFIG 0x04

Definition at line 94 of file ne2k.h.

## ◆ E8390_RXOFF

#define E8390_RXOFF 0x20

Definition at line 92 of file ne2k.h.

## ◆ E8390_START

#define E8390_START 0x02

Definition at line 89 of file ne2k.h.

## ◆ E8390_STOP

#define E8390_STOP 0x01

Definition at line 84 of file ne2k.h.

## ◆ E8390_TXCONFIG

#define E8390_TXCONFIG 0x00

Definition at line 95 of file ne2k.h.

## ◆ E8390_TXOFF

#define E8390_TXOFF 0x00

Definition at line 93 of file ne2k.h.

## ◆ EN0_BOUNDARY

#define EN0_BOUNDARY 0x03

Definition at line 110 of file ne2k.h.

## ◆ EN0_COUNTER0

#define EN0_COUNTER0 0x0d

Definition at line 97 of file ne2k.h.

## ◆ EN0_DCFG

#define EN0_DCFG 0x0e

Definition at line 98 of file ne2k.h.

## ◆ EN0_IMR

#define EN0_IMR 0x0f

Definition at line 102 of file ne2k.h.

## ◆ EN0_ISR

#define EN0_ISR 0x07

Definition at line 101 of file ne2k.h.

## ◆ EN0_RCNTHI

#define EN0_RCNTHI 0x0b

Definition at line 100 of file ne2k.h.

## ◆ EN0_RCNTLO

#define EN0_RCNTLO 0x0a

Definition at line 99 of file ne2k.h.

## ◆ EN0_RSARHI

#define EN0_RSARHI 0x09

Definition at line 104 of file ne2k.h.

## ◆ EN0_RSARLO

#define EN0_RSARLO 0x08

Definition at line 103 of file ne2k.h.

## ◆ EN0_RXCR

#define EN0_RXCR 0x0c

Definition at line 106 of file ne2k.h.

## ◆ EN0_STARTPG

#define EN0_STARTPG 0x01

Definition at line 108 of file ne2k.h.

## ◆ EN0_STOPPG

#define EN0_STOPPG 0x02

Definition at line 109 of file ne2k.h.

## ◆ EN0_TPSR

#define EN0_TPSR 0x04

Definition at line 105 of file ne2k.h.

## ◆ EN0_TXCR

#define EN0_TXCR 0x0D

Definition at line 107 of file ne2k.h.

## ◆ EN1_CURPAG

#define EN1_CURPAG 0x07

Definition at line 113 of file ne2k.h.

## ◆ EN1_MULT

#define EN1_MULT 0x08

Definition at line 114 of file ne2k.h.

## ◆ EN1_PHYS

#define EN1_PHYS 0x01

Definition at line 112 of file ne2k.h.

## ◆ ENDCFG_WTS

#define ENDCFG_WTS 0x01

Definition at line 123 of file ne2k.h.

## ◆ ENISR_ALL

#define ENISR_ALL 0x3f

Definition at line 121 of file ne2k.h.

## ◆ ether_addr

#define ether_addr ether_addr_t

Definition at line 35 of file ne2k.h.

## ◆ NE1SM_START_PG

#define NE1SM_START_PG 0x20

Definition at line 116 of file ne2k.h.

## ◆ NE1SM_STOP_PG

#define NE1SM_STOP_PG 0x40

Definition at line 117 of file ne2k.h.

## ◆ NE_BNRY

#define NE_BNRY 0x03

Definition at line 64 of file ne2k.h.

## ◆ NE_CMD

#define NE_CMD 0x00

Definition at line 61 of file ne2k.h.

## ◆ NE_CURRENT

#define NE_CURRENT 0x07

Definition at line 67 of file ne2k.h.

## ◆ NE_DATAPORT

#define NE_DATAPORT 0x10

Definition at line 125 of file ne2k.h.

## ◆ NE_DCR

#define NE_DCR 0x0E

Definition at line 72 of file ne2k.h.

## ◆ NE_DCR_AR

#define NE_DCR_AR 0x10

Definition at line 78 of file ne2k.h.

## ◆ NE_DCR_FT0

#define NE_DCR_FT0 0x20

Definition at line 80 of file ne2k.h.

## ◆ NE_DCR_FT1

#define NE_DCR_FT1 0x40

Definition at line 79 of file ne2k.h.

## ◆ NE_DCR_LS

#define NE_DCR_LS 0x08

Definition at line 77 of file ne2k.h.

## ◆ NE_DCR_WTS

#define NE_DCR_WTS 0x01

Definition at line 76 of file ne2k.h.

## ◆ NE_IMR

#define NE_IMR 0x0F

Definition at line 73 of file ne2k.h.

## ◆ NE_ISR

#define NE_ISR 0x07

Definition at line 66 of file ne2k.h.

## ◆ NE_PSTART

#define NE_PSTART 0x01

Definition at line 62 of file ne2k.h.

## ◆ NE_PSTOP

#define NE_PSTOP 0x02

Definition at line 63 of file ne2k.h.

## ◆ NE_RBCR0

#define NE_RBCR0 0x0A

Definition at line 68 of file ne2k.h.

## ◆ NE_RBCR1

#define NE_RBCR1 0x0B

Definition at line 69 of file ne2k.h.

## ◆ NE_RCR

#define NE_RCR 0x0C

Definition at line 70 of file ne2k.h.

## ◆ NE_TCR

#define NE_TCR 0x0D

Definition at line 71 of file ne2k.h.

## ◆ NE_TPSR

#define NE_TPSR 0x04

Definition at line 65 of file ne2k.h.

## ◆ NESM_START_PG

#define NESM_START_PG 0x40

Definition at line 118 of file ne2k.h.

## ◆ NESM_STOP_PG

#define NESM_STOP_PG 0x80

Definition at line 119 of file ne2k.h.

## ◆ OK

#define OK 0

Definition at line 54 of file ne2k.h.

## ◆ RSR_FO

#define RSR_FO 0x08

Definition at line 50 of file ne2k.h.

## ◆ RSR_PRX

#define RSR_PRX 0x01

Definition at line 51 of file ne2k.h.

## ◆ startPage

#define startPage 0x4C

Definition at line 57 of file ne2k.h.

## ◆ stopPage

#define stopPage 0x80

Definition at line 58 of file ne2k.h.

## ◆ TX_1X_PAGES

#define TX_1X_PAGES 6

Definition at line 128 of file ne2k.h.

## ◆ TX_2X_PAGES

#define TX_2X_PAGES 12

Definition at line 127 of file ne2k.h.

## ◆ TX_PAGES

#define TX_PAGES (dev->priv->pingPong ? TX_2X_PAGES : TX_1X_PAGES)

Definition at line 129 of file ne2k.h.

## Typedef Documentation

## ◆ dp_rcvhdr_t

typedef struct dp_rcvhdr dp_rcvhdr_t

## ◆ ether_addr_t

typedef union etheraddr ether_addr_t

## Function Documentation

## ◆ ne2k_init()

int ne2k_init | ( |  | ) |

Definition at line 68 of file ne2k.c.

## ◆ ne2kAllocBuffer()

struct nicBuffer* ne2kAllocBuffer | ( | int |  | ) |

Definition at line 312 of file ne2k.c.

References spinLock(), and tmpBuf.

Here is the call graph for this function:

## ◆ ne2kDevInit()

int ne2kDevInit | ( | struct device * |  | ) |

## ◆ ne2kFreeBuffer()

void ne2kFreeBuffer | ( | struct nicBuffer * |  | ) |

Definition at line 353 of file ne2k.c.

References kfree().

Here is the call graph for this function:

## ◆ ne2kGetBuffer()

struct nicBuffer* ne2kGetBuffer | ( |  | ) |

Definition at line 341 of file ne2k.c.

References tmpBuf.

## ◆ ne2kHandler()

void ne2kHandler | ( |  | ) |

Definition at line 187 of file ne2k.c.

## ◆ ne2kISR()

void ne2kISR | ( |  | ) |

## ◆ ne2kProbe()

int ne2kProbe | ( | int | ,
|  | struct device * |
| ) |  |

## ◆ NICtoPC()

int NICtoPC | ( | struct device * | dev,
|  | void * | packet,
|  | int | length,
|  | int | nic_addr
| ) |  |

Definition at line 162 of file ne2k.c.

References assert, EN0_ISR, EN0_RCNTHI, EN0_RCNTLO, EN0_RSARHI, EN0_RSARLO, inportWord(), device::ioAddr, NE_DATAPORT, and outportByte().

Here is the call graph for this function:

## ◆ NS8390_init()

void NS8390_init | ( | struct device * | dev,
|  | int | startp
| ) |  |

## ◆ PCtoNIC()

int PCtoNIC | ( | struct device * | dev,
|  | void * | packet,
|  | int | length
| ) |  |

Definition at line 113 of file ne2k.c.

References assert, E8390_RWRITE, E8390_START, EN0_ISR, EN0_RCNTHI, EN0_RCNTLO, EN0_RSARHI, EN0_RSARLO, EN0_TPSR, inportByte(), device::ioAddr, kpanic(), NE_DATAPORT, outportByte(), outportByteP(), and outportWord().

Here is the call graph for this function:

## Variable Documentation

## ◆ nicPacket

char* nicPacket

## ◆ packetLength

uInt32 packetLength