Subversion Repositories HelenOS

Rev

Rev 4163 | Rev 4261 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4163 Rev 4192
1
/*
1
/*
2
 * Copyright (c) 1987,1997, 2006, Vrije Universiteit, Amsterdam, The Netherlands All rights reserved. Redistribution and use of the MINIX 3 operating system in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
2
 * Copyright (c) 1987,1997, 2006, Vrije Universiteit, Amsterdam, The Netherlands All rights reserved. Redistribution and use of the MINIX 3 operating system in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
3
 *
3
 *
4
 * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
4
 * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
5
 * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
5
 * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
6
 * * Neither the name of the Vrije Universiteit nor the names of the software authors or contributors may be used to endorse or promote products derived from this software without specific prior written permission.
6
 * * Neither the name of the Vrije Universiteit nor the names of the software authors or contributors may be used to endorse or promote products derived from this software without specific prior written permission.
7
 * * Any deviations from these conditions require written permission from the copyright holder in advance
7
 * * Any deviations from these conditions require written permission from the copyright holder in advance
8
 *
8
 *
9
 *
9
 *
10
 * Disclaimer
10
 * Disclaimer
11
 *
11
 *
12
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS, AUTHORS, AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
12
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS, AUTHORS, AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR
13
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
13
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
14
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
14
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
15
 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ANY AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
15
 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ANY AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
16
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
17
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
18
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
18
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
19
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
20
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22
 *
22
 *
23
 * Changes:
23
 * Changes:
24
 *  2009 Lukas Medjrech ported to HelenOS
24
 *  2009 Lukas Medjrech ported to HelenOS
25
 */
25
 */
26
 
26
 
27
/** @addtogroup dp8390
27
/** @addtogroup dp8390
28
 *  @{
28
 *  @{
29
 */
29
 */
30
 
30
 
31
/**
31
/**
32
 * @file
32
 * @file
33
 */
33
 */
34
 
34
 
35
#ifndef __NET_NETIF_DP8390_H__
35
#ifndef __NET_NETIF_DP8390_H__
36
#define __NET_NETIF_DP8390_H__
36
#define __NET_NETIF_DP8390_H__
37
 
37
 
-
 
38
#include "../../structures/packet/packet.h"
-
 
39
 
38
#include "dp8390_port.h"
40
#include "dp8390_port.h"
39
#include "local.h"
41
#include "local.h"
40
 
42
 
41
/*
43
/*
42
dp8390.h
44
dp8390.h
43
 
45
 
44
Created:    before Dec 28, 1992 by Philip Homburg
46
Created:    before Dec 28, 1992 by Philip Homburg
45
*/
47
*/
46
 
48
 
47
/* National Semiconductor DP8390 Network Interface Controller. */
49
/* National Semiconductor DP8390 Network Interface Controller. */
48
 
50
 
49
                /* Page 0, for reading ------------- */
51
                /* Page 0, for reading ------------- */
50
#define DP_CR       0x0 /* Read side of Command Register     */
52
#define DP_CR       0x0 /* Read side of Command Register     */
51
#define DP_CLDA0    0x1 /* Current Local Dma Address 0       */
53
#define DP_CLDA0    0x1 /* Current Local Dma Address 0       */
52
#define DP_CLDA1    0x2 /* Current Local Dma Address 1       */
54
#define DP_CLDA1    0x2 /* Current Local Dma Address 1       */
53
#define DP_BNRY     0x3 /* Boundary Pointer                  */
55
#define DP_BNRY     0x3 /* Boundary Pointer                  */
54
#define DP_TSR      0x4 /* Transmit Status Register          */
56
#define DP_TSR      0x4 /* Transmit Status Register          */
55
#define DP_NCR      0x5 /* Number of Collisions Register     */
57
#define DP_NCR      0x5 /* Number of Collisions Register     */
56
#define DP_FIFO     0x6 /* Fifo ??                           */
58
#define DP_FIFO     0x6 /* Fifo ??                           */
57
#define DP_ISR      0x7 /* Interrupt Status Register         */
59
#define DP_ISR      0x7 /* Interrupt Status Register         */
58
#define DP_CRDA0    0x8 /* Current Remote Dma Address 0      */
60
#define DP_CRDA0    0x8 /* Current Remote Dma Address 0      */
59
#define DP_CRDA1    0x9 /* Current Remote Dma Address 1      */
61
#define DP_CRDA1    0x9 /* Current Remote Dma Address 1      */
60
#define DP_DUM1     0xA /* unused                            */
62
#define DP_DUM1     0xA /* unused                            */
61
#define DP_DUM2     0xB /* unused                            */
63
#define DP_DUM2     0xB /* unused                            */
62
#define DP_RSR      0xC /* Receive Status Register           */
64
#define DP_RSR      0xC /* Receive Status Register           */
63
#define DP_CNTR0    0xD /* Tally Counter 0                   */
65
#define DP_CNTR0    0xD /* Tally Counter 0                   */
64
#define DP_CNTR1    0xE /* Tally Counter 1                   */
66
#define DP_CNTR1    0xE /* Tally Counter 1                   */
65
#define DP_CNTR2    0xF /* Tally Counter 2                   */
67
#define DP_CNTR2    0xF /* Tally Counter 2                   */
66
 
