GNU Radio 3.4.2 C++ API
fpga_regs_standard.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2003,2004,2006 Free Software Foundation, Inc.
00004  * 
00005  * This file is part of GNU Radio
00006  * 
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 3, or (at your option)
00010  * any later version.
00011  * 
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 51 Franklin Street,
00020  * Boston, MA 02110-1301, USA.
00021  */
00022 #ifndef INCLUDED_FPGA_REGS_STANDARD_H
00023 #define INCLUDED_FPGA_REGS_STANDARD_H
00024 
00025 // Register numbers 0 to 31 are reserved for use in fpga_regs_common.h.
00026 // Registers 64 to 79 are available for custom FPGA builds.
00027 
00028 
00029 // DDC / DUC
00030 
00031 #define FR_INTERP_RATE          32      // [1,1024]
00032 #define FR_DECIM_RATE           33      // [1,256]
00033 
00034 // DDC center freq
00035 
00036 #define FR_RX_FREQ_0            34
00037 #define FR_RX_FREQ_1            35
00038 #define FR_RX_FREQ_2            36
00039 #define FR_RX_FREQ_3            37
00040 
00041 // See below for DDC Starting Phase
00042 
00043 // ------------------------------------------------------------------------
00044 //  configure FPGA Rx mux
00045 //
00046 //    3                   2                   1                       
00047 //  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
00048 // +-----------------------+-------+-------+-------+-------+-+-----+
00049 // |      must be zero     | Q3| I3| Q2| I2| Q1| I1| Q0| I0|Z| NCH |
00050 // +-----------------------+-------+-------+-------+-------+-+-----+
00051 //
00052 // There are a maximum of 4 digital downconverters in the the FPGA.
00053 // Each DDC has two 16-bit inputs, I and Q, and two 16-bit outputs, I & Q.
00054 //
00055 // DDC I inputs are specified by the two bit fields I3, I2, I1 & I0
00056 //
00057 //   0 = DDC input is from ADC 0
00058 //   1 = DDC input is from ADC 1
00059 //   2 = DDC input is from ADC 2
00060 //   3 = DDC input is from ADC 3
00061 //
00062 // If Z == 1, all DDC Q inputs are set to zero
00063 // If Z == 0, DDC Q inputs are specified by the two bit fields Q3, Q2, Q1 & Q0
00064 //
00065 // NCH specifies the number of complex channels that are sent across
00066 // the USB.  The legal values are 1, 2 or 4, corresponding to 2, 4 or
00067 // 8 16-bit values.
00068 
00069 #define FR_RX_MUX               38
00070 
00071 // ------------------------------------------------------------------------
00072 //  configure FPGA Tx Mux.
00073 //
00074 //    3                   2                   1                       
00075 //  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
00076 // +-----------------------+-------+-------+-------+-------+-+-----+
00077 // |                       | DAC3  | DAC2  | DAC1  |  DAC0 |0| NCH |
00078 // +-----------------------------------------------+-------+-+-----+
00079 //
00080 // NCH specifies the number of complex channels that are sent across
00081 // the USB.  The legal values are 1 or 2, corresponding to 2 or 4
00082 // 16-bit values.
00083 //
00084 // There are two interpolators with complex inputs and outputs.
00085 // There are four DACs.  (We use the DUC in each AD9862.)
00086 //
00087 // Each 4-bit DACx field specifies the source for the DAC and
00088 // whether or not that DAC is enabled.  Each subfield is coded
00089 // like this: 
00090 //
00091 //    3 2 1 0
00092 //   +-+-----+
00093 //   |E|  N  |
00094 //   +-+-----+
00095 //
00096 // Where E is set if the DAC is enabled, and N specifies which
00097 // interpolator output is connected to this DAC.
00098 //
00099 //  N   which interp output
00100 // ---  -------------------
00101 //  0   chan 0 I
00102 //  1   chan 0 Q
00103 //  2   chan 1 I
00104 //  3   chan 1 Q
00105 
00106 #define FR_TX_MUX               39
00107 
00108 // ------------------------------------------------------------------------
00109 // REFCLK control
00110 //
00111 // Control whether a reference clock is sent to the daughterboards,
00112 // and what frequency.  The refclk is sent on d'board i/o pin 0.
00113 //
00114 //    3                   2                   1                       
00115 //  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
00116 // +-----------------------------------------------+-+------------+
00117 // |             Reserved (Must be zero)           |E|   DIVISOR  |
00118 // +-----------------------------------------------+-+------------+
00119 
00120 //
00121 // Bit 7  -- 1 turns on refclk, 0 allows IO use
00122 // Bits 6:0 Divider value
00123 
00124 #define FR_TX_A_REFCLK          40
00125 #define FR_RX_A_REFCLK          41
00126 #define FR_TX_B_REFCLK          42
00127 #define FR_RX_B_REFCLK          43
00128 
00129 #  define bmFR_REFCLK_EN           0x80
00130 #  define bmFR_REFCLK_DIVISOR_MASK 0x7f
00131 
00132 // ------------------------------------------------------------------------
00133 // DDC Starting Phase
00134 
00135 #define FR_RX_PHASE_0           44
00136 #define FR_RX_PHASE_1           45
00137 #define FR_RX_PHASE_2           46
00138 #define FR_RX_PHASE_3           47
00139 
00140 // ------------------------------------------------------------------------
00141 // Tx data format control register
00142 //
00143 //    3                   2                   1                       
00144 //  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
00145 // +-------------------------------------------------------+-------+
00146 // |                    Reserved (Must be zero)            |  FMT  |
00147 // +-------------------------------------------------------+-------+
00148 //
00149 //  FMT values:
00150 
00151 #define FR_TX_FORMAT            48
00152 #  define bmFR_TX_FORMAT_16_IQ          0       // 16-bit I, 16-bit Q
00153 
00154 // ------------------------------------------------------------------------
00155 // Rx data format control register
00156 //
00157 //    3                   2                   1                       
00158 //  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
00159 // +-----------------------------------------+-+-+---------+-------+
00160 // |          Reserved (Must be zero)        |B|Q|  WIDTH  | SHIFT |
00161 // +-----------------------------------------+-+-+---------+-------+
00162 //
00163 //  FMT values:
00164 
00165 #define FR_RX_FORMAT            49
00166 
00167 #  define bmFR_RX_FORMAT_SHIFT_MASK     (0x0f <<  0)    // arithmetic right shift [0, 15]
00168 #  define bmFR_RX_FORMAT_SHIFT_SHIFT    0
00169 #  define bmFR_RX_FORMAT_WIDTH_MASK     (0x1f <<  4)    // data width in bits [1, 16] (not all valid)
00170 #  define bmFR_RX_FORMAT_WIDTH_SHIFT    4
00171 #  define bmFR_RX_FORMAT_WANT_Q         (0x1  <<  9)    // deliver both I & Q, else just I
00172 #  define bmFR_RX_FORMAT_BYPASS_HB      (0x1  << 10)    // bypass half-band filter
00173 
00174 // The valid combinations currently are:
00175 //
00176 //   B  Q  WIDTH  SHIFT
00177 //   0  1    16     0
00178 //   0  1     8     8
00179 
00180 
00181 // Possible future values of WIDTH = {4, 2, 1}
00182 // 12 takes a bit more work, since we need to know packet alignment.
00183 
00184 // ------------------------------------------------------------------------
00185 // FIXME register numbers 50 to 63 are available
00186 
00187 // ------------------------------------------------------------------------
00188 // Registers 64 to 95 are reserved for user custom FPGA builds.
00189 // The standard USRP software will not touch these.
00190 
00191 #define FR_USER_0       64
00192 #define FR_USER_1       65
00193 #define FR_USER_2       66
00194 #define FR_USER_3       67
00195 #define FR_USER_4       68
00196 #define FR_USER_5       69
00197 #define FR_USER_6       70
00198 #define FR_USER_7       71
00199 #define FR_USER_8       72
00200 #define FR_USER_9       73
00201 #define FR_USER_10      74
00202 #define FR_USER_11      75
00203 #define FR_USER_12      76
00204 #define FR_USER_13      77
00205 #define FR_USER_14      78
00206 #define FR_USER_15      79
00207 #define FR_USER_16      80
00208 #define FR_USER_17      81
00209 #define FR_USER_18      82
00210 #define FR_USER_19      83
00211 #define FR_USER_20      84
00212 #define FR_USER_21      85
00213 #define FR_USER_22      86
00214 #define FR_USER_23      87
00215 #define FR_USER_24      88
00216 #define FR_USER_25      89
00217 #define FR_USER_26      90
00218 #define FR_USER_27      91
00219 #define FR_USER_28      92
00220 #define FR_USER_29      93
00221 #define FR_USER_30      94
00222 #define FR_USER_31      95
00223 
00224 //Registers needed for multi usrp master/slave configuration
00225 //
00226 //Rx Master/slave control register (FR_RX_MASTER_SLAVE = FR_USER_0)
00227 //
00228 #define FR_RX_MASTER_SLAVE              64
00229 #define bitnoFR_RX_SYNC                 0
00230 #define bitnoFR_RX_SYNC_MASTER          1
00231 #define bitnoFR_RX_SYNC_SLAVE           2
00232 #  define bmFR_RX_SYNC          (1 <<bitnoFR_RX_SYNC) //1 If this is a master "sync now" and send sync to slave.
00233                                                       //  If this is a slave "sync now" (testing purpose only)
00234                                                       //  Sync is allmost the same as reset (clear all counters and buffers) 
00235                                                       //  except that the io outputs and settings don't get reset (otherwise it couldn't send the sync to the slave)
00236                                                       //0 Normal operation
00237 
00238 #  define bmFR_RX_SYNC_MASTER (1 <<bitnoFR_RX_SYNC_MASTER) //1 This is a rx sync master, output sync_rx on rx_a_io[15]
00239                                                            //0 This is not a rx sync master
00240 #  define bmFR_RX_SYNC_SLAVE  (1 <<bitnoFR_RX_SYNC_SLAVE) //1 This is a rx sync slave, follow sync_rx on rx_a_io[bitnoFR_RX_SYNC_INPUT_IOPIN]
00241                                                           //0 This is not an rx sync slave.
00242 
00243 //Caution The master settings will output values on the io lines.
00244 //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.
00245 //If you set the slave bits then your usrp won't do anything if you don't connect a master.
00246 // Rx Master/slave control register
00247 //
00248 // 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
00249 // This can be done with basic_rx boards or dbsrx boards
00250 //dbsrx: connect master-J25 to slave-J25
00251 //basic rx: connect J25 to slave-J25
00252 //CAUTION: pay attention to the lineup of your connector.
00253 //The red line (pin1) should be at the same side of the daughterboards on master and slave.
00254 //If you turnaround the cable on one end you will burn your usrp.
00255 
00256 //You cannot use a 16pin flatcable if you are using FLEX400 or FLEX2400 daughterboards, since these use a lot of the io pins.
00257 //You can still link them but you must use only a 2pin or 1pin cable
00258 //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.
00259 //You can use a cable like the ones found with the leds on the mainbord of a PC.
00260 //Make sure you don't twist the cable, otherwise you connect the sync output to ground.
00261 //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.
00262 
00263 
00264 // Since rx_io[0] can normally be used as a refclk and is not exported on all daughterboards this line
00265 // still has the refclk function if you use the master/slave setup (it is not touched by the master/slave settings).
00266 // The master/slave circuitry will only use io pin 15 and does not touch any of the other io pins.
00267 #define bitnoFR_RX_SYNC_INPUT_IOPIN             15
00268 #define bmFR_RX_SYNC_INPUT_IOPIN                (1<<bitnoFR_RX_SYNC_INPUT_IOPIN)
00269 //TODO the output pin is still hardcoded in the verilog code, make it listen to the following define
00270 #define bitnoFR_RX_SYNC_OUTPUT_IOPIN    15
00271 #define bmFR_RX_SYNC_OUTPUT_IOPIN       (1<<bitnoFR_RX_SYNC_OUTPUT_IOPIN)
00272 // =======================================================================
00273 // READBACK Registers
00274 // =======================================================================
00275 
00276 #define FR_RB_IO_RX_A_IO_TX_A   1       // read back a-side i/o pins
00277 #define FR_RB_IO_RX_B_IO_TX_B   2       // read back b-side i/o pins
00278 
00279 // ------------------------------------------------------------------------
00280 // FPGA Capability register
00281 //
00282 //    3                   2                   1                       
00283 //  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
00284 // +-----------------------------------------------+-+-----+-+-----+
00285 // |                    Reserved (Must be zero)    |T|NDUC |R|NDDC |
00286 // +-----------------------------------------------+-+-----+-+-----+
00287 //
00288 // Bottom 4-bits are Rx capabilities
00289 // Next   4-bits are Tx capabilities
00290 
00291 #define FR_RB_CAPS      3
00292 #  define bmFR_RB_CAPS_NDDC_MASK        (0x7 << 0)   // # of digital down converters 0,1,2,4
00293 #  define bmFR_RB_CAPS_NDDC_SHIFT       0
00294 #  define bmFR_RB_CAPS_RX_HAS_HALFBAND  (0x1 << 3)
00295 #  define bmFR_RB_CAPS_NDUC_MASK        (0x7 << 4)   // # of digital up converters 0,1,2
00296 #  define bmFR_RB_CAPS_NDUC_SHIFT       4
00297 #  define bmFR_RB_CAPS_TX_HAS_HALFBAND  (0x1 << 7)
00298 
00299 
00300 #endif /* INCLUDED_FPGA_REGS_STANDARD_H */