OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [branches/] [oc/] [orpmon/] [include/] [eth.h] - Blame information for rev 1771

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 809 simons
#define ETH_REG_BASE  ETH_BASE 
2
#define ETH_BD_BASE   ETH_BASE + 0x400
3
#define ETH_TOTAL_BD  128
4
#define ETH_MAXBUF_LEN 0x600
5
 
6
#define ETH_TXBD_NUM      8
7
#define ETH_TXBD_NUM_MASK (ETH_TXBD_NUM - 1)
8
#define ETH_RXBD_NUM      8
9
#define ETH_RXBD_NUM_MASK (ETH_RXBD_NUM - 1)
10
 
11
/* Ethernet buffer descriptor */
12
typedef struct _eth_bd {
13
        unsigned short  len;            /* Buffer length */
14
        unsigned short  status;         /* Buffer status */
15
        unsigned long    addr;          /* Buffer address */
16
} eth_bd;
17
 
18
extern void eth_init (void (*rec)(volatile unsigned char *, int));
19
extern void *eth_get_tx_buf (void);
20
extern void eth_send (void *buf, unsigned long len);
21
extern unsigned long eth_rx (void);
22
extern void eth_halt(void);
23
 
24
/* Tx BD */
25
#define ETH_TX_BD_READY    0x8000 /* Tx BD Ready */
26
#define ETH_TX_BD_IRQ      0x4000 /* Tx BD IRQ Enable */
27
#define ETH_TX_BD_WRAP     0x2000 /* Tx BD Wrap (last BD) */
28
#define ETH_TX_BD_PAD      0x1000 /* Tx BD Pad Enable */
29
#define ETH_TX_BD_CRC      0x0800 /* Tx BD CRC Enable */
30
 
31
#define ETH_TX_BD_UNDERRUN 0x0100 /* Tx BD Underrun Status */
32
#define ETH_TX_BD_RETRY    0x00F0 /* Tx BD Retry Status */
33
#define ETH_TX_BD_RETLIM   0x0008 /* Tx BD Retransmission Limit Status */
34
#define ETH_TX_BD_LATECOL  0x0004 /* Tx BD Late Collision Status */
35
#define ETH_TX_BD_DEFER    0x0002 /* Tx BD Defer Status */
36
#define ETH_TX_BD_CARRIER  0x0001 /* Tx BD Carrier Sense Lost Status */
37
#define ETH_TX_BD_STATS        (ETH_TX_BD_UNDERRUN             | \
38
                                ETH_TX_BD_RETRY                | \
39
                                ETH_TX_BD_RETLIM               | \
40
                                ETH_TX_BD_LATECOL              | \
41
                                ETH_TX_BD_DEFER                | \
42
                                ETH_TX_BD_CARRIER)
43
 
44
/* Rx BD */
45
#define ETH_RX_BD_EMPTY    0x8000 /* Rx BD Empty */
46
#define ETH_RX_BD_IRQ      0x4000 /* Rx BD IRQ Enable */
47
#define ETH_RX_BD_WRAP     0x2000 /* Rx BD Wrap (last BD) */
48
 
49
#define ETH_RX_BD_MISS     0x0080 /* Rx BD Miss Status */
50
#define ETH_RX_BD_OVERRUN  0x0040 /* Rx BD Overrun Status */
51
#define ETH_RX_BD_INVSIMB  0x0020 /* Rx BD Invalid Symbol Status */
52
#define ETH_RX_BD_DRIBBLE  0x0010 /* Rx BD Dribble Nibble Status */
53
#define ETH_RX_BD_TOOLONG  0x0008 /* Rx BD Too Long Status */
54
#define ETH_RX_BD_SHORT    0x0004 /* Rx BD Too Short Frame Status */
55
#define ETH_RX_BD_CRCERR   0x0002 /* Rx BD CRC Error Status */
56
#define ETH_RX_BD_LATECOL  0x0001 /* Rx BD Late Collision Status */
57
#define ETH_RX_BD_STATS        (ETH_RX_BD_MISS                | \
58
                                ETH_RX_BD_OVERRUN              | \
59
                                ETH_RX_BD_INVSIMB              | \
60
                                ETH_RX_BD_DRIBBLE              | \
61
                                ETH_RX_BD_TOOLONG              | \
62
                                ETH_RX_BD_SHORT                | \
63
                                ETH_RX_BD_CRCERR               | \
64
                                ETH_RX_BD_LATECOL)
65
 
66
/* Register space */
67
#define ETH_MODER      0x00     /* Mode Register */
68
#define ETH_INT        0x04     /* Interrupt Source Register */
69
#define ETH_INT_MASK   0x08 /* Interrupt Mask Register */
70
#define ETH_IPGT       0x0C /* Back to Bak Inter Packet Gap Register */
71
#define ETH_IPGR1      0x10 /* Non Back to Back Inter Packet Gap Register 1 */
72
#define ETH_IPGR2      0x14 /* Non Back to Back Inter Packet Gap Register 2 */
73
#define ETH_PACKETLEN  0x18 /* Packet Length Register (min. and max.) */
74
#define ETH_COLLCONF   0x1C /* Collision and Retry Configuration Register */
75
#define ETH_TX_BD_NUM  0x20 /* Transmit Buffer Descriptor Number Register */
76
#define ETH_CTRLMODER  0x24 /* Control Module Mode Register */
77
#define ETH_MIIMODER   0x28 /* MII Mode Register */
78
#define ETH_MIICOMMAND 0x2C /* MII Command Register */
79
#define ETH_MIIADDRESS 0x30 /* MII Address Register */
80
#define ETH_MIITX_DATA 0x34 /* MII Transmit Data Register */
81
#define ETH_MIIRX_DATA 0x38 /* MII Receive Data Register */
82
#define ETH_MIISTATUS  0x3C /* MII Status Register */
83
#define ETH_MAC_ADDR0  0x40 /* MAC Individual Address Register 0 */
84
#define ETH_MAC_ADDR1  0x44 /* MAC Individual Address Register 1 */
85
#define ETH_HASH_ADDR0 0x48 /* Hash Register 0 */
86
#define ETH_HASH_ADDR1 0x4C /* Hash Register 1 */
87
 