68
 
67
                /* Page 0, for writing ------------- */
69
                /* Page 0, for writing ------------- */
68
#define DP_CR       0x0 /* Write side of Command Register    */
70
#define DP_CR       0x0 /* Write side of Command Register    */
69
#define DP_PSTART   0x1 /* Page Start Register               */
71
#define DP_PSTART   0x1 /* Page Start Register               */
70
#define DP_PSTOP    0x2 /* Page Stop Register                */
72
#define DP_PSTOP    0x2 /* Page Stop Register                */
71
#define DP_BNRY     0x3 /* Boundary Pointer                  */
73
#define DP_BNRY     0x3 /* Boundary Pointer                  */
72
#define DP_TPSR     0x4 /* Transmit Page Start Register      */
74
#define DP_TPSR     0x4 /* Transmit Page Start Register      */
73
#define DP_TBCR0    0x5 /* Transmit Byte Count Register 0    */
75
#define DP_TBCR0    0x5 /* Transmit Byte Count Register 0    */
74
#define DP_TBCR1    0x6 /* Transmit Byte Count Register 1    */
76
#define DP_TBCR1    0x6 /* Transmit Byte Count Register 1    */
75
#define DP_ISR      0x7 /* Interrupt Status Register         */
77
#define DP_ISR      0x7 /* Interrupt Status Register         */
76
#define DP_RSAR0    0x8 /* Remote Start Address Register 0   */
78
#define DP_RSAR0    0x8 /* Remote Start Address Register 0   */
77
#define DP_RSAR1    0x9 /* Remote Start Address Register 1   */
79
#define DP_RSAR1    0x9 /* Remote Start Address Register 1   */
78
#define DP_RBCR0    0xA /* Remote Byte Count Register 0      */
80
#define DP_RBCR0    0xA /* Remote Byte Count Register 0      */
79
#define DP_RBCR1    0xB /* Remote Byte Count Register 1      */
81
#define DP_RBCR1    0xB /* Remote Byte Count Register 1      */
80
#define DP_RCR      0xC /* Receive Configuration Register    */
82
#define DP_RCR      0xC /* Receive Configuration Register    */
81
#define DP_TCR      0xD /* Transmit Configuration Register   */
83
#define DP_TCR      0xD /* Transmit Configuration Register   */
82
#define DP_DCR      0xE /* Data Configuration Register       */
84
#define DP_DCR      0xE /* Data Configuration Register       */
83
#define DP_IMR      0xF /* Interrupt Mask Register           */
85
#define DP_IMR      0xF /* Interrupt Mask Register           */
84
 
86
 
85
                /* Page 1, read/write -------------- */
87
                /* Page 1, read/write -------------- */
86
#define DP_CR       0x0 /* Command Register                  */
88
#define DP_CR       0x0 /* Command Register                  */
87
#define DP_PAR0     0x1 /* Physical Address Register 0       */
89
#define DP_PAR0     0x1 /* Physical Address Register 0       */
88
#define DP_PAR1     0x2 /* Physical Address Register 1       */
90
#define DP_PAR1     0x2 /* Physical Address Register 1       */
89
#define DP_PAR2     0x3 /* Physical Address Register 2       */
91
#define DP_PAR2     0x3 /* Physical Address Register 2       */
90
#define DP_PAR3     0x4 /* Physical Address Register 3       */
92
#define DP_PAR3     0x4 /* Physical Address Register 3       */
91
#define DP_PAR4     0x5 /* Physical Address Register 4       */
93
#define DP_PAR4     0x5 /* Physical Address Register 4       */
92
#define DP_PAR5     0x6 /* Physical Address Register 5       */
94
#define DP_PAR5     0x6 /* Physical Address Register 5       */
93
#define DP_CURR     0x7 /* Current Page Register             */
95
#define DP_CURR     0x7 /* Current Page Register             */
94
#define DP_MAR0     0x8 /* Multicast Address Register 0      */
96
#define DP_MAR0     0x8 /* Multicast Address Register 0      */
95
#define DP_MAR1     0x9 /* Multicast Address Register 1      */
97
#define DP_MAR1     0x9 /* Multicast Address Register 1      */
96
#define DP_MAR2     0xA /* Multicast Address Register 2      */
98
#define DP_MAR2     0xA /* Multicast Address Register 2      */
97
#define DP_MAR3     0xB /* Multicast Address Register 3      */
99
#define DP_MAR3     0xB /* Multicast Address Register 3      */
98
#define DP_MAR4     0xC /* Multicast Address Register 4      */
100
#define DP_MAR4     0xC /* Multicast Address Register 4      */
99
#define DP_MAR5     0xD /* Multicast Address Register 5      */
101
#define DP_MAR5     0xD /* Multicast Address Register 5      */
100
#define DP_MAR6     0xE /* Multicast Address Register 6      */
102
#define DP_MAR6     0xE /* Multicast Address Register 6      */
101
#define DP_MAR7     0xF /* Multicast Address Register 7      */
103
#define DP_MAR7     0xF /* Multicast Address Register 7      */
102
 
