[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 93/148: using vrt::expanded_header::unparse
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 93/148: using vrt::expanded_header::unparse in usrp2 impl tx raw |
Date: |
Mon, 15 Aug 2016 00:47:28 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
nwest pushed a commit to annotated tag old_usrp_devel_udp
in repository gnuradio.
commit f9251480a5e8fc00dd9bcc3938e64fb91c7dc514
Author: Josh Blum <address@hidden>
Date: Thu Dec 17 16:50:42 2009 -0800
using vrt::expanded_header::unparse in usrp2 impl tx raw
---
usrp2/host/lib/usrp2_impl.cc | 62 +++++++++++++-------------------------------
1 file changed, 18 insertions(+), 44 deletions(-)
diff --git a/usrp2/host/lib/usrp2_impl.cc b/usrp2/host/lib/usrp2_impl.cc
index c21b295..3e6a510 100644
--- a/usrp2/host/lib/usrp2_impl.cc
+++ b/usrp2/host/lib/usrp2_impl.cc
@@ -679,59 +679,33 @@ namespace usrp2 {
size_t nframes = (nitems + U2_MAX_SAMPLES - 1) / U2_MAX_SAMPLES;
- uint32_t trailer = htonx(hdr->trailer);
- size_t n32_bit_words_trailer = hdr->trailer_p()? 1 : 0;
+ uint32_t header[vrt::HEADER_MAX_N32_BIT_WORDS];
+ size_t n32_bit_words_header;
+ uint32_t trailer[vrt::TRAILER_MAX_N32_BIT_WORDS];
+ size_t n32_bit_words_trailer;
+ vrt::expanded_header hdr_frag;
+ memcpy(&hdr_frag, hdr, sizeof(vrt::expanded_header));
size_t items_sent = 0;
for (size_t fn = 0; fn < nframes; fn++){
- //calculate the data length
+ //calculate the payload length
size_t n32_bit_words_payload = std::min((size_t) U2_MAX_SAMPLES, nitems
- items_sent);
- //------------------ load the header contents ------------------//
- uint32_t header[sizeof(vrt::expanded_header)];
- size_t n32_bit_words_header = 0;
- //load header word
- header[n32_bit_words_header] = hdr->header; //leave in host byte order
(handled below)
- n32_bit_words_header += 1;
- //load stream id
- if (hdr->stream_id_p()){
- header[n32_bit_words_header] = htonx(hdr->stream_id);
- n32_bit_words_header += 1;
- }
- //load class id
- if (hdr->class_id_p()){
- ((uint64_t*)(header+n32_bit_words_header))[0] = htonx(hdr->class_id);
- n32_bit_words_header += 2;
- }
- //load integer secs
- if (hdr->integer_secs_p()){
- header[n32_bit_words_header] = htonx(hdr->integer_secs);
- n32_bit_words_header += 1;
- }
- //load fractional secs
- if (hdr->fractional_secs_p()){
- ((uint64_t*)(header+n32_bit_words_header))[0] =
htonx(hdr->fractional_secs);
- n32_bit_words_header += 2;
- }
-
- //------- set burst flags, header size, and packet count -------//
- header[0] &= ~( //clear the relevant flags and counts
- VRTH_START_OF_BURST | VRTH_END_OF_BURST |
- (VRTH_PKT_CNT_MASK << VRTH_PKT_CNT_SHIFT) |
- VRTH_PKT_SIZE_MASK);
-
- //set the new packet header length and count
- header[0] &=
- ((n32_bit_words_header+n32_bit_words_payload+n32_bit_words_trailer) &
VRTH_PKT_SIZE_MASK) |
- ((d_tx_pkt_cnt++ << VRTH_PKT_CNT_SHIFT) & VRTH_PKT_CNT_MASK);
+ //clear the burst flags and count
+ hdr_frag.header &= ~(VRTH_START_OF_BURST | VRTH_END_OF_BURST |
VRTH_PKT_CNT_MASK);
+ //set the packet count
+ hdr_frag.header |= ((d_tx_pkt_cnt++ << VRTH_PKT_CNT_SHIFT) &
VRTH_PKT_CNT_MASK);
//start of burst can only be set on the first fragment
if (hdr->header & VRTH_START_OF_BURST and fn == 0)
- header[0] &= VRTH_START_OF_BURST;
+ hdr_frag.header |= VRTH_START_OF_BURST;
//end of burst can only be set on the last fragment
if (hdr->header & VRTH_END_OF_BURST and fn == nframes - 1)
- header[0] &= VRTH_END_OF_BURST;
- header[0] = htonx(header[0]); //finally, convert word zero to nbo
+ hdr_frag.header |= VRTH_END_OF_BURST;
+
+ //--------- load the header, trailer, and word counts ----------//
+ vrt::expanded_header::unparse(&hdr_frag, n32_bit_words_payload, // in
+ header, &n32_bit_words_header, trailer, &n32_bit_words_trailer); // out
//------- pack the iovecs with the header, data, trailer -------//
iovec iov[3];
@@ -739,7 +713,7 @@ namespace usrp2 {
iov[0].iov_len = n32_bit_words_header*sizeof(uint32_t);
iov[1].iov_base = const_cast<uint32_t *>(&items[items_sent]);
iov[1].iov_len = n32_bit_words_payload*sizeof(uint32_t);
- iov[2].iov_base = &trailer;
+ iov[2].iov_base = trailer;
iov[2].iov_len = n32_bit_words_trailer*sizeof(uint32_t);
if (not d_data_transport->sendv(iov, dimof(iov))){
- [Commit-gnuradio] [gnuradio] 122/148: debug state, (continued)
- [Commit-gnuradio] [gnuradio] 122/148: debug state, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 124/148: try proper reset, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 81/148: Removed stream-at changes to make this mergable into wip/usrp2. Stream-at will be re-implemented with the new vita capabilities., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 140/148: Improved the timed samples example with RTT estimation., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 123/148: forgot to declare wire, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 125/148: try a width that works..., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 80/148: working vrt tx, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 85/148: also release ethernet frames here, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 88/148: revered dumb change to vrt expanded header, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 84/148: Replaced rx metadata with vrt expanded header. Removed timestamp from tx metadata, changes will be made for vrt., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 93/148: using vrt::expanded_header::unparse in usrp2 impl tx raw,
git <=
- [Commit-gnuradio] [gnuradio] 94/148: Replaced the need for code word tables by setting the header/trailer lengths in the switch body jump table, just like in the unparser switch body., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 72/148: Logic for the start/end of burst bits, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 82/148: Merge branch 'merge_usrp2' into wip/usrp2, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 91/148: Added time spec to the start streaming command. One can do a start streaming at by specifiying a time spec, or leave the parameter off for stream now mode., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 97/148: removed the usrp2_bytesex header since it only imported from gruel, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 100/148: Made some gruel changes to get it compiling on this system., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 101/148: flattened usrp2 hierarchy `, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 87/148: Removed references to channel numbers in usrp2 and gr usrp2. Removed the sample handler and replaced it with the vrt packet handler. Fixed the build systems to require vrt for usrp., git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 117/148: typo fix, git, 2016/08/14
- [Commit-gnuradio] [gnuradio] 111/148: Merge branch 'master' of address@hidden:jblum into wip/usrp2, git, 2016/08/14