GNU Radio 3.4.2 C++ API
fpga_regs_common.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2003,2004 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_COMMON_H
00023 #define INCLUDED_FPGA_REGS_COMMON_H
00024 
00025 // This file defines registers common to all FPGA configurations.
00026 // Registers 0 to 31 are reserved for use in this file.
00027 
00028 
00029 // The FPGA needs to know the rate that samples are coming from and
00030 // going to the A/D's and D/A's.  div = 128e6 / sample_rate
00031 
00032 #define FR_TX_SAMPLE_RATE_DIV    0
00033 #define FR_RX_SAMPLE_RATE_DIV    1
00034 
00035 // 2 and 3 are defined in the ATR section
00036 
00037 #define FR_MASTER_CTRL           4      // master enable and reset controls
00038 #  define  bmFR_MC_ENABLE_TX            (1 << 0)
00039 #  define  bmFR_MC_ENABLE_RX            (1 << 1)
00040 #  define  bmFR_MC_RESET_TX             (1 << 2)
00041 #  define  bmFR_MC_RESET_RX             (1 << 3)
00042 
00043 // i/o direction registers for pins that go to daughterboards.
00044 // Setting the bit makes it an output from the FPGA to the d'board.
00045 // top 16 is mask, low 16 is value
00046 
00047 #define FR_OE_0                  5      // slot 0
00048 #define FR_OE_1                  6
00049 #define FR_OE_2                  7
00050 #define FR_OE_3                  8
00051 
00052 // i/o registers for pins that go to daughterboards.
00053 // top 16 is a mask, low 16 is value
00054 
00055 #define FR_IO_0                  9      // slot 0
00056 #define FR_IO_1                 10
00057 #define FR_IO_2                 11
00058 #define FR_IO_3                 12
00059 
00060 #define FR_MODE                 13
00061 #  define  bmFR_MODE_NORMAL                   0
00062 #  define  bmFR_MODE_LOOPBACK           (1 << 0)        // enable digital loopback
00063 #  define  bmFR_MODE_RX_COUNTING        (1 << 1)        // Rx is counting
00064 #  define  bmFR_MODE_RX_COUNTING_32BIT  (1 << 2)        // Rx is counting with a 32 bit counter
00065                                                     // low and high 16 bits are multiplexed across channel I and Q
00066 
00067 
00068 // If the corresponding bit is set, internal FPGA debug circuitry
00069 // controls the i/o pins for the associated bank of daughterboard
00070 // i/o pins.  Typically used for debugging FPGA designs.
00071 
00072 #define FR_DEBUG_EN             14
00073 #  define bmFR_DEBUG_EN_TX_A           (1 << 0)        // debug controls TX_A i/o
00074 #  define bmFR_DEBUG_EN_RX_A           (1 << 1)        // debug controls RX_A i/o
00075 #  define bmFR_DEBUG_EN_TX_B           (1 << 2)        // debug controls TX_B i/o
00076 #  define bmFR_DEBUG_EN_RX_B           (1 << 3)        // debug controls RX_B i/o
00077 
00078 
00079 // If the corresponding bit is set, enable the automatic DC
00080 // offset correction control loop.
00081 //
00082 // The 4 low bits are significant:
00083 //
00084 //   ADC0 = (1 << 0)
00085 //   ADC1 = (1 << 1)
00086 //   ADC2 = (1 << 2)
00087 //   ADC3 = (1 << 3)
00088 //
00089 // This control loop works if the attached daugherboard blocks DC.
00090 // Currently all daughterboards do block DC.  This includes:
00091 // basic rx, dbs_rx, tv_rx, flex_xxx_rx.
00092 
00093 #define FR_DC_OFFSET_CL_EN      15                      // DC Offset Control Loop Enable
00094 
00095 
00096 // offset corrections for ADC's and DAC's (2's complement)
00097 
00098 #define FR_ADC_OFFSET_0         16
00099 #define FR_ADC_OFFSET_1         17
00100 #define FR_ADC_OFFSET_2         18
00101 #define FR_ADC_OFFSET_3         19
00102 
00103 
00104 // ------------------------------------------------------------------------
00105 // Automatic Transmit/Receive switching
00106 //
00107 // If automatic transmit/receive (ATR) switching is enabled in the
00108 // FR_ATR_CTL register, the presence or absence of data in the FPGA
00109 // transmit fifo selects between two sets of values for each of the 4
00110 // banks of daughterboard i/o pins.
00111 //
00112 // Each daughterboard slot has 3 16-bit registers associated with it:
00113 //   FR_ATR_MASK_*, FR_ATR_TXVAL_* and FR_ATR_RXVAL_*
00114 //
00115 // FR_ATR_MASK_{0,1,2,3}: 
00116 //
00117 //   These registers determine which of the daugherboard i/o pins are
00118 //   affected by ATR switching.  If a bit in the mask is set, the
00119 //   corresponding i/o bit is controlled by ATR, else it's output
00120 //   value comes from the normal i/o pin output register:
00121 //   FR_IO_{0,1,2,3}.
00122 //
00123 // FR_ATR_TXVAL_{0,1,2,3}:
00124 // FR_ATR_RXVAL_{0,1,2,3}:
00125 //
00126 //   If the Tx fifo contains data, then the bits from TXVAL that are
00127 //   selected by MASK are output.  Otherwise, the bits from RXVAL that
00128 //   are selected by MASK are output.
00129                       
00130 #define FR_ATR_MASK_0           20      // slot 0
00131 #define FR_ATR_TXVAL_0          21
00132 #define FR_ATR_RXVAL_0          22
00133 
00134 #define FR_ATR_MASK_1           23      // slot 1
00135 #define FR_ATR_TXVAL_1          24
00136 #define FR_ATR_RXVAL_1          25
00137 
00138 #define FR_ATR_MASK_2           26      // slot 2
00139 #define FR_ATR_TXVAL_2          27
00140 #define FR_ATR_RXVAL_2          28
00141 
00142 #define FR_ATR_MASK_3           29      // slot 3
00143 #define FR_ATR_TXVAL_3          30
00144 #define FR_ATR_RXVAL_3          31
00145 
00146 // Clock ticks to delay rising and falling edge of T/R signal
00147 #define FR_ATR_TX_DELAY          2
00148 #define FR_ATR_RX_DELAY          3
00149 
00150 #endif /* INCLUDED_FPGA_REGS_COMMON_H */