88
/* MODER Register */
89
#define ETH_MODER_RXEN     0x00000001 /* Receive Enable  */
90
#define ETH_MODER_TXEN     0x00000002 /* Transmit Enable */
91
#define ETH_MODER_NOPRE    0x00000004 /* No Preamble  */
92
#define ETH_MODER_BRO      0x00000008 /* Reject Broadcast */
93
#define ETH_MODER_IAM      0x00000010 /* Use Individual Hash */
94
#define ETH_MODER_PRO      0x00000020 /* Promiscuous (receive all) */
95
#define ETH_MODER_IFG      0x00000040 /* Min. IFG not required */
96
#define ETH_MODER_LOOPBCK  0x00000080 /* Loop Back */
97
#define ETH_MODER_NOBCKOF  0x00000100 /* No Backoff */
98
#define ETH_MODER_EXDFREN  0x00000200 /* Excess Defer */
99
#define ETH_MODER_FULLD    0x00000400 /* Full Duplex */
100
#define ETH_MODER_RST      0x00000800 /* Reset MAC */
101
#define ETH_MODER_DLYCRCEN 0x00001000 /* Delayed CRC Enable */
102
#define ETH_MODER_CRCEN    0x00002000 /* CRC Enable */
103
#define ETH_MODER_HUGEN    0x00004000 /* Huge Enable */
104
#define ETH_MODER_PAD      0x00008000 /* Pad Enable */
105
#define ETH_MODER_RECSMALL 0x00010000 /* Receive Small */
106
 
107
/* Interrupt Source Register */
108
#define ETH_INT_TXB        0x00000001 /* Transmit Buffer IRQ */
109
#define ETH_INT_TXE        0x00000002 /* Transmit Error IRQ */
110
#define ETH_INT_RXF        0x00000004 /* Receive Frame IRQ */
111
#define ETH_INT_RXE        0x00000008 /* Receive Error IRQ */
112
#define ETH_INT_BUSY       0x00000010 /* Busy IRQ */
113
#define ETH_INT_TXC        0x00000020 /* Transmit Control Frame IRQ */
114
#define ETH_INT_RXC        0x00000040 /* Received Control Frame IRQ */
115
 
116
/* Interrupt Mask Register */
117
#define ETH_INT_MASK_TXB   0x00000001 /* Transmit Buffer IRQ Mask */
118
#define ETH_INT_MASK_TXE   0x00000002 /* Transmit Error IRQ Mask */
119
#define ETH_INT_MASK_RXF   0x00000004 /* Receive Frame IRQ Mask */
120
#define ETH_INT_MASK_RXE   0x00000008 /* Receive Error IRQ Mask */
121
#define ETH_INT_MASK_BUSY  0x00000010 /* Busy IRQ Mask */
122
#define ETH_INT_MASK_TXC   0x00000020 /* Transmit Control Frame IRQ Mask */
123
#define ETH_INT_MASK_RXC   0x00000040 /* Received Control Frame IRQ Mask */
124
 
125
/* Control Module Mode Register */
126
#define ETH_CTRLMODER_PASSALL 0x00000001 /* Pass Control Frames */
127
#define ETH_CTRLMODER_RXFLOW  0x00000002 /* Receive Control Flow Enable */
128
#define ETH_CTRLMODER_TXFLOW  0x00000004 /* Transmit Control Flow Enable */
129
 
130
/* MII Mode Register */
131
#define ETH_MIIMODER_CLKDIV   0x000000FF /* Clock Divider */
132
#define ETH_MIIMODER_NOPRE    0x00000100 /* No Preamble */
133
#define ETH_MIIMODER_RST      0x00000200 /* MIIM Reset */
134
 
135
/* MII Command Register */
136
#define ETH_MIICOMMAND_SCANSTAT  0x00000001 /* Scan Status */
137
#define ETH_MIICOMMAND_RSTAT     0x00000002 /* Read Status */
138
#define ETH_MIICOMMAND_WCTRLDATA 0x00000004 /* Write Control Data */
139
 
140
/* MII Address Register */
141
#define ETH_MIIADDRESS_FIAD 0x0000001F /* PHY Address */
142
#define ETH_MIIADDRESS_RGAD 0x00001F00 /* RGAD Address */
143
 
144
/* MII Status Register */
145
#define ETH_MIISTATUS_LINKFAIL 0x00000001 /* Link Fail */
146
#define ETH_MIISTATUS_BUSY     0x00000002 /* MII Busy */
147
#define ETH_MIISTATUS_NVALID   0x00000004 /* Data in MII Status Register is invalid */
148
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.