Revision a161923e host/lib/usrp/usrp1/mboard_impl.cpp
| b/host/lib/usrp/usrp1/mboard_impl.cpp | ||
|---|---|---|
| 33 | 33 |
using namespace uhd::usrp; |
| 34 | 34 |
|
| 35 | 35 |
/*********************************************************************** |
| 36 |
* Helper Functions |
|
| 36 |
* Calculate the RX mux value: |
|
| 37 |
* The I and Q mux values are intentionally reversed to flip I and Q |
|
| 38 |
* to account for the reversal in the type conversion routines. |
|
| 37 | 39 |
**********************************************************************/ |
| 40 |
static int calc_rx_mux_pair(int adc_for_i, int adc_for_q){
|
|
| 41 |
return (adc_for_i << 2) | (adc_for_q << 0); //shift reversal here |
|
| 42 |
} |
|
| 43 |
|
|
| 44 |
/*! |
|
| 45 |
* 3 2 1 0 |
|
| 46 |
* 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 |
|
| 47 |
* +-----------------------+-------+-------+-------+-------+-+-----+ |
|
| 48 |
* | must be zero | Q3| I3| Q2| I2| Q1| I1| Q0| I0|Z| NCH | |
|
| 49 |
* +-----------------------+-------+-------+-------+-------+-+-----+ |
|
| 50 |
*/ |
|
| 38 | 51 |
static boost::uint32_t calc_rx_mux( |
| 39 | 52 |
const subdev_spec_t &subdev_spec, wax::obj mboard |
| 40 | 53 |
){
|
| ... | ... | |
| 42 | 55 |
static const int ADC0 = 0, ADC1 = 1, ADC2 = 2, ADC3 = 3; |
| 43 | 56 |
static const uhd::dict<std::string, uhd::dict<subdev_conn_t, int> > name_to_conn_to_flag = boost::assign::map_list_of |
| 44 | 57 |
("A", boost::assign::map_list_of
|
| 45 |
(SUBDEV_CONN_COMPLEX_IQ, (ADC0 << 0) | (ADC1 << 2)) //I and Q
|
|
| 46 |
(SUBDEV_CONN_COMPLEX_QI, (ADC1 << 0) | (ADC0 << 2)) //I and Q
|
|
| 47 |
(SUBDEV_CONN_REAL_I, (ADC0 << 0) | (ADC0 << 2)) //I and Q (Q identical but ignored Z=1)
|
|
| 48 |
(SUBDEV_CONN_REAL_Q, (ADC1 << 0) | (ADC1 << 2)) //I and Q (Q identical but ignored Z=1)
|
|
| 58 |
(SUBDEV_CONN_COMPLEX_IQ, calc_rx_mux_pair(ADC0, ADC1)) //I and Q
|
|
| 59 |
(SUBDEV_CONN_COMPLEX_QI, calc_rx_mux_pair(ADC1, ADC0)) //I and Q
|
|
| 60 |
(SUBDEV_CONN_REAL_I, calc_rx_mux_pair(ADC0, ADC0)) //I and Q (Q identical but ignored Z=1)
|
|
| 61 |
(SUBDEV_CONN_REAL_Q, calc_rx_mux_pair(ADC1, ADC1)) //I and Q (Q identical but ignored Z=1)
|
|
| 49 | 62 |
) |
| 50 | 63 |
("B", boost::assign::map_list_of
|
| 51 |
(SUBDEV_CONN_COMPLEX_IQ, (ADC2 << 0) | (ADC3 << 2)) //I and Q
|
|
| 52 |
(SUBDEV_CONN_COMPLEX_QI, (ADC3 << 0) | (ADC2 << 2)) //I and Q
|
|
| 53 |
(SUBDEV_CONN_REAL_I, (ADC2 << 0) | (ADC2 << 2)) //I and Q (Q identical but ignored Z=1)
|
|
| 54 |
(SUBDEV_CONN_REAL_Q, (ADC3 << 0) | (ADC3 << 2)) //I and Q (Q identical but ignored Z=1)
|
|
| 64 |
(SUBDEV_CONN_COMPLEX_IQ, calc_rx_mux_pair(ADC2, ADC3)) //I and Q
|
|
| 65 |
(SUBDEV_CONN_COMPLEX_QI, calc_rx_mux_pair(ADC3, ADC2)) //I and Q
|
|
| 66 |
(SUBDEV_CONN_REAL_I, calc_rx_mux_pair(ADC2, ADC2)) //I and Q (Q identical but ignored Z=1)
|
|
| 67 |
(SUBDEV_CONN_REAL_Q, calc_rx_mux_pair(ADC3, ADC3)) //I and Q (Q identical but ignored Z=1)
|
|
| 55 | 68 |
) |
| 56 | 69 |
; |
| 57 | 70 |
|
| ... | ... | |
| 88 | 101 |
return ((channel_flags & 0xffff) << 4) | ((Z & 0x1) << 3) | ((nchan & 0x7) << 0); |
| 89 | 102 |
} |
| 90 | 103 |
|
| 104 |
/*********************************************************************** |
|
| 105 |
* Calculate the TX mux value: |
|
| 106 |
* The I and Q mux values are intentionally reversed to flip I and Q |
|
| 107 |
* to account for the reversal in the type conversion routines. |
|
| 108 |
**********************************************************************/ |
|
| 109 |
static int calc_tx_mux_pair(int chn_for_i, int chn_for_q){
|
|
| 110 |
return (chn_for_i << 4) | (chn_for_q << 0); //shift reversal here |
|
| 111 |
} |
|
| 112 |
|
|
| 113 |
/*! |
|
| 114 |
* 3 2 1 0 |
|
| 115 |
* 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 |
|
| 116 |
* +-----------------------+-------+-------+-------+-------+-+-----+ |
|
| 117 |
* | | DAC1Q | DAC1I | DAC0Q | DAC0I |0| NCH | |
|
| 118 |
* +-----------------------------------------------+-------+-+-----+ |
|
| 119 |
*/ |
|
| 91 | 120 |
static boost::uint32_t calc_tx_mux( |
| 92 | 121 |
const subdev_spec_t &subdev_spec, wax::obj mboard |
| 93 | 122 |
){
|
| ... | ... | |
| 95 | 124 |
static const int ENB = 1 << 3, CHAN_I0 = 0, CHAN_Q0 = 1, CHAN_I1 = 2, CHAN_Q1 = 3; |
| 96 | 125 |
static const uhd::dict<size_t, uhd::dict<subdev_conn_t, int> > chan_to_conn_to_flag = boost::assign::map_list_of |
| 97 | 126 |
(0, boost::assign::map_list_of |
| 98 |
(SUBDEV_CONN_COMPLEX_IQ, ((CHAN_I0 | ENB) << 0) | ((CHAN_Q0 | ENB) << 4))
|
|
| 99 |
(SUBDEV_CONN_COMPLEX_QI, ((CHAN_I0 | ENB) << 4) | ((CHAN_Q0 | ENB) << 0))
|
|
| 100 |
(SUBDEV_CONN_REAL_I, ((CHAN_I0 | ENB) << 0))
|
|
| 101 |
(SUBDEV_CONN_REAL_Q, ((CHAN_I0 | ENB) << 4))
|
|
| 127 |
(SUBDEV_CONN_COMPLEX_IQ, calc_tx_mux_pair(CHAN_I0 | ENB, CHAN_Q0 | ENB))
|
|
| 128 |
(SUBDEV_CONN_COMPLEX_QI, calc_tx_mux_pair(CHAN_Q0 | ENB, CHAN_I0 | ENB))
|
|
| 129 |
(SUBDEV_CONN_REAL_I, calc_tx_mux_pair(CHAN_I0 | ENB, 0 ))
|
|
| 130 |
(SUBDEV_CONN_REAL_Q, calc_tx_mux_pair(0, CHAN_I0 | ENB))
|
|
| 102 | 131 |
) |
| 103 | 132 |
(1, boost::assign::map_list_of |
| 104 |
(SUBDEV_CONN_COMPLEX_IQ, ((CHAN_I1 | ENB) << 0) | ((CHAN_Q1 | ENB) << 4))
|
|
| 105 |
(SUBDEV_CONN_COMPLEX_QI, ((CHAN_I1 | ENB) << 4) | ((CHAN_Q1 | ENB) << 0))
|
|
| 106 |
(SUBDEV_CONN_REAL_I, ((CHAN_I1 | ENB) << 0))
|
|
| 107 |
(SUBDEV_CONN_REAL_Q, ((CHAN_I1 | ENB) << 4))
|
|
| 133 |
(SUBDEV_CONN_COMPLEX_IQ, calc_tx_mux_pair(CHAN_I1 | ENB, CHAN_Q1 | ENB))
|
|
| 134 |
(SUBDEV_CONN_COMPLEX_QI, calc_tx_mux_pair(CHAN_Q1 | ENB, CHAN_I1 | ENB))
|
|
| 135 |
(SUBDEV_CONN_REAL_I, calc_tx_mux_pair(CHAN_I1 | ENB, 0 ))
|
|
| 136 |
(SUBDEV_CONN_REAL_Q, calc_tx_mux_pair(0, CHAN_I1 | ENB))
|
|
| 108 | 137 |
) |
| 109 | 138 |
; |
| 110 | 139 |
|
Also available in: Unified diff