Statistics
| Branch: | Tag: | Revision:

root / host / lib / usrp / usrp2 / usrp2_regs.hpp @ 5b5696cb

History | View | Annotate | Download (7.63 KB)

1
//
2
// Copyright 2010 Ettus Research LLC
3
//
4
// This program is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8
//
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
//
17

    
18
#ifndef INCLUDED_USRP2_REGS_HPP
19
#define INCLUDED_USRP2_REGS_HPP
20

    
21
#include <boost/cstdint.hpp>
22

    
23
////////////////////////////////////////////////////
24
// Settings Bus, Slave #7, Not Byte Addressable!
25
//
26
// Output-only from processor point-of-view.
27
// 1KB of address space (== 256 32-bit write-only regs)
28

    
29

    
30
#define MISC_OUTPUT_BASE        0xD400
31
//#define TX_PROTOCOL_ENGINE_BASE 0xD480
32
//#define RX_PROTOCOL_ENGINE_BASE 0xD4C0
33
//#define BUFFER_POOL_CTRL_BASE   0xD500
34
//#define LAST_SETTING_REG        0xD7FC  // last valid setting register
35

    
36
#define SR_MISC 0
37
#define SR_TX_PROT_ENG 32
38
#define SR_RX_PROT_ENG 48
39
#define SR_BUFFER_POOL_CTRL 64
40
#define SR_UDP_SM 96
41
#define SR_TX_DSP 208
42
#define SR_TX_CTRL 224
43
#define SR_RX_DSP 160
44
#define SR_RX_CTRL 176
45
#define SR_TIME64 192
46
#define SR_SIMTIMER 198
47
#define SR_LAST 255
48

    
49
#define _SR_ADDR(sr)    (MISC_OUTPUT_BASE + (sr) * sizeof(boost::uint32_t))
50

    
51
/////////////////////////////////////////////////
52
// SPI Slave Constants
53
////////////////////////////////////////////////
54
// Masks for controlling different peripherals
55
#define SPI_SS_AD9510    1
56
#define SPI_SS_AD9777    2
57
#define SPI_SS_RX_DAC    4
58
#define SPI_SS_RX_ADC    8
59
#define SPI_SS_RX_DB    16
60
#define SPI_SS_TX_DAC   32
61
#define SPI_SS_TX_ADC   64
62
#define SPI_SS_TX_DB   128
63

    
64
/////////////////////////////////////////////////
65
// Misc Control
66
////////////////////////////////////////////////
67
#define FR_CLOCK_CONTROL _SR_ADDR(0)
68

    
69
/////////////////////////////////////////////////
70
// VITA49 64 bit time (write only)
71
////////////////////////////////////////////////
72
  /*!
73
   * \brief Time 64 flags
74
   *
75
   * <pre>
76
   *
77
   *    3                   2                   1                       
78
   *  1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
79
   * +-----------------------------------------------------------+-+-+
80
   * |                                                           |S|P|
81
   * +-----------------------------------------------------------+-+-+
82
   *
83
   * P - PPS edge selection (0=negedge, 1=posedge, default=0)
84
   * S - Source (0=sma, 1=mimo, 0=default)
85
   *
86
   * </pre>
87
   */
88
#define FR_TIME64_SECS  _SR_ADDR(SR_TIME64 + 0)  // value to set absolute secs to on next PPS
89
#define FR_TIME64_TICKS _SR_ADDR(SR_TIME64 + 1)  // value to set absolute ticks to on next PPS
90
#define FR_TIME64_FLAGS _SR_ADDR(SR_TIME64 + 2)  // flags - see chart above
91
#define FR_TIME64_IMM   _SR_ADDR(SR_TIME64 + 3) // set immediate (0=latch on next pps, 1=latch immediate, default=0)
92

    
93
//pps flags (see above)
94
#define FRF_TIME64_PPS_NEGEDGE (0 << 0)
95
#define FRF_TIME64_PPS_POSEDGE (1 << 0)
96
#define FRF_TIME64_PPS_SMA     (0 << 1)
97
#define FRF_TIME64_PPS_MIMO    (1 << 1)
98

    
99
#define FRF_TIME64_LATCH_NOW 1
100
#define FRF_TIME64_LATCH_NEXT_PPS 0
101

    
102
/////////////////////////////////////////////////
103
// DSP TX Regs
104
////////////////////////////////////////////////
105
#define FR_DSP_TX_FREQ         _SR_ADDR(SR_TX_DSP + 0)
106
#define FR_DSP_TX_SCALE_IQ     _SR_ADDR(SR_TX_DSP + 1) // {scale_i,scale_q}
107
#define FR_DSP_TX_INTERP_RATE  _SR_ADDR(SR_TX_DSP + 2)
108

    
109
  /*!
110
   * \brief output mux configuration.
111
   *
112
   * <pre>
113
   *     3                   2                   1                       
114
   *   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
115
   *  +-------------------------------+-------+-------+-------+-------+
116
   *  |                                               | DAC1  |  DAC0 |
117
   *  +-------------------------------+-------+-------+-------+-------+
118
   * 
119
   *  There are N DUCs (1 now) with complex inputs and outputs.
120
   *  There are two DACs.
121
   * 
122
   *  Each 4-bit DACx field specifies the source for the DAC
123
   *  Each subfield is coded like this: 
124
   * 
125
   *     3 2 1 0
126
   *    +-------+
127
   *    |   N   |
128
   *    +-------+
129
   * 
130
   *  N specifies which DUC output is connected to this DAC.
131
   * 
132
   *   N   which interp output
133
   *  ---  -------------------
134
   *   0   DUC 0 I
135
   *   1   DUC 0 Q
136
   *   2   DUC 1 I
137
   *   3   DUC 1 Q
138
   *   F   All Zeros
139
   *   
140
   * The default value is 0x10
141
   * </pre>
142
   */
