[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r6699 - gnuradio/branches/features/inband-usb/usrp/hos
From: |
gnychis |
Subject: |
[Commit-gnuradio] r6699 - gnuradio/branches/features/inband-usb/usrp/host/lib/inband |
Date: |
Fri, 26 Oct 2007 02:09:41 -0600 (MDT) |
Author: gnychis
Date: 2007-10-26 02:09:40 -0600 (Fri, 26 Oct 2007)
New Revision: 6699
Modified:
gnuradio/branches/features/inband-usb/usrp/host/lib/inband/fake_usrp.cc
gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_inband_usb_packet.h
gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_rx.cc
gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_server.cc
gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_server.h
gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_tx.cc
gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_tx_stub.cc
Log:
Merging -r6689:6698 from developers/gnychis/inband
Modified:
gnuradio/branches/features/inband-usb/usrp/host/lib/inband/fake_usrp.cc
===================================================================
--- gnuradio/branches/features/inband-usb/usrp/host/lib/inband/fake_usrp.cc
2007-10-26 03:32:36 UTC (rev 6698)
+++ gnuradio/branches/features/inband-usb/usrp/host/lib/inband/fake_usrp.cc
2007-10-26 08:09:40 UTC (rev 6699)
@@ -44,7 +44,7 @@
// I'm assuming that a control packet cannot exist in a burst of data
packets,
// therefore i read only the first packet's channel in the current burst
- if(pkts[0].chan() == 0x1f) {
+ if(pkts[0].chan() == CONTROL_CHAN) {
return control_block(pkts, n_bytes);
} else {
return data_block(pkts, n_bytes);
Modified:
gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_inband_usb_packet.h
===================================================================
---
gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_inband_usb_packet.h
2007-10-26 03:32:36 UTC (rev 6698)
+++
gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_inband_usb_packet.h
2007-10-26 08:09:40 UTC (rev 6699)
@@ -31,6 +31,7 @@
static const int USB_PKT_SIZE = 512; // bytes
static const int MAX_PAYLOAD = USB_PKT_SIZE-2*sizeof(uint32_t);
+static const int CONTROL_CHAN = CONTROL_CHAN;
class usrp_inband_usb_packet {
//
Modified: gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_rx.cc
===================================================================
--- gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_rx.cc
2007-10-26 03:32:36 UTC (rev 6698)
+++ gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_rx.cc
2007-10-26 08:09:40 UTC (rev 6699)
@@ -132,7 +132,7 @@
std::cout << "[usrp_rx] Read 1 packet\n";
if(d_disk_write) {
- if(pkt->chan() == 0x1f)
+ if(pkt->chan() == CONTROL_CHAN)
d_cs_ofile.write((const char *)pkt, transport_pkt::max_pkt_size());
else
d_ofile.write((const char *)pkt, transport_pkt::max_pkt_size());
Modified:
gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_server.cc
===================================================================
--- gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_server.cc
2007-10-26 03:32:36 UTC (rev 6698)
+++ gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_server.cc
2007-10-26 08:09:40 UTC (rev 6699)
@@ -207,6 +207,7 @@
pmt_t status = pmt_nth(1, data);
d_cs->send(s_response_open, pmt_list2(invocation_handle, status));
+ //reset_all_registers();
initialize_registers();
if(pmt_eqv(status,PMT_T)) {
@@ -240,7 +241,7 @@
// Do not report back responses if they were generated from a
// command packet
- if(channel == 0x1f)
+ if(channel == CONTROL_CHAN)
return;
// Find the port through the owner of the channel
@@ -718,7 +719,7 @@
size_t psize;
long payload_len = 0;
- long channel = 0x1f;
+ long channel = CONTROL_CHAN;
// The design of the following code is optimized for simplicity, not
// performance. To performance optimize this code, the total size in bytes
@@ -1137,7 +1138,7 @@
return;
// If the packet is a C/S packet, parse it separately
- if(channel == 0x1f) {
+ if(channel == CONTROL_CHAN) {
parse_control_pkt(invocation_handle, pkt);
return;
}
@@ -1377,7 +1378,7 @@
pmt_t invocation_handle = pmt_nth(1, signal_info);
// not a valid channel number?
- if(channel >= (long)chan_info.size() && channel != 0x1f) {
+ if(channel >= (long)chan_info.size() && channel != CONTROL_CHAN) {
port->send(response_signal,
pmt_list2(invocation_handle,
s_err_channel_invalid));
@@ -1513,7 +1514,7 @@
set_register(FR_RX_FREQ_3, 0);
// DEBUGGING
- check_register_initialization();
+ //check_register_initialization();
}
// FIXME: used for debugging to determine if all the registers are actually
@@ -1600,17 +1601,44 @@
read_register(FR_RX_FREQ_3);
}
+void
+usrp_server::reset_all_registers()
+{
+ for(int i=0; i<64; i++)
+ set_register(i, 0);
+}
+
// THIS IS ONLY FOR INTERNAL USRP_SERVER USAGE
+//
+// This function needs to create its own USB packet and not use
+// handle_cmd_to_control_channel because in many cases such as initialization,
+// the number of register writes needed are more than the number of RID's. If
+// there are no RID's left for use then handle_cmd_to_control_channel() will
+// throw away the request. This allows usrp_server to generate its own
register
+// writes without eating up RID's, since usrp_server does not really care about
+// the response.
void
usrp_server::set_register(long reg, long val)
{
- handle_cmd_to_control_channel(d_tx[0], d_chaninfo_tx,
- pmt_list2(PMT_NIL, // empty invoc handle
- pmt_list1(pmt_list2(s_op_write_reg,
- pmt_list2(pmt_from_long(reg),
- pmt_from_long(val))))));
+ size_t psize;
+ long payload_len = 0;
+
+ pmt_t v_packet = pmt_make_u8vector(sizeof(transport_pkt), 0);
+ transport_pkt *pkt = (transport_pkt *)
pmt_u8vector_writeable_elements(v_packet, psize);
+
+ pkt->set_header(0, CONTROL_CHAN, 0, payload_len);
+ pkt->set_timestamp(0xffffffff);
+
+ pkt->cs_write_reg(reg, val);
+
+ d_cs_usrp->send(s_cmd_usrp_write,
+ pmt_list3(PMT_NIL,
+ pmt_from_long(CONTROL_CHAN),
+ v_packet));
}
+// Only for internal usrp_server usage. Structed the same way as
+// set_register().
void
usrp_server::read_register(long reg)
{
Modified:
gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_server.h
===================================================================
--- gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_server.h
2007-10-26 03:32:36 UTC (rev 6698)
+++ gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_server.h
2007-10-26 08:09:40 UTC (rev 6699)
@@ -125,6 +125,7 @@
void set_register(long reg, long val);
void read_register(long reg);
void check_register_initialization();
+ void reset_all_registers();
};
#endif /* INCLUDED_USRP_SERVER_H */
Modified: gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_tx.cc
===================================================================
--- gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_tx.cc
2007-10-26 03:32:36 UTC (rev 6698)
+++ gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_tx.cc
2007-10-26 08:09:40 UTC (rev 6699)
@@ -121,7 +121,7 @@
for(int i=0; i < n_packets; i++) {
if(d_disk_write) {
- if(pkts[i].chan() == 0x1f)
+ if(pkts[i].chan() == CONTROL_CHAN)
d_cs_ofile.write((const char *)&pkts[i],
transport_pkt::max_pkt_size());
else
d_ofile.write((const char *)&pkts[i], transport_pkt::max_pkt_size());
Modified:
gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_tx_stub.cc
===================================================================
--- gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_tx_stub.cc
2007-10-26 03:32:36 UTC (rev 6698)
+++ gnuradio/branches/features/inband-usb/usrp/host/lib/inband/usrp_tx_stub.cc
2007-10-26 08:09:40 UTC (rev 6699)
@@ -103,7 +103,7 @@
for(long i=0; i<n_packets; i++) {
if(d_disk_write) {
- if(pkts[i].chan() == 0x1f)
+ if(pkts[i].chan() == CONTROL_CHAN)
d_cs_ofile.write((const char *)&pkts[i],
transport_pkt::max_pkt_size());
else
d_ofile.write((const char *)&pkts[i], transport_pkt::max_pkt_size());
@@ -112,7 +112,7 @@
d_ofile.flush();
}
- if(pkts[i].chan() == 0x1f)
+ if(pkts[i].chan() == CONTROL_CHAN)
parse_cs(invocation_handle, pkts[i]);
}
@@ -140,7 +140,7 @@
transport_pkt *q_pkt =
(transport_pkt *) pmt_u8vector_writeable_elements(v_pkt, ignore);
- q_pkt->set_header(0, 0x1f, 0, 0);
+ q_pkt->set_header(0, CONTROL_CHAN, 0, 0);
q_pkt->set_timestamp(0xffffffff);
// We dispatch based on the control packet type, however we can extract the
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r6699 - gnuradio/branches/features/inband-usb/usrp/host/lib/inband,
gnychis <=