1 |
257 |
erez |
/* ethernet.h -- Definition of types and structures for Ethernet MAC
|
2 |
|
|
Copyright (C) 2001 Erez Volk, erez@mailandnews.comopencores.org
|
3 |
|
|
|
4 |
|
|
This file is part of OpenRISC 1000 Architectural Simulator.
|
5 |
|
|
|
6 |
|
|
This program is free software; you can redistribute it and/or modify
|
7 |
|
|
it under the terms of the GNU General Public License as published by
|
8 |
|
|
the Free Software Foundation; either version 2 of the License, or
|
9 |
|
|
(at your option) any later version.
|
10 |
|
|
|
11 |
|
|
This program is distributed in the hope that it will be useful,
|
12 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
|
|
GNU General Public License for more details.
|
15 |
|
|
|
16 |
|
|
You should have received a copy of the GNU General Public License
|
17 |
|
|
along with this program; if not, write to the Free Software
|
18 |
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
19 |
|
|
*/
|
20 |
|
|
|
21 |
346 |
erez |
#ifndef __OR1KSIM_PERIPHERAL_ETHERNET_H
|
22 |
|
|
#define __OR1KSIM_PERIPHERAL_ETHERNET_H
|
23 |
|
|
|
24 |
257 |
erez |
/* Exported function prototypes */
|
25 |
|
|
void eth_reset( void );
|
26 |
|
|
void eth_clock( void );
|
27 |
|
|
void eth_status( void );
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
/* Address space required by one Ethernet MAC */
|
31 |
|
|
#define ETH_ADDR_SPACE 0x1000
|
32 |
|
|
|
33 |
|
|
/* Relative Register Addresses */
|
34 |
444 |
erez |
#define ETH_MODER (4 * 0x00)
|
35 |
257 |
erez |
#define ETH_INT_SOURCE (4 * 0x01)
|
36 |
|
|
#define ETH_INT_MASK (4 * 0x02)
|
37 |
444 |
erez |
#define ETH_IPGT (4 * 0x03)
|
38 |
|
|
#define ETH_IPGR1 (4 * 0x04)
|
39 |
|
|
#define ETH_IPGR2 (4 * 0x05)
|
40 |
257 |
erez |
#define ETH_PACKETLEN (4 * 0x06)
|
41 |
|
|
#define ETH_COLLCONF (4 * 0x07)
|
42 |
418 |
erez |
#define ETH_TX_BD_NUM (4 * 0x08)
|
43 |
257 |
erez |
#define ETH_CTRLMODER (4 * 0x09)
|
44 |
|
|
#define ETH_MIIMODER (4 * 0x0A)
|
45 |
|
|
#define ETH_MIICOMMAND (4 * 0x0B)
|
46 |
|
|
#define ETH_MIIADDRESS (4 * 0x0C)
|
47 |
|
|
#define ETH_MIITX_DATA (4 * 0x0D)
|
48 |
|
|
#define ETH_MIIRX_DATA (4 * 0x0E)
|
49 |
|
|
#define ETH_MIISTATUS (4 * 0x0F)
|
50 |
|
|
#define ETH_MAC_ADDR0 (4 * 0x10)
|
51 |
|
|
#define ETH_MAC_ADDR1 (4 * 0x11)
|
52 |
744 |
simons |
#define ETH_HASH0 (4 * 0x12)
|
53 |
|
|
#define ETH_HASH1 (4 * 0x13)
|
54 |
257 |
erez |
|
55 |
|
|
/* Where BD's are stored */
|
56 |
|
|
#define ETH_BD_BASE 0x400
|
57 |
|
|
#define ETH_BD_COUNT 0x100
|
58 |
|
|
#define ETH_BD_SPACE (4 * ETH_BD_COUNT)
|
59 |
|
|
|
60 |
|
|
/* Where to point DMA to transmit/receive */
|
61 |
|
|
#define ETH_DMA_RX_TX 0x800
|
62 |
|
|
|
63 |
|
|
/* Field definitions for MODER */
|
64 |
|
|
#define ETH_MODER_DMAEN_OFFSET 17
|
65 |
|
|
#define ETH_MODER_RECSMALL_OFFSET 16
|
66 |
|
|
#define ETH_MODER_PAD_OFFSET 15
|
67 |
|
|
#define ETH_MODER_HUGEN_OFFSET 14
|
68 |
|
|
#define ETH_MODER_CRCEN_OFFSET 13
|
69 |
|
|
#define ETH_MODER_DLYCRCEN_OFFSET 12
|
70 |
|
|
#define ETH_MODER_RST_OFFSET 11
|
71 |
|
|
#define ETH_MODER_FULLD_OFFSET 10
|
72 |
|
|
#define ETH_MODER_EXDFREN_OFFSET 9
|
73 |
|
|
#define ETH_MODER_NOBCKOF_OFFSET 8
|
74 |
|
|
#define ETH_MODER_LOOPBCK_OFFSET 7
|
75 |
695 |
ivang |
#define ETH_MODER_IFG_OFFSET 6
|
76 |
257 |
erez |
#define ETH_MODER_PRO_OFFSET 5
|
77 |
|
|
#define ETH_MODER_IAM_OFFSET 4
|
78 |
|
|
#define ETH_MODER_BRO_OFFSET 3
|
79 |
|
|
#define ETH_MODER_NOPRE_OFFSET 2
|
80 |
|
|
#define ETH_MODER_TXEN_OFFSET 1
|
81 |
|
|
#define ETH_MODER_RXEN_OFFSET 0
|
82 |
|
|
|
83 |
|
|
/* Field definitions for INT_SOURCE */
|
84 |
705 |
ivang |
#define ETH_INT_SOURCE_RXC_OFFSET 6
|
85 |
|
|
#define ETH_INT_SOURCE_TXC_OFFSET 5
|
86 |
257 |
erez |
#define ETH_INT_SOURCE_BUSY_OFFSET 4
|
87 |
705 |
ivang |
#define ETH_INT_SOURCE_RXE_OFFSET 3
|
88 |
257 |
erez |
#define ETH_INT_SOURCE_RXB_OFFSET 2
|
89 |
|
|
#define ETH_INT_SOURCE_TXE_OFFSET 1
|
90 |
|
|
#define ETH_INT_SOURCE_TXB_OFFSET 0
|
91 |
|
|
|
92 |
|
|
/* Field definitions for INT_MASK */
|
93 |
705 |
ivang |
#define ETH_INT_MASK_RXC_M_OFFSET 6
|
94 |
|
|
#define ETH_INT_MASK_TXC_M_OFFSET 5
|
95 |
257 |
erez |
#define ETH_INT_MASK_BUSY_M_OFFSET 4
|
96 |
705 |
ivang |
#define ETH_INT_MASK_RXE_M_OFFSET 3
|
97 |
257 |
erez |
#define ETH_INT_MASK_RXB_M_OFFSET 2
|
98 |
|
|
#define ETH_INT_MASK_TXE_M_OFFSET 1
|
99 |
|
|
#define ETH_INT_MASK_TXB_M_OFFSET 0
|
100 |
|
|
|
101 |
|
|
/* Field definitions for PACKETLEN */
|
102 |
|
|
#define ETH_PACKETLEN_MINFL_OFFSET 16
|
103 |
|
|
#define ETH_PACKETLEN_MINFL_WIDTH 16
|
104 |
|
|
#define ETH_PACKETLEN_MAXFL_OFFSET 0
|
105 |
|
|
#define ETH_PACKETLEN_MAXFL_WIDTH 16
|
106 |
|
|
|
107 |
695 |
ivang |
/* Field definitions for COLLCONF */
|
108 |
|
|
#define ETH_COLLCONF_MAXRET_OFFSET 16
|
109 |
|
|
#define ETH_COLLCONF_MAXRET_WIDTH 4
|
110 |
|
|
#define ETH_COLLCONF_COLLVALID_OFFSET 0
|
111 |
|
|
#define ETH_COLLCONF_COLLVALID_WIDTH 6
|
112 |
|
|
|
113 |
|
|
/* Field definitions for CTRLMODER */
|
114 |
|
|
#define ETH_CMODER_TXFLOW_OFFSET 2
|
115 |
|
|
#define ETH_CMODER_RXFLOW_OFFSET 1
|
116 |
|
|
#define ETH_CMODER_PASSALL_OFFSET 0
|
117 |
|
|
|
118 |
|
|
/* Field definitions for MIIMODER */
|
119 |
705 |
ivang |
#define ETH_MIIMODER_MRST_OFFSET 9
|
120 |
695 |
ivang |
#define ETH_MIIMODER_NOPRE_OFFSET 8
|
121 |
|
|
#define ETH_MIIMODER_CLKDIV_OFFSET 0
|
122 |
|
|
#define ETH_MIIMODER_CLKDIV_WIDTH 8
|
123 |
|
|
|
124 |
|
|
/* Field definitions for MIICOMMAND */
|
125 |
|
|
#define ETH_MIICOMM_WCDATA_OFFSET 2
|
126 |
|
|
#define ETH_MIICOMM_RSTAT_OFFSET 1
|
127 |
|
|
#define ETH_MIICOMM_SCANS_OFFSET 0
|
128 |
|
|
|
129 |
|
|
/* Field definitions for MIIADDRESS */
|
130 |
|
|
#define ETH_MIIADDR_RGAD_OFFSET 8
|
131 |
|
|
#define ETH_MIIADDR_RGAD_WIDTH 5
|
132 |
|
|
#define ETH_MIIADDR_FIAD_OFFSET 0
|
133 |
|
|
#define ETH_MIIADDR_FIAD_WIDTH 5
|
134 |
|
|
|
135 |
|
|
/* Field definitions for MIISTATUS */
|
136 |
705 |
ivang |
#define ETH_MIISTAT_NVALID_OFFSET 1
|
137 |
|
|
#define ETH_MIISTAT_BUSY_OFFSET 1
|
138 |
695 |
ivang |
#define ETH_MIISTAT_FAIL_OFFSET 0
|
139 |
|
|
|
140 |
257 |
erez |
/* Field definitions for TX buffer descriptors */
|
141 |
|
|
#define ETH_TX_BD_LENGTH_OFFSET 16
|
142 |
|
|
#define ETH_TX_BD_LENGTH_WIDTH 16
|
143 |
|
|
#define ETH_TX_BD_READY_OFFSET 15
|
144 |
889 |
ivang |
#define ETH_TX_BD_IRQ_OFFSET 14
|
145 |
257 |
erez |
#define ETH_TX_BD_WRAP_OFFSET 13
|
146 |
|
|
#define ETH_TX_BD_PAD_OFFSET 12
|
147 |
|
|
#define ETH_TX_BD_CRC_OFFSET 11
|
148 |
|
|
#define ETH_TX_BD_LAST_OFFSET 10
|
149 |
|
|
#define ETH_TX_BD_PAUSE_OFFSET 9
|
150 |
695 |
ivang |
#define ETH_TX_BD_UNDERRUN_OFFSET 8
|
151 |
|
|
#define ETH_TX_BD_RETRY_OFFSET 4
|
152 |
257 |
erez |
#define ETH_TX_BD_RETRY_WIDTH 4
|
153 |
695 |
ivang |
#define ETH_TX_BD_RETRANSMIT_OFFSET 3
|
154 |
|
|
#define ETH_TX_BD_COLLISION_OFFSET 2
|
155 |
|
|
#define ETH_TX_BD_DEFER_OFFSET 1
|
156 |
|
|
#define ETH_TX_BD_NO_CARRIER_OFFSET 0
|
157 |
257 |
erez |
|
158 |
695 |
ivang |
|
159 |
257 |
erez |
/* Field definitions for RX buffer descriptors */
|
160 |
|
|
#define ETH_RX_BD_LENGTH_OFFSET 16
|
161 |
|
|
#define ETH_RX_BD_LENGTH_WIDTH 16
|
162 |
702 |
ivang |
#define ETH_RX_BD_READY_OFFSET 15
|
163 |
889 |
ivang |
#define ETH_RX_BD_IRQ_OFFSET 14
|
164 |
257 |
erez |
#define ETH_RX_BD_WRAP_OFFSET 13
|
165 |
695 |
ivang |
#define ETH_RX_BD_MISS_OFFSET 7
|
166 |
|
|
#define ETH_RX_BD_UVERRUN_OFFSET 6
|
167 |
|
|
#define ETH_RX_BD_INVALID_OFFSET 5
|
168 |
|
|
#define ETH_RX_BD_DRIBBLE_OFFSET 4
|
169 |
|
|
#define ETH_RX_BD_TOOBIG_OFFSET 3
|
170 |
|
|
#define ETH_RX_BD_TOOSHORT_OFFSET 2
|
171 |
|
|
#define ETH_RX_BD_CRC_OFFSET 1
|
172 |
702 |
ivang |
#define ETH_RX_BD_COLLISION_OFFSET 0
|
173 |
257 |
erez |
|
174 |
346 |
erez |
#endif /* __OR1KSIM_PERIPHERAL_ETHERNET_H */
|