GNU Radio 3.3.0 C++ API
db_base.h
Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2008,2009 Free Software Foundation, Inc.
00004  *
00005  * This program is free software: you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation, either version 3 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017  */
00018 
00019 #ifndef INCLUDED_DB_BASE_H
00020 #define INCLUDED_DB_BASE_H
00021 
00022 #include <usrp2_types.h>
00023 #include <bool.h>
00024 
00025 /*!
00026  * \brief "base class" for firmware version of daughterboard code
00027  */
00028 struct db_base {
00029   uint16_t              dbid;           //< daughterboard ID
00030 
00031   uint16_t              is_tx             : 1;  //< is this a transmit db?
00032   uint16_t              is_quadrature     : 1;
00033   uint16_t              i_and_q_swapped   : 1;
00034   uint16_t              spectrum_inverted : 1;
00035 
00036   uint16_t              output_enables; //< bitmask of which pins should be outputs from FPGA
00037   uint16_t              used_pins;      //< bitmask of pins used by the daughterboard
00038 
00039   u2_fxpt_freq_t        freq_min;       //< min freq that can be set (Hz)
00040   u2_fxpt_freq_t        freq_max;       //< max freq that can be set (Hz)
00041 
00042   u2_fxpt_gain_t        gain_min;       //< min gain that can be set (dB)
00043   u2_fxpt_gain_t        gain_max;       //< max gain that can be set (dB)
00044   u2_fxpt_gain_t        gain_step_size; //< (dB)
00045 
00046   u2_fxpt_freq_t        default_lo_offset;  //< offset to add to tune frequency, reset value
00047   u2_fxpt_freq_t        current_lo_offset;  //< current value of lo_offset
00048 
00049   /*
00050    * Auto T/R control values
00051    */
00052   uint32_t              atr_mask;       //< which bits to control
00053   uint32_t              atr_txval;      //< value to use when transmitting
00054   uint32_t              atr_rxval;      //< value to use when receiving
00055 
00056   //! delay in clk ticks from when Tx fifo gets data to when T/R switches
00057   // uint32_t           atr_tx_delay;
00058 
00059   //! delay in clk ticks from when Tx fifo goes empty to when T/R switches
00060   // uint32_t           atr_rx_delay;
00061 
00062   bool  (*init)(struct db_base *);
00063   bool  (*set_freq)(struct db_base *, u2_fxpt_freq_t freq, u2_fxpt_freq_t *dc);
00064   bool  (*set_gain)(struct db_base *, u2_fxpt_gain_t gain);
00065   bool  (*set_tx_enable)(struct db_base *, bool on);
00066   bool  (*set_antenna)(struct db_base *, int ant);
00067 };
00068 
00069 
00070 #endif /* INCLUDED_DB_BASE_H */