[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r5887 - gnuradio/branches/developers/gnychis/inband/us
From: |
gnychis |
Subject: |
[Commit-gnuradio] r5887 - gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband |
Date: |
Mon, 2 Jul 2007 14:33:19 -0600 (MDT) |
Author: gnychis
Date: 2007-07-02 14:33:18 -0600 (Mon, 02 Jul 2007)
New Revision: 5887
Modified:
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.cc
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_inband_usb_packet.h
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_tx_stub.cc
Log:
Cleaned up debug output and wrote QA code to test that multiple subpackets are
read from a single m-block 'to command channel' message
Modified:
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.cc
===================================================================
---
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.cc
2007-07-02 19:37:04 UTC (rev 5886)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/qa_inband_usrp_server.cc
2007-07-02 20:33:18 UTC (rev 5887)
@@ -1105,7 +1105,7 @@
: mb_mblock(runtime, instance_name, user_arg)
{
d_nrecvd=0;
- d_nmsgs_to_recv = 10;
+ d_nmsgs_to_recv = 5;
d_nstatus=0;
d_nstatus_to_recv = 50;
@@ -1194,6 +1194,20 @@
pmt_list1(
pmt_list2(s_op_delay,
pmt_list1(pmt_from_long(0x7))))));
+
+ pmt_t subpackets = pmt_list4(
+ pmt_list2(s_op_ping_fixed, pmt_list2(PMT_NIL,
pmt_from_long(0))),
+ pmt_list2(s_op_delay, pmt_list1(pmt_from_long(0x7))),
+ pmt_list2(s_op_write_reg_masked,
pmt_list3(pmt_from_long(3),
+
pmt_from_long(4),
+
pmt_from_long(5))),
+ pmt_list2(s_op_write_reg, pmt_list2(pmt_from_long(3),
+ pmt_from_long(4)))
+ );
+
+ d_tx->send(s_cmd_to_control_channel,
+ pmt_list2(pmt_list2(s_response_from_control_channel, PMT_T),
+ subpackets));
}
void
Modified:
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_inband_usb_packet.h
===================================================================
---
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_inband_usb_packet.h
2007-07-02 19:37:04 UTC (rev 5886)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_inband_usb_packet.h
2007-07-02 20:33:18 UTC (rev 5887)
@@ -417,11 +417,31 @@
}
case OP_WRITE_REG:
- return PMT_NIL;
+ {
+ pmt_t reg_num = pmt_from_long((subpkt >> CS_REGNUM_SHIFT) &
CS_REGNUM_MASK);
+ // To get the register value we just read the next 32 bits
+ uint32_t val = usrp_to_host_u32(*((uint32_t *)d_payload +
payload_offset + 4));
+ pmt_t reg_val = pmt_from_long(val);
+
+ return pmt_list3(s_op_write_reg, reg_num, reg_val);
+ }
+
case OP_WRITE_REG_MASKED:
- return PMT_NIL;
+ {
+ pmt_t reg_num = pmt_from_long((subpkt >> CS_REGNUM_SHIFT) &
CS_REGNUM_MASK);
+ // To get the register value we just read the next 32 bits
+ uint32_t val = usrp_to_host_u32(*((uint32_t *)d_payload +
payload_offset + 4));
+ pmt_t reg_val = pmt_from_long(val);
+
+ // The mask is the next 32 bits
+ uint32_t mask = usrp_to_host_u32(*((uint32_t *)d_payload +
payload_offset + 8));
+ pmt_t reg_mask = pmt_from_long(mask);
+
+ return pmt_list4(s_op_write_reg_masked, reg_num, reg_val, reg_mask);
+ }
+
case OP_READ_REG:
{
pmt_t rid = pmt_from_long((subpkt >> CS_RID_SHIFT) & CS_RID_MASK);
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-07-02 19:37:04 UTC (rev 5886)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc
2007-07-02 20:33:18 UTC (rev 5887)
@@ -98,8 +98,8 @@
d_rx_chan_mask = 0;
// Initialize request ID's to 0
- d_op_ping_fixed_rid = 2;
- d_op_read_reg_rid = 1;
+ d_op_ping_fixed_rid = 0;
+ d_op_read_reg_rid = 0;
for(int i=0; i < D_OP_PING_FIXED_MAX_RID; i++)
d_op_ping_fixed_owners.push_back(PMT_NIL);
@@ -945,9 +945,11 @@
pmt_t pingval = pmt_nth(2, sub_packet);
if(verbose)
- std::cout << "[USRP_SERVER] Found ping response: \n"
- << "\tRID: " << rid << std::endl
- << "\tVAL: " << pingval << std::endl;
+ std::cout << "[USRP_SERVER] Found ping response "
+ << "("
+ << "RID: " << rid << ", "
+ << "VAL: " << pingval
+ << ")\n";
// Do some bounds checking incase of bogus/corrupt responses
if(pmt_to_long(rid) > D_OP_PING_FIXED_MAX_RID)
@@ -972,10 +974,12 @@
pmt_t reg_val = pmt_nth(3, sub_packet);
if(verbose)
- std::cout << "[USRP_SERVER] Found read register response: \n"
- << "\tRID: " << rid << std::endl
- << "\tREG: " << reg_num << std::endl
- << "\tVAL: " << reg_val << std::endl;
+ std::cout << "[USRP_SERVER] Found read register response "
+ << "("
+ << "RID: " << rid << ", "
+ << "REG: " << reg_num << ", "
+ << "VAL: " << reg_val
+ << ")\n";
// Do some bounds checking to avoid seg faults
if(pmt_to_long(rid) > D_OP_READ_REG_MAX_RID)
Modified:
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_tx_stub.cc
===================================================================
---
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_tx_stub.cc
2007-07-02 19:37:04 UTC (rev 5886)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_tx_stub.cc
2007-07-02 20:33:18 UTC (rev 5887)
@@ -166,9 +166,11 @@
d_cs_queue.push(pmt_list2(invocation_handle, v_pkt));
if(verbose)
- std::cout << "[USRP_TX_STUB] Generated ping response:\n"
- << "\tRID: " << rid << std::endl
- << "\tVAL: " << pingval << std::endl;
+ std::cout << "[USRP_TX_STUB] Generated ping response "
+ << "("
+ << "RID: " << rid << ", "
+ << "VAL: " << pingval
+ << ")\n";
}
//----------------- READ REG ------------------//
@@ -193,24 +195,56 @@
d_cs_queue.push(pmt_list2(invocation_handle, v_pkt));
if(verbose)
- std::cout << "[USRP_TX_STUB] Generated read register response:\n"
- << "\tRID: " << rid << std::endl
- << "\tREG: " << reg_num << std::endl
- << "\tVAL: " << reg_val << std::endl;
+ std::cout << "[USRP_TX_STUB] Generated read register response "
+ << "("
+ << "RID: " << rid << ", "
+ << "REG: " << reg_num << ", "
+ << "VAL: " << reg_val
+ << ")\n";
}
//----------------- READ REG ------------------//
if(pmt_eq(op_symbol, s_op_delay)) {
- size_t ignore;
-
long ticks = pmt_to_long(pmt_nth(1, sub_packet));
if(verbose)
- std::cout << "[USRP_TX_STUB] Received delay of "
- << ticks << " ticks\n";
+ std::cout << "[USRP_TX_STUB] Received delay command "
+ << "("
+ << "Ticks: " << ticks
+ << ")\n";
}
+ //----------------- WRITE REG ------------------//
+ if(pmt_eq(op_symbol, s_op_write_reg)) {
+
+ pmt_t reg_num = pmt_nth(1, sub_packet);
+ pmt_t reg_val = pmt_nth(2, sub_packet);
+
+ if(verbose)
+ std::cout << "[USRP_TX_STUB] Received write register command "
+ << "("
+ << "RegNum: " << reg_num << ", "
+ << "Val: " << reg_val
+ << ")\n";
+ }
+
+ //----------------- WRITE REG MASK ---------------//
+ if(pmt_eq(op_symbol, s_op_write_reg_masked)) {
+
+ pmt_t reg_num = pmt_nth(1, sub_packet);
+ pmt_t reg_val = pmt_nth(2, sub_packet);
+ pmt_t mask = pmt_nth(3, sub_packet);
+
+ if(verbose)
+ std::cout << "[USRP_TX_STUB] Received write register command "
+ << "("
+ << "RegNum: " << reg_num << ", "
+ << "Val: " << reg_val << ", "
+ << "Mask: " << mask
+ << ")\n";
+ }
+
// Each subpacket has an unaccounted for 2 bytes which is the opcode
// and the length field
curr_payload += len + 2;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r5887 - gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband,
gnychis <=