104
 
103
/* Bits in dp_cr */
105
/* Bits in dp_cr */
104
#define CR_STP      0x01    /* Stop: software reset              */
106
#define CR_STP      0x01    /* Stop: software reset              */
105
#define CR_STA      0x02    /* Start: activate NIC               */
107
#define CR_STA      0x02    /* Start: activate NIC               */
106
#define CR_TXP      0x04    /* Transmit Packet                   */
108
#define CR_TXP      0x04    /* Transmit Packet                   */
107
#define CR_DMA      0x38    /* Mask for DMA control              */
109
#define CR_DMA      0x38    /* Mask for DMA control              */
108
#define CR_DM_NOP   0x00    /* DMA: No Operation                 */
110
#define CR_DM_NOP   0x00    /* DMA: No Operation                 */
109
#define CR_DM_RR    0x08    /* DMA: Remote Read                  */
111
#define CR_DM_RR    0x08    /* DMA: Remote Read                  */
110
#define CR_DM_RW    0x10    /* DMA: Remote Write                 */
112
#define CR_DM_RW    0x10    /* DMA: Remote Write                 */
111
#define CR_DM_SP    0x18    /* DMA: Send Packet                  */
113
#define CR_DM_SP    0x18    /* DMA: Send Packet                  */
112
#define CR_DM_ABORT 0x20    /* DMA: Abort Remote DMA Operation   */
114
#define CR_DM_ABORT 0x20    /* DMA: Abort Remote DMA Operation   */
113
#define CR_PS       0xC0    /* Mask for Page Select              */
115
#define CR_PS       0xC0    /* Mask for Page Select              */
114
#define CR_PS_P0    0x00    /* Register Page 0                   */
116
#define CR_PS_P0    0x00    /* Register Page 0                   */
115
#define CR_PS_P1    0x40    /* Register Page 1                   */
117
#define CR_PS_P1    0x40    /* Register Page 1                   */
116
#define CR_PS_P2    0x80    /* Register Page 2                   */
118
#define CR_PS_P2    0x80    /* Register Page 2                   */
117
#define CR_PS_T1    0xC0    /* Test Mode Register Map            */
119
#define CR_PS_T1    0xC0    /* Test Mode Register Map            */
118
 
120
 
119
/* Bits in dp_isr */
121
/* Bits in dp_isr */
120
#define ISR_PRX     0x01    /* Packet Received with no errors    */
122
#define ISR_PRX     0x01    /* Packet Received with no errors    */
121
#define ISR_PTX     0x02    /* Packet Transmitted with no errors */
123
#define ISR_PTX     0x02    /* Packet Transmitted with no errors */
122
#define ISR_RXE     0x04    /* Receive Error                     */
124
#define ISR_RXE     0x04    /* Receive Error                     */
123
#define ISR_TXE     0x08    /* Transmit Error                    */
125
#define ISR_TXE     0x08    /* Transmit Error                    */
124
#define ISR_OVW     0x10    /* Overwrite Warning                 */
126
#define ISR_OVW     0x10    /* Overwrite Warning                 */
125
#define ISR_CNT     0x20    /* Counter Overflow                  */
127
#define ISR_CNT     0x20    /* Counter Overflow                  */
126
#define ISR_RDC     0x40    /* Remote DMA Complete               */
128
#define ISR_RDC     0x40    /* Remote DMA Complete               */
127
#define ISR_RST     0x80    /* Reset Status                      */
129
#define ISR_RST     0x80    /* Reset Status                      */
128
 
130
 
129
/* Bits in dp_imr */
131
/* Bits in dp_imr */
130
#define IMR_PRXE    0x01    /* Packet Received iEnable           */
132
#define IMR_PRXE    0x01    /* Packet Received iEnable           */
131
#define IMR_PTXE    0x02    /* Packet Transmitted iEnable        */
133
#define IMR_PTXE    0x02    /* Packet Transmitted iEnable        */
132
#define IMR_RXEE    0x04    /* Receive Error iEnable             */
134
#define IMR_RXEE    0x04    /* Receive Error iEnable             */
133
#define IMR_TXEE    0x08    /* Transmit Error iEnable            */
135
#define IMR_TXEE    0x08    /* Transmit Error iEnable            */
134
#define IMR_OVWE    0x10    /* Overwrite Warning iEnable         */
136
#define IMR_OVWE    0x10    /* Overwrite Warning iEnable         */
135
#define IMR_CNTE    0x20    /* Counter Overflow iEnable          */
137
#define IMR_CNTE    0x20    /* Counter Overflow iEnable          */
136
#define IMR_RDCE    0x40    /* DMA Complete iEnable              */
138
#define IMR_RDCE    0x40    /* DMA Complete iEnable              */
137
 
