Skip to content

Commit 24b07e1

Browse files
committed
usrp1: copy regs files into common and fix include paths
1 parent a08af5a commit 24b07e1

File tree

12 files changed

+393
-20
lines changed

12 files changed

+393
-20
lines changed

usrp1/common/fpga_regs_common.v

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
//
2+
// This file is machine generated from ./fpga_regs_common.h
3+
// Do not edit by hand; your edits will be overwritten.
4+
//
5+
6+
// This file defines registers common to all FPGA configurations.
7+
// Registers 0 to 31 are reserved for use in this file.
8+
9+
10+
// The FPGA needs to know the rate that samples are coming from and
11+
// going to the A/D's and D/A's. div = 128e6 / sample_rate
12+
13+
`define FR_TX_SAMPLE_RATE_DIV 7'd0
14+
`define FR_RX_SAMPLE_RATE_DIV 7'd1
15+
16+
// 2 and 3 are defined in the ATR section
17+
18+
`define FR_MASTER_CTRL 7'd4 // master enable and reset controls
19+
20+
// i/o direction registers for pins that go to daughterboards.
21+
// Setting the bit makes it an output from the FPGA to the d'board.
22+
// top 16 is mask, low 16 is value
23+
24+
`define FR_OE_0 7'd5 // slot 0
25+
`define FR_OE_1 7'd6
26+
`define FR_OE_2 7'd7
27+
`define FR_OE_3 7'd8
28+
29+
// i/o registers for pins that go to daughterboards.
30+
// top 16 is a mask, low 16 is value
31+
32+
`define FR_IO_0 7'd9 // slot 0
33+
`define FR_IO_1 7'd10
34+
`define FR_IO_2 7'd11
35+
`define FR_IO_3 7'd12
36+
37+
`define FR_MODE 7'd13
38+
39+
40+
// If the corresponding bit is set, internal FPGA debug circuitry
41+
// controls the i/o pins for the associated bank of daughterboard
42+
// i/o pins. Typically used for debugging FPGA designs.
43+
44+
`define FR_DEBUG_EN 7'd14
45+
46+
47+
// If the corresponding bit is set, enable the automatic DC
48+
// offset correction control loop.
49+
//
50+
// The 4 low bits are significant:
51+
//
52+
// ADC0 = (1 << 0)
53+
// ADC1 = (1 << 1)
54+
// ADC2 = (1 << 2)
55+
// ADC3 = (1 << 3)
56+
//
57+
// This control loop works if the attached daugherboard blocks DC.
58+
// Currently all daughterboards do block DC. This includes:
59+
// basic rx, dbs_rx, tv_rx, flex_xxx_rx.
60+
61+
`define FR_DC_OFFSET_CL_EN 7'd15 // DC Offset Control Loop Enable
62+
63+
64+
// offset corrections for ADC's and DAC's (2's complement)
65+
66+
`define FR_ADC_OFFSET_0 7'd16
67+
`define FR_ADC_OFFSET_1 7'd17
68+
`define FR_ADC_OFFSET_2 7'd18
69+
`define FR_ADC_OFFSET_3 7'd19
70+
71+
72+
// ------------------------------------------------------------------------
73+
// Automatic Transmit/Receive switching
74+
//
75+
// If automatic transmit/receive (ATR) switching is enabled in the
76+
// FR_ATR_CTL register, the presence or absence of data in the FPGA
77+
// transmit fifo selects between two sets of values for each of the 4
78+
// banks of daughterboard i/o pins.
79+
//
80+
// Each daughterboard slot has 3 16-bit registers associated with it:
81+
// FR_ATR_MASK_*, FR_ATR_TXVAL_* and FR_ATR_RXVAL_*
82+
//
83+
// FR_ATR_MASK_{0,1,2,3}:
84+
//
85+
// These registers determine which of the daugherboard i/o pins are
86+
// affected by ATR switching. If a bit in the mask is set, the
87+
// corresponding i/o bit is controlled by ATR, else it's output
88+
// value comes from the normal i/o pin output register:
89+
// FR_IO_{0,1,2,3}.
90+
//
91+
// FR_ATR_TXVAL_{0,1,2,3}:
92+
// FR_ATR_RXVAL_{0,1,2,3}:
93+
//
94+
// If the Tx fifo contains data, then the bits from TXVAL that are
95+
// selected by MASK are output. Otherwise, the bits from RXVAL that
96+
// are selected by MASK are output.
97+
98+
`define FR_ATR_MASK_0 7'd20 // slot 0
99+
`define FR_ATR_TXVAL_0 7'd21
100+
`define FR_ATR_RXVAL_0 7'd22
101+
102+
`define FR_ATR_MASK_1 7'd23 // slot 1
103+
`define FR_ATR_TXVAL_1 7'd24
104+
`define FR_ATR_RXVAL_1 7'd25
105+
106+
`define FR_ATR_MASK_2 7'd26 // slot 2
107+
`define FR_ATR_TXVAL_2 7'd27
108+
`define FR_ATR_RXVAL_2 7'd28
109+
110+
`define FR_ATR_MASK_3 7'd29 // slot 3
111+
`define FR_ATR_TXVAL_3 7'd30
112+
`define FR_ATR_RXVAL_3 7'd31
113+
114+
// Clock ticks to delay rising and falling edge of T/R signal
115+
`define FR_ATR_TX_DELAY 7'd2
116+
`define FR_ATR_RX_DELAY 7'd3
117+

