Imported Upstream version 3.2.2
[debian/gnuradio] / usrp2 / firmware / lib / eth_mac_regs.h
1 /* -*- c -*- */
2 /*
3  * Copyright 2007 Free Software Foundation, Inc.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18
19 #ifndef INCLUDED_ETH_MAC_REGS_H
20 #define INCLUDED_ETH_MAC_REGS_H
21
22 /*
23  * See opencores.org 10_100_1000 Mbps Tri-mode Ethernet MAC Specification
24  *
25  * In reality, these are 16-bit regs, but are assigned
26  * on 32-bit boundaries.  Because we're little endian,
27  * declaring them "int" works.
28  */
29 typedef struct {
30   volatile int  tx_hwmark;
31   volatile int  tx_lwmark;
32
33   //! if set, send pause frames automatically
34   volatile int  pause_frame_send_en;
35
36   //! quanta value for pause frame in units of 512 bit times.
37   volatile int  pause_quanta_set;
38
39   volatile int  ifg_set;
40   volatile int  full_duplex;
41   volatile int  max_retry;
42   volatile int  mac_tx_add_en;
43   volatile int  mac_tx_add_prom_data;
44   volatile int  mac_tx_add_prom_add;
45   volatile int  mac_tx_add_prom_wr;
46
47   //! if set, other end can pause us (i.e., we pay attention to pause frames)
48   volatile int  tx_pause_en;
49
50   // Flow Control high and low water marks
51   //! when space available (in 32-bit lines) > hwmark, send un-pause frame
52   volatile int  fc_hwmark;      
53
54   //! when space avail (in 32-bit lines) < lwmark, send pause frame
55   volatile int  fc_lwmark;      
56
57   volatile int  mac_rx_add_chk_en;
58   volatile int  mac_rx_add_prom_data;
59   volatile int  mac_rx_add_prom_add;
60   volatile int  mac_rx_add_prom_wr;
61   volatile int  broadcast_filter_en;
62   volatile int  broadcast_bucket_depth;
63   volatile int  broadcast_bucket_interval;
64   volatile int  rx_append_crc;
65   volatile int  rx_hwmark;
66   volatile int  rx_lwmark;
67   volatile int  crc_chk_en;
68   volatile int  rx_ifg_set;
69   volatile int  rx_max_length;
70   volatile int  rx_min_length;
71   volatile int  rmon_rd_addr;           // performance counter access
72   volatile int  rmon_rd_apply;          
73   volatile int  rmon_rd_grant;          // READONLY
74   volatile int  rmon_rd_dout;           // READONLY
75   volatile int  dummy;  // READONLY
76   volatile int  line_loop_en;
77   volatile int  speed;
78   volatile int  miimoder;
79   volatile int  miicommand;
80   volatile int  miiaddress;
81   volatile int  miitx_data;
82   volatile int  miirx_data;
83   volatile int  miistatus;
84   volatile int  fc_padtime;
85 } eth_mac_regs_t;
86
87 // miicommand register
88 #define MIIC_SCANSSTAT  (1 << 0)        // Scan status
89 #define MIIC_RSTAT      (1 << 1)        // Read status
90 #define MIIC_WCTRLDATA  (1 << 2)        // Write control data
91
92 // miistatus register
93 #define MIIS_LINKFAIL   (1 << 0)        // The link failed
94 #define MIIS_BUSY       (1 << 1)        // The MII is busy (operation in progress)
95 #define MIIS_NVALID     (1 << 2)        // The data in the status register is invalid
96                                         //   This it is only valid when the scan status is active.
97
98 #endif /* INCLUDED_ETH_MAC_REGS_H */