139
 
138
/* Bits in dp_dcr */
140
/* Bits in dp_dcr */
139
#define DCR_WTS     0x01    /* Word Transfer Select              */
141
#define DCR_WTS     0x01    /* Word Transfer Select              */
140
#define DCR_BYTEWIDE    0x00    /* WTS: byte wide transfers          */
142
#define DCR_BYTEWIDE    0x00    /* WTS: byte wide transfers          */
141
#define DCR_WORDWIDE    0x01    /* WTS: word wide transfers          */
143
#define DCR_WORDWIDE    0x01    /* WTS: word wide transfers          */
142
#define DCR_BOS     0x02    /* Byte Order Select                 */
144
#define DCR_BOS     0x02    /* Byte Order Select                 */
143
#define DCR_LTLENDIAN   0x00    /* BOS: Little Endian                */
145
#define DCR_LTLENDIAN   0x00    /* BOS: Little Endian                */
144
#define DCR_BIGENDIAN   0x02    /* BOS: Big Endian                   */
146
#define DCR_BIGENDIAN   0x02    /* BOS: Big Endian                   */
145
#define DCR_LAS     0x04    /* Long Address Select               */
147
#define DCR_LAS     0x04    /* Long Address Select               */
146
#define DCR_BMS     0x08    /* Burst Mode Select
148
#define DCR_BMS     0x08    /* Burst Mode Select
147
                 * Called Loopback Select (LS) in
149
                 * Called Loopback Select (LS) in
148
                 * later manuals. Should be set.     */
150
                 * later manuals. Should be set.     */
149
#define DCR_AR      0x10    /* Autoinitialize Remote             */
151
#define DCR_AR      0x10    /* Autoinitialize Remote             */
150
#define DCR_FTS     0x60    /* Fifo Threshold Select             */
152
#define DCR_FTS     0x60    /* Fifo Threshold Select             */
151
#define DCR_2BYTES  0x00    /* 2 bytes                           */
153
#define DCR_2BYTES  0x00    /* 2 bytes                           */
152
#define DCR_4BYTES  0x40    /* 4 bytes                           */
154
#define DCR_4BYTES  0x40    /* 4 bytes                           */
153
#define DCR_8BYTES  0x20    /* 8 bytes                           */
155
#define DCR_8BYTES  0x20    /* 8 bytes                           */
154
#define DCR_12BYTES 0x60    /* 12 bytes                          */
156
#define DCR_12BYTES 0x60    /* 12 bytes                          */
155
 
157
 
156
/* Bits in dp_tcr */
158
/* Bits in dp_tcr */
157
#define TCR_CRC     0x01    /* Inhibit CRC                       */
159
#define TCR_CRC     0x01    /* Inhibit CRC                       */
158
#define TCR_ELC     0x06    /* Encoded Loopback Control          */
160
#define TCR_ELC     0x06    /* Encoded Loopback Control          */
159
#define TCR_NORMAL  0x00    /* ELC: Normal Operation             */
161
#define TCR_NORMAL  0x00    /* ELC: Normal Operation             */
160
#define TCR_INTERNAL    0x02    /* ELC: Internal Loopback            */
162
#define TCR_INTERNAL    0x02    /* ELC: Internal Loopback            */
161
#define TCR_0EXTERNAL   0x04    /* ELC: External Loopback LPBK=0     */
163
#define TCR_0EXTERNAL   0x04    /* ELC: External Loopback LPBK=0     */
162
#define TCR_1EXTERNAL   0x06    /* ELC: External Loopback LPBK=1     */
164
#define TCR_1EXTERNAL   0x06    /* ELC: External Loopback LPBK=1     */
163
#define TCR_ATD     0x08    /* Auto Transmit Disable             */
165
#define TCR_ATD     0x08    /* Auto Transmit Disable             */
164
#define TCR_OFST    0x10    /* Collision Offset Enable (be nice) */
166
#define TCR_OFST    0x10    /* Collision Offset Enable (be nice) */
165
 
167
 
166
/* Bits in dp_tsr */
168
/* Bits in dp_tsr */
167
#define TSR_PTX     0x01    /* Packet Transmitted (without error)*/
169
#define TSR_PTX     0x01    /* Packet Transmitted (without error)*/
168
#define TSR_DFR     0x02    /* Transmit Deferred, reserved in
170
#define TSR_DFR     0x02    /* Transmit Deferred, reserved in
169
                 * later manuals.            */
