[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r8615 - in usrp2/branches/features/host-ng: firmware/a
From: |
eb |
Subject: |
[Commit-gnuradio] r8615 - in usrp2/branches/features/host-ng: firmware/apps firmware/include host-ng/lib |
Date: |
Wed, 18 Jun 2008 15:15:42 -0600 (MDT) |
Author: eb
Date: 2008-06-18 15:15:39 -0600 (Wed, 18 Jun 2008)
New Revision: 8615
Removed:
usrp2/branches/features/host-ng/firmware/apps/app_common.h
usrp2/branches/features/host-ng/firmware/apps/rx_only.c
usrp2/branches/features/host-ng/firmware/apps/tx_only.c
Modified:
usrp2/branches/features/host-ng/firmware/apps/Makefile.am
usrp2/branches/features/host-ng/firmware/apps/app_common_v2.c
usrp2/branches/features/host-ng/firmware/apps/app_common_v2.h
usrp2/branches/features/host-ng/firmware/include/usrp2_eth_packet.h
usrp2/branches/features/host-ng/host-ng/lib/control.h
usrp2/branches/features/host-ng/host-ng/lib/find.cc
usrp2/branches/features/host-ng/host-ng/lib/usrp2_impl.cc
Log:
Refactored subpackets into a smaller set. Renumbered OP_*. Replies
now correspond to the OP_* with the OP_REPLY_BIT set. Firmware now
handles multiple subpackets per command packet and generates replies
for all commands. Compiles OK, but not yet tested on h/w.
Modified: usrp2/branches/features/host-ng/firmware/apps/Makefile.am
===================================================================
--- usrp2/branches/features/host-ng/firmware/apps/Makefile.am 2008-06-18
20:02:27 UTC (rev 8614)
+++ usrp2/branches/features/host-ng/firmware/apps/Makefile.am 2008-06-18
21:15:39 UTC (rev 8615)
@@ -1,5 +1,5 @@
#
-# Copyright 2007 Free Software Foundation, Inc.
+# Copyright 2007,2008 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
@@ -29,7 +29,6 @@
ibs_rx_test \
ibs_tx_test \
rcv_eth_packets \
- rx_only \
rx_only_v2 \
read_dbids \
test1 \
@@ -40,12 +39,9 @@
test_lsdac \
test_serdes \
timer_test \
- tx_only \
tx_only_v2 \
tx_standalone \
txrx \
- eth_to_serdes \
- serdes_to_dsp \
sd_gentest \
sd_bounce
@@ -53,13 +49,11 @@
# tx_drop_SOURCES = tx_drop.c app_common.c
# tx_drop_rate_limited_SOURCES = tx_drop_rate_limited.c app_common.c
# tx_drop2_SOURCES = tx_drop2.c app_common.c
-tx_only_SOURCES = tx_only.c app_common.c
-rx_only_SOURCES = rx_only.c app_common.c
rx_only_v2_SOURCES = rx_only_v2.c app_common_v2.c
tx_only_v2_SOURCES = tx_only_v2.c app_common_v2.c
txrx_SOURCES = txrx.c app_common_v2.c
-eth_to_serdes_SOURCES = eth_to_serdes.c app_passthru.c
-serdes_to_dsp_SOURCES = serdes_to_dsp.c app_common.c
+#eth_to_serdes_SOURCES = eth_to_serdes.c app_passthru.c
+#serdes_to_dsp_SOURCES = serdes_to_dsp.c app_common.c
Deleted: usrp2/branches/features/host-ng/firmware/apps/app_common.h
Modified: usrp2/branches/features/host-ng/firmware/apps/app_common_v2.c
===================================================================
--- usrp2/branches/features/host-ng/firmware/apps/app_common_v2.c
2008-06-18 20:02:27 UTC (rev 8614)
+++ usrp2/branches/features/host-ng/firmware/apps/app_common_v2.c
2008-06-18 21:15:39 UTC (rev 8615)
@@ -38,10 +38,10 @@
static unsigned char exp_seqno = 0;
-static void
+static bool
burn_mac_addr(const op_burn_mac_addr_t *p)
{
- ethernet_set_mac_addr(&p->addr);
+ return ethernet_set_mac_addr(&p->addr);
}
void
@@ -90,155 +90,38 @@
}
-void
-handle_control_chan_frame(u2_eth_packet_t *pkt, size_t len)
+static size_t
+op_id_cmd(const op_generic_t *p,
+ void *reply_payload, size_t reply_payload_space)
{
- unsigned char reply[sizeof(u2_eth_packet_t) + sizeof(u2_subpkt_t)] _AL4;
- unsigned char *s = &reply[sizeof(u2_eth_packet_t)];
- size_t reply_len = 0;
+ if (reply_payload_space < sizeof(op_id_reply_t)) // no room
+ return 0;
- // initialize reply
- memset(reply, 0, sizeof(reply));
- set_reply_hdr((u2_eth_packet_t *) reply, pkt);
+ // Build reply subpacket
- // point to beginning of payload (subpackets)
- unsigned char *p = ((unsigned char *) pkt) + sizeof(u2_eth_packet_t);
+ op_id_reply_t *r = (op_id_reply_t *) reply_payload;
+ r->opcode = OP_ID_REPLY;
+ r->len = sizeof(op_id_reply_t);
+ r->rid = p->rid;
+ r->addr = *ethernet_mac_addr();
+ r->hw_rev = 0x0000; // FIXME
+ // r->fpga_md5sum = ; // FIXME
+ // r->sw_md5sum = ; // FIXME
- // FIXME iterate over payload, handling more than a single subpacket
+ // FIXME Add d'board info, including dbid, min/max gain, min/max freq
- int opcode = p[0];
-
- switch(opcode){
- case OP_ID:
- {
- op_id_reply_t *r = (op_id_reply_t *) s;
- reply_len = sizeof(u2_eth_packet_t) + sizeof(op_id_reply_t);
- r->opcode = OP_ID_REPLY;
- r->len = sizeof(op_id_reply_t);
- r->rid = ((op_id_t *) p)->rid;
- r->addr = *ethernet_mac_addr();
- r->hw_rev = 0x0000; // FIXME
- // r->fpga_md5sum = ; // FIXME
- // r->sw_md5sum = ; // FIXME
-
- // FIXME Add d'board info, including dbid, min/max gain, min/max freq
- }
- send_reply(reply, reply_len);
- break;
-
- case OP_CONFIG_TX_V2:
- config_tx_v2_cmd((op_config_tx_v2_t *) p, (op_config_tx_reply_v2_t *) s);
- send_reply(reply, sizeof(u2_eth_packet_t) + s[1]);
- break;
-
- case OP_CONFIG_RX_V2:
- config_rx_v2_cmd((op_config_rx_v2_t *) p, (op_config_rx_reply_v2_t *) s);
- send_reply(reply, sizeof(u2_eth_packet_t) + s[1]);
- break;
-
- case OP_START_RX_STREAMING:
- start_rx_streaming_cmd(&pkt->ehdr.src, (op_start_rx_streaming_t *) p);
- break;
-
- case OP_STOP_RX:
- stop_rx_cmd();
- break;
-
- case OP_BURN_MAC_ADDR:
- burn_mac_addr((op_burn_mac_addr_t *) p);
- break;
-
- case OP_READ_TIME:
- {
- op_read_time_reply_t *r = (op_read_time_reply_t *) s;
- reply_len = sizeof(u2_eth_packet_t) + sizeof(op_read_time_reply_t);
- r->opcode = OP_READ_TIME_REPLY;
- r->len = sizeof(op_read_time_reply_t);
- r->rid = ((op_read_time_t *) p)->rid;
- r->time = timer_regs->time;
- }
- send_reply(reply, reply_len);
- break;
-
- default:
- printf("app_common_v2: unhandled opcode = %d\n", opcode);
- break;
- }
+ return r->len;
}
-/*
- * Called when an ethernet packet is received.
- * Return true if we handled it here, otherwise
- * it'll be passed on to the DSP Tx pipe
- */
-bool
-eth_pkt_inspector(dbsm_t *sm, int bufno)
+static size_t
+config_tx_v2_cmd(const op_config_tx_v2_t *p,
+ void *reply_payload, size_t reply_payload_space)
{
- u2_eth_packet_t *pkt = (u2_eth_packet_t *) buffer_ram(bufno);
- size_t byte_len = (buffer_pool_status->last_line[bufno] - 3) * 4;
+ op_config_tx_reply_v2_t *r = (op_config_tx_reply_v2_t *) reply_payload;
+ if (reply_payload_space < sizeof(*r))
+ return 0; // no room
- hal_toggle_leds(0x1);
-
- // inspect rcvd frame and figure out what do do.
-
- if (pkt->ehdr.ethertype != U2_ETHERTYPE)
- return true; // ignore, probably bogus PAUSE frame from MAC
-
- int chan = u2p_chan(&pkt->fixed);
-
- switch (chan){
- case CONTROL_CHAN:
- handle_control_chan_frame(pkt, byte_len);
- return true; // we handled the packet
- break;
-
- case 0:
- default:
-#if 0
- if((pkt->thdr.seqno) == exp_seqno){
- exp_seqno++;
- //putchar('.');
- }
- else {
- // putchar('S');
- //printf("S%d %d ",exp_seqno,pkt->thdr.seqno);
- exp_seqno = pkt->thdr.seqno + 1;
- }
-#endif
- return false; // pass it on to Tx DSP
- break;
- }
-}
-
-/*
- * Called when eth phy state changes (w/ interrupts disabled)
- */
-void
-link_changed_callback(int speed)
-{
- link_is_up = speed != 0;
- hal_set_leds(link_is_up ? 0x10 : 0x0, 0x10);
- printf("\neth link changed: speed = %d\n", speed);
-}
-
-
-void
-print_tune_result(char *msg, bool tune_ok,
- u2_fxpt_freq_t target_freq, struct tune_result *r)
-{
- printf("db_tune %s %s\n", msg, tune_ok ? "true" : "false");
- putstr(" target_freq "); print_fxpt_freq(target_freq); newline();
- putstr(" baseband_freq "); print_fxpt_freq(r->baseband_freq); newline();
- putstr(" dxc_freq "); print_fxpt_freq(r->dxc_freq); newline();
- putstr(" residual_freq "); print_fxpt_freq(r->residual_freq); newline();
- printf(" inverted %s\n", r->inverted ? "true" : "false");
-}
-
-
-void
-config_tx_v2_cmd(const op_config_tx_v2_t *p, op_config_tx_reply_v2_t *r)
-{
struct tune_result tune_result;
memset(&tune_result, 0, sizeof(tune_result));
@@ -263,10 +146,10 @@
dsp_tx_regs->scale_iq = p->scale_iq;
}
- // Build reply; it's sent by our caller.
+ // Build reply subpacket
r->opcode = OP_CONFIG_TX_REPLY_V2;
- r->len = sizeof(op_config_tx_reply_v2_t);
+ r->len = sizeof(*r);
r->rid = p->rid;
r->ok = ok;
r->inverted = tune_result.inverted;
@@ -276,11 +159,17 @@
r->duc_freq_lo = u2_fxpt_freq_lo(tune_result.dxc_freq);
r->residual_freq_hi = u2_fxpt_freq_hi(tune_result.residual_freq);
r->residual_freq_lo = u2_fxpt_freq_lo(tune_result.residual_freq);
+ return r->len;
}
-void
-config_rx_v2_cmd(const op_config_rx_v2_t *p, op_config_rx_reply_v2_t *r)
+static size_t
+config_rx_v2_cmd(const op_config_rx_v2_t *p,
+ void *reply_payload, size_t reply_payload_space)
{
+ op_config_rx_reply_v2_t *r = (op_config_rx_reply_v2_t *) reply_payload;
+ if (reply_payload_space < sizeof(*r))
+ return 0; // no room
+
struct tune_result tune_result;
memset(&tune_result, 0, sizeof(tune_result));
@@ -320,10 +209,10 @@
dsp_rx_regs->scale_iq = p->scale_iq;
}
- // Build reply; it's sent by our caller.
+ // Build reply subpacket
r->opcode = OP_CONFIG_RX_REPLY_V2;
- r->len = sizeof(op_config_rx_reply_v2_t);
+ r->len = sizeof(*r);
r->rid = p->rid;
r->ok = ok;
r->inverted = tune_result.inverted;
@@ -333,4 +222,204 @@
r->ddc_freq_lo = u2_fxpt_freq_lo(tune_result.dxc_freq);
r->residual_freq_hi = u2_fxpt_freq_hi(tune_result.residual_freq);
r->residual_freq_lo = u2_fxpt_freq_lo(tune_result.residual_freq);
+
+ return r->len;
}
+
+static size_t
+read_time_cmd(const op_generic_t *p,
+ void *reply_payload, size_t reply_payload_space)
+{
+ op_read_time_reply_t *r = (op_read_time_reply_t *) reply_payload;
+ if (reply_payload_space < sizeof(*r))
+ return 0; // no room
+
+ r->opcode = OP_READ_TIME_REPLY;
+ r->len = sizeof(*r);
+ r->rid = p->rid;
+ r->time = timer_regs->time;
+
+ return r->len;
+}
+
+static size_t
+generic_reply(const op_generic_t *p,
+ void *reply_payload, size_t reply_payload_space,
+ bool ok)
+{
+ 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;
+}
+
+static size_t
+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;
+}
+
+void
+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)){
+ const op_generic_t *gp = (const op_generic_t *) payload;
+ subpktlen = 0;
+
+ switch(gp->opcode){
+ case OP_EOP: // end of subpackets
+ break;
+
+ case OP_ID:
+ subpktlen = op_id_cmd(gp, reply_payload, reply_payload_space);
+ break;
+
+ case OP_CONFIG_TX_V2:
+ subpktlen = config_tx_v2_cmd((op_config_tx_v2_t *) payload,
+ reply_payload, reply_payload_space);
+ break;
+
+ case OP_CONFIG_RX_V2:
+ subpktlen = config_rx_v2_cmd((op_config_rx_v2_t *) payload,
+ reply_payload, reply_payload_space);
+ break;
+
+ case OP_START_RX_STREAMING:
+ start_rx_streaming_cmd(&pkt->ehdr.src, (op_start_rx_streaming_t *)
payload);
+ subpktlen = generic_reply(gp, reply_payload, reply_payload_space, true);
+ break;
+
+ case OP_STOP_RX:
+ stop_rx_cmd();
+ subpktlen = generic_reply(gp, reply_payload, reply_payload_space, true);
+ break;
+
+ case OP_BURN_MAC_ADDR:
+ subpktlen = generic_reply(gp, reply_payload, reply_payload_space,
+ burn_mac_addr((op_burn_mac_addr_t *) payload));
+ break;
+
+ case OP_READ_TIME:
+ subpktlen = read_time_cmd(gp, reply_payload, reply_payload_space);
+ break;
+
+ default:
+ printf("app_common_v2: unhandled opcode = %d\n", gp->opcode);
+ break;
+ }
+
+ int t = (gp->len + 3) & ~3; // bump to a multiple of 4
+ payload += t;
+ payload_len -= t;
+
+ subpktlen = (subpktlen + 3) & ~3; // bump to a multiple of 4
+ reply_payload += subpktlen;
+ reply_payload_space -= subpktlen;
+ }
+
+ // add the EOP marker
+ subpktlen = add_eop(reply_payload, reply_payload_space);
+ subpktlen = (subpktlen + 3) & ~3; // bump to a multiple of 4
+ reply_payload += subpktlen;
+ reply_payload_space -= subpktlen;
+
+ send_reply(reply, reply_payload - reply);
+}
+
+
+/*
+ * Called when an ethernet packet is received.
+ * Return true if we handled it here, otherwise
+ * it'll be passed on to the DSP Tx pipe
+ */
+bool
+eth_pkt_inspector(dbsm_t *sm, int bufno)
+{
+ u2_eth_packet_t *pkt = (u2_eth_packet_t *) buffer_ram(bufno);
+ size_t byte_len = (buffer_pool_status->last_line[bufno] - 3) * 4;
+
+ hal_toggle_leds(0x1);
+
+ // inspect rcvd frame and figure out what do do.
+
+ if (pkt->ehdr.ethertype != U2_ETHERTYPE)
+ return true; // ignore, probably bogus PAUSE frame from MAC
+
+ int chan = u2p_chan(&pkt->fixed);
+
+ switch (chan){
+ case CONTROL_CHAN:
+ handle_control_chan_frame(pkt, byte_len);
+ return true; // we handled the packet
+ break;
+
+ case 0:
+ default:
+#if 0
+ if((pkt->thdr.seqno) == exp_seqno){
+ exp_seqno++;
+ //putchar('.');
+ }
+ else {
+ // putchar('S');
+ //printf("S%d %d ",exp_seqno,pkt->thdr.seqno);
+ exp_seqno = pkt->thdr.seqno + 1;
+ }
+#endif
+ return false; // pass it on to Tx DSP
+ break;
+ }
+}
+
+/*
+ * Called when eth phy state changes (w/ interrupts disabled)
+ */
+void
+link_changed_callback(int speed)
+{
+ link_is_up = speed != 0;
+ hal_set_leds(link_is_up ? 0x10 : 0x0, 0x10);
+ printf("\neth link changed: speed = %d\n", speed);
+}
+
+
+void
+print_tune_result(char *msg, bool tune_ok,
+ u2_fxpt_freq_t target_freq, struct tune_result *r)
+{
+ printf("db_tune %s %s\n", msg, tune_ok ? "true" : "false");
+ putstr(" target_freq "); print_fxpt_freq(target_freq); newline();
+ putstr(" baseband_freq "); print_fxpt_freq(r->baseband_freq); newline();
+ putstr(" dxc_freq "); print_fxpt_freq(r->dxc_freq); newline();
+ putstr(" residual_freq "); print_fxpt_freq(r->residual_freq); newline();
+ printf(" inverted %s\n", r->inverted ? "true" : "false");
+}
Modified: usrp2/branches/features/host-ng/firmware/apps/app_common_v2.h
===================================================================
--- usrp2/branches/features/host-ng/firmware/apps/app_common_v2.h
2008-06-18 20:02:27 UTC (rev 8614)
+++ usrp2/branches/features/host-ng/firmware/apps/app_common_v2.h
2008-06-18 21:15:39 UTC (rev 8615)
@@ -54,8 +54,6 @@
u2_fxpt_freq_t target_freq, struct tune_result *r);
-void config_tx_v2_cmd(const op_config_tx_v2_t *p, op_config_tx_reply_v2_t *r);
-void config_rx_v2_cmd(const op_config_rx_v2_t *p, op_config_rx_reply_v2_t *r);
void start_rx_streaming_cmd(const u2_mac_addr_t *host, op_start_rx_streaming_t
*p);
void stop_rx_cmd(void);
Deleted: usrp2/branches/features/host-ng/firmware/apps/rx_only.c
Deleted: usrp2/branches/features/host-ng/firmware/apps/tx_only.c
Modified: usrp2/branches/features/host-ng/firmware/include/usrp2_eth_packet.h
===================================================================
--- usrp2/branches/features/host-ng/firmware/include/usrp2_eth_packet.h
2008-06-18 20:02:27 UTC (rev 8614)
+++ usrp2/branches/features/host-ng/firmware/include/usrp2_eth_packet.h
2008-06-18 21:15:39 UTC (rev 8615)
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2007 Free Software Foundation, Inc.
+ * Copyright 2007,2008 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
@@ -32,6 +32,9 @@
* All these data structures are BIG-ENDIAN on the wire
*/
+// FIXME gcc specific. Really ought to come from compiler.h
+#define _AL4 __attribute__((aligned (4)))
+
/*
* \brief The classic 14-byte ethernet header
*/
@@ -154,47 +157,53 @@
/*
* Opcodes for control channel
+ *
+ * Reply opcodes are the same as the request opcode with the OP_REPLY_BIT set
(0x80).
*/
-#define OP_EOP 0 // marks last subpacket in
packet
-#define OP_ID 1
-#define OP_ID_REPLY 2
-#define OP_BURN_MAC_ADDR 3
-#define OP_READ_TIME 4 // What time is it? (100 MHz
counter)
-#define OP_READ_TIME_REPLY 5 // This time.
-#define OP_CONFIG_RX_V2 6
-#define OP_CONFIG_RX_REPLY_V2 7
-#define OP_CONFIG_TX_V2 8
-#define OP_CONFIG_TX_REPLY_V2 9
-#define OP_START_RX_STREAMING 10
-#define OP_STOP_RX 11
-#define OP_START_RX 20 // deprecated
-#define OP_CONFIG_TX 21 // deprecated
+#define OP_REPLY_BIT 0x80
-#define OP_WRITE_REG 25 // not implemented
-#define OP_WRITE_REG_MASKED 26
-#define OP_READ_REG 27
-#define OP_READ_REG_REPLY 28
+#define OP_EOP 0 // marks last subpacket in
packet
+#define OP_ID 1
+#define OP_ID_REPLY (OP_ID | OP_REPLY_BIT)
+#define OP_BURN_MAC_ADDR 2
+#define OP_BURN_MAC_ADDR_REPLY (OP_BURN_MAC_ADDR | OP_REPLY_BIT)
+#define OP_READ_TIME 3 // What time is it? (100 MHz
counter)
+#define OP_READ_TIME_REPLY (OP_READ_TIME | OP_REPLY_BIT)
+#define OP_CONFIG_RX_V2 4
+#define OP_CONFIG_RX_REPLY_V2 (OP_CONFIG_RX_V2 | OP_REPLY_BIT)
+#define OP_CONFIG_TX_V2 5
+#define OP_CONFIG_TX_REPLY_V2 (OP_CONFIG_TX_V2 | OP_REPLY_BIT)
+#define OP_START_RX_STREAMING 6
+#define OP_START_RX_STREAMING_REPLY (OP_START_RX_STREAMING |
OP_REPLY_BIT)
+#define OP_STOP_RX 7
+#define OP_STOP_RX_REPLY (OP_STOP_RX | OP_REPLY_BIT)
-/*!
- * \brief Marker for last subpacket in packet
+//#define OP_WRITE_REG xx // not implemented
+//#define OP_WRITE_REG_MASKED xx
+//#define OP_READ_REG xx
+//#define OP_READ_REG_REPLY xx
+
+/*
+ * All subpackets are a multiple of 4 bytes long.
+ * All subpackets start with an 8-bit opcode, an 8-bit len and an 8-bit rid.
*/
-typedef struct {
- uint8_t opcode;
- uint8_t len;
- uint16_t mbz;
-} op_eop_t;
+
/*!
- * \brief Look for USRP2's
+ * \brief Generic request and reply packet
+ *
+ * Used by:
+ * OP_EOP, OP_BURN_MAC_ADDR_REPLY, OP_START_RX_STREAMING_REPLY,
+ * OP_STOP_RX_REPLY
*/
typedef struct {
uint8_t opcode;
uint8_t len;
uint8_t rid;
- uint8_t mbz;
-} op_id_t;
+ uint8_t ok; // bool
+} _AL4 op_generic_t;
/*!
* \brief Reply info from a USRP2
@@ -208,41 +217,30 @@
uint16_t hw_rev;
uint8_t fpga_md5sum[16];
uint8_t sw_md5sum[16];
-} op_id_reply_t;
+} _AL4 op_id_reply_t;
typedef struct {
uint8_t opcode;
uint8_t len;
- uint16_t mbz;
+ uint8_t rid;
+ uint8_t mbz;
uint32_t items_per_frame; // # of 32-bit data items; MTU=1500: [9,371]
-} op_start_rx_streaming_t;
+} _AL4 op_start_rx_streaming_t;
typedef struct {
uint8_t opcode;
uint8_t len;
- uint16_t mbz;
-} op_stop_rx_t;
-
-typedef struct {
- uint8_t opcode;
- uint8_t len;
+ uint8_t rid;
u2_mac_addr_t addr;
-} op_burn_mac_addr_t;
+} _AL4 op_burn_mac_addr_t;
typedef struct {
uint8_t opcode;
uint8_t len;
uint8_t rid;
uint8_t mbz;
-} op_read_time_t;
-
-typedef struct {
- uint8_t opcode;
- uint8_t len;
- uint8_t rid;
- uint8_t mbz;
uint32_t time;
-} op_read_time_reply_t;
+} _AL4 op_read_time_reply_t;
/*!
@@ -260,7 +258,7 @@
uint32_t freq_lo; // low 32-bits of 64-bit fxpt_freq (Q44.20)
uint32_t decim; // desired decimation factor (NOT -1)
uint32_t scale_iq; // (scale_i << 16) | scale_q [16.0 format]
-} op_config_rx_v2_t;
+} _AL4 op_config_rx_v2_t;
// bitmask for "valid" field. If the bit is set, there's
// meaningful data in the corresonding field.
@@ -292,7 +290,7 @@
uint32_t residual_freq_hi;
uint32_t residual_freq_lo;
-} op_config_rx_reply_v2_t;
+} _AL4 op_config_rx_reply_v2_t;
/*!
* \brief Configure transmitter
@@ -310,7 +308,7 @@
uint32_t freq_lo; // low 32-bits of 64-bit fxpt_freq (Q44.20)
uint32_t interp; // desired interpolation factor (NOT -1)
uint32_t scale_iq; // (scale_i << 16) | scale_q [16.0 format]
-} op_config_tx_v2_t;
+} _AL4 op_config_tx_v2_t;
/*!
* \brief Reply to configure transmitter
@@ -334,59 +332,26 @@
uint32_t residual_freq_hi;
uint32_t residual_freq_lo;
-} op_config_tx_reply_v2_t;
+} _AL4 op_config_tx_reply_v2_t;
/*
* ================================================================
- * deprecated subpacket types
- * ================================================================
- */
-
-typedef struct { // Deprecated. Don't use.
- uint8_t opcode;
- uint8_t len;
- uint8_t rx_now; // 1 -> receive now, 0 -> at rx_time
- uint8_t mbz;
- int32_t phase_inc; // 2**32 * desired_freq/100e6
- uint32_t scale_iq; // (scale_i << 16) | scale_q [16.0 format]
- uint32_t decim; // desired decimation factor (NOT -1)
- uint32_t samples_per_frame; // MTU=1500: [9,372]; MTU=2034: [9,506]
- uint32_t total_samples; // [9, 2^21-1] == [9, 2,097,151]
- uint32_t rx_time; // when to begin receiving
-} op_start_rx_t;
-
-typedef struct { // Deprecated. Don't use
- uint8_t opcode;
- uint8_t len;
- uint16_t mbz;
- int32_t phase_inc; // 2**32 * desired_freq/100e6
- uint32_t scale_iq; // (scale_i << 16) | scale_q [16.0 format]
- uint32_t interp; // desired interpolation factor (NOT -1)
-} op_config_tx_t;
-
-/*
- * ================================================================
* union of all of subpacket types
* ================================================================
*/
typedef union {
- op_eop_t op_eop;
- op_id_t op_id;
+
+ op_generic_t op_generic;
op_id_reply_t op_id_reply;
op_start_rx_streaming_t op_start_rx_streaming;
- op_stop_rx_t op_stop_rx;
op_burn_mac_addr_t op_burn_mac_addr;
- op_read_time_t op_read_time;
op_read_time_reply_t op_read_time_reply;
op_config_rx_v2_t op_config_rx_v2;
op_config_rx_reply_v2_t op_config_rx_reply_v2;
op_config_tx_v2_t op_config_tx_v2;
op_config_tx_reply_v2_t op_config_tx_reply_v2;
- op_start_rx_t op_start_rx; // deprecated
- op_config_tx_t op_config_tx; // deprecated
-
} u2_subpkt_t;
Modified: usrp2/branches/features/host-ng/host-ng/lib/control.h
===================================================================
--- usrp2/branches/features/host-ng/host-ng/lib/control.h 2008-06-18
20:02:27 UTC (rev 8614)
+++ usrp2/branches/features/host-ng/host-ng/lib/control.h 2008-06-18
21:15:39 UTC (rev 8615)
@@ -31,20 +31,20 @@
{
u2_eth_packet_t h;
op_config_rx_v2_t op;
- op_eop_t eop;
+ op_generic_t eop;
};
struct op_start_rx_streaming_cmd
{
u2_eth_packet_t h;
op_start_rx_streaming_t op;
- op_eop_t eop;
+ op_generic_t eop;
};
struct op_stop_rx_cmd {
u2_eth_packet_t h;
- op_id_t op;
- op_eop_t eop;
+ op_generic_t op;
+ op_generic_t eop;
};
/*!
Modified: usrp2/branches/features/host-ng/host-ng/lib/find.cc
===================================================================
--- usrp2/branches/features/host-ng/host-ng/lib/find.cc 2008-06-18 20:02:27 UTC
(rev 8614)
+++ usrp2/branches/features/host-ng/host-ng/lib/find.cc 2008-06-18 21:15:39 UTC
(rev 8615)
@@ -43,7 +43,7 @@
props_vector_t result;
struct command {
u2_eth_packet_t h;
- op_id_t op_id;
+ op_generic_t op_id;
};
struct reply {
@@ -77,7 +77,7 @@
u2p_set_word0(&c->h.fixed, 0, CONTROL_CHAN);
u2p_set_timestamp(&c->h.fixed, -1);
c->op_id.opcode = OP_ID;
- c->op_id.len = sizeof(op_id_t);
+ c->op_id.len = sizeof(c->op_id);
int len = std::max((size_t) ethernet::MIN_PKTLEN, sizeof(command));
if (enet->write_packet(c, len) != len)
return result;
@@ -120,8 +120,8 @@
props p;
p.addr = std::string(addr_buf);
p.hw_rev = ntohs(rp->op_id_reply.hw_rev);
- memcpy(&p.fpga_md5sum, &rp->op_id_reply.fpga_md5sum,
sizeof(p.fpga_md5sum));
- memcpy(&p.sw_md5sum, &rp->op_id_reply.sw_md5sum, sizeof(p.sw_md5sum));
+ memcpy(p.fpga_md5sum, rp->op_id_reply.fpga_md5sum,
sizeof(p.fpga_md5sum));
+ memcpy(p.sw_md5sum, rp->op_id_reply.sw_md5sum, sizeof(p.sw_md5sum));
if (FIND_DEBUG)
std::cerr << "usrp2::find: response from " << p.addr << std::endl;
Modified: usrp2/branches/features/host-ng/host-ng/lib/usrp2_impl.cc
===================================================================
--- usrp2/branches/features/host-ng/host-ng/lib/usrp2_impl.cc 2008-06-18
20:02:27 UTC (rev 8614)
+++ usrp2/branches/features/host-ng/host-ng/lib/usrp2_impl.cc 2008-06-18
21:15:39 UTC (rev 8615)
@@ -56,12 +56,12 @@
case OP_CONFIG_TX_REPLY_V2: return "OP_CONFIG_TX_REPLY_V2";
case OP_START_RX_STREAMING: return "OP_START_RX_STREAMING";
case OP_STOP_RX: return "OP_STOP_RX";
- case OP_START_RX: return "OP_START_RX";
- case OP_CONFIG_TX: return "OP_CONFIG_TX";
+#if 0
case OP_WRITE_REG: return "OP_WRITE_REG";
case OP_WRITE_REG_MASKED: return "OP_WRITE_REG_MASKED";
case OP_READ_REG: return "OP_READ_REG";
case OP_READ_REG_REPLY: return "OP_READ_REG_REPLY";
+#endif
default:
char buf[64];
snprintf(buf, sizeof(buf), "<unknown opcode: %d>", opcode);
@@ -172,10 +172,10 @@
memset(cmd, 0, sizeof(*cmd));
init_etf_hdrs(&cmd->h, d_addr, 0, CONTROL_CHAN, -1);
cmd->op.opcode = OP_CONFIG_RX_V2;
- cmd->op.len = sizeof(op_config_rx_v2_t);
+ cmd->op.len = sizeof(cmd->op);
cmd->op.rid = d_next_rid++; // TODO: reserve rid=0
cmd->eop.opcode = OP_EOP;
- cmd->eop.len = sizeof(op_eop_t);
+ cmd->eop.len = sizeof(cmd->eop);
}
bool
@@ -265,10 +265,10 @@
memset(&cmd, 0, sizeof(cmd));
init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, -1);
cmd.op.opcode = OP_START_RX_STREAMING;
- cmd.op.len = sizeof(op_start_rx_streaming_t);
+ cmd.op.len = sizeof(cmd.op);
cmd.op.items_per_frame = htonl(items_per_frame);
cmd.eop.opcode = OP_EOP;
- cmd.eop.len = sizeof(op_eop_t);
+ cmd.eop.len = sizeof(cmd.eop);
//pending_reply p(cmd.op.rid, &reply, sizeof(reply));
if (!transmit_cmd(&cmd, sizeof(cmd), NULL))
@@ -287,9 +287,9 @@
memset(&cmd, 0, sizeof(cmd));
init_etf_hdrs(&cmd.h, d_addr, 0, CONTROL_CHAN, -1);
cmd.op.opcode = OP_STOP_RX;
- cmd.op.len = sizeof(op_stop_rx_t);
+ cmd.op.len = sizeof(cmd.op);
cmd.eop.opcode = OP_EOP;
- cmd.eop.len = sizeof(op_eop_t);
+ cmd.eop.len = sizeof(cmd.eop);
//pending_reply p(cmd.op.rid, &reply, sizeof(reply));
if (!transmit_cmd(&cmd, sizeof(cmd), NULL))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r8615 - in usrp2/branches/features/host-ng: firmware/apps firmware/include host-ng/lib,
eb <=