[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r7668 - in usrp2/trunk: firmware/apps firmware/include
From: |
eb |
Subject: |
[Commit-gnuradio] r7668 - in usrp2/trunk: firmware/apps firmware/include firmware/lib host/lib |
Date: |
Wed, 13 Feb 2008 19:04:54 -0700 (MST) |
Author: eb
Date: 2008-02-13 19:04:53 -0700 (Wed, 13 Feb 2008)
New Revision: 7668
Modified:
usrp2/trunk/firmware/apps/rx_only.c
usrp2/trunk/firmware/include/usrp2_eth_packet.h
usrp2/trunk/firmware/lib/memory_map.h
usrp2/trunk/host/lib/usrp2_basic.cc
usrp2/trunk/host/lib/usrp2_basic.h
Log:
Revised to use new rx_command register format with "now" (31) and
"chain" (30) bits.
Modified: usrp2/trunk/firmware/apps/rx_only.c
===================================================================
--- usrp2/trunk/firmware/apps/rx_only.c 2008-02-14 00:12:09 UTC (rev 7667)
+++ usrp2/trunk/firmware/apps/rx_only.c 2008-02-14 02:04:53 UTC (rev 7668)
@@ -135,20 +135,27 @@
streaming_p = true;
streaming_frame_count = FRAMES_PER_CMD;
dsp_rx_regs->rx_command =
- MK_RX_CMD(FRAMES_PER_CMD * p->samples_per_frame, p->samples_per_frame);
+ MK_RX_CMD(FRAMES_PER_CMD * p->samples_per_frame, p->samples_per_frame,
+ p->rx_now, 1); // set "chain" bit
// kick off the state machine
dbsm_start(&dsp_rx_sm);
- dsp_rx_regs->rx_time = T_NOW; // queue up two commands
- dsp_rx_regs->rx_time = T_NOW;
+ dsp_rx_regs->rx_time = p->rx_time; // enqueue first of two commands
+
+ // make sure this one and the rest have the "now" and "chain" bits set.
+ dsp_rx_regs->rx_command =
+ MK_RX_CMD(FRAMES_PER_CMD * p->samples_per_frame, p->samples_per_frame,
+ 1, 1);
+ dsp_rx_regs->rx_time = 0; // enqueue second command
}
else {
streaming_p = false;
- dsp_rx_regs->rx_command = MK_RX_CMD(p->total_samples,
p->samples_per_frame);
+ dsp_rx_regs->rx_command =
+ MK_RX_CMD(p->total_samples, p->samples_per_frame, p->rx_now, 0);
// kick off the state machine
dbsm_start(&dsp_rx_sm);
- dsp_rx_regs->rx_time = T_NOW; // start NOW!
+ dsp_rx_regs->rx_time = p->rx_time;
}
}
@@ -207,7 +214,7 @@
// queue up another rx command when required
if (streaming_p && --streaming_frame_count == 0){
streaming_frame_count = FRAMES_PER_CMD;
- dsp_rx_regs->rx_time = T_NOW;
+ dsp_rx_regs->rx_time = 0;
}
return false; // we didn't handle the packet
Modified: usrp2/trunk/firmware/include/usrp2_eth_packet.h
===================================================================
--- usrp2/trunk/firmware/include/usrp2_eth_packet.h 2008-02-14 00:12:09 UTC
(rev 7667)
+++ usrp2/trunk/firmware/include/usrp2_eth_packet.h 2008-02-14 02:04:53 UTC
(rev 7668)
@@ -189,12 +189,14 @@
typedef struct {
uint8_t opcode;
uint8_t len;
- uint16_t mbz;
+ 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^23-1] == [9, 8,388,607]
+ 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 {
Modified: usrp2/trunk/firmware/lib/memory_map.h
===================================================================
--- usrp2/trunk/firmware/lib/memory_map.h 2008-02-14 00:12:09 UTC (rev
7667)
+++ usrp2/trunk/firmware/lib/memory_map.h 2008-02-14 02:04:53 UTC (rev
7668)
@@ -377,15 +377,15 @@
volatile uint32_t scale_iq; // {scale_i,scale_q}
volatile uint32_t decim_rate;
volatile uint32_t rx_time; // when to begin reception
- volatile uint32_t rx_command; // {num_lines(23), lines_per_frame(9)
+ volatile uint32_t rx_command; // {now, chain, num_lines(21),
lines_per_frame(9)
volatile uint32_t clear_state; // clears out state machine, fifos,
// cmd queue, NOT freq, scale, decim
} dsp_rx_regs_t;
#define dsp_rx_regs ((dsp_rx_regs_t *) DSP_RX_BASE)
-#define MK_RX_CMD(num_lines, lines_per_frame) \
- (((num_lines) << 9) | ((lines_per_frame) & 0x1ff))
+#define MK_RX_CMD(num_lines, lines_per_frame, now, chain) \
+ (((num_lines) << 9) | ((lines_per_frame) & 0x1ff) | (((now) & 0x1) << 31) |
(((chain) & 0x1) << 30))
/*
* --- ethernet tx protocol engine regs (write only) ---
Modified: usrp2/trunk/host/lib/usrp2_basic.cc
===================================================================
--- usrp2/trunk/host/lib/usrp2_basic.cc 2008-02-14 00:12:09 UTC (rev 7667)
+++ usrp2/trunk/host/lib/usrp2_basic.cc 2008-02-14 02:04:53 UTC (rev 7668)
@@ -176,10 +176,12 @@
usrp2_basic::start_rx(const u2_mac_addr_t &which,
double freq,
unsigned int decim,
- unsigned int total_samples, // [9, 2**23 - 1]
+ unsigned int total_samples, // 0 or [9, 2**21 - 1]
unsigned int samples_per_frame, // [9, 371] or [9, 505]
if MTU==2034
int scale_i, // 16.0 fixed point
format
- int scale_q // 16.0 fixed point
format
+ int scale_q, // 16.0 fixed point
format
+ bool rx_now,
+ uint32_t rx_time
)
{
uint8_t pktbuf[MAX_PKTLEN];
@@ -190,7 +192,7 @@
op_start_rx_t op;
};
- if ((total_samples < 9 && total_samples != 0) || total_samples >= (1L <<
23)){
+ if ((total_samples < 9 && total_samples != 0) || total_samples >= (1L <<
21)){
std::cerr << "usrp2_basic::start_rx: total_samples is out of range\n";
return false;
}
@@ -207,11 +209,13 @@
c->op.len = sizeof(op_start_rx_t);
double actual_freq;
+ c->op.rx_now = rx_now ? 1 : 0;
c->op.phase_inc = htonl(compute_freq_control_word_fpga(adc_rate(), freq,
&actual_freq));
c->op.scale_iq = htonl(((scale_i & 0xffff) << 16) | (scale_q & 0xffff));
c->op.decim = htonl(decim);
c->op.samples_per_frame = htonl(samples_per_frame);
c->op.total_samples = htonl(total_samples);
+ c->op.rx_time = htonl(rx_time);
int len = std::max((size_t) MIN_PKTLEN, sizeof(command));
Modified: usrp2/trunk/host/lib/usrp2_basic.h
===================================================================
--- usrp2/trunk/host/lib/usrp2_basic.h 2008-02-14 00:12:09 UTC (rev 7667)
+++ usrp2/trunk/host/lib/usrp2_basic.h 2008-02-14 02:04:53 UTC (rev 7668)
@@ -80,10 +80,12 @@
bool start_rx(const u2_mac_addr_t &which,
double freq,
unsigned int decim,
- unsigned int total_samples, // [9, 2**23 - 1]
+ unsigned int total_samples, // 0 to begin streaming, or [9,
2**21 - 1]
unsigned int samples_per_frame, // [9, 372] or [9, 506] if
MTU==2034
int scale_i, // 16.0 fixed point format
- int scale_q // 16.0 fixed point format
+ int scale_q, // 16.0 fixed point format
+ bool rx_now = true, // if true begin receiving now
+ uint32_t rx_time = -1 // otherwise begin receiving at
rx_time
);
bool stop_rx(const u2_mac_addr_t &which);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r7668 - in usrp2/trunk: firmware/apps firmware/include firmware/lib host/lib,
eb <=