usrp1/common/fpga_regs_standard.v

Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,256 @@
1+
//
2+
// This file is machine generated from ./fpga_regs_standard.h
3+
// Do not edit by hand; your edits will be overwritten.
4+
//
5+
6+
// Register numbers 0 to 31 are reserved for use in fpga_regs_common.h.
7+
// Registers 64 to 79 are available for custom FPGA builds.
8+
9+
10+
// DDC / DUC
11+
12+
`define FR_INTERP_RATE 7'd32 // [1,1024]
13+
`define FR_DECIM_RATE 7'd33 // [1,256]
14+
15+
// DDC center freq
16+
17+
`define FR_RX_FREQ_0 7'd34
18+
`define FR_RX_FREQ_1 7'd35
19+
`define FR_RX_FREQ_2 7'd36
20+
`define FR_RX_FREQ_3 7'd37
21+
22+
// See below for DDC Starting Phase
23+
24+
// ------------------------------------------------------------------------
25+
// configure FPGA Rx mux
26+
//
27+
// 3 2 1
28+
// 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
29+
// +-----------------------+-------+-------+-------+-------+-+-----+
30+
// | must be zero | Q3| I3| Q2| I2| Q1| I1| Q0| I0|Z| NCH |
31+
// +-----------------------+-------+-------+-------+-------+-+-----+
32+
//
33+
// There are a maximum of 4 digital downconverters in the the FPGA.
34+
// Each DDC has two 16-bit inputs, I and Q, and two 16-bit outputs, I & Q.
35+
//
36+
// DDC I inputs are specified by the two bit fields I3, I2, I1 & I0
37+
//
38+
// 0 = DDC input is from ADC 0
39+
// 1 = DDC input is from ADC 1
40+
// 2 = DDC input is from ADC 2
41+
// 3 = DDC input is from ADC 3
42+
//
43+
// If Z == 1, all DDC Q inputs are set to zero
44+
// If Z == 0, DDC Q inputs are specified by the two bit fields Q3, Q2, Q1 & Q0
45+
//
46+
// NCH specifies the number of complex channels that are sent across
47+
// the USB. The legal values are 1, 2 or 4, corresponding to 2, 4 or
48+
// 8 16-bit values.
49+
50+
`define FR_RX_MUX 7'd38
51+
52+
// ------------------------------------------------------------------------
53+
// configure FPGA Tx Mux.
54+
//
55+
// 3 2 1
56+
// 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
57+
// +-----------------------+-------+-------+-------+-------+-+-----+
58+
// | | DAC3 | DAC2 | DAC1 | DAC0 |0| NCH |
59+
// +-----------------------------------------------+-------+-+-----+
60+
//
61+
// NCH specifies the number of complex channels that are sent across
62+
// the USB. The legal values are 1 or 2, corresponding to 2 or 4
63+
// 16-bit values.
64+
//
65+
// There are two interpolators with complex inputs and outputs.
66+
// There are four DACs. (We use the DUC in each AD9862.)
67+
//
68+
// Each 4-bit DACx field specifies the source for the DAC and
69+
// whether or not that DAC is enabled. Each subfield is coded
70+
// like this:
71+
//
72+
// 3 2 1 0
73+
// +-+-----+
74+
// |E| N |
75+
// +-+-----+
76+
//
77+
// Where E is set if the DAC is enabled, and N specifies which
78+
// interpolator output is connected to this DAC.
79+
//
80+
// N which interp output
81+
// --- -------------------
82+
// 0 chan 0 I
83+
// 1 chan 0 Q
84+
// 2 chan 1 I
85+
// 3 chan 1 Q
86+
87+
`define FR_TX_MUX 7'd39
88+
89+
// ------------------------------------------------------------------------
90+
// REFCLK control
91+
//
92+
// Control whether a reference clock is sent to the daughterboards,
93+
// and what frequency. The refclk is sent on d'board i/o pin 0.
94+
//
95+
// 3 2 1
96+
// 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
97+
// +-----------------------------------------------+-+------------+
98+
// | Reserved (Must be zero) |E| DIVISOR |
99+
// +-----------------------------------------------+-+------------+
100+
101+
//
102+
// Bit 7 -- 1 turns on refclk, 0 allows IO use
103+
// Bits 6:0 Divider value
104+
105+
`define FR_TX_A_REFCLK 7'd40
106+
`define FR_RX_A_REFCLK 7'd41
107+
`define FR_TX_B_REFCLK 7'd42
108+
`define FR_RX_B_REFCLK 7'd43
109+
110+
111+
// ------------------------------------------------------------------------
112+
// DDC Starting Phase
113+
114+
`define FR_RX_PHASE_0 7'd44
115+
`define FR_RX_PHASE_1 7'd45
116+
`define FR_RX_PHASE_2 7'd46
117+
`define FR_RX_PHASE_3 7'd47
118+
119+
// ------------------------------------------------------------------------
120+
// Tx data format control register
121+
//
122+
// 3 2 1
123+
// 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
124+
// +-------------------------------------------------------+-------+
125+
// | Reserved (Must be zero) | FMT |
126+
// +-------------------------------------------------------+-------+
127+
//
128+
// FMT values:
129+
130+
`define FR_TX_FORMAT 7'd48
131+
132+
// ------------------------------------------------------------------------
133+
// Rx data format control register
134+
//
135+
// 3 2 1
136+
// 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
137+
// +-----------------------------------------+-+-+---------+-------+
138+
// | Reserved (Must be zero) |B|Q| WIDTH | SHIFT |
139+
// +-----------------------------------------+-+-+---------+-------+
140+
//
141+
// FMT values:
142+
143+
`define FR_RX_FORMAT 7'd49
144+
145+
146+
// The valid combinations currently are:
147+
//
148+
// B Q WIDTH SHIFT
149+
// 0 1 16 0
150+
// 0 1 8 8
151+
152+
153+
// Possible future values of WIDTH = {4, 2, 1}
154+
// 12 takes a bit more work, since we need to know packet alignment.
155+
156+
// ------------------------------------------------------------------------
157+
// FIXME register numbers 50 to 63 are available
158+
159+
// ------------------------------------------------------------------------
160+
// Registers 64 to 95 are reserved for user custom FPGA builds.
161+
// The standard USRP software will not touch these.
162+
163+
`define FR_USER_0 7'd64
164+
`define FR_USER_1 7'd65
165+
`define FR_USER_2 7'd66
166+
`define FR_USER_3 7'd67
167+
`define FR_USER_4 7'd68
168+
`define FR_USER_5 7'd69
169+
`define FR_USER_6 7'd70
170+
`define FR_USER_7 7'd71
171+
`define FR_USER_8 7'd72
172+
`define FR_USER_9 7'd73
173+
`define FR_USER_10 7'd74
174+
`define FR_USER_11 7'd75
175+
`define FR_USER_12 7'd76
176+
`define FR_USER_13 7'd77
177+
`define FR_USER_14 7'd78
178+
`define FR_USER_15 7'd79
179+
`define FR_USER_16 7'd80
180+
`define FR_USER_17 7'd81
181+
`define FR_USER_18 7'd82
182+
`define FR_USER_19 7'd83
183+
`define FR_USER_20 7'd84
184+
`define FR_USER_21 7'd85
185+
`define FR_USER_22 7'd86
186+
`define FR_USER_23 7'd87
187+
`define FR_USER_24 7'd88
188+
`define FR_USER_25 7'd89
189+
`define FR_USER_26 7'd90
190+
`define FR_USER_27 7'd91
191+
`define FR_USER_28 7'd92
192+
`define FR_USER_29 7'd93
193+
`define FR_USER_30 7'd94
194+
`define FR_USER_31 7'd95
195+
196+
//Registers needed for multi usrp master/slave configuration
197+
//
198+
//Rx Master/slave control register (FR_RX_MASTER_SLAVE = FR_USER_0)
199+
//
200+
`define FR_RX_MASTER_SLAVE 7'd64
201+
`define bitnoFR_RX_SYNC 0
202+
`define bitnoFR_RX_SYNC_MASTER 1
203+
`define bitnoFR_RX_SYNC_SLAVE 2
204+
205+
206+
//Caution The master settings will output values on the io lines.
207+
//They inheritely enable these lines as output. If you have a daughtercard which uses these lines also as output then you will burn your usrp and daughtercard.
208+
//If you set the slave bits then your usrp won't do anything if you don't connect a master.
209+
// Rx Master/slave control register
210+
//
211+
// The way this is supposed to be used is connecting a (short) 16pin flatcable from an rx daughterboard in RXA master io_rx[8..15] to slave io_rx[8..15] on RXA of slave usrp
212+
// This can be done with basic_rx boards or dbsrx boards
213+
//dbsrx: connect master-J25 to slave-J25
214+
//basic rx: connect J25 to slave-J25
215+
//CAUTION: pay attention to the lineup of your connector.
216+
//The red line (pin1) should be at the same side of the daughterboards on master and slave.
217+
//If you turnaround the cable on one end you will burn your usrp.
218+
219+
//You cannot use a 16pin flatcable if you are using FLEX400 or FLEX2400 daughterboards, since these use a lot of the io pins.
220+
//You can still link them but you must use only a 2pin or 1pin cable
221+
//You can also use a 2-wire link. put a 2pin header on io[15],gnd of the master RXA daughterboard and connect it to io15,gnd of the slave RXA db.
222+
//You can use a cable like the ones found with the leds on the mainbord of a PC.
223+
//Make sure you don't twist the cable, otherwise you connect the sync output to ground.
224+
//To be save you could also just use a single wire from master io[15] to slave io[15], but this is not optimal for signal integrity.
225+
226+
227+
// Since rx_io[0] can normally be used as a refclk and is not exported on all daughterboards this line
228+
// still has the refclk function if you use the master/slave setup (it is not touched by the master/slave settings).
229+
// The master/slave circuitry will only use io pin 15 and does not touch any of the other io pins.
230+
`define bitnoFR_RX_SYNC_INPUT_IOPIN 15
231+
`define bmFR_RX_SYNC_INPUT_IOPIN (1<<bitnoFR_RX_SYNC_INPUT_IOPIN)
232+
//TODO the output pin is still hardcoded in the verilog code, make it listen to the following define
233+
`define bitnoFR_RX_SYNC_OUTPUT_IOPIN 15
234+
`define bmFR_RX_SYNC_OUTPUT_IOPIN (1<<bitnoFR_RX_SYNC_OUTPUT_IOPIN)
235+
// =======================================================================
236+
// READBACK Registers
237+
// =======================================================================
238+
239+
`define FR_RB_IO_RX_A_IO_TX_A 7'd1 // read back a-side i/o pins
240+
`define FR_RB_IO_RX_B_IO_TX_B 7'd2 // read back b-side i/o pins
241+
242+
// ------------------------------------------------------------------------
243+
// FPGA Capability register
244+
//
245+
// 3 2 1
246+
// 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
247+
// +-----------------------------------------------+-+-----+-+-----+
248+
// | Reserved (Must be zero) |T|NDUC |R|NDDC |
249+
// +-----------------------------------------------+-+-----+-+-----+
250+
//
251+
// Bottom 4-bits are Rx capabilities
252+
// Next 4-bits are Tx capabilities
253+
254+
`define FR_RB_CAPS 7'd3
255+
256+

usrp1/inband_lib/rx_buffer_inband.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//`include "../../firmware/include/fpga_regs_common.v"
2-
//`include "../../firmware/include/fpga_regs_standard.v"
1+
//`include "../common/fpga_regs_common.v"
2+
//`include "../common/fpga_regs_standard.v"
33
module rx_buffer_inband
44
( input usbclk,
55
input bus_reset,

usrp1/sdr_lib/adc_interface.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22

3-
`include "../../firmware/include/fpga_regs_common.v"
4-
`include "../../firmware/include/fpga_regs_standard.v"
3+
`include "../common/fpga_regs_common.v"
4+
`include "../common/fpga_regs_standard.v"
55

66
module adc_interface
77
(input clock, input reset, input enable,

0 commit comments

Comments
 (0)