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

4.104.114.84.95
Last change on this file since 2697be56 was 2697be56, checked in by Joel Sherrill <joel.sherrill@…>, on 03/12/07 at 11:19:21

2007-03-12 Joel Sherrill <joel@…>

  • libchip/network/cs8900.c, libchip/network/cs8900.h, libchip/network/greth.c, libchip/network/greth.h: Correct license URL and/or fix mistake in copyright notice. Both of these mistakes appear to be from code submitted after these changes were made previously.
  • Property mode set to 100644
File size: 3.9 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#ifndef _GR_ETH_
13#define _GR_ETH_
14
15
16/* Configuration Information */
17
18typedef struct {
19  uint32_t              base_address;
20  uint32_t              vector;
21  uint32_t              txd_count;
22  uint32_t              rxd_count;
23} greth_configuration_t;
24
25/* Ethernet configuration registers */
26
27typedef struct _greth_regs {
28   volatile uint32_t ctrl;         /* Ctrl Register */
29   volatile uint32_t status;       /* Status Register */
30   volatile uint32_t mac_addr_msb; /* Bit 47-32 of MAC address */
31   volatile uint32_t mac_addr_lsb; /* Bit 31-0 of MAC address */
32   volatile uint32_t mdio_ctrl;    /* MDIO control and status */
33   volatile uint32_t txdesc;       /* Transmit descriptor pointer */
34   volatile uint32_t rxdesc;       /* Receive descriptor pointer */
35} greth_regs;
36
37#define GRETH_TOTAL_BD           128
38#define GRETH_MAXBUF_LEN         1520
39                                 
40/* Tx BD */                     
41#define GRETH_TXD_ENABLE      0x0800 /* Tx BD Enable */
42#define GRETH_TXD_WRAP        0x1000 /* Tx BD Wrap (last BD) */
43#define GRETH_TXD_IRQ         0x2000 /* Tx BD IRQ Enable */
44
45#define GRETH_TXD_UNDERRUN    0x4000 /* Tx BD Underrun Status */
46#define GRETH_TXD_RETLIM      0x8000 /* Tx BD Retransmission Limit Status */
47#define GRETH_TXD_STATS       (GRETH_TXD_UNDERRUN            | \
48                               GRETH_TXD_RETLIM)
49                               
50/* Rx BD */                     
51#define GRETH_RXD_ENABLE      0x0800 /* Rx BD Enable */
52#define GRETH_RXD_WRAP        0x1000 /* Rx BD Wrap (last BD) */
53#define GRETH_RXD_IRQ         0x2000 /* Rx BD IRQ Enable */
54
55#define GRETH_RXD_DRIBBLE     0x4000 /* Rx BD Dribble Nibble Status */                               
56#define GRETH_RXD_TOOLONG     0x8000 /* Rx BD Too Long Status */
57#define GRETH_RXD_CRCERR      0x10000 /* Rx BD CRC Error Status */
58#define GRETH_RXD_OVERRUN     0x20000 /* Rx BD Overrun Status */
59#define GRETH_RXD_STATS       (GRETH_RXD_OVERRUN             | \
60                               GRETH_RXD_DRIBBLE             | \
61                               GRETH_RXD_TOOLONG             | \
62                               GRETH_RXD_CRCERR)
63
64/* CTRL Register */
65#define GRETH_CTRL_TXEN         0x00000001 /* Transmit Enable */
66#define GRETH_CTRL_RXEN         0x00000002 /* Receive Enable  */
67#define GRETH_CTRL_TXIRQ        0x00000004 /* Transmit Enable */
68#define GRETH_CTRL_RXIRQ        0x00000008 /* Receive Enable  */
69#define GRETH_CTRL_FULLD        0x00000010 /* Full Duplex */
70#define GRETH_CTRL_PRO          0x00000020 /* Promiscuous (receive all) */
71#define GRETH_CTRL_RST          0x00000040 /* Reset MAC */
72
73/* Status Register */
74#define GRETH_STATUS_RXERR      0x00000001 /* Receive Error */
75#define GRETH_STATUS_TXERR      0x00000002 /* Transmit Error IRQ */
76#define GRETH_STATUS_RXIRQ      0x00000004 /* Receive Frame IRQ */
77#define GRETH_STATUS_TXIRQ      0x00000008 /* Transmit Error IRQ */
78#define GRETH_STATUS_RXAHBERR   0x00000010 /* Receiver AHB Error */
79#define GRETH_STATUS_TXAHBERR   0x00000020 /* Transmitter AHB Error */
80
81/* MDIO Control  */
82#define GRETH_MDIO_WRITE        0x00000001 /* MDIO Write */
83#define GRETH_MDIO_READ         0x00000002 /* MDIO Read */
84#define GRETH_MDIO_LINKFAIL     0x00000004 /* MDIO Link failed */
85#define GRETH_MDIO_BUSY         0x00000008 /* MDIO Link Busy */
86#define GRETH_MDIO_REGADR       0x000007C0 /* Register Address */
87#define GRETH_MDIO_PHYADR       0x0000F800 /* PHY address */
88#define GRETH_MDIO_DATA         0xFFFF0000 /* MDIO DATA */
89 
90/* Attach routine */
91
92int rtems_greth_driver_attach (
93    struct rtems_bsdnet_ifconfig *config,
94    greth_configuration_t *chip
95);
96
97/*
98#ifdef CPU_U32_FIX
99void ipalign(struct mbuf *m);
100#endif
101*/
102
103#endif
104
Note: See TracBrowser for help on using the repository browser.