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 |
|
|
|
53 |
|
|
/* Where BD's are stored */
|
54 |
|
|
#define ETH_BD_BASE 0x400
|
55 |
|
|
#define ETH_BD_COUNT 0x100
|
56 |
|
|
#define ETH_BD_SPACE (4 * ETH_BD_COUNT)
|
57 |
|
|
|
58 |
|
|
/* Where to point DMA to transmit/receive */
|
59 |
|
|
#define ETH_DMA_RX_TX 0x800
|
60 |
|
|
|
61 |
|
|
/* Field definitions for MODER */
|
62 |
|
|
#define ETH_MODER_DMAEN_OFFSET 17
|
63 |
|
|
#define ETH_MODER_RECSMALL_OFFSET 16
|
64 |
|
|
#define ETH_MODER_PAD_OFFSET 15
|
65 |
|
|
#define ETH_MODER_HUGEN_OFFSET 14
|
66 |
|
|
#define ETH_MODER_CRCEN_OFFSET 13
|
67 |
|
|
#define ETH_MODER_DLYCRCEN_OFFSET 12
|
68 |
|
|
#define ETH_MODER_RST_OFFSET 11
|
69 |
|
|
#define ETH_MODER_FULLD_OFFSET 10
|
70 |
|
|
#define ETH_MODER_EXDFREN_OFFSET 9
|
71 |
|
|
#define ETH_MODER_NOBCKOF_OFFSET 8
|
72 |
|
|
#define ETH_MODER_LOOPBCK_OFFSET 7
|
73 |
|
|
#define ETH_MODER_PRO_OFFSET 5
|
74 |
|
|
#define ETH_MODER_IAM_OFFSET 4
|
75 |
|
|
#define ETH_MODER_BRO_OFFSET 3
|
76 |
|
|
#define ETH_MODER_NOPRE_OFFSET 2
|
77 |
|
|
#define ETH_MODER_TXEN_OFFSET 1
|
78 |
|
|
#define ETH_MODER_RXEN_OFFSET 0
|
79 |
|
|
|
80 |
|
|
/* Field definitions for INT_SOURCE */
|
81 |
|
|
#define ETH_INT_SOURCE_BUSY_OFFSET 4
|
82 |
|
|
#define ETH_INT_SOURCE_RXF_OFFSET 3
|
83 |
|
|
#define ETH_INT_SOURCE_RXB_OFFSET 2
|
84 |
|
|
#define ETH_INT_SOURCE_TXE_OFFSET 1
|
85 |
|
|
#define ETH_INT_SOURCE_TXB_OFFSET 0
|
86 |
|
|
|
87 |
|
|
/* Field definitions for INT_MASK */
|
88 |
|
|
#define ETH_INT_MASK_BUSY_M_OFFSET 4
|
89 |
|
|
#define ETH_INT_MASK_RXF_M_OFFSET 3
|
90 |
|
|
#define ETH_INT_MASK_RXB_M_OFFSET 2
|
91 |
|
|
#define ETH_INT_MASK_TXE_M_OFFSET 1
|
92 |
|
|
#define ETH_INT_MASK_TXB_M_OFFSET 0
|
93 |
|
|
|
94 |
|
|
/* Field definitions for PACKETLEN */
|
95 |
|
|
#define ETH_PACKETLEN_MINFL_OFFSET 16
|
96 |
|
|
#define ETH_PACKETLEN_MINFL_WIDTH 16
|
97 |
|
|
#define ETH_PACKETLEN_MAXFL_OFFSET 0
|
98 |
|
|
#define ETH_PACKETLEN_MAXFL_WIDTH 16
|
99 |
|
|
|
100 |
|
|
/* Field definitions for TX buffer descriptors */
|
101 |
|
|
#define ETH_TX_BD_LENGTH_OFFSET 16
|
102 |
|
|
#define ETH_TX_BD_LENGTH_WIDTH 16
|
103 |
|
|
#define ETH_TX_BD_READY_OFFSET 15
|
104 |
|
|
#define ETH_TX_BD_INTERRUPT_OFFSET 14
|
105 |
|
|
#define ETH_TX_BD_WRAP_OFFSET 13
|
106 |
|
|
#define ETH_TX_BD_PAD_OFFSET 12
|
107 |
|
|
#define ETH_TX_BD_CRC_OFFSET 11
|
108 |
|
|
#define ETH_TX_BD_LAST_OFFSET 10
|
109 |
|
|
#define ETH_TX_BD_PAUSE_OFFSET 9
|
110 |
|
|
#define ETH_TX_BD_DEFER_OFFSET 8
|
111 |
|
|
#define ETH_TX_BD_COLLISION_OFFSET 7
|
112 |
|
|
#define ETH_TX_BD_RETRANSMIT_OFFSET 6
|
113 |
|
|
#define ETH_TX_BD_UNDERRUN_OFFSET 5
|
114 |
|
|
#define ETH_TX_BD_NO_CARRIER_OFFSET 4
|
115 |
|
|
#define ETH_TX_BD_RETRY_OFFSET 0
|
116 |
|
|
#define ETH_TX_BD_RETRY_WIDTH 4
|
117 |
|
|
|
118 |
|
|
/* Field definitions for RX buffer descriptors */
|
119 |
|
|
#define ETH_RX_BD_LENGTH_OFFSET 16
|
120 |
|
|
#define ETH_RX_BD_LENGTH_WIDTH 16
|
121 |
|
|
#define ETH_RX_BD_EMPTY_OFFSET 15
|
122 |
|
|
#define ETH_RX_BD_INTERRUPT_OFFSET 14
|
123 |
|
|
#define ETH_RX_BD_WRAP_OFFSET 13
|
124 |
|
|
#define ETH_RX_BD_LAST_OFFSET 10
|
125 |
|
|
#define ETH_RX_BD_PAUSE_OFFSET 9
|
126 |
|
|
#define ETH_RX_BD_DEFER_OFFSET 8
|
127 |
|
|
#define ETH_RX_BD_COLLISION_OFFSET 7
|
128 |
|
|
#define ETH_RX_BD_RETRANSMIT_OFFSET 6
|
129 |
|
|
#define ETH_RX_BD_UNDERRUN_OFFSET 5
|
130 |
|
|
#define ETH_RX_BD_NO_CARRIER_OFFSET 4
|
131 |
|
|
#define ETH_RX_BD_RETRY_OFFSET 0
|
132 |
|
|
#define ETH_RX_BD_RETRY_WIDTH 4
|
133 |
|
|
|
134 |
|
|
|
135 |
|
|
|
136 |
|
|
|
137 |
346 |
erez |
#endif /* __OR1KSIM_PERIPHERAL_ETHERNET_H */
|