xref: /haiku/src/add-ons/kernel/drivers/network/ether/etherpci/etherpci_private.h (revision 268f99dd7dc4bd7474a8bd2742d3f1ec1de6752a)
1 /*
2 	Copyright 1999, Be Incorporated.   All Rights Reserved.
3 	This file may be used under the terms of the Be Sample Code License.
4 */
5 /*
6  * etherpci_private.h
7  * Copyright (c) 1998 Be, Inc.	All Rights Reserved
8  *
9  * Definitions private to ne2000 PCI ethernet driver
10  *
11  * Modification History (most recent first):
12  *
13  * 18 May 98	malyn	new today
14  */
15 
16 #ifndef _ETHERPCI_PRIVATE_H
17 #define _ETHERPCI_PRIVATE_H
18 
19 #ifndef _KERNEL_EXPORT_H
20 #include <KernelExport.h>
21 #endif
22 
23 /*
24  * Wait this long before giving up on an ethernet transmit
25  */
26 #define ETHER_TRANSMIT_TIMEOUT ((bigtime_t)1000000)	/* one second */
27 
28 #define NIRQS 128	//x hmm...
29 
30 #define MAX_MULTI 14
31 
32 #define ETHER_BUF_START_NE2000	0x4000
33 #define ETHER_BUF_SIZE_NE2000	0x4000
34 
35 #define ETHER_BUF_SIZE_MAX		ETHER_BUF_SIZE_NE2000
36 
37 #define ETHER_MTU 1500
38 #define ETHER_MIN_SIZE 60
39 #define ETHER_MAX_SIZE 1514
40 #define ETHER_IRQ2 0x10
41 #define ETHER_IRQ3 0x20
42 #define ETHER_IRQ4 0x40
43 #define ETHER_IRQ5 0x80
44 
45 
46 #define ECNTRL_RESET    0x01
47 #define ECNTRL_ONBOARD	0x02
48 #define ECNTRL_SAPROM   0x04
49 
50 #define EGACFR_NORM		0x49
51 #define EGACFR_IRQOFF	0xc9
52 
53 #define EC_PAGE_SIZE 256
54 #define EC_PAGE_SHIFT 8
55 
56 #define EN_CCMD	   0x0
57 
58 #define EN0_STARTPG	0x01
59 #define EN0_STOPPG	0x02
60 #define EN0_BOUNDARY 0x03
61 #define EN0_TPSR	0x04
62 #define EN0_TCNTLO	0x05
63 #define EN0_TCNTHI	0x06
64 #define EN0_ISR		0x07
65 #define EN0_RADDRLO	0x08
66 #define EN0_RADDRHI	0x09
67 #define EN0_RCNTLO	0x0a
68 #define EN0_RCNTHI	0x0b
69 
70 #define NE_DATA		0x10
71 #define NE_RESET	0x1f
72 
73 #define ISR_RECEIVE 0x01
74 #define ISR_TRANSMIT 0x02
75 #define ISR_RECEIVE_ERROR 0x04
76 #define ISR_TRANSMIT_ERROR 0x08
77 #define ISR_OVERWRITE   0x10
78 #define ISR_COUNTER	0x20
79 #define ISR_DMADONE 0x40
80 #define ISR_RESET   0x80
81 
82 #define EN0_RXCR	0xc
83 #define EN0_TXCR	0xd
84 #define EN0_DCFG	0xe
85 #define EN0_IMR		0xf
86 
87 #define EN0_CNTR0	0x0d
88 #define EN0_CNTR1	0x0e
89 #define EN0_CNTR2	0x0f
90 
91 #define DCFG_BM8	0x48
92 #define DCFG_BM16	0x49
93 
94 #define EN1_PHYS	0x1
95 #define EN1_CURPAG	0x7
96 #define EN1_MULT	0x8
97 
98 #define ENRXCR_MON	0x20
99 #define ENRXCR_MCST	0x08
100 #define ENRXCR_BCST	0x04
101 
102 #define TXCR_LOOPBACK	0x02
103 
104 #define ENC_PAGE0	0x00
105 #define ENC_STOP	0x01
106 #define ENC_START   0x02
107 #define ENC_TRANS	0x04
108 #define ENC_DMAREAD 0x08
109 #define ENC_DMAWRITE 0x10
110 #define ENC_NODMA	0x20
111 #define ENC_PAGE1	0x40
112 
113 
114 #define RSR_INTACT	0x01
115 
116 #define TSR_ABORTED		0x08
117 #define TSR_UNDERRUN	0x20
118 #define TSR_HEARTBEAT	0x40
119 
120 #define ETHER_ADDR_LEN 6
121 
122 /*
123  * Maximum iterations to poll before assuming error
124  */
125 #define MAXWAIT 10000
126 
127 
128 /*
129  * Swap the bytes in a short, but not on a little-endian machine
130  */
131 static const union { long l; char b[4]; } ENDIAN_TEST = { 1 };
132 #define LITTLE_ENDIAN ENDIAN_TEST.b[0]
133 #define SWAPSHORT(x) (((x & 0xff) << 8) | ((x >> 8) & 0xff))
134 #define swapshort(x) (LITTLE_ENDIAN ? (x) : SWAPSHORT(x))
135 
136 
137 /*
138  * NS8390 ring header structure
139  */
140 typedef struct ring_header	{
141 	unsigned char status;
142 	unsigned char next_packet;
143 	unsigned short count;
144 } ring_header;
145 
146 #endif
147