root / host / lib / usrp / usrp2 / usrp2_regs.hpp @ fb1f8e1a
History | View | Annotate | Download (8.6 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 |
////////////////////////////////////////////////////
|
| 22 |
// Settings Bus, Slave #7, Not Byte Addressable!
|
| 23 |
//
|
| 24 |
// Output-only from processor point-of-view.
|
| 25 |
// 1KB of address space (== 256 32-bit write-only regs)
|
| 26 |
|
| 27 |
|
| 28 |
#define MISC_OUTPUT_BASE 0xD400 |
| 29 |
//#define TX_PROTOCOL_ENGINE_BASE 0xD480
|
| 30 |
//#define RX_PROTOCOL_ENGINE_BASE 0xD4C0
|
| 31 |
//#define BUFFER_POOL_CTRL_BASE 0xD500
|
| 32 |
//#define LAST_SETTING_REG 0xD7FC // last valid setting register
|
| 33 |
|
| 34 |
#define SR_MISC 0 |
| 35 |
#define SR_TX_PROT_ENG 32 |
| 36 |
#define SR_RX_PROT_ENG 48 |
| 37 |
#define SR_BUFFER_POOL_CTRL 64 |
| 38 |
#define SR_UDP_SM 96 |
| 39 |
#define SR_TX_DSP 208 |
| 40 |
#define SR_TX_CTRL 224 |
| 41 |
#define SR_RX_DSP 160 |
| 42 |
#define SR_RX_CTRL 176 |
| 43 |
#define SR_TIME64 192 |
| 44 |
#define SR_SIMTIMER 198 |
| 45 |
#define SR_LAST 255 |
| 46 |
|
| 47 |
#define _SR_ADDR(sr) ((MISC_OUTPUT_BASE) + (4*(sr))) |
| 48 |
|
| 49 |
/////////////////////////////////////////////////
|
| 50 |
// SPI Slave Constants
|
| 51 |
////////////////////////////////////////////////
|
| 52 |
// Masks for controlling different peripherals
|
| 53 |
#define SPI_SS_AD9510 1 |
| 54 |
#define SPI_SS_AD9777 2 |
| 55 |
#define SPI_SS_RX_DAC 4 |
| 56 |
#define SPI_SS_RX_ADC 8 |
| 57 |
#define SPI_SS_RX_DB 16 |
| 58 |
#define SPI_SS_TX_DAC 32 |
| 59 |
#define SPI_SS_TX_ADC 64 |
| 60 |
#define SPI_SS_TX_DB 128 |
| 61 |
|
| 62 |
/////////////////////////////////////////////////
|
| 63 |
// Misc Control
|
| 64 |
////////////////////////////////////////////////
|
| 65 |
#define U2_REG_MISC_CTRL_CLOCK _SR_ADDR(0) |
| 66 |
#define U2_REG_MISC_CTRL_SERDES _SR_ADDR(1) |
| 67 |
#define U2_REG_MISC_CTRL_ADC _SR_ADDR(2) |
| 68 |
#define U2_REG_MISC_CTRL_LEDS _SR_ADDR(3) |
| 69 |
#define U2_REG_MISC_CTRL_PHY _SR_ADDR(4) // LSB is reset line to eth phy |
| 70 |
#define U2_REG_MISC_CTRL_DBG_MUX _SR_ADDR(5) |
| 71 |
#define U2_REG_MISC_CTRL_RAM_PAGE _SR_ADDR(6) // FIXME should go somewhere else... |
| 72 |
#define U2_REG_MISC_CTRL_FLUSH_ICACHE _SR_ADDR(7) // Flush the icache |
| 73 |
#define U2_REG_MISC_CTRL_LED_SRC _SR_ADDR(8) // HW or SW control for LEDs |
| 74 |
|
| 75 |
#define U2_FLAG_MISC_CTRL_SERDES_ENABLE 8 |
| 76 |
#define U2_FLAG_MISC_CTRL_SERDES_PRBSEN 4 |
| 77 |
#define U2_FLAG_MISC_CTRL_SERDES_LOOPEN 2 |
| 78 |
#define U2_FLAG_MISC_CTRL_SERDES_RXEN 1 |
| 79 |
|
| 80 |
#define U2_FLAG_MISC_CTRL_ADC_ON 0x0F |
| 81 |
#define U2_FLAG_MISC_CTRL_ADC_OFF 0x00 |
| 82 |
|
| 83 |
/////////////////////////////////////////////////
|
| 84 |
// VITA49 64 bit time (write only)
|
| 85 |
////////////////////////////////////////////////
|
| 86 |
/*!
|
| 87 |
* \brief Time 64 flags
|
| 88 |
*
|
| 89 |
* <pre>
|
| 90 |
*
|
| 91 |
* 3 2 1
|
| 92 |
* 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
|
| 93 |
* +-----------------------------------------------------------+-+-+
|
| 94 |
* | |S|P|
|
| 95 |
* +-----------------------------------------------------------+-+-+
|
| 96 |
*
|
| 97 |
* P - PPS edge selection (0=negedge, 1=posedge, default=0)
|
| 98 |
* S - Source (0=sma, 1=mimo, 0=default)
|
| 99 |
*
|
| 100 |
* </pre>
|
| 101 |
*/
|
| 102 |
#define U2_REG_TIME64_SECS _SR_ADDR(SR_TIME64 + 0) // value to set absolute secs to on next PPS |
| 103 |
#define U2_REG_TIME64_TICKS _SR_ADDR(SR_TIME64 + 1) // value to set absolute ticks to on next PPS |
| 104 |
#define U2_REG_TIME64_FLAGS _SR_ADDR(SR_TIME64 + 2) // flags - see chart above |
| 105 |
#define U2_REG_TIME64_IMM _SR_ADDR(SR_TIME64 + 3) // set immediate (0=latch on next pps, 1=latch immediate, default=0) |
| 106 |
#define U2_REG_TIME64_TPS _SR_ADDR(SR_TIME64 + 4) // the ticks per second rollover count |
| 107 |
|
| 108 |
#define U2_REG_TIME64_SECS_RB (0xCC00 + 4*10) |
| 109 |
#define U2_REG_TIME64_TICKS_RB (0xCC00 + 4*11) |
| 110 |
#define U2_REG_COMPAT_NUM_RB (0xCC00 + 4*12) |
| 111 |
|
| 112 |
//pps flags (see above)
|
| 113 |
#define U2_FLAG_TIME64_PPS_NEGEDGE (0 << 0) |
| 114 |
#define U2_FLAG_TIME64_PPS_POSEDGE (1 << 0) |
| 115 |
#define U2_FLAG_TIME64_PPS_SMA (0 << 1) |
| 116 |
#define U2_FLAG_TIME64_PPS_MIMO (1 << 1) |
| 117 |
|
| 118 |
#define U2_FLAG_TIME64_LATCH_NOW 1 |
| 119 |
#define U2_FLAG_TIME64_LATCH_NEXT_PPS 0 |
| 120 |
|
| 121 |
/////////////////////////////////////////////////
|
| 122 |
// DSP TX Regs
|
| 123 |
////////////////////////////////////////////////
|
| 124 |
#define U2_REG_DSP_TX_FREQ _SR_ADDR(SR_TX_DSP + 0) |
| 125 |
#define U2_REG_DSP_TX_SCALE_IQ _SR_ADDR(SR_TX_DSP + 1) // {scale_i,scale_q} |
| 126 |
#define U2_REG_DSP_TX_INTERP_RATE _SR_ADDR(SR_TX_DSP + 2) |
| 127 |
#define U2_REG_DSP_TX_MUX _SR_ADDR(SR_TX_DSP + 4) |
| 128 |
|
| 129 |
/////////////////////////////////////////////////
|
| 130 |
// DSP RX Regs
|
| 131 |
////////////////////////////////////////////////
|
| 132 |
#define U2_REG_DSP_RX_FREQ _SR_ADDR(SR_RX_DSP + 0) |
| 133 |
#define U2_REG_DSP_RX_SCALE_IQ _SR_ADDR(SR_RX_DSP + 1) // {scale_i,scale_q} |
| 134 |
#define U2_REG_DSP_RX_DECIM_RATE _SR_ADDR(SR_RX_DSP + 2) |
| 135 |
#define U2_REG_DSP_RX_DCOFFSET_I _SR_ADDR(SR_RX_DSP + 3) // Bit 31 high sets fixed offset mode, using lower 14 bits, |
| 136 |
// otherwise it is automatic
|
| 137 |
#define U2_REG_DSP_RX_DCOFFSET_Q _SR_ADDR(SR_RX_DSP + 4) // Bit 31 high sets fixed offset mode, using lower 14 bits |
| 138 |
#define U2_REG_DSP_RX_MUX _SR_ADDR(SR_RX_DSP + 5) // called adc_mux in dsp_core_rx.v |
| 139 |
|
| 140 |
////////////////////////////////////////////////
|
| 141 |
// GPIO, Slave 4
|
| 142 |
////////////////////////////////////////////////
|
| 143 |
//
|
| 144 |
// These go to the daughterboard i/o pins
|
| 145 |
//
|
| 146 |
#define U2_REG_GPIO_BASE 0xC800 |
| 147 |
|
| 148 |
#define U2_REG_GPIO_IO U2_REG_GPIO_BASE + 0 // 32 bits, gpio io pins (tx high 16 bits, rx low 16 bits) |
| 149 |
#define U2_REG_GPIO_DDR U2_REG_GPIO_BASE + 4 // 32 bits, gpio ddr, 1 means output (tx high 16 bits, rx low 16 bits) |
| 150 |
#define U2_REG_GPIO_TX_SEL U2_REG_GPIO_BASE + 8 // 16 2-bit fields select which source goes to TX DB |
| 151 |
#define U2_REG_GPIO_RX_SEL U2_REG_GPIO_BASE + 12 // 16 2-bit fields select which source goes to RX DB |
| 152 |
|
| 153 |
// each 2-bit sel field is layed out this way
|
| 154 |
#define U2_FLAG_GPIO_SEL_GPIO 0 // if pin is an output, set by GPIO register |
| 155 |
#define U2_FLAG_GPIO_SEL_ATR 1 // if pin is an output, set by ATR logic |
| 156 |
#define U2_FLAG_GPIO_SEL_DEBUG_0 2 // if pin is an output, debug lines from FPGA fabric |
| 157 |
#define U2_FLAG_GPIO_SEL_DEBUG_1 3 // if pin is an output, debug lines from FPGA fabric |
| 158 |
|
| 159 |
///////////////////////////////////////////////////
|
| 160 |
// ATR Controller, Slave 11
|
| 161 |
////////////////////////////////////////////////
|
| 162 |
#define U2_REG_ATR_BASE 0xE400 |
| 163 |
|
| 164 |
#define U2_REG_ATR_IDLE_TXSIDE U2_REG_ATR_BASE + 0 |
| 165 |
#define U2_REG_ATR_IDLE_RXSIDE U2_REG_ATR_BASE + 2 |
| 166 |
#define U2_REG_ATR_INTX_TXSIDE U2_REG_ATR_BASE + 4 |
| 167 |
#define U2_REG_ATR_INTX_RXSIDE U2_REG_ATR_BASE + 6 |
| 168 |
#define U2_REG_ATR_INRX_TXSIDE U2_REG_ATR_BASE + 8 |
| 169 |
#define U2_REG_ATR_INRX_RXSIDE U2_REG_ATR_BASE + 10 |
| 170 |
#define U2_REG_ATR_FULL_TXSIDE U2_REG_ATR_BASE + 12 |
| 171 |
#define U2_REG_ATR_FULL_RXSIDE U2_REG_ATR_BASE + 14 |
| 172 |
|
| 173 |
///////////////////////////////////////////////////
|
| 174 |
// RX CTRL regs
|
| 175 |
///////////////////////////////////////////////////
|
| 176 |
// The following 3 are logically a single command register.
|
| 177 |
// They are clocked into the underlying fifo when time_ticks is written.
|
| 178 |
#define U2_REG_RX_CTRL_STREAM_CMD _SR_ADDR(SR_RX_CTRL + 0) // {now, chain, num_samples(30) |
| 179 |
#define U2_REG_RX_CTRL_TIME_SECS _SR_ADDR(SR_RX_CTRL + 1) |
| 180 |
#define U2_REG_RX_CTRL_TIME_TICKS _SR_ADDR(SR_RX_CTRL + 2) |
| 181 |
|
| 182 |
#define U2_REG_RX_CTRL_CLEAR_OVERRUN _SR_ADDR(SR_RX_CTRL + 3) // write anything to clear overrun |
| 183 |
#define U2_REG_RX_CTRL_VRT_HEADER _SR_ADDR(SR_RX_CTRL + 4) // word 0 of packet. FPGA fills in packet counter |
| 184 |
#define U2_REG_RX_CTRL_VRT_STREAM_ID _SR_ADDR(SR_RX_CTRL + 5) // word 1 of packet. |
| 185 |
#define U2_REG_RX_CTRL_VRT_TRAILER _SR_ADDR(SR_RX_CTRL + 6) |
| 186 |
#define U2_REG_RX_CTRL_NSAMPS_PER_PKT _SR_ADDR(SR_RX_CTRL + 7) |
| 187 |
#define U2_REG_RX_CTRL_NCHANNELS _SR_ADDR(SR_RX_CTRL + 8) // 1 in basic case, up to 4 for vector sources |
| 188 |
|
| 189 |
///////////////////////////////////////////////////
|
| 190 |
// TX CTRL regs
|
| 191 |
///////////////////////////////////////////////////
|
| 192 |
#define U2_REG_TX_CTRL_NUM_CHAN _SR_ADDR(SR_TX_CTRL + 0) |
| 193 |
#define U2_REG_TX_CTRL_CLEAR_STATE _SR_ADDR(SR_TX_CTRL + 1) |
| 194 |
#define U2_REG_TX_CTRL_REPORT_SID _SR_ADDR(SR_TX_CTRL + 2) |
| 195 |
#define U2_REG_TX_CTRL_POLICY _SR_ADDR(SR_TX_CTRL + 3) |
| 196 |
|
| 197 |
#define U2_FLAG_TX_CTRL_POLICY_WAIT (0x1 << 0) |
| 198 |
#define U2_FLAG_TX_CTRL_POLICY_NEXT_PACKET (0x1 << 1) |
| 199 |
#define U2_FLAG_TX_CTRL_POLICY_NEXT_BURST (0x1 << 2) |
| 200 |
|
| 201 |
#endif /* INCLUDED_USRP2_REGS_HPP */ |