source: rtems/c/src/libchip/network/greth.h @ dd9cc9f7

4.104.115
Last change on this file since dd9cc9f7 was 050249d, checked in by Joel Sherrill <joel.sherrill@…>, on 09/07/07 at 15:01:15

2007-09-07 Daniel Hellstrom <daniel@…>

  • libchip/network/greth.c, libchip/network/greth.h: GRETH_GBIT support and GBIT PHY support for 10/100 MAC, also auto negotiation updated.
  • Property mode set to 100644
File size: 5.5 KB
Line 
1/*
2 * Gaisler Research ethernet MAC driver
3 * adapted from Opencores driver by Marko Isomaki
4 *
5 *  The license and distribution terms for this file may be
6 *  found in found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 *
9 *  $Id$
10 */
11
12
13#ifndef _GR_ETH_
14#define _GR_ETH_
15
16
17/* Configuration Information */
18
19typedef struct {
20  uint32_t              base_address;
21  uint32_t              vector;
22  uint32_t              txd_count;
23  uint32_t              rxd_count;
24} greth_configuration_t;
25
26/* Ethernet configuration registers */
27
28typedef struct _greth_regs {
29   volatile uint32_t ctrl;         /* Ctrl Register */
30   volatile uint32_t status;       /* Status Register */
31   volatile uint32_t mac_addr_msb; /* Bit 47-32 of MAC address */
32   volatile uint32_t mac_addr_lsb; /* Bit 31-0 of MAC address */
33   volatile uint32_t mdio_ctrl;    /* MDIO control and status */
34   volatile uint32_t txdesc;       /* Transmit descriptor pointer */
35   volatile uint32_t rxdesc;       /* Receive descriptor pointer */
36} greth_regs;
37
38#define GRETH_TOTAL_BD           128
39#define GRETH_MAXBUF_LEN         1520
40                               
41/* Tx BD */                     
42#define GRETH_TXD_ENABLE      0x0800 /* Tx BD Enable */
43#define GRETH_TXD_WRAP        0x1000 /* Tx BD Wrap (last BD) */
44#define GRETH_TXD_IRQ         0x2000 /* Tx BD IRQ Enable */
45#define GRETH_TXD_MORE        0x20000 /* Tx BD More (more descs for packet) */
46#define GRETH_TXD_IPCS        0x40000 /* Tx BD insert ip chksum */
47#define GRETH_TXD_TCPCS       0x80000 /* Tx BD insert tcp chksum */
48#define GRETH_TXD_UDPCS       0x100000 /* Tx BD insert udp chksum */
49
50#define GRETH_TXD_UNDERRUN    0x4000 /* Tx BD Underrun Status */
51#define GRETH_TXD_RETLIM      0x8000 /* Tx BD Retransmission Limit Status */
52#define GRETH_TXD_LATECOL     0x10000 /* Tx BD Late Collision */
53
54#define GRETH_TXD_STATS       (GRETH_TXD_UNDERRUN            | \
55                               GRETH_TXD_RETLIM              | \
56                               GRETH_TXD_LATECOL)
57
58#define GRETH_TXD_CS          (GRETH_TXD_IPCS            | \
59                               GRETH_TXD_TCPCS           | \
60                               GRETH_TXD_UDPCS)
61                               
62/* Rx BD */                     
63#define GRETH_RXD_ENABLE      0x0800 /* Rx BD Enable */
64#define GRETH_RXD_WRAP        0x1000 /* Rx BD Wrap (last BD) */
65#define GRETH_RXD_IRQ         0x2000 /* Rx BD IRQ Enable */
66
67#define GRETH_RXD_DRIBBLE     0x4000 /* Rx BD Dribble Nibble Status */                               
68#define GRETH_RXD_TOOLONG     0x8000 /* Rx BD Too Long Status */
69#define GRETH_RXD_CRCERR      0x10000 /* Rx BD CRC Error Status */
70#define GRETH_RXD_OVERRUN     0x20000 /* Rx BD Overrun Status */
71#define GRETH_RXD_LENERR      0x40000 /* Rx BD Length Error */
72#define GRETH_RXD_ID          0x40000 /* Rx BD IP Detected */
73#define GRETH_RXD_IR          0x40000 /* Rx BD IP Chksum Error */
74#define GRETH_RXD_UD          0x40000 /* Rx BD UDP Detected*/
75#define GRETH_RXD_UR          0x40000 /* Rx BD UDP Chksum Error */
76#define GRETH_RXD_TD          0x40000 /* Rx BD TCP Detected */
77#define GRETH_RXD_TR          0x40000 /* Rx BD TCP Chksum Error */
78
79
80#define GRETH_RXD_STATS       (GRETH_RXD_OVERRUN             | \
81                               GRETH_RXD_DRIBBLE             | \
82                               GRETH_RXD_TOOLONG             | \
83                               GRETH_RXD_CRCERR)
84
85/* CTRL Register */
86#define GRETH_CTRL_TXEN         0x00000001 /* Transmit Enable */
87#define GRETH_CTRL_RXEN         0x00000002 /* Receive Enable  */
88#define GRETH_CTRL_TXIRQ        0x00000004 /* Transmit Enable */
89#define GRETH_CTRL_RXIRQ        0x00000008 /* Receive Enable  */
90#define GRETH_CTRL_FULLD        0x00000010 /* Full Duplex */
91#define GRETH_CTRL_PRO          0x00000020 /* Promiscuous (receive all) */
92#define GRETH_CTRL_RST          0x00000040 /* Reset MAC */
93
94/* Status Register */
95#define GRETH_STATUS_RXERR      0x00000001 /* Receive Error */
96#define GRETH_STATUS_TXERR      0x00000002 /* Transmit Error IRQ */
97#define GRETH_STATUS_RXIRQ      0x00000004 /* Receive Frame IRQ */
98#define GRETH_STATUS_TXIRQ      0x00000008 /* Transmit Error IRQ */
99#define GRETH_STATUS_RXAHBERR   0x00000010 /* Receiver AHB Error */
100#define GRETH_STATUS_TXAHBERR   0x00000020 /* Transmitter AHB Error */
101
102/* MDIO Control  */
103#define GRETH_MDIO_WRITE        0x00000001 /* MDIO Write */
104#define GRETH_MDIO_READ         0x00000002 /* MDIO Read */
105#define GRETH_MDIO_LINKFAIL     0x00000004 /* MDIO Link failed */
106#define GRETH_MDIO_BUSY         0x00000008 /* MDIO Link Busy */
107#define GRETH_MDIO_REGADR       0x000007C0 /* Register Address */
108#define GRETH_MDIO_PHYADR       0x0000F800 /* PHY address */
109#define GRETH_MDIO_DATA         0xFFFF0000 /* MDIO DATA */
110
111
112/* MII registers */
113#define GRETH_MII_EXTADV_1000FD 0x00000200
114#define GRETH_MII_EXTADV_1000HD 0x00000100
115#define GRETH_MII_EXTPRT_1000FD 0x00000800
116#define GRETH_MII_EXTPRT_1000HD 0x00000400
117
118#define GRETH_MII_100T4         0x00000200
119#define GRETH_MII_100TXFD       0x00000100
120#define GRETH_MII_100TXHD       0x00000080
121#define GRETH_MII_10FD          0x00000040
122#define GRETH_MII_10HD          0x00000020
123
124
125
126/* Attach routine */
127
128int rtems_greth_driver_attach (
129    struct rtems_bsdnet_ifconfig *config,
130    greth_configuration_t *chip
131);
132
133/* PHY data */
134struct phy_device_info
135{
136   int vendor;
137   int device;
138   int rev;
139   
140   int adv;
141   int part;
142
143   int extadv;
144   int extpart;
145};
146
147/*
148#ifdef CPU_U32_FIX
149void ipalign(struct mbuf *m);
150#endif
151
152*/
153#endif
154
Note: See TracBrowser for help on using the repository browser.