171
                 * later manuals.            */
170
#define TSR_COL     0x04    /* Transmit Collided                 */
172
#define TSR_COL     0x04    /* Transmit Collided                 */
171
#define TSR_ABT     0x08    /* Transmit Aborted                  */
173
#define TSR_ABT     0x08    /* Transmit Aborted                  */
172
#define TSR_CRS     0x10    /* Carrier Sense Lost                */
174
#define TSR_CRS     0x10    /* Carrier Sense Lost                */
173
#define TSR_FU      0x20    /* FIFO Underrun                     */
175
#define TSR_FU      0x20    /* FIFO Underrun                     */
174
#define TSR_CDH     0x40    /* CD Heartbeat                      */
176
#define TSR_CDH     0x40    /* CD Heartbeat                      */
175
#define TSR_OWC     0x80    /* Out of Window Collision           */
177
#define TSR_OWC     0x80    /* Out of Window Collision           */
176
 
178
 
177
/* Bits in tp_rcr */
179
/* Bits in tp_rcr */
178
#define RCR_SEP     0x01    /* Save Errored Packets              */
180
#define RCR_SEP     0x01    /* Save Errored Packets              */
179
#define RCR_AR      0x02    /* Accept Runt Packets               */
181
#define RCR_AR      0x02    /* Accept Runt Packets               */
180
#define RCR_AB      0x04    /* Accept Broadcast                  */
182
#define RCR_AB      0x04    /* Accept Broadcast                  */
181
#define RCR_AM      0x08    /* Accept Multicast                  */
183
#define RCR_AM      0x08    /* Accept Multicast                  */
182
#define RCR_PRO     0x10    /* Physical Promiscuous              */
184
#define RCR_PRO     0x10    /* Physical Promiscuous              */
183
#define RCR_MON     0x20    /* Monitor Mode                      */
185
#define RCR_MON     0x20    /* Monitor Mode                      */
184
 
186
 
185
/* Bits in dp_rsr */
187
/* Bits in dp_rsr */
186
#define RSR_PRX     0x01    /* Packet Received Intact            */
188
#define RSR_PRX     0x01    /* Packet Received Intact            */
187
#define RSR_CRC     0x02    /* CRC Error                         */
189
#define RSR_CRC     0x02    /* CRC Error                         */
188
#define RSR_FAE     0x04    /* Frame Alignment Error             */
190
#define RSR_FAE     0x04    /* Frame Alignment Error             */
189
#define RSR_FO      0x08    /* FIFO Overrun                      */
191
#define RSR_FO      0x08    /* FIFO Overrun                      */
190
#define RSR_MPA     0x10    /* Missed Packet                     */
192
#define RSR_MPA     0x10    /* Missed Packet                     */
191
#define RSR_PHY     0x20    /* Multicast Address Match           */
193
#define RSR_PHY     0x20    /* Multicast Address Match           */
192
#define RSR_DIS     0x40    /* Receiver Disabled                 */
194
#define RSR_DIS     0x40    /* Receiver Disabled                 */
193
#define RSR_DFR     0x80    /* In later manuals: Deferring       */
195
#define RSR_DFR     0x80    /* In later manuals: Deferring       */
194
 
196
 
195
 
197
 
196
typedef struct dp_rcvhdr
198
typedef struct dp_rcvhdr
197
{
199
{
198
    u8_t dr_status;         /* Copy of rsr                       */
200
    u8_t dr_status;         /* Copy of rsr                       */
199
    u8_t dr_next;           /* Pointer to next packet            */
201
    u8_t dr_next;           /* Pointer to next packet            */
200
    u8_t dr_rbcl;           /* Receive Byte Count Low            */
202
    u8_t dr_rbcl;           /* Receive Byte Count Low            */
201
    u8_t dr_rbch;           /* Receive Byte Count High           */
203
    u8_t dr_rbch;           /* Receive Byte Count High           */
202
} dp_rcvhdr_t;
204
} dp_rcvhdr_t;
203
 
205
 
204
#define DP_PAGESIZE 256
206
#define DP_PAGESIZE 256
205
 
207
 
206
/* Some macros to simplify accessing the dp8390 */
208
/* Some macros to simplify accessing the dp8390 */
207
#define inb_reg0(dep, reg)      (inb(dep->de_dp8390_port+reg))
209
#define inb_reg0(dep, reg)      (inb(dep->de_dp8390_port+reg))
208
#define outb_reg0(dep, reg, data)   (outb(dep->de_dp8390_port+reg, data))
210
#define outb_reg0(dep, reg, data)   (outb(dep->de_dp8390_port+reg, data))
209
#define inb_reg1(dep, reg)      (inb(dep->de_dp8390_port+reg))
211
#define inb_reg1(dep, reg)      (inb(dep->de_dp8390_port+reg))
210
#define outb_reg1(dep, reg, data)   (outb(dep->de_dp8390_port+reg, data))
212
#define outb_reg1(dep, reg, data)   (outb(dep->de_dp8390_port+reg, data))
211
 
