First pass WBX USRP2 driver
[debian/gnuradio] / usrp2 / firmware / lib / db_wbxng.h
1 /*
2  * Copyright 2010 Free Software Foundation, Inc.
3  *
4  * Copyright 2010 Ettus Research LLC
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20
21 #ifndef DB_WBXNG_H
22 #define DB_WBXNG_H
23
24 #include <db_base.h>
25
26 // IO Pin functions
27 // Tx and Rx have shared defs, but different i/o regs
28 #define ENABLE_5        (1 << 7)              // enables 5.0V power supply
29 #define ENABLE_33       (1 << 6)              // enables 3.3V supply
30 //#define RX_TXN          (1 << 15)             // Tx only: T/R antenna switch for TX/RX port
31 //#define RX2_RX1N        (1 << 15)             // Rx only: antenna switch between RX2 and TX/RX port
32 #define RX_TXN          ((1 << 5)|(1 << 15))  // Tx only: T/R antenna switch for TX/RX port
33 #define RX2_RX1N        ((1 << 5)|(1 << 15))  // Rx only: antenna switch between RX2 and TX/RX port
34 #define RXBB_EN         (1 << 4)
35 #define TXMOD_EN        (1 << 4)
36 #define PLL_CE          (1 << 3)
37 #define PLL_PDBRF       (1 << 2)
38 #define PLL_MUXOUT      (1 << 1)
39 #define PLL_LOCK_DETECT (1 << 0)
40
41 // RX Attenuator constants
42 #define ATTN_SHIFT      8
43 #define ATTN_MASK       (63 << ATTN_SHIFT)
44
45 struct db_wbxng_common {
46   // RFX common stuff
47   uint16_t adf4350_regs_int;
48   uint16_t adf4350_regs_frac;
49   uint8_t adf4350_regs_prescaler;
50   uint16_t adf4350_regs_mod;
51   uint16_t adf4350_regs_10_bit_r_counter;
52   uint8_t adf4350_regs_divider_select;
53   uint8_t adf4350_regs_8_bit_band_select_clock_divider_value;
54
55   int freq_mult;
56   int spi_mask;
57 };
58
59 struct db_wbxng_dummy {
60   struct db_base        base;
61   struct db_wbxng_common        common;
62 };
63
64
65 struct db_wbxng_rx {
66   struct db_base        base;
67   struct db_wbxng_common        common;
68 };
69
70 struct db_wbxng_tx {
71   struct db_base        base;
72   struct db_wbxng_common        common;
73 };
74
75
76 #endif /* DB_WBXNG_H */