summaryrefslogtreecommitdiffstats
path: root/host/lib/transport
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-04-08 10:57:16 -0700
committerJosh Blum <josh@joshknows.com>2010-04-08 10:57:16 -0700
commitd743784919b362d93e6408f05bdef6e543e3fc7e (patch)
tree41bd275d4cb06c5d56a1858c3023ce4498381042 /host/lib/transport
parentb66a74ff1f629af714e26040b410d472c08be522 (diff)
downloaduhd-d743784919b362d93e6408f05bdef6e543e3fc7e.tar.gz
uhd-d743784919b362d93e6408f05bdef6e543e3fc7e.tar.bz2
uhd-d743784919b362d93e6408f05bdef6e543e3fc7e.zip
converted timespec to use nanoseconds for fractional part
Diffstat (limited to 'host/lib/transport')
-rwxr-xr-xhost/lib/transport/gen_vrt.py10
-rw-r--r--host/lib/transport/vrt.cpp72
2 files changed, 43 insertions, 39 deletions
diff --git a/host/lib/transport/gen_vrt.py b/host/lib/transport/gen_vrt.py
index 918de3ad7..bc6635d78 100755
--- a/host/lib/transport/gen_vrt.py
+++ b/host/lib/transport/gen_vrt.py
@@ -54,7 +54,8 @@ void vrt::pack(
size_t &num_header_words32, //output
size_t num_payload_words32, //input
size_t &num_packet_words32, //output
- size_t packet_count //input
+ size_t packet_count, //input
+ double tick_rate //input
){
boost::uint32_t vrt_hdr_flags;
@@ -91,7 +92,7 @@ void vrt::pack(
#if $pred & $tsf_p
header_buff[$num_header_words] = htonl(0);
#set $num_header_words += 1
- header_buff[$num_header_words] = htonl(metadata.time_spec.ticks);
+ header_buff[$num_header_words] = htonl(metadata.time_spec.get_ticks(tick_rate));
#set $num_header_words += 1
#set $flags |= (0x1 << 20);
#end if
@@ -127,7 +128,8 @@ void vrt::unpack(
size_t &num_header_words32, //output
size_t &num_payload_words32, //output
size_t num_packet_words32, //input
- size_t &packet_count //output
+ size_t &packet_count, //output
+ double tick_rate //input
){
//clear the metadata
metadata = rx_metadata_t();
@@ -180,7 +182,7 @@ void vrt::unpack(
#set $set_has_time_spec = True
#end if
#set $num_header_words += 1
- metadata.time_spec.ticks = ntohl(header_buff[$num_header_words]);
+ metadata.time_spec.set_ticks(ntohl(header_buff[$num_header_words]), tick_rate);
#set $num_header_words += 1
#end if
########## Trailer ##########
diff --git a/host/lib/transport/vrt.cpp b/host/lib/transport/vrt.cpp
index bebca5db9..78c3cf2cb 100644
--- a/host/lib/transport/vrt.cpp
+++ b/host/lib/transport/vrt.cpp
@@ -2,7 +2,7 @@
/***********************************************************************
- * This file was generated by ./gen_vrt.py on Fri Mar 26 15:33:00 2010
+ * This file was generated by gen_vrt.py on 04/08/10 10:55:26
**********************************************************************/
#include <uhd/transport/vrt.hpp>
@@ -18,7 +18,8 @@ void vrt::pack(
size_t &num_header_words32, //output
size_t num_payload_words32, //input
size_t &num_packet_words32, //output
- size_t packet_count //input
+ size_t packet_count, //input
+ double tick_rate //input
){
boost::uint32_t vrt_hdr_flags;
@@ -85,7 +86,7 @@ void vrt::pack(
break;
case 8:
header_buff[1] = htonl(0);
- header_buff[2] = htonl(metadata.time_spec.ticks);
+ header_buff[2] = htonl(metadata.time_spec.get_ticks(tick_rate));
num_header_words32 = 3;
num_packet_words32 = 3 + num_payload_words32;
vrt_hdr_flags = 0x100000;
@@ -93,7 +94,7 @@ void vrt::pack(
case 9:
header_buff[1] = htonl(metadata.stream_id);
header_buff[2] = htonl(0);
- header_buff[3] = htonl(metadata.time_spec.ticks);
+ header_buff[3] = htonl(metadata.time_spec.get_ticks(tick_rate));
num_header_words32 = 4;
num_packet_words32 = 4 + num_payload_words32;
vrt_hdr_flags = 0x10100000;
@@ -102,7 +103,7 @@ void vrt::pack(
header_buff[1] = htonl(0);
header_buff[2] = htonl(0);
header_buff[3] = htonl(0);
- header_buff[4] = htonl(metadata.time_spec.ticks);
+ header_buff[4] = htonl(metadata.time_spec.get_ticks(tick_rate));
num_header_words32 = 5;
num_packet_words32 = 5 + num_payload_words32;
vrt_hdr_flags = 0x8100000;
@@ -112,7 +113,7 @@ void vrt::pack(
header_buff[2] = htonl(0);
header_buff[3] = htonl(0);
header_buff[4] = htonl(0);
- header_buff[5] = htonl(metadata.time_spec.ticks);
+ header_buff[5] = htonl(metadata.time_spec.get_ticks(tick_rate));
num_header_words32 = 6;
num_packet_words32 = 6 + num_payload_words32;
vrt_hdr_flags = 0x18100000;
@@ -120,7 +121,7 @@ void vrt::pack(
case 12:
header_buff[1] = htonl(metadata.time_spec.secs);
header_buff[2] = htonl(0);
- header_buff[3] = htonl(metadata.time_spec.ticks);
+ header_buff[3] = htonl(metadata.time_spec.get_ticks(tick_rate));
num_header_words32 = 4;
num_packet_words32 = 4 + num_payload_words32;
vrt_hdr_flags = 0xd00000;
@@ -129,7 +130,7 @@ void vrt::pack(
header_buff[1] = htonl(metadata.stream_id);
header_buff[2] = htonl(metadata.time_spec.secs);
header_buff[3] = htonl(0);
- header_buff[4] = htonl(metadata.time_spec.ticks);
+ header_buff[4] = htonl(metadata.time_spec.get_ticks(tick_rate));
num_header_words32 = 5;
num_packet_words32 = 5 + num_payload_words32;
vrt_hdr_flags = 0x10d00000;
@@ -139,7 +140,7 @@ void vrt::pack(
header_buff[2] = htonl(0);
header_buff[3] = htonl(metadata.time_spec.secs);
header_buff[4] = htonl(0);
- header_buff[5] = htonl(metadata.time_spec.ticks);
+ header_buff[5] = htonl(metadata.time_spec.get_ticks(tick_rate));
num_header_words32 = 6;
num_packet_words32 = 6 + num_payload_words32;
vrt_hdr_flags = 0x8d00000;
@@ -150,7 +151,7 @@ void vrt::pack(
header_buff[3] = htonl(0);
header_buff[4] = htonl(metadata.time_spec.secs);
header_buff[5] = htonl(0);
- header_buff[6] = htonl(metadata.time_spec.ticks);
+ header_buff[6] = htonl(metadata.time_spec.get_ticks(tick_rate));
num_header_words32 = 7;
num_packet_words32 = 7 + num_payload_words32;
vrt_hdr_flags = 0x18d00000;
@@ -213,7 +214,7 @@ void vrt::pack(
break;
case 24:
header_buff[1] = htonl(0);
- header_buff[2] = htonl(metadata.time_spec.ticks);
+ header_buff[2] = htonl(metadata.time_spec.get_ticks(tick_rate));
num_header_words32 = 3;
num_packet_words32 = 4 + num_payload_words32;
vrt_hdr_flags = 0x4100000;
@@ -221,7 +222,7 @@ void vrt::pack(
case 25:
header_buff[1] = htonl(metadata.stream_id);
header_buff[2] = htonl(0);
- header_buff[3] = htonl(metadata.time_spec.ticks);
+ header_buff[3] = htonl(metadata.time_spec.get_ticks(tick_rate));
num_header_words32 = 4;
num_packet_words32 = 5 + num_payload_words32;
vrt_hdr_flags = 0x14100000;
@@ -230,7 +231,7 @@ void vrt::pack(
header_buff[1] = htonl(0);
header_buff[2] = htonl(0);
header_buff[3] = htonl(0);
- header_buff[4] = htonl(metadata.time_spec.ticks);
+ header_buff[4] = htonl(metadata.time_spec.get_ticks(tick_rate));
num_header_words32 = 5;
num_packet_words32 = 6 + num_payload_words32;
vrt_hdr_flags = 0xc100000;
@@ -240,7 +241,7 @@ void vrt::pack(
header_buff[2] = htonl(0);
header_buff[3] = htonl(0);
header_buff[4] = htonl(0);
- header_buff[5] = htonl(metadata.time_spec.ticks);
+ header_buff[5] = htonl(metadata.time_spec.get_ticks(tick_rate));
num_header_words32 = 6;
num_packet_words32 = 7 + num_payload_words32;
vrt_hdr_flags = 0x1c100000;
@@ -248,7 +249,7 @@ void vrt::pack(
case 28:
header_buff[1] = htonl(metadata.time_spec.secs);
header_buff[2] = htonl(0);
- header_buff[3] = htonl(metadata.time_spec.ticks);
+ header_buff[3] = htonl(metadata.time_spec.get_ticks(tick_rate));
num_header_words32 = 4;
num_packet_words32 = 5 + num_payload_words32;
vrt_hdr_flags = 0x4d00000;
@@ -257,7 +258,7 @@ void vrt::pack(
header_buff[1] = htonl(metadata.stream_id);
header_buff[2] = htonl(metadata.time_spec.secs);
header_buff[3] = htonl(0);
- header_buff[4] = htonl(metadata.time_spec.ticks);
+ header_buff[4] = htonl(metadata.time_spec.get_ticks(tick_rate));
num_header_words32 = 5;
num_packet_words32 = 6 + num_payload_words32;
vrt_hdr_flags = 0x14d00000;
@@ -267,7 +268,7 @@ void vrt::pack(
header_buff[2] = htonl(0);
header_buff[3] = htonl(metadata.time_spec.secs);
header_buff[4] = htonl(0);
- header_buff[5] = htonl(metadata.time_spec.ticks);
+ header_buff[5] = htonl(metadata.time_spec.get_ticks(tick_rate));
num_header_words32 = 6;
num_packet_words32 = 7 + num_payload_words32;
vrt_hdr_flags = 0xcd00000;
@@ -278,7 +279,7 @@ void vrt::pack(
header_buff[3] = htonl(0);
header_buff[4] = htonl(metadata.time_spec.secs);
header_buff[5] = htonl(0);
- header_buff[6] = htonl(metadata.time_spec.ticks);
+ header_buff[6] = htonl(metadata.time_spec.get_ticks(tick_rate));
num_header_words32 = 7;
num_packet_words32 = 8 + num_payload_words32;
vrt_hdr_flags = 0x1cd00000;
@@ -302,7 +303,8 @@ void vrt::unpack(
size_t &num_header_words32, //output
size_t &num_payload_words32, //output
size_t num_packet_words32, //input
- size_t &packet_count //output
+ size_t &packet_count, //output
+ double tick_rate //input
){
//clear the metadata
metadata = rx_metadata_t();
@@ -376,7 +378,7 @@ void vrt::unpack(
break;
case 8:
metadata.has_time_spec = true;
- metadata.time_spec.ticks = ntohl(header_buff[2]);
+ metadata.time_spec.set_ticks(ntohl(header_buff[2]), tick_rate);
num_header_words32 = 3;
num_payload_words32 = packet_words32 - 3;
break;
@@ -384,13 +386,13 @@ void vrt::unpack(
metadata.has_stream_id = true;
metadata.stream_id = ntohl(header_buff[1]);
metadata.has_time_spec = true;
- metadata.time_spec.ticks = ntohl(header_buff[3]);
+ metadata.time_spec.set_ticks(ntohl(header_buff[3]), tick_rate);
num_header_words32 = 4;
num_payload_words32 = packet_words32 - 4;
break;
case 10:
metadata.has_time_spec = true;
- metadata.time_spec.ticks = ntohl(header_buff[4]);
+ metadata.time_spec.set_ticks(ntohl(header_buff[4]), tick_rate);
num_header_words32 = 5;
num_payload_words32 = packet_words32 - 5;
break;
@@ -398,14 +400,14 @@ void vrt::unpack(
metadata.has_stream_id = true;
metadata.stream_id = ntohl(header_buff[1]);
metadata.has_time_spec = true;
- metadata.time_spec.ticks = ntohl(header_buff[5]);
+ metadata.time_spec.set_ticks(ntohl(header_buff[5]), tick_rate);
num_header_words32 = 6;
num_payload_words32 = packet_words32 - 6;
break;
case 12:
metadata.has_time_spec = true;
metadata.time_spec.secs = ntohl(header_buff[1]);
- metadata.time_spec.ticks = ntohl(header_buff[3]);
+ metadata.time_spec.set_ticks(ntohl(header_buff[3]), tick_rate);
num_header_words32 = 4;
num_payload_words32 = packet_words32 - 4;
break;
@@ -414,14 +416,14 @@ void vrt::unpack(
metadata.stream_id = ntohl(header_buff[1]);
metadata.has_time_spec = true;
metadata.time_spec.secs = ntohl(header_buff[2]);
- metadata.time_spec.ticks = ntohl(header_buff[4]);
+ metadata.time_spec.set_ticks(ntohl(header_buff[4]), tick_rate);
num_header_words32 = 5;
num_payload_words32 = packet_words32 - 5;
break;
case 14:
metadata.has_time_spec = true;
metadata.time_spec.secs = ntohl(header_buff[3]);
- metadata.time_spec.ticks = ntohl(header_buff[5]);
+ metadata.time_spec.set_ticks(ntohl(header_buff[5]), tick_rate);
num_header_words32 = 6;
num_payload_words32 = packet_words32 - 6;
break;
@@ -430,7 +432,7 @@ void vrt::unpack(
metadata.stream_id = ntohl(header_buff[1]);
metadata.has_time_spec = true;
metadata.time_spec.secs = ntohl(header_buff[4]);
- metadata.time_spec.ticks = ntohl(header_buff[6]);
+ metadata.time_spec.set_ticks(ntohl(header_buff[6]), tick_rate);
num_header_words32 = 7;
num_payload_words32 = packet_words32 - 7;
break;
@@ -484,7 +486,7 @@ void vrt::unpack(
break;
case 24:
metadata.has_time_spec = true;
- metadata.time_spec.ticks = ntohl(header_buff[2]);
+ metadata.time_spec.set_ticks(ntohl(header_buff[2]), tick_rate);
num_header_words32 = 3;
num_payload_words32 = packet_words32 - 4;
break;
@@ -492,13 +494,13 @@ void vrt::unpack(
metadata.has_stream_id = true;
metadata.stream_id = ntohl(header_buff[1]);
metadata.has_time_spec = true;
- metadata.time_spec.ticks = ntohl(header_buff[3]);
+ metadata.time_spec.set_ticks(ntohl(header_buff[3]), tick_rate);
num_header_words32 = 4;
num_payload_words32 = packet_words32 - 5;
break;
case 26:
metadata.has_time_spec = true;
- metadata.time_spec.ticks = ntohl(header_buff[4]);
+ metadata.time_spec.set_ticks(ntohl(header_buff[4]), tick_rate);
num_header_words32 = 5;
num_payload_words32 = packet_words32 - 6;
break;
@@ -506,14 +508,14 @@ void vrt::unpack(
metadata.has_stream_id = true;
metadata.stream_id = ntohl(header_buff[1]);
metadata.has_time_spec = true;
- metadata.time_spec.ticks = ntohl(header_buff[5]);
+ metadata.time_spec.set_ticks(ntohl(header_buff[5]), tick_rate);
num_header_words32 = 6;
num_payload_words32 = packet_words32 - 7;
break;
case 28:
metadata.has_time_spec = true;
metadata.time_spec.secs = ntohl(header_buff[1]);
- metadata.time_spec.ticks = ntohl(header_buff[3]);
+ metadata.time_spec.set_ticks(ntohl(header_buff[3]), tick_rate);
num_header_words32 = 4;
num_payload_words32 = packet_words32 - 5;
break;
@@ -522,14 +524,14 @@ void vrt::unpack(
metadata.stream_id = ntohl(header_buff[1]);
metadata.has_time_spec = true;
metadata.time_spec.secs = ntohl(header_buff[2]);
- metadata.time_spec.ticks = ntohl(header_buff[4]);
+ metadata.time_spec.set_ticks(ntohl(header_buff[4]), tick_rate);
num_header_words32 = 5;
num_payload_words32 = packet_words32 - 6;
break;
case 30:
metadata.has_time_spec = true;
metadata.time_spec.secs = ntohl(header_buff[3]);
- metadata.time_spec.ticks = ntohl(header_buff[5]);
+ metadata.time_spec.set_ticks(ntohl(header_buff[5]), tick_rate);
num_header_words32 = 6;
num_payload_words32 = packet_words32 - 7;
break;
@@ -538,7 +540,7 @@ void vrt::unpack(
metadata.stream_id = ntohl(header_buff[1]);
metadata.has_time_spec = true;
metadata.time_spec.secs = ntohl(header_buff[4]);
- metadata.time_spec.ticks = ntohl(header_buff[6]);
+ metadata.time_spec.set_ticks(ntohl(header_buff[6]), tick_rate);
num_header_words32 = 7;
num_payload_words32 = packet_words32 - 8;
break;