diff options
-rwxr-xr-x | host/lib/transport/gen_vrt_if_packet.py | 10 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_iface.cpp | 2 |
2 files changed, 9 insertions, 3 deletions
diff --git a/host/lib/transport/gen_vrt_if_packet.py b/host/lib/transport/gen_vrt_if_packet.py index 7910ff60d..9b5bfca02 100755 --- a/host/lib/transport/gen_vrt_if_packet.py +++ b/host/lib/transport/gen_vrt_if_packet.py @@ -62,7 +62,10 @@ using namespace uhd::transport; #set $tlr_p = 0b10000 static UHD_INLINE void pack_uint64_$(suffix)(boost::uint64_t num, boost::uint32_t *mem){ - *(reinterpret_cast<boost::uint64_t *>(mem)) = $(XE_MACRO)(num); + //*(reinterpret_cast<boost::uint64_t *>(mem)) = $(XE_MACRO)(num); + //second word is lower 32 bits due to fpga implementation + mem[1] = $(XE_MACRO)(boost::uint32_t(num >> 0)); + mem[0] = $(XE_MACRO)(boost::uint32_t(num >> 32)); } void vrt::if_hdr_pack_$(suffix)( @@ -137,7 +140,10 @@ void vrt::if_hdr_pack_$(suffix)( } static UHD_INLINE void unpack_uint64_$(suffix)(boost::uint64_t &num, const boost::uint32_t *mem){ - num = $(XE_MACRO)(*reinterpret_cast<const boost::uint64_t *>(mem)); + //num = $(XE_MACRO)(*reinterpret_cast<const boost::uint64_t *>(mem)); + //second word is lower 32 bits due to fpga implementation + num = boost::uint64_t($(XE_MACRO)(mem[1])) << 0; + num |= boost::uint64_t($(XE_MACRO)(mem[0])) << 32; } void vrt::if_hdr_unpack_$(suffix)( diff --git a/host/lib/usrp/usrp2/usrp2_iface.cpp b/host/lib/usrp/usrp2/usrp2_iface.cpp index faf4a5c7e..8552edd1f 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.cpp +++ b/host/lib/usrp/usrp2/usrp2_iface.cpp @@ -161,7 +161,7 @@ public: //loop until we get the packet or timeout boost::uint8_t usrp2_ctrl_data_in_mem[USRP2_UDP_BYTES]; //allocate max bytes for recv - usrp2_ctrl_data_t *ctrl_data_in = reinterpret_cast<usrp2_ctrl_data_t *>(usrp2_ctrl_data_in_mem); + const usrp2_ctrl_data_t *ctrl_data_in = reinterpret_cast<const usrp2_ctrl_data_t *>(usrp2_ctrl_data_in_mem); while(true){ size_t len = _ctrl_transport->recv(boost::asio::buffer(usrp2_ctrl_data_in_mem)); if(len >= sizeof(boost::uint32_t) and ntohl(ctrl_data_in->proto_ver) != USRP2_PROTO_VERSION){ |