root / host / lib / usrp / usrp2 / usrp2_regs.hpp @ 2f12295f
History | View | Annotate | Download (9.17 KB)
| 1 |
//
|
|---|---|
| 2 |
// Copyright 2010-2011 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 |
typedef struct { |
| 22 |
int misc_ctrl_clock;
|
| 23 |
int misc_ctrl_serdes;
|
| 24 |
int misc_ctrl_adc;
|
| 25 |
int misc_ctrl_leds;
|
| 26 |
int misc_ctrl_phy;
|
| 27 |
int misc_ctrl_dbg_mux;
|
| 28 |
int misc_ctrl_ram_page;
|
| 29 |
int misc_ctrl_flush_icache;
|
| 30 |
int misc_ctrl_led_src;
|
| 31 |
int time64_secs; // value to set absolute secs to on next PPS |
| 32 |
int time64_ticks; // value to set absolute ticks to on next PPS |
| 33 |
int time64_flags; // flags -- see chart below |
| 34 |
int time64_imm; // set immediate (0=latch on next pps, 1=latch immediate, default=0) |
| 35 |
int time64_tps; // ticks per second rollover count |
| 36 |
int time64_mimo_sync;
|
| 37 |
int status;
|
| 38 |
int time64_secs_rb_imm;
|
| 39 |
int time64_ticks_rb_imm;
|
| 40 |
int time64_secs_rb_pps;
|
| 41 |
int time64_ticks_rb_pps;
|
| 42 |
int compat_num_rb;
|
| 43 |
int dsp_tx_freq;
|
| 44 |
int dsp_tx_scale_iq;
|
| 45 |
int dsp_tx_interp_rate;
|
| 46 |
int dsp_tx_mux;
|
| 47 |
struct{
|
| 48 |
int freq;
|
| 49 |
int scale_iq;
|
| 50 |
int decim_rate;
|
| 51 |
int dcoffset_i;
|
| 52 |
int dcoffset_q;
|
| 53 |
int mux;
|
| 54 |
} dsp_rx[2];
|
| 55 |
int gpio_base;
|
| 56 |
int gpio_io;
|
| 57 |
int gpio_ddr;
|
| 58 |
int gpio_tx_sel;
|
| 59 |
int gpio_rx_sel;
|
| 60 |
int atr_base;
|
| 61 |
int atr_idle_txside;
|
| 62 |
int atr_idle_rxside;
|
| 63 |
int atr_intx_txside;
|
| 64 |
int atr_intx_rxside;
|
| 65 |
int atr_inrx_txside;
|
| 66 |
int atr_inrx_rxside;
|
| 67 |
int atr_full_txside;
|
| 68 |
int atr_full_rxside;
|
| 69 |
struct{
|
| 70 |
int stream_cmd;
|
| 71 |
int time_secs;
|
| 72 |
int time_ticks;
|
| 73 |
int clear_overrun;
|
| 74 |
int vrt_header;
|
| 75 |
int vrt_stream_id;
|
| 76 |
int vrt_trailer;
|
| 77 |
int nsamps_per_pkt;
|
| 78 |
int nchannels;
|
| 79 |
} rx_ctrl[2];
|
| 80 |
int tx_ctrl_num_chan;
|
| 81 |
int tx_ctrl_clear_state;
|
| 82 |
int tx_ctrl_report_sid;
|
| 83 |
int tx_ctrl_policy;
|
| 84 |
int tx_ctrl_cycles_per_up;
|
| 85 |
int tx_ctrl_packets_per_up;
|
| 86 |
} usrp2_regs_t; |
| 87 |
|
| 88 |
extern const usrp2_regs_t usrp2_regs; //the register definitions, set in usrp2_regs.cpp and usrp2p_regs.cpp |
| 89 |
|
| 90 |
usrp2_regs_t usrp2_get_regs(bool);
|
| 91 |
|
| 92 |
////////////////////////////////////////////////////
|
| 93 |
// Settings Bus, Slave #7, Not Byte Addressable!
|
| 94 |
//
|
| 95 |
// Output-only from processor point-of-view.
|
| 96 |
// 1KB of address space (== 256 32-bit write-only regs)
|
| 97 |
|
| 98 |
|
| 99 |
//#define MISC_OUTPUT_BASE 0xD400
|
| 100 |
//#define TX_PROTOCOL_ENGINE_BASE 0xD480
|
| 101 |
//#define RX_PROTOCOL_ENGINE_BASE 0xD4C0
|
| 102 |
//#define BUFFER_POOL_CTRL_BASE 0xD500
|
| 103 |
//#define LAST_SETTING_REG 0xD7FC // last valid setting register
|
| 104 |
|
| 105 |
/////////////////////////////////////////////////
|
| 106 |
// SPI Slave Constants
|
| 107 |
////////////////////////////////////////////////
|
| 108 |
// Masks for controlling different peripherals
|
| 109 |
#define SPI_SS_AD9510 1 |
| 110 |
#define SPI_SS_AD9777 2 |
| 111 |
#define SPI_SS_RX_DAC 4 |
| 112 |
#define SPI_SS_RX_ADC 8 |
| 113 |
#define SPI_SS_RX_DB 16 |
| 114 |
#define SPI_SS_TX_DAC 32 |
| 115 |
#define SPI_SS_TX_ADC 64 |
| 116 |
#define SPI_SS_TX_DB 128 |
| 117 |
#define SPI_SS_ADS62P44 256 //for usrp2p |
| 118 |
|
| 119 |
/////////////////////////////////////////////////
|
| 120 |
// Misc Control
|
| 121 |
////////////////////////////////////////////////
|
| 122 |
#define U2_FLAG_MISC_CTRL_SERDES_ENABLE 8 |
| 123 |
#define U2_FLAG_MISC_CTRL_SERDES_PRBSEN 4 |
| 124 |
#define U2_FLAG_MISC_CTRL_SERDES_LOOPEN 2 |
| 125 |
#define U2_FLAG_MISC_CTRL_SERDES_RXEN 1 |
| 126 |
|
| 127 |
#define U2_FLAG_MISC_CTRL_ADC_ON 0x0F |
| 128 |
#define U2_FLAG_MISC_CTRL_ADC_OFF 0x00 |
| 129 |
|
| 130 |
/////////////////////////////////////////////////
|
| 131 |
// VITA49 64 bit time (write only)
|
| 132 |
////////////////////////////////////////////////
|
| 133 |
/*!
|
| 134 |
* \brief Time 64 flags
|
| 135 |
*
|
| 136 |
* <pre>
|
| 137 |
*
|
| 138 |
* 3 2 1
|
| 139 |
* 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
|
| 140 |
* +-----------------------------------------------------------+-+-+
|
| 141 |
* | |S|P|
|
| 142 |
* +-----------------------------------------------------------+-+-+
|
| 143 |
*
|
| 144 |
* P - PPS edge selection (0=negedge, 1=posedge, default=0)
|
| 145 |
* S - Source (0=sma, 1=mimo, 0=default)
|
| 146 |
*
|
| 147 |
* </pre>
|
| 148 |
*/
|
| 149 |
|
| 150 |
//pps flags (see above)
|
| 151 |
#define U2_FLAG_TIME64_PPS_NEGEDGE (0 << 0) |
| 152 |
#define U2_FLAG_TIME64_PPS_POSEDGE (1 << 0) |
| 153 |
#define U2_FLAG_TIME64_PPS_SMA (0 << 1) |
| 154 |
#define U2_FLAG_TIME64_PPS_MIMO (1 << 1) |
| 155 |
|
| 156 |
#define U2_FLAG_TIME64_LATCH_NOW 1 |
| 157 |
#define U2_FLAG_TIME64_LATCH_NEXT_PPS 0 |
| 158 |
|
| 159 |
/////////////////////////////////////////////////
|
| 160 |
// DSP TX Regs
|
| 161 |
////////////////////////////////////////////////
|
| 162 |
|
| 163 |
/*!
|
| 164 |
* \brief output mux configuration.
|
| 165 |
*
|
| 166 |
* <pre>
|
| 167 |
* 3 2 1
|
| 168 |
* 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
|
| 169 |
* +-------------------------------+-------+-------+-------+-------+
|
| 170 |
* | | DAC1 | DAC0 |
|
| 171 |
* +-------------------------------+-------+-------+-------+-------+
|
| 172 |
*
|
| 173 |
* There are N DUCs (1 now) with complex inputs and outputs.
|
| 174 |
* There are two DACs.
|
| 175 |
*
|
| 176 |
* Each 4-bit DACx field specifies the source for the DAC
|
| 177 |
* Each subfield is coded like this:
|
| 178 |
*
|
| 179 |
* 3 2 1 0
|
| 180 |
* +-------+
|
| 181 |
* | N |
|
| 182 |
* +-------+
|
| 183 |
*
|
| 184 |
* N specifies which DUC output is connected to this DAC.
|
| 185 |
*
|
| 186 |
* N which interp output
|
| 187 |
* --- -------------------
|
| 188 |
* 0 DUC 0 I
|
| 189 |
* 1 DUC 0 Q
|
| 190 |
* 2 DUC 1 I
|
| 191 |
* 3 DUC 1 Q
|
| 192 |
* F All Zeros
|
| 193 |
*
|
| 194 |
* The default value is 0x10
|
| 195 |
* </pre>
|
| 196 |
*/
|
| 197 |
|
| 198 |
|
| 199 |
/////////////////////////////////////////////////
|
| 200 |
// DSP RX Regs
|
| 201 |
////////////////////////////////////////////////
|
| 202 |
|
| 203 |
/*!
|
| 204 |
* \brief input mux configuration.
|
| 205 |
*
|
| 206 |
* This determines which ADC (or constant zero) is connected to
|
| 207 |
* each DDC input. There are N DDCs (1 now). Each has two inputs.
|
| 208 |
*
|
| 209 |
* <pre>
|
| 210 |
* Mux value:
|
| 211 |
*
|
| 212 |
* 3 2 1
|
| 213 |
* 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
|
| 214 |
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
| 215 |
* | |Q0 |I0 |
|
| 216 |
* +-------+-------+-------+-------+-------+-------+-------+-------+
|
| 217 |
*
|
| 218 |
* Each 2-bit I field is either 00 (A/D A), 01 (A/D B) or 1X (const zero)
|
| 219 |
* Each 2-bit Q field is either 00 (A/D A), 01 (A/D B) or 1X (const zero)
|
| 220 |
*
|
| 221 |
* The default value is 0x4
|
| 222 |
* </pre>
|
| 223 |
*/
|
| 224 |
|
| 225 |
////////////////////////////////////////////////
|
| 226 |
// GPIO, Slave 4
|
| 227 |
////////////////////////////////////////////////
|
| 228 |
|
| 229 |
// each 2-bit sel field is layed out this way
|
| 230 |
#define U2_FLAG_GPIO_SEL_GPIO 0 // if pin is an output, set by GPIO register |
| 231 |
#define U2_FLAG_GPIO_SEL_ATR 1 // if pin is an output, set by ATR logic |
| 232 |
#define U2_FLAG_GPIO_SEL_DEBUG_0 2 // if pin is an output, debug lines from FPGA fabric |
| 233 |
#define U2_FLAG_GPIO_SEL_DEBUG_1 3 // if pin is an output, debug lines from FPGA fabric |
| 234 |
|
| 235 |
///////////////////////////////////////////////////
|
| 236 |
// ATR Controller, Slave 11
|
| 237 |
////////////////////////////////////////////////
|
| 238 |
|
| 239 |
|
| 240 |
///////////////////////////////////////////////////
|
| 241 |
// RX CTRL regs
|
| 242 |
///////////////////////////////////////////////////
|
| 243 |
// The following 3 are logically a single command register.
|
| 244 |
// They are clocked into the underlying fifo when time_ticks is written.
|
| 245 |
//#define U2_REG_RX_CTRL_STREAM_CMD _SR_ADDR(SR_RX_CTRL + 0) // {now, chain, num_samples(30)
|
| 246 |
//#define U2_REG_RX_CTRL_TIME_SECS _SR_ADDR(SR_RX_CTRL + 1)
|
| 247 |
//#define U2_REG_RX_CTRL_TIME_TICKS _SR_ADDR(SR_RX_CTRL + 2)
|
| 248 |
|
| 249 |
//#define U2_REG_RX_CTRL_CLEAR_STATE _SR_ADDR(SR_RX_CTRL + 3)
|
| 250 |
//#define U2_REG_RX_CTRL_VRT_HEADER _SR_ADDR(SR_RX_CTRL + 4) // word 0 of packet. FPGA fills in packet counter
|
| 251 |
//#define U2_REG_RX_CTRL_VRT_STREAM_ID _SR_ADDR(SR_RX_CTRL + 5) // word 1 of packet.
|
| 252 |
//#define U2_REG_RX_CTRL_VRT_TRAILER _SR_ADDR(SR_RX_CTRL + 6)
|
| 253 |
//#define U2_REG_RX_CTRL_NSAMPS_PER_PKT _SR_ADDR(SR_RX_CTRL + 7)
|
| 254 |
//#define U2_REG_RX_CTRL_NCHANNELS _SR_ADDR(SR_RX_CTRL + 8) // 1 in basic case, up to 4 for vector sources
|
| 255 |
|
| 256 |
///////////////////////////////////////////////////
|
| 257 |
// TX CTRL regs
|
| 258 |
///////////////////////////////////////////////////
|
| 259 |
//#define U2_REG_TX_CTRL_NUM_CHAN _SR_ADDR(SR_TX_CTRL + 0)
|
| 260 |
//#define U2_REG_TX_CTRL_CLEAR_STATE _SR_ADDR(SR_TX_CTRL + 1)
|
| 261 |
//#define U2_REG_TX_CTRL_REPORT_SID _SR_ADDR(SR_TX_CTRL + 2)
|
| 262 |
//#define U2_REG_TX_CTRL_POLICY _SR_ADDR(SR_TX_CTRL + 3)
|
| 263 |
//#define U2_REG_TX_CTRL_CYCLES_PER_UP _SR_ADDR(SR_TX_CTRL + 4)
|
| 264 |
//#define U2_REG_TX_CTRL_PACKETS_PER_UP _SR_ADDR(SR_TX_CTRL + 5)
|
| 265 |
|
| 266 |
#define U2_FLAG_TX_CTRL_POLICY_WAIT (0x1 << 0) |
| 267 |
#define U2_FLAG_TX_CTRL_POLICY_NEXT_PACKET (0x1 << 1) |
| 268 |
#define U2_FLAG_TX_CTRL_POLICY_NEXT_BURST (0x1 << 2) |
| 269 |
|
| 270 |
//enable flag for registers: cycles and packets per update packet
|
| 271 |
#define U2_FLAG_TX_CTRL_UP_ENB (1ul << 31) |
| 272 |
|
| 273 |
#endif /* INCLUDED_USRP2_REGS_HPP */ |