[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r5987 - gnuradio/branches/developers/gnychis/inband/us
From: |
gnychis |
Subject: |
[Commit-gnuradio] r5987 - gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband |
Date: |
Mon, 16 Jul 2007 10:35:17 -0600 (MDT) |
Author: gnychis
Date: 2007-07-16 10:35:17 -0600 (Mon, 16 Jul 2007)
New Revision: 5987
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
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_tx_stub.cc
Log:
Adding in code to parse 32-bit aligned CS packets.
Code is tested to be working.
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-16 16:02:34 UTC (rev 5986)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_inband_usb_packet.h
2007-07-16 16:35:17 UTC (rev 5987)
@@ -116,7 +116,7 @@
static const int CS_I2CADDR_MASK = 0x7f;
static const int CS_I2CADDR_SHIFT = 0;
- static const int CS_I2CREAD_LEN = 6;
+ static const int CS_I2CREAD_LEN = 3;
static const int CS_I2CREADBYTES_MASK = 0x7f;
static const int CS_I2CREADBYTES_SHIFT = 24;
@@ -205,25 +205,26 @@
bool align32()
{
int p_len = payload_len();
+
int bytes_needed = 4 - (p_len % 4);
+ if(bytes_needed == 4)
+ return true;
+
// If the room left in the packet is less than the number of bytes
// needed, return false to indicate no room to align
if((MAX_PAYLOAD - p_len) < bytes_needed)
return false;
+
+ p_len += bytes_needed;
+
+ int h_flags = flags();
+ int h_chan = chan();
+ int h_tag = tag();
+ int h_payload_len = p_len;
- if(bytes_needed > 0) // not 32-bit aligned
- {
- p_len += bytes_needed;
-
- int h_flags = flags();
- int h_chan = chan();
- int h_tag = tag();
- int h_payload_len = p_len;
+ set_header(h_flags, h_chan, h_tag, h_payload_len);
- set_header(h_flags, h_chan, h_tag, h_payload_len);
- }
-
return true;
}
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-16 16:02:34 UTC (rev 5986)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_server.cc
2007-07-16 16:35:17 UTC (rev 5987)
@@ -849,7 +849,7 @@
}
if(verbose)
- std::cout << "[USRP_SERVER] Received I2C write";
+ std::cout << "[USRP_SERVER] Received I2C write\n";
}
//----------- I2C Read -------------//
@@ -876,7 +876,7 @@
}
if(verbose)
- std::cout << "[USRP_SERVER] Received I2C read";
+ std::cout << "[USRP_SERVER] Received I2C read\n";
}
curr_subpkt++;
@@ -1148,6 +1148,12 @@
// Each subpacket has an unaccounted for 2 bytes which is the opcode
// and the length field
curr_payload += len + 2;
+
+ // All subpackets are 32-bit aligned
+ int align_offset = 4 - (curr_payload % 4);
+
+ if(align_offset != 4)
+ curr_payload += align_offset;
}
}
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-16 16:02:34 UTC (rev 5986)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_tx_stub.cc
2007-07-16 16:35:17 UTC (rev 5987)
@@ -281,6 +281,13 @@
// Each subpacket has an unaccounted for 2 bytes which is the opcode
// and the length field
curr_payload += len + 2;
+
+ // All subpackets are 32-bit aligned
+ int align_offset = 4 - (curr_payload % 4);
+
+ if(align_offset != 4)
+ curr_payload += align_offset;
+
}
// If the packet has data in the payload, it needs queued
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r5987 - gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband,
gnychis <=