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
23enum Ne2kConstants {
24 NE_CMD = 0x0,
25 NE_PSTART = 0x1, // write
26 NE_PSTOP = 0x2, // write
27 NE_BNDRY = 0x3,
28
29 NE_TSR = 0x4, // read
30
31 NE_TPSR = 0x4, // write
32 NE_TBCR0 = 0x5, // write
33 NE_TBCR1 = 0x6, // write
34
35 NE_ISR = 0x7,
36
37 NE_RSAR0 = 0x8, // write
38 NE_RSAR1 = 0x9, // write
39 NE_RBCR0 = 0xa, // write
40 NE_RBCR1 = 0xb, // write
41 NE_RCR = 0xc, // write
42 NE_TCR = 0xd, // write
43 NE_DCR = 0xe, // write
44
45 NE_IMR = 0xf, // write
46
47 NE_PAR = 0x1, // page 1, really 0x1 - 0x6
48 NE_CURR = 0x7, // page 1
49 NE_MAR = 0x8, // page 1, really 0x8 - 0xf
50};
51
52#define MAR_SIZE 8
53
54#define PAGE_TX 0x40
55#define PAGE_RX 0x50
56#define PAGE_STOP 0x80
57
58#define NE_RESET 0x1f
59#define NE_DATA 0x10
60
61// E8390 chip constants
62#define E8390_TX_IRQ_MASK 0xa /* For register EN0_ISR */
63#define E8390_RX_IRQ_MASK 0x5
64#define E8390_RXCONFIG 0x4 /* EN0_RXCR: broadcasts, no multicast,errors */
65#define E8390_RXOFF 0x20 /* EN0_RXCR: Accept no packets */
66#define E8390_TXCONFIG 0x00 /* EN0_TXCR: Normal transmit mode */
67#define E8390_TXOFF 0x02 /* EN0_TXCR: Transmitter off */
68
69// E8390 chip commands
70#define E8390_STOP 0x01 /* Stop and reset the chip */
71#define E8390_START 0x02 /* Start the chip, clear reset */
72#define E8390_TRANS 0x04 /* Transmit a frame */
73#define E8390_RREAD 0x08 /* Remote read */
74#define E8390_RWRITE 0x10 /* Remote write */
75#define E8390_NODMA 0x20 /* Remote DMA */
76#define E8390_PAGE0 0x00 /* Select page chip registers */
77#define E8390_PAGE1 0x40 /* using the two high-order bits */
78#define E8390_PAGE2 0x80 /* Page 3 is invalid. */
79
80#endif