aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/transport/gen_vrt.py
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-04-16 09:42:46 +0000
committerJosh Blum <josh@joshknows.com>2010-04-16 09:42:46 +0000
commit835cb56ef820a69e1e6e0ccde7c5a0e78ca5ad25 (patch)
tree4fe48bdaf92311deedfbe1a5e77dd209468a2d7d /host/lib/transport/gen_vrt.py
parentf1838b9284a124fcfb5996eaf1647a69b4473278 (diff)
parent067491b58676cbdaa754334949a8ffc2daf32979 (diff)
downloaduhd-835cb56ef820a69e1e6e0ccde7c5a0e78ca5ad25.tar.gz
uhd-835cb56ef820a69e1e6e0ccde7c5a0e78ca5ad25.tar.bz2
uhd-835cb56ef820a69e1e6e0ccde7c5a0e78ca5ad25.zip
Merge branch 'master' of git@ettus.sourcerepo.com:ettus/uhdpriv into usrp_e
Conflicts: .gitignore
Diffstat (limited to 'host/lib/transport/gen_vrt.py')
-rwxr-xr-xhost/lib/transport/gen_vrt.py24
1 files changed, 16 insertions, 8 deletions
diff --git a/host/lib/transport/gen_vrt.py b/host/lib/transport/gen_vrt.py
index 918de3ad7..38a394dee 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 ##########
@@ -198,9 +200,15 @@ void vrt::unpack(
}
"""
-from Cheetah import Template
-def parse_str(_tmpl_text, **kwargs): return str(Template.Template(_tmpl_text, kwargs))
+import os
+import sys
+
+from Cheetah.Template import Template
+def parse_tmpl(_tmpl_text, **kwargs):
+ return str(Template(_tmpl_text, kwargs))
+def safe_makedirs(path):
+ not os.path.isdir(path) and os.makedirs(path)
if __name__ == '__main__':
- from Cheetah import Template
- print parse_str(TMPL_TEXT, file=__file__)
+ safe_makedirs(os.path.dirname(sys.argv[1]))
+ open(sys.argv[1], 'w').write(parse_tmpl(TMPL_TEXT, file=__file__))