diff options
author | matt | 2008-12-17 23:02:59 +0000 |
---|---|---|
committer | matt | 2008-12-17 23:02:59 +0000 |
commit | 97537ae02e08048e89c98e4fbe4455faeabcbd1c (patch) | |
tree | ddaf486899619294d8fd3f474a37f232dd9bb52a /usrp2/firmware/lib/db_rfx.c | |
parent | 0ebedf4c4111e2842ad4f90eb80f812479e6ec18 (diff) | |
download | gnuradio-97537ae02e08048e89c98e4fbe4455faeabcbd1c.tar.gz gnuradio-97537ae02e08048e89c98e4fbe4455faeabcbd1c.tar.bz2 gnuradio-97537ae02e08048e89c98e4fbe4455faeabcbd1c.zip |
added frequency offset capability. Set to 12.5e6 on TX, 0 on RX for now
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10125 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'usrp2/firmware/lib/db_rfx.c')
-rw-r--r-- | usrp2/firmware/lib/db_rfx.c | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/usrp2/firmware/lib/db_rfx.c b/usrp2/firmware/lib/db_rfx.c index 8e265b585..b127f2c33 100644 --- a/usrp2/firmware/lib/db_rfx.c +++ b/usrp2/firmware/lib/db_rfx.c @@ -72,7 +72,8 @@ struct db_rfx_common { unsigned char CP1; unsigned char CP2; int freq_mult; - int spi_mask; + int spi_mask; + u2_fxpt_freq_t freq_offset; }; struct db_rfx_dummy { @@ -162,7 +163,8 @@ struct db_rfx_400_rx db_rfx_400_rx = { .common.CP1 = 7, .common.CP2 = 7, .common.spi_mask = SPI_SS_RX_DB, - .common.freq_mult = 2 + .common.freq_mult = 2, + .common.freq_offset = U2_DOUBLE_TO_FXPT_FREQ(0) }; @@ -193,7 +195,8 @@ struct db_rfx_400_tx db_rfx_400_tx = { .common.CP1 = 7, .common.CP2 = 7, .common.spi_mask = SPI_SS_TX_DB, - .common.freq_mult = 2 + .common.freq_mult = 2, + .common.freq_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6) }; struct db_rfx_900_rx db_rfx_900_rx = { @@ -223,7 +226,8 @@ struct db_rfx_900_rx db_rfx_900_rx = { .common.CP1 = 7, .common.CP2 = 7, .common.spi_mask = SPI_SS_RX_DB, - .common.freq_mult = 2 + .common.freq_mult = 2, + .common.freq_offset = U2_DOUBLE_TO_FXPT_FREQ(0) }; @@ -254,7 +258,8 @@ struct db_rfx_900_tx db_rfx_900_tx = { .common.CP1 = 7, .common.CP2 = 7, .common.spi_mask = SPI_SS_TX_DB, - .common.freq_mult = 2 + .common.freq_mult = 2, + .common.freq_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6) }; struct db_rfx_1200_rx db_rfx_1200_rx = { @@ -284,7 +289,8 @@ struct db_rfx_1200_rx db_rfx_1200_rx = { .common.CP1 = 7, .common.CP2 = 7, .common.spi_mask = SPI_SS_RX_DB, - .common.freq_mult = 2 + .common.freq_mult = 2, + .common.freq_offset = U2_DOUBLE_TO_FXPT_FREQ(0) }; @@ -315,7 +321,8 @@ struct db_rfx_1200_tx db_rfx_1200_tx = { .common.CP1 = 7, .common.CP2 = 7, .common.spi_mask = SPI_SS_TX_DB, - .common.freq_mult = 2 + .common.freq_mult = 2, + .common.freq_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6) }; struct db_rfx_1800_rx db_rfx_1800_rx = { @@ -345,7 +352,8 @@ struct db_rfx_1800_rx db_rfx_1800_rx = { .common.CP1 = 7, .common.CP2 = 7, .common.spi_mask = SPI_SS_RX_DB, - .common.freq_mult = 1 + .common.freq_mult = 1, + .common.freq_offset = U2_DOUBLE_TO_FXPT_FREQ(0) }; @@ -376,7 +384,8 @@ struct db_rfx_1800_tx db_rfx_1800_tx = { .common.CP1 = 7, .common.CP2 = 7, .common.spi_mask = SPI_SS_TX_DB, - .common.freq_mult = 1 + .common.freq_mult = 1, + .common.freq_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6) }; @@ -407,7 +416,8 @@ struct db_rfx_2400_rx db_rfx_2400_rx = { .common.CP1 = 7, .common.CP2 = 7, .common.spi_mask = SPI_SS_RX_DB, - .common.freq_mult = 1 + .common.freq_mult = 1, + .common.freq_offset = U2_DOUBLE_TO_FXPT_FREQ(0) }; @@ -438,7 +448,8 @@ struct db_rfx_2400_tx db_rfx_2400_tx = { .common.CP1 = 7, .common.CP2 = 7, .common.spi_mask = SPI_SS_TX_DB, - .common.freq_mult = 1 + .common.freq_mult = 1, + .common.freq_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6) }; @@ -477,9 +488,7 @@ rfx_set_freq(struct db_base *dbb, u2_fxpt_freq_t freq, u2_fxpt_freq_t *dc) *dc = 0; struct db_rfx_dummy *db = (struct db_rfx_dummy *) dbb; - //u2_fxpt_freq_t desired_n = db->common.freq_mult*freq/phdet_freq; - //int N_DIV = u2_fxpt_freq_round_to_int(desired_n); - u2_fxpt_freq_t desired_n = ((1LL<<20) * db->common.freq_mult*freq)/phdet_freq; + u2_fxpt_freq_t desired_n = ((1LL<<20)*db->common.freq_mult*(freq+db->common.freq_offset))/phdet_freq; int N_DIV = u2_fxpt_freq_round_to_int(desired_n); int B = N_DIV/PRESCALER; int A = N_DIV - PRESCALER*B; |