summaryrefslogtreecommitdiff
path: root/usrp/host/lib/inband/usrp_server.cc
diff options
context:
space:
mode:
authoreb2007-09-13 23:21:41 +0000
committereb2007-09-13 23:21:41 +0000
commit4e7d048aeb80f95b19cebed9d76b79e6cbe64a9a (patch)
tree71eb3edd8fe57d5701ccf3aa7bf624a76e8d1ec9 /usrp/host/lib/inband/usrp_server.cc
parent6006b92a287fa5a23bcb7905f6f854d9c9dd4462 (diff)
downloadgnuradio-4e7d048aeb80f95b19cebed9d76b79e6cbe64a9a.tar.gz
gnuradio-4e7d048aeb80f95b19cebed9d76b79e6cbe64a9a.tar.bz2
gnuradio-4e7d048aeb80f95b19cebed9d76b79e6cbe64a9a.zip
Merged r6329:6428 of features/inband-usb + distcheck fixes into trunk.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@6429 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'usrp/host/lib/inband/usrp_server.cc')
-rw-r--r--usrp/host/lib/inband/usrp_server.cc29
1 files changed, 27 insertions, 2 deletions
diff --git a/usrp/host/lib/inband/usrp_server.cc b/usrp/host/lib/inband/usrp_server.cc
index 760397dc7..d73c7d525 100644
--- a/usrp/host/lib/inband/usrp_server.cc
+++ b/usrp/host/lib/inband/usrp_server.cc
@@ -53,6 +53,8 @@ usrp_server::usrp_server(mb_runtime *rt, const std::string &instance_name, pmt_t
: mb_mblock(rt, instance_name, user_arg),
d_fake_rx(false)
{
+ if(verbose)
+ std::cout << "[USRP_SERVER] Initializing...\n";
// Dictionary for arguments to all of the components
pmt_t usrp_dict = user_arg;
@@ -596,11 +598,26 @@ void usrp_server::handle_cmd_xmit_raw_frame(mb_port_sptr port, std::vector<struc
long channel = pmt_to_long(pmt_nth(1, data));
const void *samples = pmt_uniform_vector_elements(pmt_nth(2, data), n_bytes);
long timestamp = pmt_to_long(pmt_nth(3, data));
+ pmt_t properties = pmt_nth(4, data);
// Ensure the channel is valid and the caller owns the port
if(!check_valid(port, channel, chan_info,
pmt_list2(s_response_xmit_raw_frame, invocation_handle)))
return;
+
+ // Read information from the properties of the packet
+ bool carrier_sense = false;
+ if(pmt_is_dict(properties)) {
+
+ // Check if carrier sense is enabled for the frame
+ if(pmt_t p_carrier_sense = pmt_dict_ref(properties,
+ pmt_intern("carrier-sense"),
+ PMT_NIL)) {
+ if(pmt_eqv(p_carrier_sense, PMT_T))
+ carrier_sense = true;
+ }
+ }
+
// Determine the number of packets to allocate contiguous memory for
// bursting over the USB and get a pointer to the memory to be used in
@@ -619,8 +636,16 @@ void usrp_server::handle_cmd_xmit_raw_frame(mb_port_sptr port, std::vector<struc
std::min((long)(n_bytes-(n*max_payload_len)), (long)max_payload_len);
if(n == 0) { // first packet gets start of burst flag and timestamp
- pkts[n].set_header(pkts[n].FL_START_OF_BURST, channel, 0, payload_len);
+
+ if(carrier_sense)
+ pkts[n].set_header(pkts[n].FL_START_OF_BURST
+ | pkts[n].FL_CARRIER_SENSE,
+ channel, 0, payload_len);
+ else
+ pkts[n].set_header(pkts[n].FL_START_OF_BURST, channel, 0, payload_len);
+
pkts[n].set_timestamp(timestamp);
+
} else {
pkts[n].set_header(0, channel, 0, payload_len);
pkts[n].set_timestamp(0xffffffff);
@@ -635,7 +660,7 @@ void usrp_server::handle_cmd_xmit_raw_frame(mb_port_sptr port, std::vector<struc
pkts[n_packets-1].set_end_of_burst(); // set the last packet's end of burst
- if (verbose)
+ if (verbose && 0)
std::cout << "[USRP_SERVER] Received raw frame invocation: "
<< invocation_handle << std::endl;