diff options
-rw-r--r-- | usrp2/firmware/lib/db_init.c | 2 | ||||
-rw-r--r-- | usrp2/firmware/lib/db_tvrx.c | 32 |
2 files changed, 19 insertions, 15 deletions
diff --git a/usrp2/firmware/lib/db_init.c b/usrp2/firmware/lib/db_init.c index 925a34f39..a0bfc5cfb 100644 --- a/usrp2/firmware/lib/db_init.c +++ b/usrp2/firmware/lib/db_init.c @@ -69,7 +69,9 @@ struct db_base *all_dboards[] = { &db_rfx_2400_tx, &db_rfx_2400_rx, &db_tvrx1, +#if 0 &db_tvrx2, +#endif &db_tvrx3, &db_dbsrx, &db_xcvr2450_tx, diff --git a/usrp2/firmware/lib/db_tvrx.c b/usrp2/firmware/lib/db_tvrx.c index ba70b6402..49bf75883 100644 --- a/usrp2/firmware/lib/db_tvrx.c +++ b/usrp2/firmware/lib/db_tvrx.c @@ -28,7 +28,7 @@ bool tvrx_set_freq(struct db_base *db, u2_fxpt_freq_t freq, u2_fxpt_freq_t *dc); bool tvrx_set_gain(struct db_base *db, u2_fxpt_gain_t gain); #define I2C_ADDR 0x60 -#define ref_freq (U2_DOUBLE_TO_FXPT_FREQ(4e6)/640*8) +#define REF_FREQ (U2_DOUBLE_TO_FXPT_FREQ(4e6)/640*8) #define ref_div 640 /* choices are 640, 512, 1024 */ @@ -101,6 +101,7 @@ struct db_tvrx1 db_tvrx1 = { .common.second_if = U2_DOUBLE_TO_FXPT_FREQ(5.75e6), }; +#if 0 struct db_tvrx2 db_tvrx2 = { .base.dbid = 0x000c, .base.is_tx = false, @@ -113,7 +114,7 @@ struct db_tvrx2 db_tvrx2 = { .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(1), .base.is_quadrature = false, .base.i_and_q_swapped = false, - .base.spectrum_inverted = true, + .base.spectrum_inverted = false, .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0), .base.init = tvrx_init, .base.set_freq = tvrx_set_freq, @@ -125,8 +126,9 @@ struct db_tvrx2 db_tvrx2 = { // .base.atr_tx_delay = // .base.atr_rx_delay = .common.first_if = U2_DOUBLE_TO_FXPT_FREQ(44e6), - .common.second_if = U2_DOUBLE_TO_FXPT_FREQ(44e6), + .common.second_if = U2_DOUBLE_TO_FXPT_FREQ(56e6), // Fs - 44e6 }; +#endif struct db_tvrx3 db_tvrx3 = { .base.dbid = 0x0040, @@ -140,7 +142,7 @@ struct db_tvrx3 db_tvrx3 = { .base.gain_step_size = U2_DOUBLE_TO_FXPT_GAIN(1), .base.is_quadrature = false, .base.i_and_q_swapped = false, - .base.spectrum_inverted = true, + .base.spectrum_inverted = false, .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0), .base.init = tvrx_init, .base.set_freq = tvrx_set_freq, @@ -152,7 +154,7 @@ struct db_tvrx3 db_tvrx3 = { // .base.atr_tx_delay = // .base.atr_rx_delay = .common.first_if = U2_DOUBLE_TO_FXPT_FREQ(44e6), - .common.second_if = U2_DOUBLE_TO_FXPT_FREQ(44e6), + .common.second_if = U2_DOUBLE_TO_FXPT_FREQ(56e6), // Fs - 44e6 }; bool @@ -173,25 +175,25 @@ tvrx_set_freq(struct db_base *dbb, u2_fxpt_freq_t freq, u2_fxpt_freq_t *dc) struct db_tvrx_dummy *db = (struct db_tvrx_dummy *) dbb; u2_fxpt_freq_t target_lo_freq = freq + db->common.first_if; - int N_DIV = u2_fxpt_freq_round_to_int(((1LL<<20) * target_lo_freq)/ref_freq); + int n_div = u2_fxpt_freq_round_to_int(((1LL<<20) * target_lo_freq)/REF_FREQ); - u2_fxpt_freq_t actual_lo_freq = ref_freq * N_DIV; + u2_fxpt_freq_t actual_lo_freq = REF_FREQ * n_div; u2_fxpt_freq_t actual_freq = actual_lo_freq - db->common.first_if; - if(N_DIV > 32767) + if(n_div > 32767) return false; if (0) - printf("N_DIV = %d, actual_freq = %d, actual_lo_freq = %d\n", - N_DIV, u2_fxpt_freq_round_to_int(actual_freq), + printf("n_div = %d, actual_freq = %d, actual_lo_freq = %d\n", + n_div, u2_fxpt_freq_round_to_int(actual_freq), u2_fxpt_freq_round_to_int(actual_lo_freq)); unsigned char buf[4]; - buf[0] = (N_DIV>>8) & 0xff; - buf[1] = N_DIV & 0xff; + buf[0] = (n_div>>8) & 0xff; + buf[1] = n_div & 0xff; buf[2] = control_byte_1; - buf[3] = (freq < U2_DOUBLE_TO_FXPT_FREQ(158e6)) ? 0xa8 : // VHF LOW - (freq < U2_DOUBLE_TO_FXPT_FREQ(464e6)) ? 0x98 : // VHF HIGH - 0x38; // UHF + buf[3] = ((actual_freq < U2_DOUBLE_TO_FXPT_FREQ(158e6)) ? 0xa8 : // VHF LOW + (actual_freq < U2_DOUBLE_TO_FXPT_FREQ(464e6)) ? 0x98 : // VHF HIGH + 0x38); // UHF *dc = actual_freq - db->common.second_if; return i2c_write(I2C_ADDR,buf,4); |