summaryrefslogtreecommitdiff
path: root/usrp2/firmware
diff options
context:
space:
mode:
authorjcorgan2009-02-04 23:06:02 +0000
committerjcorgan2009-02-04 23:06:02 +0000
commit9b388ac1184c71449c49fb44551c5c38f8098d8e (patch)
tree619f89d81e2030a831063415c29d78c739e47c1c /usrp2/firmware
parent68282b6ffed904bb55700314a600fe5d731dd0ea (diff)
downloadgnuradio-9b388ac1184c71449c49fb44551c5c38f8098d8e.tar.gz
gnuradio-9b388ac1184c71449c49fb44551c5c38f8098d8e.tar.bz2
gnuradio-9b388ac1184c71449c49fb44551c5c38f8098d8e.zip
Merged r10383:10390 from jcorgan/u2-wip into trunk.
* Implements daughterboard independent LO offset tuning * Removes RFX specific LO offset code * Adds 'set_lo_offset' to libusrp2 and Python API * Adds --lo-offset to usrp2_fft.py and usrp2_rx_cfile.py * Ensures daughterboards are reset to default values at startup. Trunk passes distcheck. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10392 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'usrp2/firmware')
-rw-r--r--usrp2/firmware/apps/app_common_v2.c37
-rw-r--r--usrp2/firmware/include/usrp2_eth_packet.h22
-rw-r--r--usrp2/firmware/lib/db.h12
-rw-r--r--usrp2/firmware/lib/db_base.h5
-rw-r--r--usrp2/firmware/lib/db_basic.c10
-rw-r--r--[-rwxr-xr-x]usrp2/firmware/lib/db_dbsrx.c2
-rw-r--r--usrp2/firmware/lib/db_init.c14
-rw-r--r--usrp2/firmware/lib/db_rfx.c55
-rw-r--r--usrp2/firmware/lib/db_tvrx.c8
-rw-r--r--usrp2/firmware/lib/db_xcvr2450.c2
10 files changed, 109 insertions, 58 deletions
diff --git a/usrp2/firmware/apps/app_common_v2.c b/usrp2/firmware/apps/app_common_v2.c
index 9f5fd94f1..c277d12f0 100644
--- a/usrp2/firmware/apps/app_common_v2.c
+++ b/usrp2/firmware/apps/app_common_v2.c
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007,2008 Free Software Foundation, Inc.
+ * Copyright 2007,2008,2009 Free Software Foundation, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -369,6 +369,16 @@ poke_cmd(const op_poke_t *p)
return true;
}
+static bool
+set_lo_offset_cmd(const op_freq_t *p)
+{
+ u2_fxpt_freq_t f = u2_fxpt_freq_from_hilo(p->freq_hi, p->freq_lo);
+ if (p->opcode == OP_SET_TX_LO_OFFSET)
+ return db_set_lo_offset(tx_dboard, f);
+ else
+ return db_set_lo_offset(rx_dboard, f);
+}
+
static size_t
generic_reply(const op_generic_t *p,
void *reply_payload, size_t reply_payload_space,
@@ -377,12 +387,12 @@ generic_reply(const op_generic_t *p,
op_generic_t *r = (op_generic_t *) reply_payload;
if (reply_payload_space < sizeof(*r))
return 0; // no room
-
+
r->opcode = p->opcode | OP_REPLY_BIT;
r->len = sizeof(*r);
r->rid = p->rid;
r->ok = ok;
-
+
return r->len;
}
@@ -392,12 +402,12 @@ add_eop(void *reply_payload, size_t reply_payload_space)
op_generic_t *r = (op_generic_t *) reply_payload;
if (reply_payload_space < sizeof(*r))
return 0; // no room
-
+
r->opcode = OP_EOP;
r->len = sizeof(*r);
r->rid = 0;
r->ok = 0;
-
+
return r->len;
}
@@ -407,15 +417,15 @@ handle_control_chan_frame(u2_eth_packet_t *pkt, size_t len)
unsigned char reply[sizeof(u2_eth_packet_t) + 4 * sizeof(u2_subpkt_t)] _AL4;
unsigned char *reply_payload = &reply[sizeof(u2_eth_packet_t)];
int reply_payload_space = sizeof(reply) - sizeof(u2_eth_packet_t);
-
+
// initialize reply
memset(reply, 0, sizeof(reply));
set_reply_hdr((u2_eth_packet_t *) reply, pkt);
-
+
// point to beginning of payload (subpackets)
unsigned char *payload = ((unsigned char *) pkt) + sizeof(u2_eth_packet_t);
int payload_len = len - sizeof(u2_eth_packet_t);
-
+
size_t subpktlen = 0;
while (payload_len >= sizeof(op_generic_t)){
@@ -484,6 +494,17 @@ handle_control_chan_frame(u2_eth_packet_t *pkt, size_t len)
poke_cmd((op_poke_t *)payload));
break;
+ case OP_SET_TX_LO_OFFSET:
+ case OP_SET_RX_LO_OFFSET:
+ subpktlen = generic_reply(gp, reply_payload, reply_payload_space,
+ set_lo_offset_cmd((op_freq_t *)payload));
+ break;
+
+ case OP_RESET_DB:
+ db_init();
+ subpktlen = generic_reply(gp, reply_payload, reply_payload_space, true);
+ break;
+
default:
printf("app_common_v2: unhandled opcode = %d\n", gp->opcode);
break;
diff --git a/usrp2/firmware/include/usrp2_eth_packet.h b/usrp2/firmware/include/usrp2_eth_packet.h
index e212fab83..77de02dbb 100644
--- a/usrp2/firmware/include/usrp2_eth_packet.h
+++ b/usrp2/firmware/include/usrp2_eth_packet.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007,2008 Free Software Foundation, Inc.
+ * Copyright 2007,2008,2009 Free Software Foundation, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -189,6 +189,12 @@ typedef struct {
#define OP_PEEK_REPLY (OP_PEEK | OP_REPLY_BIT)
#define OP_POKE 12
#define OP_POKE_REPLY (OP_POKE | OP_REPLY_BIT)
+#define OP_SET_TX_LO_OFFSET 13
+#define OP_SET_TX_LO_OFFSET_REPLY (OP_SET_TX_LO_OFFSET | OP_REPLY_BIT)
+#define OP_SET_RX_LO_OFFSET 14
+#define OP_SET_RX_LO_OFFSET_REPLY (OP_SET_RX_LO_OFFSET | OP_REPLY_BIT)
+#define OP_RESET_DB 15
+#define OP_RESET_DB_REPLY (OP_RESET_DB | OP_REPLY_BIT)
/*
* All subpackets are a multiple of 4 bytes long.
@@ -402,6 +408,19 @@ typedef struct {
// Words follow here
} _AL4 op_poke_t;
+/*
+ * Common structure for commands with a single frequency param
+ * (e.g., set_*_lo_offset, set_*_bw)
+ */
+typedef struct {
+ uint8_t opcode;
+ uint8_t len;
+ uint8_t rid;
+ uint8_t mbz;
+ uint32_t freq_hi; //< high 32-bits of 64-bit fxpt_freq (Q44.20)
+ uint32_t freq_lo; //< low 32-bits of 64-bit fxpt_freq (Q44.20)
+} _AL4 op_freq_t;
+
/*
* ================================================================
* union of all of subpacket types
@@ -421,6 +440,7 @@ typedef union {
op_config_mimo_t op_config_mimo;
op_peek_t op_peek;
op_poke_t op_poke;
+ op_freq_t op_freq;
} u2_subpkt_t;
diff --git a/usrp2/firmware/lib/db.h b/usrp2/firmware/lib/db.h
index 5828fb00d..cec960267 100644
--- a/usrp2/firmware/lib/db.h
+++ b/usrp2/firmware/lib/db.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2008 Free Software Foundation, Inc.
+ * Copyright 2008,2009 Free Software Foundation, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -60,6 +60,16 @@ void
db_init(void);
/*!
+ * \brief Set daughterboard LO offset frequency.
+ *
+ * \param[in] db is the daughterboard instance
+ * \param[in] offset is the amount to add to tuning requests
+ * \param[out] success or failure
+ */
+bool
+db_set_lo_offset(struct db_base *db, u2_fxpt_freq_t offset);
+
+/*!
* \brief Two stage tuning. Given target_freq, tune LO and DDC/DUC
*
* \param[in] db is the daughterboard instance
diff --git a/usrp2/firmware/lib/db_base.h b/usrp2/firmware/lib/db_base.h
index 9b5ce051f..2ccfbf509 100644
--- a/usrp2/firmware/lib/db_base.h
+++ b/usrp2/firmware/lib/db_base.h
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2008 Free Software Foundation, Inc.
+ * Copyright 2008,2009 Free Software Foundation, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -43,7 +43,8 @@ struct db_base {
u2_fxpt_gain_t gain_max; //< max gain that can be set (dB)
u2_fxpt_gain_t gain_step_size; //< (dB)
- // u2_fxpt_freq_t lo_offset;
+ u2_fxpt_freq_t default_lo_offset; //< offset to add to tune frequency, reset value
+ u2_fxpt_freq_t current_lo_offset; //< current value of lo_offset
/*
* Auto T/R control values
diff --git a/usrp2/firmware/lib/db_basic.c b/usrp2/firmware/lib/db_basic.c
index 0f1ad6504..2bd4ebfbe 100644
--- a/usrp2/firmware/lib/db_basic.c
+++ b/usrp2/firmware/lib/db_basic.c
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2008 Free Software Foundation, Inc.
+ * Copyright 2008,2009 Free Software Foundation, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -42,7 +42,7 @@ struct db_basic db_basic_tx = {
.base.is_quadrature = true,
.base.i_and_q_swapped = false,
.base.spectrum_inverted = false,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
.base.atr_mask = 0,
.base.atr_txval = 0,
.base.atr_rxval = 0,
@@ -68,7 +68,7 @@ struct db_basic db_basic_rx = {
.base.is_quadrature = false,
.base.i_and_q_swapped = false,
.base.spectrum_inverted = false,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
.base.atr_mask = 0,
.base.atr_txval = 0,
.base.atr_rxval = 0,
@@ -94,7 +94,7 @@ struct db_basic db_lf_tx = {
.base.is_quadrature = true,
.base.i_and_q_swapped = false,
.base.spectrum_inverted = false,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
.base.atr_mask = 0,
.base.atr_txval = 0,
.base.atr_rxval = 0,
@@ -120,7 +120,7 @@ struct db_basic db_lf_rx = {
.base.is_quadrature = false,
.base.i_and_q_swapped = false,
.base.spectrum_inverted = false,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
.base.atr_mask = 0,
.base.atr_txval = 0,
.base.atr_rxval = 0,
diff --git a/usrp2/firmware/lib/db_dbsrx.c b/usrp2/firmware/lib/db_dbsrx.c
index 31b02722b..6e261cc3a 100755..100644
--- a/usrp2/firmware/lib/db_dbsrx.c
+++ b/usrp2/firmware/lib/db_dbsrx.c
@@ -80,7 +80,7 @@ struct db_dbsrx db_dbsrx = {
.base.is_quadrature = true,
.base.i_and_q_swapped = false,
.base.spectrum_inverted = false,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
.base.init = db_dbsrx_init,
.base.set_freq = db_dbsrx_set_freq,
.base.set_gain = db_dbsrx_set_gain,
diff --git a/usrp2/firmware/lib/db_init.c b/usrp2/firmware/lib/db_init.c
index 121bfbd9f..0aef75e57 100644
--- a/usrp2/firmware/lib/db_init.c
+++ b/usrp2/firmware/lib/db_init.c
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2008 Free Software Foundation, Inc.
+ * Copyright 2008,2009 Free Software Foundation, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -270,6 +270,7 @@ db_init(void)
//m = determine_tx_mux_value(tx_dboard);
//dsp_tx_regs->tx_mux = m;
//printf("tx_mux = 0x%x\n", m);
+ tx_dboard->current_lo_offset = tx_dboard->default_lo_offset;
rx_dboard = lookup_dboard(I2C_ADDR_RX_A, &db_basic_rx, "Rx");
//printf("db_init: rx dbid = 0x%x\n", rx_dboard->dbid);
@@ -278,6 +279,7 @@ db_init(void)
m = determine_rx_mux_value(rx_dboard);
dsp_rx_regs->rx_mux = m;
//printf("rx_mux = 0x%x\n", m);
+ rx_dboard->current_lo_offset = rx_dboard->default_lo_offset;
}
/*!
@@ -330,6 +332,12 @@ calc_dxc_freq(u2_fxpt_freq_t target_freq, u2_fxpt_freq_t baseband_freq,
}
}
+bool
+db_set_lo_offset(struct db_base *db, u2_fxpt_freq_t offset)
+{
+ db->current_lo_offset = offset;
+ return true;
+}
bool
db_tune(struct db_base *db, u2_fxpt_freq_t target_freq, struct tune_result *result)
@@ -339,8 +347,8 @@ db_tune(struct db_base *db, u2_fxpt_freq_t target_freq, struct tune_result *resu
u2_fxpt_freq_t dxc_freq;
u2_fxpt_freq_t actual_dxc_freq;
- // Ask the d'board to tune as closely as it can to target_freq
- bool ok = db->set_freq(db, target_freq, &result->baseband_freq);
+ // Ask the d'board to tune as closely as it can to target_freq+lo_offset
+ bool ok = db->set_freq(db, target_freq+db->current_lo_offset, &result->baseband_freq);
// Calculate the DDC setting that will downconvert the baseband from the
// daughterboard to our target frequency.
diff --git a/usrp2/firmware/lib/db_rfx.c b/usrp2/firmware/lib/db_rfx.c
index 0d5c89a81..3efb9f664 100644
--- a/usrp2/firmware/lib/db_rfx.c
+++ b/usrp2/firmware/lib/db_rfx.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Free Software Foundation, Inc.
+ * Copyright 2008,2009 Free Software Foundation, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -73,7 +73,6 @@ struct db_rfx_common {
unsigned char CP2;
int freq_mult;
int spi_mask;
- u2_fxpt_freq_t freq_offset;
};
struct db_rfx_dummy {
@@ -149,7 +148,7 @@ struct db_rfx_400_rx db_rfx_400_rx = {
.base.is_quadrature = true,
.base.i_and_q_swapped = true,
.base.spectrum_inverted = false,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(4e6),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
.base.init = rfx_init_rx,
.base.set_freq = rfx_set_freq,
.base.set_gain = rfx_set_gain_rx,
@@ -163,8 +162,7 @@ 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_offset = U2_DOUBLE_TO_FXPT_FREQ(0)
+ .common.freq_mult = 2
};
@@ -181,7 +179,7 @@ struct db_rfx_400_tx db_rfx_400_tx = {
.base.is_quadrature = true,
.base.i_and_q_swapped = true,
.base.spectrum_inverted = false,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(4e6),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6),
.base.init = rfx_init_tx,
.base.set_freq = rfx_set_freq,
.base.set_gain = rfx_set_gain_tx,
@@ -195,8 +193,7 @@ 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_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6)
+ .common.freq_mult = 2
};
struct db_rfx_900_rx db_rfx_900_rx = {
@@ -212,7 +209,7 @@ struct db_rfx_900_rx db_rfx_900_rx = {
.base.is_quadrature = true,
.base.i_and_q_swapped = true,
.base.spectrum_inverted = false,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(4e6),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
.base.init = rfx_init_rx,
.base.set_freq = rfx_set_freq,
.base.set_gain = rfx_set_gain_rx,
@@ -226,8 +223,7 @@ 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_offset = U2_DOUBLE_TO_FXPT_FREQ(0)
+ .common.freq_mult = 2
};
@@ -244,7 +240,7 @@ struct db_rfx_900_tx db_rfx_900_tx = {
.base.is_quadrature = true,
.base.i_and_q_swapped = true,
.base.spectrum_inverted = false,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(4e6),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6),
.base.init = rfx_init_tx,
.base.set_freq = rfx_set_freq,
.base.set_gain = rfx_set_gain_tx,
@@ -258,8 +254,7 @@ 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_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6)
+ .common.freq_mult = 2
};
struct db_rfx_1200_rx db_rfx_1200_rx = {
@@ -275,7 +270,7 @@ struct db_rfx_1200_rx db_rfx_1200_rx = {
.base.is_quadrature = true,
.base.i_and_q_swapped = true,
.base.spectrum_inverted = false,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(4e6),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
.base.init = rfx_init_rx,
.base.set_freq = rfx_set_freq,
.base.set_gain = rfx_set_gain_rx,
@@ -289,8 +284,7 @@ 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_offset = U2_DOUBLE_TO_FXPT_FREQ(0)
+ .common.freq_mult = 2
};
@@ -307,7 +301,7 @@ struct db_rfx_1200_tx db_rfx_1200_tx = {
.base.is_quadrature = true,
.base.i_and_q_swapped = true,
.base.spectrum_inverted = false,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(4e6),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6),
.base.init = rfx_init_tx,
.base.set_freq = rfx_set_freq,
.base.set_gain = rfx_set_gain_tx,
@@ -321,8 +315,7 @@ 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_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6)
+ .common.freq_mult = 2
};
struct db_rfx_1800_rx db_rfx_1800_rx = {
@@ -338,7 +331,7 @@ struct db_rfx_1800_rx db_rfx_1800_rx = {
.base.is_quadrature = true,
.base.i_and_q_swapped = true,
.base.spectrum_inverted = false,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(4e6),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
.base.init = rfx_init_rx,
.base.set_freq = rfx_set_freq,
.base.set_gain = rfx_set_gain_rx,
@@ -352,8 +345,7 @@ 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_offset = U2_DOUBLE_TO_FXPT_FREQ(0)
+ .common.freq_mult = 1
};
@@ -370,7 +362,7 @@ struct db_rfx_1800_tx db_rfx_1800_tx = {
.base.is_quadrature = true,
.base.i_and_q_swapped = true,
.base.spectrum_inverted = false,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(4e6),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6),
.base.init = rfx_init_tx,
.base.set_freq = rfx_set_freq,
.base.set_gain = rfx_set_gain_tx,
@@ -384,8 +376,7 @@ 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_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6)
+ .common.freq_mult = 1
};
@@ -402,7 +393,7 @@ struct db_rfx_2400_rx db_rfx_2400_rx = {
.base.is_quadrature = true,
.base.i_and_q_swapped = true,
.base.spectrum_inverted = false,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(4e6),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
.base.init = rfx_init_rx,
.base.set_freq = rfx_set_freq,
.base.set_gain = rfx_set_gain_rx,
@@ -416,8 +407,7 @@ 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_offset = U2_DOUBLE_TO_FXPT_FREQ(0)
+ .common.freq_mult = 1
};
@@ -434,7 +424,7 @@ struct db_rfx_2400_tx db_rfx_2400_tx = {
.base.is_quadrature = true,
.base.i_and_q_swapped = true,
.base.spectrum_inverted = false,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(4e6),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6),
.base.init = rfx_init_tx,
.base.set_freq = rfx_set_freq,
.base.set_gain = rfx_set_gain_tx,
@@ -448,8 +438,7 @@ 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_offset = U2_DOUBLE_TO_FXPT_FREQ(12.5e6)
+ .common.freq_mult = 1
};
@@ -488,7 +477,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 = (U2_DOUBLE_TO_FXPT_FREQ(1.0)*db->common.freq_mult*(freq+db->common.freq_offset))/phdet_freq;
+ u2_fxpt_freq_t desired_n = (U2_DOUBLE_TO_FXPT_FREQ(1.0)*db->common.freq_mult*freq)/phdet_freq;
int N_DIV = u2_fxpt_freq_round_to_int(desired_n);
int B = N_DIV/PRESCALER;
int A = N_DIV - PRESCALER*B;
diff --git a/usrp2/firmware/lib/db_tvrx.c b/usrp2/firmware/lib/db_tvrx.c
index 9e600bf88..435fe7dad 100644
--- a/usrp2/firmware/lib/db_tvrx.c
+++ b/usrp2/firmware/lib/db_tvrx.c
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2008 Free Software Foundation, Inc.
+ * Copyright 2008,2009 Free Software Foundation, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -88,7 +88,7 @@ struct db_tvrx1 db_tvrx1 = {
.base.is_quadrature = false,
.base.i_and_q_swapped = false,
.base.spectrum_inverted = false,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(4e6),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
.base.init = tvrx_init,
.base.set_freq = tvrx_set_freq,
.base.set_gain = tvrx_set_gain,
@@ -115,7 +115,7 @@ struct db_tvrx2 db_tvrx2 = {
.base.is_quadrature = false,
.base.i_and_q_swapped = false,
.base.spectrum_inverted = true,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(4e6),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
.base.init = tvrx_init,
.base.set_freq = tvrx_set_freq,
.base.set_gain = tvrx_set_gain,
@@ -142,7 +142,7 @@ struct db_tvrx3 db_tvrx3 = {
.base.is_quadrature = false,
.base.i_and_q_swapped = false,
.base.spectrum_inverted = true,
- //.base.lo_offset = U2_DOUBLE_TO_FXPT_FREQ(4e6),
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
.base.init = tvrx_init,
.base.set_freq = tvrx_set_freq,
.base.set_gain = tvrx_set_gain,
diff --git a/usrp2/firmware/lib/db_xcvr2450.c b/usrp2/firmware/lib/db_xcvr2450.c
index 6c165bc96..8132d69a7 100644
--- a/usrp2/firmware/lib/db_xcvr2450.c
+++ b/usrp2/firmware/lib/db_xcvr2450.c
@@ -147,6 +147,7 @@ struct db_xcvr2450_rx db_xcvr2450_rx = {
.base.is_quadrature = true,
.base.i_and_q_swapped = false,
.base.spectrum_inverted = false,
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
.base.init = xcvr2450_init,
.base.set_freq = xcvr2450_set_freq,
.base.set_gain = xcvr2450_set_gain_rx,
@@ -169,6 +170,7 @@ struct db_xcvr2450_tx db_xcvr2450_tx = {
.base.is_quadrature = true,
.base.i_and_q_swapped = true,
.base.spectrum_inverted = false,
+ .base.default_lo_offset = U2_DOUBLE_TO_FXPT_FREQ(0),
.base.init = xcvr2450_init,
.base.set_freq = xcvr2450_set_freq,
.base.set_gain = xcvr2450_set_gain_tx,