143
#define FR_DSP_TX_MUX  _SR_ADDR(SR_TX_DSP + 4)
144

    
145
/////////////////////////////////////////////////
146
// DSP RX Regs
147
////////////////////////////////////////////////
148
#define FR_DSP_RX_FREQ         _SR_ADDR(SR_RX_DSP + 0)
149
#define FR_DSP_RX_SCALE_IQ     _SR_ADDR(SR_RX_DSP + 1) // {scale_i,scale_q}
150
#define FR_DSP_RX_DECIM_RATE   _SR_ADDR(SR_RX_DSP + 2)
151
#define FR_DSP_RX_DCOFFSET_I   _SR_ADDR(SR_RX_DSP + 3) // Bit 31 high sets fixed offset mode, using lower 14 bits,
152
                                                       // otherwise it is automatic 
153
#define FR_DSP_RX_DCOFFSET_Q   _SR_ADDR(SR_RX_DSP + 4) // Bit 31 high sets fixed offset mode, using lower 14 bits
154
  /*!
155
   * \brief input mux configuration.
156
   *
157
   * This determines which ADC (or constant zero) is connected to 
158
   * each DDC input.  There are N DDCs (1 now).  Each has two inputs.
159
   *
160
   * <pre>
161
   * Mux value:
162
   *
163
   *    3                   2                   1                       
164
   *  1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
165
   * +-------+-------+-------+-------+-------+-------+-------+-------+
166
   * |                                                       |Q0 |I0 |
167
   * +-------+-------+-------+-------+-------+-------+-------+-------+
168
   *
169
   * Each 2-bit I field is either 00 (A/D A), 01 (A/D B) or 1X (const zero)
170
   * Each 2-bit Q field is either 00 (A/D A), 01 (A/D B) or 1X (const zero)
171
   *
172
   * The default value is 0x4
173
   * </pre>
174
   */
175
#define FR_DSP_RX_MUX  _SR_ADDR(SR_RX_DSP + 5)         // called adc_mux in dsp_core_rx.v
176

    
177
////////////////////////////////////////////////
178
// GPIO, Slave 4
179
////////////////////////////////////////////////
180
//
181
// These go to the daughterboard i/o pins
182
//
183
#define FR_GPIO_BASE 0xC800
184

    
185
#define FR_GPIO_IO         FR_GPIO_BASE + 0  // 32 bits, gpio io pins (tx high 16 bits, rx low 16 bits)
186
#define FR_GPIO_DDR        FR_GPIO_BASE + 4  // 32 bits, gpio ddr, 1 means output (tx high 16 bits, rx low 16 bits)
187
#define FR_GPIO_TX_SEL     FR_GPIO_BASE + 8  // 16 2-bit fields select which source goes to TX DB
188
#define FR_GPIO_RX_SEL     FR_GPIO_BASE + 12 // 16 2-bit fields select which source goes to RX DB
189

    
190
// each 2-bit sel field is layed out this way
191
#define FRF_GPIO_SEL_SW        0 // if pin is an output, set by software in the io reg
192
#define FRF_GPIO_SEL_ATR       1 // if pin is an output, set by ATR logic
193
#define FRF_GPIO_SEL_DEBUG_0   2 // if pin is an output, debug lines from FPGA fabric
194
#define FRF_GPIO_SEL_DEBUG_1   3 // if pin is an output, debug lines from FPGA fabric
195

    
196
///////////////////////////////////////////////////
197
// ATR Controller, Slave 11
198
////////////////////////////////////////////////
199
#define FR_ATR_BASE  0xE400
200

    
201
#define FR_ATR_IDLE_TXSIDE  FR_ATR_BASE + 0
202
#define FR_ATR_IDLE_RXSIDE  FR_ATR_BASE + 2
203
#define FR_ATR_INTX_TXSIDE  FR_ATR_BASE + 4
204
#define FR_ATR_INTX_RXSIDE  FR_ATR_BASE + 6
205
#define FR_ATR_INRX_TXSIDE  FR_ATR_BASE + 8
206
#define FR_ATR_INRX_RXSIDE  FR_ATR_BASE + 10
207
#define FR_ATR_FULL_TXSIDE  FR_ATR_BASE + 12
208
#define FR_ATR_FULL_RXSIDE  FR_ATR_BASE + 14
209

    
210
#endif /* INCLUDED_USRP2_REGS_HPP */