[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r6128 - in gnuradio/branches/developers/gnychis/inband
From: |
gnychis |
Subject: |
[Commit-gnuradio] r6128 - in gnuradio/branches/developers/gnychis/inband/usrp/host: apps lib/inband |
Date: |
Wed, 8 Aug 2007 14:06:14 -0600 (MDT) |
Author: gnychis
Date: 2007-08-08 14:06:14 -0600 (Wed, 08 Aug 2007)
New Revision: 6128
Modified:
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/Makefile.am
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_ping.cc
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_registers.cc
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc
Log:
Adding in a read registers test program where we write to a register and try to
read the register value back. Still a work in progress.
Modified: gnuradio/branches/developers/gnychis/inband/usrp/host/apps/Makefile.am
===================================================================
--- gnuradio/branches/developers/gnychis/inband/usrp/host/apps/Makefile.am
2007-08-08 19:13:52 UTC (rev 6127)
+++ gnuradio/branches/developers/gnychis/inband/usrp/host/apps/Makefile.am
2007-08-08 20:06:14 UTC (rev 6128)
@@ -34,6 +34,7 @@
check_order_quickly \
test_usrp_inband_cs \
test_usrp_inband_ping \
+ test_usrp_inband_registers \
test_usrp_inband_rx \
test_usrp_inband_tx \
test_usrp_inband_timestamps \
@@ -77,6 +78,9 @@
test_usrp_inband_timestamps_SOURCES = test_usrp_inband_timestamps.cc
time_stuff.c ui_sincos.c
test_usrp_inband_timestamps_LDADD = $(USRP_LA)
+test_usrp_inband_registers_SOURCES = test_usrp_inband_registers.cc
time_stuff.c ui_sincos.c
+test_usrp_inband_registers_LDADD = $(USRP_LA)
+
test_usrp_inband_rx_SOURCES = test_usrp_inband_rx.cc time_stuff.c
ui_sincos.c
test_usrp_inband_rx_LDADD = $(USRP_LA)
Modified:
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_ping.cc
===================================================================
---
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_ping.cc
2007-08-08 19:13:52 UTC (rev 6127)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_ping.cc
2007-08-08 20:06:14 UTC (rev 6128)
@@ -366,8 +366,8 @@
d_tx->send(s_cmd_to_control_channel, // USRP server signal
pmt_list2(PMT_NIL, // invocation handle
pmt_list1(pmt_list3(s_op_ping_fixed,
- PMT_NIL,
- PMT_NIL))));
+ pmt_from_long(0),
+ pmt_from_long(0)))));
if(verbose)
std::cout << "[TEST_USRP_INBAND_PING] Ping!!" << std::endl;
Modified:
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_registers.cc
===================================================================
---
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_registers.cc
2007-08-08 19:13:52 UTC (rev 6127)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_registers.cc
2007-08-08 20:06:14 UTC (rev 6128)
@@ -34,108 +34,90 @@
#include <mb_msg_accepter.h>
#include <mb_class_registry.h>
#include <pmt.h>
-#include <ui_nco.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <iostream>
+// Include the symbols needed for communication with USRP server
#include <symbols_usrp_server_cs.h>
#include <symbols_usrp_channel.h>
#include <symbols_usrp_low_level_cs.h>
#include <symbols_usrp_tx.h>
#include <symbols_usrp_rx.h>
-#define NBPING 10
-
static bool verbose = true;
-bool bskip = false;
-long bstep = 10000;
-long bcurr = 0;
-long incr = 0x500;
-long ptime = 0x000;
-class test_usrp_inband_timestamps : public mb_mblock
+class test_usrp_inband_registers : public mb_mblock
{
- mb_port_sptr d_tx;
- mb_port_sptr d_rx;
- mb_port_sptr d_cs;
- pmt_t d_tx_chan; // returned tx channel handle
- pmt_t d_rx_chan; // returned tx channel handle
- struct timeval times[NBPING];
+ mb_port_sptr d_tx; // Ports connected to the USRP server
+ mb_port_sptr d_rx;
+ mb_port_sptr d_cs;
+ pmt_t d_tx_chan; // Returned channel from TX allocation
+ pmt_t d_rx_chan; // Returned channel from RX allocation
+
+ pmt_t d_which_usrp; // The USRP to use for the test
+
+ long d_warm_msgs; // The number of messages to 'warm' the USRP
+ long d_warm_recvd; // The number of msgs received in the 'warm' state
+
+ // Keep track of current state
enum state_t {
INIT,
OPENING_USRP,
- ALLOCATING_CHANNEL,
- TRANSMITTING,
- CLOSING_CHANNEL,
+ ALLOCATING_CHANNELS,
+ WRITE_REGISTER,
+ READ_REGISTER,
+ CLOSING_CHANNELS,
CLOSING_USRP,
};
+ state_t d_state;
- state_t d_state;
- long d_nsamples_to_send;
- long d_nsamples_xmitted;
- long d_nframes_xmitted;
- long d_samples_per_frame;
- bool d_done_sending;
-
- // for generating sine wave output
- ui_nco<float,float> d_nco;
- double d_amplitude;
-
public:
- test_usrp_inband_timestamps(mb_runtime *runtime, const std::string
&instance_name, pmt_t user_arg);
- ~test_usrp_inband_timestamps();
+ test_usrp_inband_registers(mb_runtime *runtime, const std::string
&instance_name, pmt_t user_arg);
+ ~test_usrp_inband_registers();
void initial_transition();
void handle_message(mb_message_sptr msg);
protected:
- void open_usrp();
- void close_usrp();
- void allocate_channel();
- void send_packets();
- void enter_receiving();
- void enter_transmitting();
- void build_and_send_ping();
- void build_and_send_next_frame();
- void handle_xmit_response(pmt_t invocation_handle);
- void enter_closing_channel();
+ void opening_usrp();
+ void allocating_channels();
+ void write_register();
+ void read_register();
+ void closing_channels();
+ void closing_usrp();
};
-test_usrp_inband_timestamps::test_usrp_inband_timestamps(mb_runtime *runtime,
const std::string &instance_name, pmt_t user_arg)
- : mb_mblock(runtime, instance_name, user_arg),
- d_tx_chan(PMT_NIL),
- d_rx_chan(PMT_NIL),
- d_state(INIT), d_nsamples_to_send((long) 40e6),
- d_nsamples_xmitted(0),
- d_nframes_xmitted(0),
- //d_samples_per_frame((long)(126)),
- d_samples_per_frame((long)(126 * 2)), // non-full packet
- //d_samples_per_frame((long)(126 * 3.5)), // non-full packet
- //d_samples_per_frame((long)(126 * 4)), // full packet
- d_done_sending(false),
- d_amplitude(16384)
-{
- if(verbose)
- std::cout << "[TEST_USRP_INBAND_TIMESTAMPS] Initializing...\n";
-
- d_tx = define_port("tx0", "usrp-tx", false, mb_port::INTERNAL);
- d_rx = define_port("rx0", "usrp-rx", false, mb_port::INTERNAL);
- d_cs = define_port("cs", "usrp-server-cs", false, mb_port::INTERNAL);
-
- bool fake_usrp_p = false;
- // Test the TX side
+int
+main (int argc, char **argv)
+{
+ // handle any command line args here
+ mb_runtime_sptr rt = mb_make_runtime();
+ pmt_t result = PMT_NIL;
+
+ rt->run("top", "test_usrp_inband_registers", PMT_F, &result);
+}
+
+
+test_usrp_inband_registers::test_usrp_inband_registers(mb_runtime *runtime,
const std::string &instance_name, pmt_t user_arg)
+ : mb_mblock(runtime, instance_name, user_arg),
+ d_tx_chan(PMT_NIL),
+ d_rx_chan(PMT_NIL),
+ d_which_usrp(pmt_from_long(0)),
+ d_state(INIT)
+{
+
+ // A dictionary is used to pass parameters to the USRP
pmt_t usrp_dict = pmt_make_dict();
- if(fake_usrp_p) {
- pmt_dict_set(usrp_dict,
- pmt_intern("fake-usrp"),
- PMT_T);
- }
+ // Specify the RBF to use
+ pmt_dict_set(usrp_dict,
+ pmt_intern("rbf"),
+ pmt_intern("tmac7.rbf"));
// Set TX and RX interpolations
pmt_dict_set(usrp_dict,
@@ -145,364 +127,308 @@
pmt_dict_set(usrp_dict,
pmt_intern("interp-rx"),
pmt_from_long(16));
+
+ d_tx = define_port("tx0", "usrp-tx", false, mb_port::INTERNAL);
+ d_rx = define_port("rx0", "usrp-rx", false, mb_port::INTERNAL);
+ d_cs = define_port("cs", "usrp-server-cs", false, mb_port::INTERNAL);
- // Specify the RBF to use
- pmt_dict_set(usrp_dict,
- pmt_intern("rbf"),
- pmt_intern("tmac5.rbf"));
-
+ // Create an instance of USRP server and connect ports
define_component("server", "usrp_server", usrp_dict);
-
connect("self", "tx0", "server", "tx0");
connect("self", "rx0", "server", "rx0");
connect("self", "cs", "server", "cs");
- // initialize NCO
- double freq = 100e3;
- int interp = 32; // 32 -> 4MS/s
- double sample_rate = 128e6 / interp;
- d_nco.set_freq(2*M_PI * freq/sample_rate);
-
}
-test_usrp_inband_timestamps::~test_usrp_inband_timestamps()
+test_usrp_inband_registers::~test_usrp_inband_registers()
{
}
void
-test_usrp_inband_timestamps::initial_transition()
+test_usrp_inband_registers::initial_transition()
{
- open_usrp();
+ opening_usrp();
}
+// Handle message reads all incoming messages from USRP server which will be
+// initialization and ping responses. We perform actions based on the current
+// state and the event (ie, ping response)
void
-test_usrp_inband_timestamps::handle_message(mb_message_sptr msg)
+test_usrp_inband_registers::handle_message(mb_message_sptr msg)
{
- pmt_t event = msg->signal();
+ pmt_t event = msg->signal();
pmt_t data = msg->data();
pmt_t port_id = msg->port_id();
pmt_t handle = PMT_F;
pmt_t status = PMT_F;
std::string error_msg;
-
- //std::cout << msg << std::endl;
- switch(d_state){
- case OPENING_USRP:
- if (pmt_eq(event, s_response_open)){
- status = pmt_nth(1, data);
- if (pmt_eq(status, PMT_T)){
- allocate_channel();
- return;
+ // Dispatch based on state
+ switch(d_state) {
+
+ //----------------------------- OPENING_USRP ----------------------------//
+ // We only expect a response from opening the USRP which should be
succesful
+ // or failed.
+ case OPENING_USRP:
+
+ if(pmt_eq(event, s_response_open)) {
+
+ status = pmt_nth(1, data); // failed/succes
+
+ if(pmt_eq(status, PMT_T)) {
+ allocating_channels();
+ return;
+ }
+ else {
+ error_msg = "failed to open usrp:";
+ goto bail;
+ }
+
}
- else {
- error_msg = "failed to open usrp:";
- goto bail;
- }
- }
- goto unhandled;
+
+ goto unhandled; // all other messages not handled in this state
+
- case ALLOCATING_CHANNEL:
- if (pmt_eq(event, s_response_allocate_channel)){
+ //----------------------- ALLOCATING CHANNELS --------------------//
+ // When allocating channels, we need to wait for 2 responses from
+ // USRP server: one for TX and one for RX. Both are initialized to
+ // NIL so we know to continue to the next state once both are set.
+ case ALLOCATING_CHANNELS:
- if(pmt_eq(d_tx->port_symbol(), port_id)) {
+ // A TX allocation response
+ if(pmt_eq(event, s_response_allocate_channel)
+ && pmt_eq(d_tx->port_symbol(), port_id))
+ {
status = pmt_nth(1, data);
- d_tx_chan = pmt_nth(2, data);
+
+ // If successful response, extract the channel
+ if(pmt_eq(status, PMT_T)) {
+
+ d_tx_chan = pmt_nth(2, data);
- if (pmt_eq(status, PMT_T)){
-
if(verbose)
- std::cout << "[TEST_USRP_INBAND_TIMESTAMPS] Received allocation
for TX\n";
+ std::cout << "[TEST_USRP_INBAND_PING] Received TX allocation"
+ << " on channel " << d_tx_chan << std::endl;
- if(!pmt_eqv(d_rx_chan, PMT_NIL)) {
- enter_receiving();
- enter_transmitting();
- }
+ // If the RX has also been allocated already, we can continue
+ if(!pmt_eqv(d_rx_chan, PMT_NIL))
+ write_register();
+
return;
}
- else {
- error_msg = "failed to allocate channel:";
+ else { // TX allocation failed
+ error_msg = "failed to allocate TX channel:";
goto bail;
}
}
- if(pmt_eq(d_rx->port_symbol(), port_id)) {
+ // A RX allocation response
+ if(pmt_eq(event, s_response_allocate_channel)
+ && pmt_eq(d_rx->port_symbol(), port_id))
+ {
status = pmt_nth(1, data);
- d_rx_chan = pmt_nth(2, data);
+
+ // If successful response, extract the channel
+ if(pmt_eq(status, PMT_T)) {
+
+ d_rx_chan = pmt_nth(2, data);
- if (pmt_eq(status, PMT_T)){
-
if(verbose)
- std::cout << "[TEST_USRP_INBAND_TIMESTAMPS] Received allocation
for TX\n";
-
- if(!pmt_eqv(d_tx_chan, PMT_NIL)) {
- enter_receiving();
- enter_transmitting();
- }
+ std::cout << "[TEST_USRP_INBAND_PING] Received RX allocation"
+ << " on channel " << d_rx_chan << std::endl;
+
+ // If the TX has also been allocated already, we can continue
+ if(!pmt_eqv(d_tx_chan, PMT_NIL))
+ write_register();
+
return;
}
- else {
- error_msg = "failed to allocate channel:";
+ else { // RX allocation failed
+ error_msg = "failed to allocate RX channel:";
goto bail;
}
}
- }
- goto unhandled;
- case TRANSMITTING:
- if (pmt_eq(event, s_response_xmit_raw_frame)){
- handle = pmt_nth(0, data);
- status = pmt_nth(1, data);
+ goto unhandled;
- if (pmt_eq(status, PMT_T)){
- handle_xmit_response(handle);
- return;
- }
- else {
- error_msg = "bad response-xmit-raw-frame:";
- goto bail;
- }
- }
+ //-------------------------- WRITE REGISTER ----------------------------//
+ // In the write register state, we do not expect to receive any messages
+ // since the write does not directly generate a response until the USRP
+ // responds.
+ case WRITE_REGISTER:
+ goto unhandled;
- if (pmt_eq(event, s_response_from_control_channel)) {
- std::cout << "ping response!\n";
- }
- goto unhandled;
+ //-------------------------- READ REGISTER ----------------------------//
+ // In the read register state, we only expect a read register response back
+ // that has the value we expect to have in it. We read the response,
ensure
+ // that the read was successful and display the register value.
+ case READ_REGISTER:
- case CLOSING_CHANNEL:
- if (pmt_eq(event, s_response_deallocate_channel)){
- status = pmt_nth(1, data);
+ if(pmt_eq(event, s_response_from_control_channel)
+ && pmt_eq(d_tx->port_symbol(), port_id))
+ {
+ status = pmt_nth(1, data);
- if (pmt_eq(status, PMT_T)){
- close_usrp();
- return;
- }
- else {
- error_msg = "failed to deallocate channel:";
- goto bail;
- }
- }
- goto unhandled;
+ // If the read was successful, we extract the subpacket information
+ if(pmt_eq(status, PMT_T)) {
+
+ pmt_t subp = pmt_nth(2, data); // subpacket should be the read
reg reply
- case CLOSING_USRP:
- if (pmt_eq(event, s_response_close)){
- status = pmt_nth(1, data);
+ pmt_t subp_sig = pmt_nth(0, subp);
+ pmt_t subp_data = pmt_nth(1, subp);
- if (pmt_eq(status, PMT_T)){
- shutdown_all(PMT_T);
- return;
+ if(!pmt_eqv(subp_sig, s_op_read_reg_reply)) {
+ error_msg = "received improper subpacket when expecting reg
reply.";
+ goto bail;
+ }
+
+ pmt_t rid = pmt_nth(0, subp_data);
+ pmt_t reg_num = pmt_nth(1, subp_data);
+ pmt_t reg_val = pmt_nth(2, subp_data);
+
+ if(verbose)
+ std::cout << "[TEST_USRP_INBAND_REGISTERS] Received read reg reply
"
+ << "("
+ << "RID: " << rid
+ << "Reg: " << reg_num
+ << "Val: " << reg_val
+ << ")\n";
+
+ // read_register(); FIX ME STATE TRANSITION
+ return;
+
+ } else { // bail on unsuccessful write
+ error_msg = "failed to write to register.";
+ goto bail;
+ }
}
- else {
- error_msg = "failed to close USRP:";
- goto bail;
- }
- }
- goto unhandled;
+ goto unhandled;
- default:
- goto unhandled;
- }
- return;
+ case CLOSING_CHANNELS:
+ goto unhandled;
+ case CLOSING_USRP:
+ goto unhandled;
+
+ case INIT:
+ goto unhandled;
+
+ }
+
+ // An error occured, print it, and shutdown all m-blocks
bail:
std::cerr << error_msg << data
- << "status = " << status << std::endl;
+ << "status = " << status << std::endl;
shutdown_all(PMT_F);
return;
+ // Received an unhandled message for a specific state
unhandled:
- if(verbose && 0)
+ if(verbose)
std::cout << "test_usrp_inband_tx: unhandled msg: " << msg
<< "in state "<< d_state << std::endl;
+
}
+// Sends a command to USRP server to open up a connection to the
+// specified USRP, which is defaulted to USRP 0 on the system
void
-test_usrp_inband_timestamps::open_usrp()
+test_usrp_inband_registers::opening_usrp()
{
- pmt_t which_usrp = pmt_from_long(0);
- d_cs->send(s_cmd_open, pmt_list2(PMT_NIL, which_usrp));
+ if(verbose)
+ std::cout << "[TEST_USRP_INBAND_PING] Opening USRP "
+ << d_which_usrp << std::endl;
+
+ d_cs->send(s_cmd_open, pmt_list2(PMT_NIL, d_which_usrp));
d_state = OPENING_USRP;
}
+// RX and TX channels must be allocated so that the USRP server can
+// properly share bandwidth across multiple USRPs. No commands will be
+// successful to the USRP through the USRP server on the TX or RX channels
until
+// a bandwidth allocation has been received.
void
-test_usrp_inband_timestamps::close_usrp()
+test_usrp_inband_registers::allocating_channels()
{
- d_cs->send(s_cmd_close, pmt_list1(PMT_NIL));
- d_state = CLOSING_USRP;
+ d_state = ALLOCATING_CHANNELS;
- if(verbose)
- std::cout << "[TEST_USRP_INBAND_TIMESTAMPS] Closing USRP\n";
-}
-
-void
-test_usrp_inband_timestamps::allocate_channel()
-{
long capacity = (long) 16e6;
d_tx->send(s_cmd_allocate_channel, pmt_list2(PMT_T,
pmt_from_long(capacity)));
d_rx->send(s_cmd_allocate_channel, pmt_list2(PMT_T,
pmt_from_long(capacity)));
- d_state = ALLOCATING_CHANNEL;
}
+// After allocating the channels, a write register command will be sent to the
+// USRP.
void
-test_usrp_inband_timestamps::enter_receiving()
+test_usrp_inband_registers::write_register()
{
- d_rx->send(s_cmd_start_recv_raw_samples,
- pmt_list2(PMT_F,
- d_rx_chan));
-}
+ d_state = WRITE_REGISTER;
-void
-test_usrp_inband_timestamps::enter_transmitting()
-{
- d_state = TRANSMITTING;
- d_nsamples_xmitted = 0;
+ long reg = 13;
+ d_tx->send(s_cmd_to_control_channel, // C/S packet
+ pmt_list2(PMT_NIL, // invoc handle
+ pmt_list1(
+ pmt_list2(s_op_write_reg,
+ pmt_list2(
+ pmt_from_long(reg),
+ pmt_from_long(0xbeef))))));
+
if(verbose)
- std::cout << "[TEST_USRP_INBAND_TIMESTAMPS] Beginning transmission\n";
+ std::cout << "[TEST_USRP_INBAND_REGISTERS] Writing 0xbeef to "
+ << reg << std::endl;
- sleep(1);
-
- build_and_send_next_frame();
- build_and_send_next_frame();
- build_and_send_next_frame();
- build_and_send_next_frame();
-
-}
-
-void
-test_usrp_inband_timestamps::build_and_send_ping()
-{
+ read_register(); // immediately transition to read the register
d_tx->send(s_cmd_to_control_channel,
- pmt_list2(PMT_NIL, pmt_list1(pmt_list2(s_op_ping_fixed,
- pmt_list2(pmt_from_long(0),
-
pmt_from_long(0))))));
- if(verbose && 0)
- std::cout << "[TEST_USRP_INBAND_TIMESTAMPS] Ping sent" << std::endl;
+ pmt_list2(PMT_NIL,
+ pmt_list1(
+ pmt_list2(s_op_ping_fixed,
+ pmt_list2(pmt_from_long(3),
+ pmt_from_long(0))))));
+ d_tx->send(s_cmd_to_control_channel,
+ pmt_list2(PMT_NIL,
+ pmt_list1(
+ pmt_list2(s_op_ping_fixed,
+ pmt_list2(pmt_from_long(3),
+ pmt_from_long(0))))));
+ d_tx->send(s_cmd_to_control_channel,
+ pmt_list2(PMT_NIL,
+ pmt_list1(
+ pmt_list2(s_op_ping_fixed,
+ pmt_list2(pmt_from_long(3),
+ pmt_from_long(0))))));
+ d_tx->send(s_cmd_to_control_channel,
+ pmt_list2(PMT_NIL,
+ pmt_list1(
+ pmt_list2(s_op_ping_fixed,
+ pmt_list2(pmt_from_long(3),
+ pmt_from_long(0))))));
}
+// After writing to the register, we want to read the value back and ensure
that
+// it is the same value that we wrote.
void
-test_usrp_inband_timestamps::build_and_send_next_frame()
+test_usrp_inband_registers::read_register()
{
- // allocate the uniform vector for the samples
- // FIXME perhaps hold on to this between calls
+ d_state = READ_REGISTER;
-#if 0
- long nsamples_this_frame =
- std::min(d_nsamples_to_send - d_nsamples_xmitted,
- d_samples_per_frame);
-#else
- long nsamples_this_frame = d_samples_per_frame;
-#endif
+ long reg = 13;
- if (nsamples_this_frame == 0){
- d_done_sending = true;
- return;
- }
-
+ d_tx->send(s_cmd_to_control_channel, // C/S packet
+ pmt_list2(PMT_NIL, // invoc handle
+ pmt_list1(
+ pmt_list2(s_op_read_reg,
+ pmt_list2(
+ pmt_from_long(0), // rid
+ pmt_from_long(reg))))));
- size_t nshorts = 2 * nsamples_this_frame; // 16-bit I & Q
- pmt_t uvec = pmt_make_s16vector(nshorts, 0);
- size_t ignore;
- int16_t *samples = pmt_s16vector_writeable_elements(uvec, ignore);
-
- // fill in the complex sinusoid
-
- for (int i = 0; i < nsamples_this_frame; i++){
-
- if (1){
- gr_complex s;
- d_nco.sincos(&s, 1, d_amplitude);
- // write 16-bit i & q
- samples[2*i] = (int16_t) s.real();
- samples[2*i+1] = (int16_t) s.imag();
- }
- else {
- gr_complex s(d_amplitude, d_amplitude);
-
- // write 16-bit i & q
- samples[2*i] = (int16_t) s.real();
- samples[2*i+1] = (int16_t) s.imag();
- }
- }
-
- pmt_t timestamp;
-
- if(bskip) {
- timestamp = pmt_from_long(0x0); // throw away
- bcurr++;
- if(bcurr == bstep) {
- bskip = false;
- bcurr = 0;
- }
- } else {
- timestamp = pmt_from_long(0xffffffff); // NOW
- timestamp = pmt_from_long(ptime);
- ptime += incr;
- bcurr++;
- if(bcurr == bstep) {
- //bskip = true;
- bcurr = 0;
- }
- }
-
- std::cout << bskip << " -- " << bcurr << std::endl;
-
- d_tx->send(s_cmd_xmit_raw_frame,
- pmt_list4(pmt_from_long(d_nframes_xmitted), // invocation-handle
- d_tx_chan, // channel
- uvec, // the samples
- timestamp));
-
- d_nsamples_xmitted += nsamples_this_frame;
- d_nframes_xmitted++;
-
- if(verbose && 0)
- std::cout << "[TEST_USRP_INBAND_TIMESTAMPS] Transmitted frame\n";
-
- //build_and_send_next_frame();
-}
-
-
-void
-test_usrp_inband_timestamps::handle_xmit_response(pmt_t handle)
-{
- if (d_done_sending &&
- pmt_to_long(handle) == (d_nframes_xmitted - 1)){
- // We're done sending and have received all responses
- enter_closing_channel();
- }
-
- build_and_send_next_frame();
- //build_and_send_ping();
-}
-
-void
-test_usrp_inband_timestamps::enter_closing_channel()
-{
- d_state = CLOSING_CHANNEL;
-
- d_tx->send(s_cmd_deallocate_channel, pmt_list2(PMT_NIL, d_tx_chan));
-
if(verbose)
- std::cout << "[TEST_USRP_INBAND_TIMESTAMPS] Closing channel\n";
+ std::cout << "[TEST_USRP_INBAND_REGISTERS] Reading from register "
+ << reg << std::endl;
}
-REGISTER_MBLOCK_CLASS(test_usrp_inband_timestamps);
-
-
-// ----------------------------------------------------------------
-
-int
-main (int argc, char **argv)
-{
- // handle any command line args here
-
- mb_runtime_sptr rt = mb_make_runtime();
- pmt_t result = PMT_NIL;
-
- rt->run("top", "test_usrp_inband_timestamps", PMT_F, &result);
-}
+REGISTER_MBLOCK_CLASS(test_usrp_inband_registers);
Modified:
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc
===================================================================
---
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc
2007-08-08 19:13:52 UTC (rev 6127)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc
2007-08-08 20:06:14 UTC (rev 6128)
@@ -38,7 +38,7 @@
typedef usrp_inband_usb_packet transport_pkt; // makes conversion to gigabit
easy
-const static bool verbose = false;
+const static bool verbose = true;
static std::string
str(long x)
@@ -764,7 +764,11 @@
}
if(verbose)
- std::cout << "[USRP_SERVER] Received write register request\n";
+ std::cout << "[USRP_SERVER] Received write register request "
+ << "("
+ << "Reg: " << reg_num << ", "
+ << "Val: " << val
+ << ")\n";
}
//------- WRITE REG MASKED ----------//
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r6128 - in gnuradio/branches/developers/gnychis/inband/usrp/host: apps lib/inband,
gnychis <=