213
 
212
/* Software interface to the dp8390 driver */
214
/* Software interface to the dp8390 driver */
213
 
215
 
214
struct dpeth;
216
struct dpeth;
215
struct iovec_dat;
217
struct iovec_dat;
216
//struct iovec_dat_s;
218
//struct iovec_dat_s;
217
_PROTOTYPE( typedef void (*dp_initf_t), (struct dpeth *dep)     );
219
_PROTOTYPE( typedef void (*dp_initf_t), (struct dpeth *dep)     );
218
_PROTOTYPE( typedef void (*dp_stopf_t), (struct dpeth *dep)     );
220
_PROTOTYPE( typedef void (*dp_stopf_t), (struct dpeth *dep)     );
219
//_PROTOTYPE( typedef void (*dp_user2nicf_t), (struct dpeth *dep,
221
_PROTOTYPE( typedef void (*dp_user2nicf_t), (struct dpeth *dep,
220
//          struct iovec_dat *iovp, vir_bytes offset,
222
            struct iovec_dat *iovp, vir_bytes offset,
221
//          int nic_addr, vir_bytes count)          );
223
            int nic_addr, vir_bytes count)          );
222
//_PROTOTYPE( typedef void (*dp_user2nicf_s_t), (struct dpeth *dep,
224
//_PROTOTYPE( typedef void (*dp_user2nicf_s_t), (struct dpeth *dep,
223
//          struct iovec_dat_s *iovp, vir_bytes offset,
225
//          struct iovec_dat_s *iovp, vir_bytes offset,
224
//          int nic_addr, vir_bytes count)          );
226
//          int nic_addr, vir_bytes count)          );
225
_PROTOTYPE( typedef void (*dp_nic2userf_t), (struct dpeth *dep,
227
_PROTOTYPE( typedef void (*dp_nic2userf_t), (struct dpeth *dep,
226
            int nic_addr, struct iovec_dat *iovp,
228
            int nic_addr, struct iovec_dat *iovp,
227
            vir_bytes offset, vir_bytes count)      );
229
            vir_bytes offset, vir_bytes count)      );
228
//_PROTOTYPE( typedef void (*dp_nic2userf_s_t), (struct dpeth *dep,
230
//_PROTOTYPE( typedef void (*dp_nic2userf_s_t), (struct dpeth *dep,
229
//          int nic_addr, struct iovec_dat_s *iovp,
231
//          int nic_addr, struct iovec_dat_s *iovp,
230
//          vir_bytes offset, vir_bytes count)      );
232
//          vir_bytes offset, vir_bytes count)      );
231
//#if 0
233
//#if 0
232
//_PROTOTYPE( typedef void (*dp_getheaderf_t), (struct dpeth *dep,
234
//_PROTOTYPE( typedef void (*dp_getheaderf_t), (struct dpeth *dep,
233
//          int page, struct dp_rcvhdr *h, u16_t *eth_type) );
235
//          int page, struct dp_rcvhdr *h, u16_t *eth_type) );
234
//#endif
236
//#endif
235
_PROTOTYPE( typedef void (*dp_getblock_t), (struct dpeth *dep,
237
_PROTOTYPE( typedef void (*dp_getblock_t), (struct dpeth *dep,
236
        int page, size_t offset, size_t size, void *dst)    );
238
        int page, size_t offset, size_t size, void *dst)    );
237
 
239
 
238
/* iovectors are handled IOVEC_NR entries at a time. */
240
/* iovectors are handled IOVEC_NR entries at a time. */
-
 
241
//#define IOVEC_NR  16
-
 
242
// no vectors allowed
239
#define IOVEC_NR    16
243
#define IOVEC_NR    1
240
 
244
 
