summaryrefslogtreecommitdiff
path: root/usrp2/firmware
diff options
context:
space:
mode:
authoreb2008-10-22 00:56:40 +0000
committereb2008-10-22 00:56:40 +0000
commitbfe79d23738f24562dc7612049a90e8b20b53f79 (patch)
tree312e66fc143621f320f6e57592f5194e15e52e1f /usrp2/firmware
parentafc6e2b005581d1061b47c464f47ff2b48c6418b (diff)
downloadgnuradio-bfe79d23738f24562dc7612049a90e8b20b53f79.tar.gz
gnuradio-bfe79d23738f24562dc7612049a90e8b20b53f79.tar.bz2
gnuradio-bfe79d23738f24562dc7612049a90e8b20b53f79.zip
Added methods to query daughterboard parameters. Merged eb/u2-wip2
-r9804:9814 into trunk; initialized dacmux in firmware. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@9816 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.h34
-rw-r--r--usrp2/firmware/lib/memory_map.h2
-rw-r--r--usrp2/firmware/lib/u2_init.c2
4 files changed, 72 insertions, 3 deletions
diff --git a/usrp2/firmware/apps/app_common_v2.c b/usrp2/firmware/apps/app_common_v2.c
index e267401a9..f132e55fd 100644
--- a/usrp2/firmware/apps/app_common_v2.c
+++ b/usrp2/firmware/apps/app_common_v2.c
@@ -27,6 +27,7 @@
#include "nonstdio.h"
#include "print_rmon_regs.h"
#include "db.h"
+#include "db_base.h"
#include "clocks.h"
#include "u2_init.h"
#include <string.h>
@@ -279,6 +280,38 @@ read_time_cmd(const op_generic_t *p,
return r->len;
}
+static void
+fill_db_info(u2_db_info_t *p, const struct db_base *db)
+{
+ p->dbid = db->dbid;
+ p->freq_min_hi = u2_fxpt_freq_hi(db->freq_min);
+ p->freq_min_lo = u2_fxpt_freq_lo(db->freq_min);
+ p->freq_max_hi = u2_fxpt_freq_hi(db->freq_max);
+ p->freq_max_lo = u2_fxpt_freq_lo(db->freq_max);
+ p->gain_min = db->gain_min;
+ p->gain_max = db->gain_max;
+ p->gain_step_size = db->gain_step_size;
+}
+
+static size_t
+dboard_info_cmd(const op_generic_t *p,
+ void *reply_payload, size_t reply_payload_space)
+{
+ op_dboard_info_reply_t *r = (op_dboard_info_reply_t *) reply_payload;
+ if (reply_payload_space < sizeof(*r))
+ return 0; // no room
+
+ r->opcode = OP_DBOARD_INFO_REPLY;
+ r->len = sizeof(*r);
+ r->rid = p->rid;
+ r->ok = true;
+
+ fill_db_info(&r->tx_db_info, tx_dboard);
+ fill_db_info(&r->rx_db_info, rx_dboard);
+
+ return r->len;
+}
+
static size_t
generic_reply(const op_generic_t *p,
void *reply_payload, size_t reply_payload_space,
@@ -374,6 +407,10 @@ handle_control_chan_frame(u2_eth_packet_t *pkt, size_t len)
subpktlen = read_time_cmd(gp, reply_payload, reply_payload_space);
break;
+ case OP_DBOARD_INFO:
+ subpktlen = dboard_info_cmd(gp, reply_payload, reply_payload_space);
+ 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 ca13d61ad..ed3ce1fe3 100644
--- a/usrp2/firmware/include/usrp2_eth_packet.h
+++ b/usrp2/firmware/include/usrp2_eth_packet.h
@@ -181,6 +181,8 @@ typedef struct {
#define OP_STOP_RX_REPLY (OP_STOP_RX | OP_REPLY_BIT)
#define OP_CONFIG_MIMO 8
#define OP_CONFIG_MIMO_REPLY (OP_CONFIG_MIMO | OP_REPLY_BIT)
+#define OP_DBOARD_INFO 9
+#define OP_DBOARD_INFO_REPLY (OP_DBOARD_INFO | OP_REPLY_BIT)
//#define OP_WRITE_REG xx // not implemented
@@ -199,7 +201,7 @@ typedef struct {
*
* Used by:
* OP_EOP, OP_BURN_MAC_ADDR_REPLY, OP_START_RX_STREAMING_REPLY,
- * OP_STOP_RX_REPLY
+ * OP_STOP_RX_REPLY, OP_DBOARD_INFO
*/
typedef struct {
uint8_t opcode;
@@ -348,6 +350,36 @@ typedef struct {
} op_config_mimo_t;
+/*!
+ * \brief High-level information about daughterboards
+ */
+typedef struct {
+ int32_t dbid; //< d'board ID (-1 none, -2 invalid eeprom)
+ uint32_t freq_min_hi; //< high 32-bits of 64-bit fxpt_freq (Q44.20)
+ uint32_t freq_min_lo; //< low 32-bits of 64-bit fxpt_freq (Q44.20)
+ uint32_t freq_max_hi; //< high 32-bits of 64-bit fxpt_freq (Q44.20)
+ uint32_t freq_max_lo; //< low 32-bits of 64-bit fxpt_freq (Q44.20)
+ uint16_t gain_min; //< min gain that can be set. fxpt_db (Q9.7)
+ uint16_t gain_max; //< max gain that can be set. fxpt_db (Q9.7)
+ uint16_t gain_step_size; //< fxpt_db (Q9.7)
+} u2_db_info_t;
+
+
+/*!
+ * \brief Reply to d'board info request
+ */
+typedef struct {
+ uint8_t opcode;
+ uint8_t len;
+ uint8_t rid;
+ uint8_t ok; // request was successful (bool)
+
+ u2_db_info_t tx_db_info;
+ u2_db_info_t rx_db_info;
+} _AL4 op_dboard_info_reply_t;
+
+
+
/*
* ================================================================
* union of all of subpacket types
diff --git a/usrp2/firmware/lib/memory_map.h b/usrp2/firmware/lib/memory_map.h
index 740bf47fa..159b095c1 100644
--- a/usrp2/firmware/lib/memory_map.h
+++ b/usrp2/firmware/lib/memory_map.h
@@ -412,7 +412,7 @@ typedef struct {
* The default value is 0x10
* </pre>
*/
- volatile uint32_t tx_mux; // FIXME this register is currently unimplemented
+ volatile uint32_t tx_mux;
} dsp_tx_regs_t;
diff --git a/usrp2/firmware/lib/u2_init.c b/usrp2/firmware/lib/u2_init.c
index 7482040f0..948055694 100644
--- a/usrp2/firmware/lib/u2_init.c
+++ b/usrp2/firmware/lib/u2_init.c
@@ -87,7 +87,7 @@ u2_init(void)
ad9777_write_reg(12, 0);
// Initial values for tx and rx mux registers
- // dsp_tx_regs->tx_mux = 0x10;
+ dsp_tx_regs->tx_mux = 0x10;
dsp_rx_regs->rx_mux = 0x44444444;
// Set up serdes