UbixOS V2 2.0

ne2k.h
Go to the documentation of this file.
1 /*-
2 * Copyright (c) 2002-2018 The UbixOS Project.
3 * All rights reserved.
4 *
5 * This was developed by Christopher W. Olsen for the UbixOS Project.
6 *
7 * Redistribution and use in source and binary forms, with or without modification, are permitted
8 * provided that the following conditions are met:
9 *
10 * 1) Redistributions of source code must retain the above copyright notice, this list of
11 * conditions, the following disclaimer and the list of authors.
12 * 2) Redistributions in binary form must reproduce the above copyright notice, this list of
13 * conditions, the following disclaimer and the list of authors in the documentation and/or
14 * other materials provided with the distribution.
15 * 3) Neither the name of the UbixOS Project nor the names of its contributors may be used to
16 * endorse or promote products derived from this software without specific prior written
17 * permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
20 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
22 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
24 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 #ifndef _ISA_NE2K_H
30 #define _ISA_NE2K_H
31
32 #include <sys/types.h>
33 #include <sys/device.old.h>
34
35 #define ether_addr ether_addr_t
36 typedef struct dp_rcvhdr
37 {
38 uInt8 dr_status; /* Copy of rsr */
39 uInt8 dr_next; /* Pointer to next packet */
40 uInt8 dr_rbcl; /* Receive Byte Count Low */
41 uInt8 dr_rbch; /* Receive Byte Count High */
42 } dp_rcvhdr_t;
43
44 typedef union etheraddr {
45 unsigned char bytes[6]; /* byteorder safe initialization */
46 unsigned short shorts[3]; /* force 2-byte alignment */
47 } ether_addr;
48
49
50 #define RSR_FO 0x08
51 #define RSR_PRX 0x01
52 #define DEF_ENABLED 0x200
53
54 #define OK 0
55
56
57 #define startPage 0x4C
58 #define stopPage 0x80
59
60
61 #define NE_CMD 0x00
62 #define NE_PSTART 0x01
63 #define NE_PSTOP 0x02
64 #define NE_BNRY 0x03
65 #define NE_TPSR 0x04
66 #define NE_ISR 0x07
67 #define NE_CURRENT 0x07
68 #define NE_RBCR0 0x0A
69 #define NE_RBCR1 0x0B
70 #define NE_RCR 0x0C
71 #define NE_TCR 0x0D
72 #define NE_DCR 0x0E
73 #define NE_IMR 0x0F
74
75
76 #define NE_DCR_WTS 0x01
77 #define NE_DCR_LS 0x08
78 #define NE_DCR_AR 0x10
79 #define NE_DCR_FT1 0x40
80 #define NE_DCR_FT0 0x20
81
82
83
84 #define E8390_STOP 0x01
85 #define E8390_NODMA 0x20
86 #define E8390_PAGE0 0x00
87 #define E8390_PAGE1 0x40
88 #define E8390_CMD 0x00
89 #define E8390_START 0x02
90 #define E8390_RREAD 0x08
91 #define E8390_RWRITE 0x10
92 #define E8390_RXOFF 0x20
93 #define E8390_TXOFF 0x00
94 #define E8390_RXCONFIG 0x04
95 #define E8390_TXCONFIG 0x00
96
97 #define EN0_COUNTER0 0x0d
98 #define EN0_DCFG 0x0e
99 #define EN0_RCNTLO 0x0a
100 #define EN0_RCNTHI 0x0b
101 #define EN0_ISR 0x07
102 #define EN0_IMR 0x0f
103 #define EN0_RSARLO 0x08
104 #define EN0_RSARHI 0x09
105 #define EN0_TPSR 0x04
106 #define EN0_RXCR 0x0c
107 #define EN0_TXCR 0x0D
108 #define EN0_STARTPG 0x01
109 #define EN0_STOPPG 0x02
110 #define EN0_BOUNDARY 0x03
111
112 #define EN1_PHYS 0x01
113 #define EN1_CURPAG 0x07
114 #define EN1_MULT 0x08
115
116 #define NE1SM_START_PG 0x20
117 #define NE1SM_STOP_PG 0x40
118 #define NESM_START_PG 0x40
119 #define NESM_STOP_PG 0x80
120
121 #define ENISR_ALL 0x3f
122
123 #define ENDCFG_WTS 0x01
124
125 #define NE_DATAPORT 0x10
126
127 #define TX_2X_PAGES 12
128 #define TX_1X_PAGES 6
129 #define TX_PAGES (dev->priv->pingPong ? TX_2X_PAGES : TX_1X_PAGES)
130
131
132 #define DP_CURR 0x7 /* Current Page Register */
133 #define DP_MAR0 0x8 /* Multicast Address Register 0 */
134 #define DP_MAR1 0x9 /* Multicast Address Register 1 */
135 #define DP_MAR2 0xA /* Multicast Address Register 2 */
136 #define DP_MAR3 0xB /* Multicast Address Register 3 */
137 #define DP_MAR4 0xC /* Multicast Address Register 4 */
138 #define DP_MAR5 0xD /* Multicast Address Register 5 */
139 #define DP_MAR6 0xE /* Multicast Address Register 6 */
140 #define DP_MAR7 0xF /* Multicast Address Register 7 */
141
142 #define DP_CNTR0 0xD /* Tally Counter 0 */
143 #define DP_CNTR1 0xE /* Tally Counter 1 */
144 #define DP_CNTR2 0xF /* Tally Counter 2 */
145
146
147 #define DP_PAGESIZE 256
148
149 extern char *nicPacket;
150 extern uInt32 packetLength;
151
152
153 int ne2k_init();
154 int ne2kProbe(int,struct device *);
155 int ne2kDevInit(struct device *);
156 void NS8390_init(struct device *dev,int startp);
157
158 void ne2kISR();
159 void ne2kHandler();
160
161 int NICtoPC(struct device *dev,void *packet,int length,int nic_addr);
162 int PCtoNIC(struct device *dev,void *packet,int length);
163
164 struct nicBuffer *ne2kAllocBuffer(int);
165 struct nicBuffer *ne2kGetBuffer();
166 void ne2kFreeBuffer(struct nicBuffer *);
167
168 #endif
169
170 /***
171 $Log: ne2k.h,v $
172 Revision 1.1.1.1 2006/06/01 12:46:14 reddawg
173 ubix2
174
175 Revision 1.2 2005/10/12 00:13:36 reddawg
176 Removed
177
178 Revision 1.1.1.1 2005/09/26 17:23:39 reddawg
179 no message
180
181 Revision 1.6 2004/07/14 12:03:49 reddawg
182 ne2k: ne2kInit to ne2k_init
183 Changed Startup Routines
184
185 Revision 1.5 2004/05/21 14:57:16 reddawg
186 Cleaned up
187
188
189 END
190 ***/
PCtoNIC
int PCtoNIC(struct device *dev, void *packet, int length)
Definition: ne2k.c:113
dp_rcvhdr::dr_next
uInt8 dr_next
Definition: ne2k.h:39
uInt32
unsigned long int uInt32
Definition: objgfx30.h:49
etheraddr
Definition: ne2k.h:44
ne2k_init
int ne2k_init()
Definition: ne2k.c:68
device
Definition: device.old.h:34
ne2kProbe
int ne2kProbe(int, struct device *)
ne2kGetBuffer
struct nicBuffer * ne2kGetBuffer()
Definition: ne2k.c:341
types.h
etheraddr::shorts
unsigned short shorts[3]
Definition: ne2k.h:46
ne2kAllocBuffer
struct nicBuffer * ne2kAllocBuffer(int)
Definition: ne2k.c:312
dp_rcvhdr_t
struct dp_rcvhdr dp_rcvhdr_t
NS8390_init
void NS8390_init(struct device *dev, int startp)
dp_rcvhdr::dr_rbch
uInt8 dr_rbch
Definition: ne2k.h:41
device.old.h
nicBuffer
Definition: netif.h:52
NICtoPC
int NICtoPC(struct device *dev, void *packet, int length, int nic_addr)
Definition: ne2k.c:162
uInt8
unsigned char uInt8
Definition: objgfx30.h:47
dp_rcvhdr::dr_status
uInt8 dr_status
Definition: ne2k.h:38
ne2kDevInit
int ne2kDevInit(struct device *)
ne2kISR
void ne2kISR()
ne2kHandler
void ne2kHandler()
Definition: ne2k.c:187
dp_rcvhdr::dr_rbcl
uInt8 dr_rbcl
Definition: ne2k.h:40
ne2kFreeBuffer
void ne2kFreeBuffer(struct nicBuffer *)
Definition: ne2k.c:353
etheraddr::bytes
unsigned char bytes[6]
Definition: ne2k.h:45
packetLength
uInt32 packetLength
ether_addr
#define ether_addr
Definition: ne2k.h:35
dp_rcvhdr
Definition: ne2k.h:36
nicPacket
char * nicPacket