241
/*
245
/*
242
typedef int irq_hook_t;
246
typedef int irq_hook_t;
243
*/
247
*/
244
typedef struct iovec_dat
248
typedef struct iovec_dat
245
{
249
{
246
  iovec_t iod_iovec[IOVEC_NR];
250
  iovec_t iod_iovec[IOVEC_NR];
247
  int iod_iovec_s;
251
  int iod_iovec_s;
-
 
252
  // no direct process access
248
  int iod_proc_nr;
253
  int iod_proc_nr;
249
  vir_bytes iod_iovec_addr;
254
  vir_bytes iod_iovec_addr;
250
} iovec_dat_t;
255
} iovec_dat_t;
251
/*
256
/*
252
typedef struct iovec_dat_s
257
typedef struct iovec_dat_s
253
{
258
{
254
  iovec_s_t iod_iovec[IOVEC_NR];
259
  iovec_s_t iod_iovec[IOVEC_NR];
255
  int iod_iovec_s;
260
  int iod_iovec_s;
256
  int iod_proc_nr;
261
  int iod_proc_nr;
257
  cp_grant_id_t iod_grant;
262
  cp_grant_id_t iod_grant;
258
  vir_bytes iod_iovec_offset;
263
  vir_bytes iod_iovec_offset;
259
} iovec_dat_s_t;
264
} iovec_dat_s_t;
260
*/
265
*/
261
#define SENDQ_NR    2   /* Maximum size of the send queue */
266
#define SENDQ_NR    2   /* Maximum size of the send queue */
262
#define SENDQ_PAGES 6   /* 6 * DP_PAGESIZE >= 1514 bytes */
267
#define SENDQ_PAGES 6   /* 6 * DP_PAGESIZE >= 1514 bytes */
263
 
268
 
264
typedef struct dpeth
269
typedef struct dpeth
265
{
270
{
-
 
271
    /* Parent device structure.
-
 
272
     */
-
 
273
    void *      parent;
-
 
274
    /* Packet send queue.
-
 
275
    */
-
 
276
    packet_t    packet_queue;
-
 
277
    int         packet_count;
-
 
278
 
266
    /* The de_base_port field is the starting point of the probe.
279
    /* The de_base_port field is the starting point of the probe.
267
     * The conf routine also fills de_linmem and de_irq. If the probe
280
     * The conf routine also fills de_linmem and de_irq. If the probe
268
     * routine knows the irq and/or memory address because they are
281
     * routine knows the irq and/or memory address because they are
269
     * hardwired in the board, the probe should modify these fields.
282
     * hardwired in the board, the probe should modify these fields.
270
     * Futhermore, the probe routine should also fill in de_initf and
283
     * Futhermore, the probe routine should also fill in de_initf and
271
     * de_stopf fields with the appropriate function pointers and set
284
     * de_stopf fields with the appropriate function pointers and set
272
     * de_prog_IO iff programmed I/O is to be used.
285
     * de_prog_IO iff programmed I/O is to be used.
273
     */
286
     */
274
    port_t de_base_port;
287
    port_t de_base_port;
275
    phys_bytes de_linmem;
288
    phys_bytes de_linmem;
276
    char *de_locmem;
289
    char *de_locmem;
277
    int de_irq;
290
    int de_irq;
278
    int de_int_pending;
291
    int de_int_pending;
279
//  irq_hook_t de_hook;
292
//  irq_hook_t de_hook;
280
    dp_initf_t de_initf;
293
    dp_initf_t de_initf;
281
    dp_stopf_t de_stopf;
294
    dp_stopf_t de_stopf;
282
    int de_prog_IO;
295
    int de_prog_IO;
283
    char de_name[sizeof("dp8390#n")];
296
    char de_name[sizeof("dp8390#n")];
284
 
297
 
285
    /* The initf function fills the following fields. Only cards that do
298
    /* The initf function fills the following fields. Only cards that do
286
     * programmed I/O fill in the de_pata_port field.
299
     * programmed I/O fill in the de_pata_port field.
287
     * In addition, the init routine has to fill in the sendq data
300
     * In addition, the init routine has to fill in the sendq data
288
     * structures.
301
     * structures.
289
     */
302
     */
290
    ether_addr_t de_address;
303
    ether_addr_t de_address;
291
    port_t de_dp8390_port;
304
    port_t de_dp8390_port;
292
    port_t de_data_port;
305
    port_t de_data_port;
293
    int de_16bit;
306
    int de_16bit;
294
    int de_ramsize;
307
    int de_ramsize;
295
    int de_offset_page;
308
    int de_offset_page;
296
    int de_startpage;
309
    int de_startpage;
297
    int de_stoppage;
310
    int de_stoppage;
298
 
311
 
299
    /* should be here - read even for ne2k isa init... */
312
    /* should be here - read even for ne2k isa init... */
300
    char de_pci;            /* TRUE iff PCI device */
313
    char de_pci;            /* TRUE iff PCI device */
301
 
314
 
302
#if ENABLE_PCI
315
#if ENABLE_PCI
303
    /* PCI config */
316
    /* PCI config */
304
//  char de_pci;            /* TRUE iff PCI device */
317
//  char de_pci;            /* TRUE iff PCI device */
305
//  u8_t de_pcibus; 
318
//  u8_t de_pcibus; 
306
//  u8_t de_pcidev; 
319
//  u8_t de_pcidev; 
307
//  u8_t de_pcifunc;    
320
//  u8_t de_pcifunc;    
308
#endif
321
#endif
309
 
322
 
310
    /* Do it yourself send queue */
323
    /* Do it yourself send queue */
311
    struct sendq
324
    struct sendq
312
    {
325
    {
313
        int sq_filled;      /* this buffer contains a packet */
326
        int sq_filled;      /* this buffer contains a packet */
314
        int sq_size;        /* with this size */
327
        int sq_size;        /* with this size */
315
        int sq_sendpage;    /* starting page of the buffer */
328
        int sq_sendpage;    /* starting page of the buffer */
316
    } de_sendq[SENDQ_NR];
329
    } de_sendq[SENDQ_NR];
317
    int de_sendq_nr;
330
    int de_sendq_nr;
318
    int de_sendq_head;      /* Enqueue at the head */
331
    int de_sendq_head;      /* Enqueue at the head */
319
    int de_sendq_tail;      /* Dequeue at the tail */
332
    int de_sendq_tail;      /* Dequeue at the tail */
320
 
333
 
321
    /* Fields for internal use by the dp8390 driver. */
334
    /* Fields for internal use by the dp8390 driver. */
322
    int de_flags;
335
    int de_flags;
323
    int de_mode;
336
    int de_mode;
324
    eth_stat_t de_stat;
337
    eth_stat_t de_stat;
325
    iovec_dat_t de_read_iovec;
338
    iovec_dat_t de_read_iovec;
326
//  iovec_dat_s_t de_read_iovec_s;
339
//  iovec_dat_s_t de_read_iovec_s;
327
//  int de_safecopy_read;
340
//  int de_safecopy_read;
328
//  iovec_dat_t de_write_iovec;
341
    iovec_dat_t de_write_iovec;
329
//  iovec_dat_s_t de_write_iovec_s;
342
//  iovec_dat_s_t de_write_iovec_s;
330
    iovec_dat_t de_tmp_iovec;
343
    iovec_dat_t de_tmp_iovec;
331
//  iovec_dat_s_t de_tmp_iovec_s;
344
//  iovec_dat_s_t de_tmp_iovec_s;
332
    vir_bytes de_read_s;
345
    vir_bytes de_read_s;
333
//  int de_client;
346
//  int de_client;
334
//  message de_sendmsg;
347
//  message de_sendmsg;
335
//  dp_user2nicf_t de_user2nicf; 
348
    dp_user2nicf_t de_user2nicf;
336
//  dp_user2nicf_s_t de_user2nicf_s; 
349
//  dp_user2nicf_s_t de_user2nicf_s; 
337
    dp_nic2userf_t de_nic2userf;
350
    dp_nic2userf_t de_nic2userf;
338
//  dp_nic2userf_s_t de_nic2userf_s; 
351
//  dp_nic2userf_s_t de_nic2userf_s; 
339
    dp_getblock_t de_getblockf;
352
    dp_getblock_t de_getblockf;
340
} dpeth_t;
353
} dpeth_t;
341
 
