[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r5985 - in gnuradio/branches/developers/gnychis/inband
From: |
gnychis |
Subject: |
[Commit-gnuradio] r5985 - in gnuradio/branches/developers/gnychis/inband/usrp/host: apps lib/inband |
Date: |
Mon, 16 Jul 2007 09:36:52 -0600 (MDT) |
Author: gnychis
Date: 2007-07-16 09:36:52 -0600 (Mon, 16 Jul 2007)
New Revision: 5985
Modified:
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_cs.cc
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_inband_usb_packet.h
Log:
32-bit aligning all CS sub-packets which is according to the spec to make
parsing easier on the FPGA.
Modified:
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_cs.cc
===================================================================
---
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_cs.cc
2007-07-16 15:06:45 UTC (rev 5984)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/apps/test_usrp_inband_cs.cc
2007-07-16 15:36:52 UTC (rev 5985)
@@ -355,23 +355,27 @@
sleep(1);
- build_and_send_next_frame(); // fire off 4 to start pipeline
- build_and_send_next_frame();
- build_and_send_next_frame();
- build_and_send_next_frame();
+// build_and_send_next_frame(); // fire off 4 to start pipeline
+// build_and_send_next_frame();
+// build_and_send_next_frame();
+// build_and_send_next_frame();
+ build_and_send_ping();
+ build_and_send_ping();
+ build_and_send_ping();
+ build_and_send_ping();
- struct timezone tz;
+// struct timezone tz;
- for (int i(0); i < NBPING; i++)
- {
-
- struct timeval *tv = (struct timeval*)calloc(1, sizeof(struct timeval));
- gettimeofday(tv, &tz);
- times[i] = *tv;
- build_and_send_ping();
-
- free(tv);
- }
+// for (int i(0); i < NBPING; i++)
+// {
+//
+// struct timeval *tv = (struct timeval*)calloc(1, sizeof(struct timeval));
+// gettimeofday(tv, &tz);
+// times[i] = *tv;
+// build_and_send_ping();
+//
+// free(tv);
+// }
}
void
@@ -379,7 +383,9 @@
{
d_tx->send(s_cmd_to_control_channel,
- pmt_list2(PMT_NIL, pmt_list1(pmt_list3(s_op_ping_fixed, PMT_NIL,
PMT_NIL))));
+ pmt_list2(PMT_NIL, pmt_list1(pmt_list2(s_op_ping_fixed,
+ pmt_list2(pmt_from_long(0),
+
pmt_from_long(0))))));
std::cout << "ping sent" << std::endl;
}
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 15:06:45 UTC (rev 5984)
+++
gnuradio/branches/developers/gnychis/inband/usrp/host/lib/inband/usrp_inband_usb_packet.h
2007-07-16 15:36:52 UTC (rev 5985)
@@ -202,8 +202,35 @@
return USB_PKT_SIZE;
}
+ bool align32()
+ {
+ int p_len = payload_len();
+ int bytes_needed = 4 - (p_len % 4);
+
+ // 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;
+
+ 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);
+ }
+
+ return true;
+ }
+
bool cs_ping(long rid, long ping_val)
{
+ if(!align32())
+ return false;
int p_len = payload_len();
@@ -234,6 +261,9 @@
bool cs_ping_reply(long rid, long ping_val)
{
+ if(!align32())
+ return false;
+
int p_len = payload_len();
if((MAX_PAYLOAD - p_len) < (CS_PING_LEN + CS_FIXED_LEN))
@@ -263,6 +293,9 @@
bool cs_write_reg(long reg_num, long val)
{
+ if(!align32())
+ return false;
+
int p_len = payload_len();
if((MAX_PAYLOAD - p_len) < (CS_WRITEREG_LEN + CS_FIXED_LEN))
@@ -298,6 +331,9 @@
bool cs_write_reg_masked(long reg_num, long val, long mask)
{
+ if(!align32())
+ return false;
+
int p_len = payload_len();
if((MAX_PAYLOAD - p_len) < (CS_WRITEREGMASKED_LEN + CS_FIXED_LEN))
@@ -336,6 +372,9 @@
bool cs_read_reg(long rid, long reg_num)
{
+ if(!align32())
+ return false;
+
int p_len = payload_len();
if((MAX_PAYLOAD - p_len) < (CS_READREG_LEN + CS_FIXED_LEN))
@@ -365,6 +404,9 @@
bool cs_read_reg_reply(long rid, long reg_num, long reg_val)
{
+ if(!align32())
+ return false;
+
int p_len = payload_len();
if((MAX_PAYLOAD - p_len) < (CS_READREGREPLY_LEN + CS_FIXED_LEN))
@@ -398,6 +440,9 @@
bool cs_delay(long ticks)
{
+ if(!align32())
+ return false;
+
int p_len = payload_len();
if((MAX_PAYLOAD - p_len) < (CS_DELAY_LEN + CS_FIXED_LEN))
@@ -426,6 +471,9 @@
bool cs_i2c_write(long i2c_addr, uint8_t *i2c_data, size_t data_len)
{
+ if(!align32())
+ return false;
+
int p_len = payload_len();
int i2c_len = data_len + 2; // 2 bytes between mbz and addr
@@ -462,6 +510,9 @@
bool cs_i2c_read(long rid, long i2c_addr, long n_bytes)
{
+ if(!align32())
+ return false;
+
int p_len = payload_len();
if((MAX_PAYLOAD - p_len) < (CS_I2CREAD_LEN + CS_FIXED_LEN))
@@ -498,6 +549,9 @@
bool cs_i2c_read_reply(long rid, long i2c_addr, uint8_t *i2c_data, long
i2c_data_len)
{
+ if(!align32())
+ return false;
+
int p_len = payload_len();
int i2c_len = i2c_data_len + 2;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r5985 - in gnuradio/branches/developers/gnychis/inband/usrp/host: apps lib/inband,
gnychis <=