The Pedigree Project  0.1
Ne2kConstants.h
1 /*
2  * Copyright (c) 2008-2014, Pedigree Developers
3  *
4  * Please see the CONTRIB file in the root of the source tree for a full
5  * list of contributors.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #ifndef NE2K_CONSTANTS_H
21 #define NE2K_CONSTANTS_H
22 
23 enum Ne2kConstants
24 {
25  NE_CMD = 0x0,
26  NE_PSTART = 0x1, // write
27  NE_PSTOP = 0x2, // write
28  NE_BNDRY = 0x3,
29 
30  NE_TSR = 0x4, // read
31 
32  NE_TPSR = 0x4, // write
33  NE_TBCR0 = 0x5, // write
34  NE_TBCR1 = 0x6, // write
35 
36  NE_ISR = 0x7,
37 
38  NE_RSAR0 = 0x8, // write
39  NE_RSAR1 = 0x9, // write
40  NE_RBCR0 = 0xa, // write
41  NE_RBCR1 = 0xb, // write
42  NE_RCR = 0xc, // write
43  NE_TCR = 0xd, // write
44  NE_DCR = 0xe, // write
45 
46  NE_IMR = 0xf, // write
47 
48  NE_PAR = 0x1, // page 1, really 0x1 - 0x6
49  NE_CURR = 0x7, // page 1
50  NE_MAR = 0x8, // page 1, really 0x8 - 0xf
51 };
52 
53 #define MAR_SIZE 8
54 
55 #define PAGE_TX 0x40
56 #define PAGE_RX 0x50
57 #define PAGE_STOP 0x80
58 
59 #define NE_RESET 0x1f
60 #define NE_DATA 0x10
61 
62 // E8390 chip constants
63 #define E8390_TX_IRQ_MASK 0xa /* For register EN0_ISR */
64 #define E8390_RX_IRQ_MASK 0x5
65 #define E8390_RXCONFIG 0x4 /* EN0_RXCR: broadcasts, no multicast,errors */
66 #define E8390_RXOFF 0x20 /* EN0_RXCR: Accept no packets */
67 #define E8390_TXCONFIG 0x00 /* EN0_TXCR: Normal transmit mode */
68 #define E8390_TXOFF 0x02 /* EN0_TXCR: Transmitter off */
69 
70 // E8390 chip commands
71 #define E8390_STOP 0x01 /* Stop and reset the chip */
72 #define E8390_START 0x02 /* Start the chip, clear reset */
73 #define E8390_TRANS 0x04 /* Transmit a frame */
74 #define E8390_RREAD 0x08 /* Remote read */
75 #define E8390_RWRITE 0x10 /* Remote write */
76 #define E8390_NODMA 0x20 /* Remote DMA */
77 #define E8390_PAGE0 0x00 /* Select page chip registers */
78 #define E8390_PAGE1 0x40 /* using the two high-order bits */
79 #define E8390_PAGE2 0x80 /* Page 3 is invalid. */
80 
81 #endif