354
 
342
#define DEI_DEFAULT 0x8000
355
#define DEI_DEFAULT 0x8000
343
 
356
 
344
#define DEF_EMPTY   0x000
357
#define DEF_EMPTY   0x000
345
#define DEF_PACK_SEND   0x001
358
#define DEF_PACK_SEND   0x001
346
#define DEF_PACK_RECV   0x002
359
#define DEF_PACK_RECV   0x002
347
#define DEF_SEND_AVAIL  0x004
360
#define DEF_SEND_AVAIL  0x004
348
#define DEF_READING 0x010
361
#define DEF_READING 0x010
349
#define DEF_PROMISC 0x040
362
#define DEF_PROMISC 0x040
350
#define DEF_MULTI   0x080
363
#define DEF_MULTI   0x080
351
#define DEF_BROAD   0x100
364
#define DEF_BROAD   0x100
352
#define DEF_ENABLED 0x200
365
#define DEF_ENABLED 0x200
353
#define DEF_STOPPED 0x400
366
#define DEF_STOPPED 0x400
354
 
367
 
355
#define DEM_DISABLED    0x0
368
#define DEM_DISABLED    0x0
356
#define DEM_SINK    0x1
369
#define DEM_SINK    0x1
357
#define DEM_ENABLED 0x2
370
#define DEM_ENABLED 0x2
358
 
371
 
359
//#if !__minix_vmd
372
//#if !__minix_vmd
360
#define debug       1   /* Standard Minix lacks debug variable */
373
#define debug       1   /* Standard Minix lacks debug variable */
361
//#endif
374
//#endif
362
 
375
 
363
/*
376
/*
364
 * $PchId: dp8390.h,v 1.10 2005/02/10 17:26:06 philip Exp $
377
 * $PchId: dp8390.h,v 1.10 2005/02/10 17:26:06 philip Exp $
365
 */
378
 */
366
 
379
 
367
#endif
380
#endif
368
 
381
 
369
/** @}
382
/** @}
370
 */
383
 */
371
 
384