[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r5843 - gnuradio/branches/developers/gnychis/inband/us
From: |
gnychis |
Subject: |
[Commit-gnuradio] r5843 - gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband |
Date: |
Tue, 26 Jun 2007 10:03:10 -0600 (MDT) |
Author: gnychis
Date: 2007-06-26 10:03:10 -0600 (Tue, 26 Jun 2007)
New Revision: 5843
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_server.cc
Log:
Adding in functionality to create a ping packet properly, needs to be tested
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-06-26 15:10:00 UTC (rev 5842)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_inband_usb_packet.h
2007-06-26 16:03:10 UTC (rev 5843)
@@ -82,6 +82,17 @@
static const int PAYLOAD_LEN_MASK = 0x1ff;
static const int PAYLOAD_LEN_SHIFT = 0;
+ static const int CS_OPCODE_MASK = 0xff;
+ static const int CS_OPCODE_SHIFT = 24;
+
+ static const int CS_LENGTH_MASK = 0xff;
+ static const int CS_LENGTH_SHIFT = 16;
+
+ static const int CS_RID_MASK = 0x3f;
+ static const int CS_RID_SHIFT = 10;
+
+ static const int CS_PINGVAL_MASK = 0x3ff;
+
public:
void set_timestamp(uint32_t timestamp){
@@ -164,6 +175,19 @@
return USB_PKT_SIZE;
}
+ uint32_t cs_ping(long rid, long ping_val) {
+
+ uint32_t ping = (
+ ((OP_PING_FIXED & CS_OPCODE_MASK) << CS_OPCODE_SHIFT)
+ | ((2 & CS_LENGTH_MASK) << CS_LENGTH_SHIFT)
+ | ((rid & CS_RID_MASK) << CS_RID_SHIFT)
+ | (ping_val & CS_PINGVAL_MASK)
+
+ );
+
+ return ping;
+ }
+
};
#endif
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-06-26 15:10:00 UTC (rev 5842)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc
2007-06-26 16:03:10 UTC (rev 5843)
@@ -652,8 +652,6 @@
long n_subpackets = pmt_length(subpackets);
- std::cout << "SUBPACKETS: " << n_subpackets << std::endl;
-
size_t psize;
long payload_len = 0;
long channel = 0x1f;
@@ -674,15 +672,26 @@
for(int i=0; i < n_subpackets; i++) {
+ pmt_t subp = pmt_nth(i, subpackets);
+ pmt_t subp_cmd = pmt_nth(0, subp);
+
+ // This code needs to become "smart" and only make a new packet when full
v_packet = pmt_make_u8vector(sizeof(transport_pkt), 0);
pkt = (transport_pkt *) pmt_u8vector_writeable_elements(v_packet, psize);
+ payload_len = 0;
- pmt_t subp = pmt_nth(i, subpackets);
- pmt_t subp_cmd = pmt_nth(0, subp);
-
//--------- PING FIXED --------------//
if(pmt_eq(subp_cmd, s_op_ping_fixed)) {
- payload_len = 4;
+
+ long rid = 0;
+ long pingval = 0;
+
+ memcpy(pkt->payload() + payload_len, // skip curr payload
+ (void *) pkt->cs_ping(rid, pingval), // create data
+ 4); // size of fixed ping
+
+ payload_len+=4; // the next subpacket is created after this in payload
+
}
pkt->set_header(0, channel, 0, payload_len);
@@ -693,8 +702,6 @@
pmt_from_long(channel),
v_packet));
- std::cout << "!!! SENT PING !!!\n";
-
}
return;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r5843 - gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband,
gnychis <=