diff options
author | Nicholas Corgan <nick.corgan@ettus.com> | 2016-06-17 09:09:25 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2016-06-17 11:37:45 -0700 |
commit | aa1665958756ab02342bb13c41f14aec6f0ef3f4 (patch) | |
tree | b25c4f9807448449771ef2e6131d37c7caec4d12 /host/lib/usrp_clock/octoclock/octoclock_uart.cpp | |
parent | 56e987d41cf8468291d3f680a4ac10fead22095e (diff) | |
download | uhd-aa1665958756ab02342bb13c41f14aec6f0ef3f4.tar.gz uhd-aa1665958756ab02342bb13c41f14aec6f0ef3f4.tar.bz2 uhd-aa1665958756ab02342bb13c41f14aec6f0ef3f4.zip |
octoclock: bugfixes, bumped firmware compat number to 4
* host: consistency in setting packet sequence numbers
* firmware: populate packet length field when setting GPSDO cache
* both: logic for dealing with mismatching compatibility numbers
Reviewed-By: Michael West <michael.west@ettus.com>
Reviewed-By: Martin Braun <martin.braun@ettus.com>
Diffstat (limited to 'host/lib/usrp_clock/octoclock/octoclock_uart.cpp')
-rw-r--r-- | host/lib/usrp_clock/octoclock/octoclock_uart.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/host/lib/usrp_clock/octoclock/octoclock_uart.cpp b/host/lib/usrp_clock/octoclock/octoclock_uart.cpp index 4d02aad3b..e0a9f08cf 100644 --- a/host/lib/usrp_clock/octoclock/octoclock_uart.cpp +++ b/host/lib/usrp_clock/octoclock/octoclock_uart.cpp @@ -1,5 +1,5 @@ // -// Copyright 2014-2015 Ettus Research LLC +// Copyright 2014-2016 Ettus Research LLC // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -47,11 +47,13 @@ namespace uhd{ _state.pos = 0; _device_state.num_wraps = 0; _device_state.pos = 0; + // To avoid replicating sequence numbers between sessions + _sequence = boost::uint32_t(std::rand()); size_t len = 0; //Get pool size from device octoclock_packet_t pkt_out; - pkt_out.sequence = uhd::htonx<boost::uint16_t>(std::rand()); + pkt_out.sequence = uhd::htonx<boost::uint32_t>(_sequence); pkt_out.len = 0; boost::uint8_t octoclock_data[udp_simple::mtu]; @@ -70,7 +72,7 @@ namespace uhd{ size_t len = 0; octoclock_packet_t pkt_out; - pkt_out.sequence = uhd::htonx<boost::uint32_t>(std::rand()); + pkt_out.sequence = uhd::htonx<boost::uint32_t>(++_sequence); pkt_out.len = to_send.size(); memcpy(pkt_out.data, to_send.c_str(), to_send.size()); @@ -111,14 +113,13 @@ namespace uhd{ void octoclock_uart_iface::_update_cache(){ octoclock_packet_t pkt_out; pkt_out.len = 0; - pkt_out.sequence = 0; size_t len = 0; boost::uint8_t octoclock_data[udp_simple::mtu]; const octoclock_packet_t *pkt_in = reinterpret_cast<octoclock_packet_t*>(octoclock_data); if(STATES_EQUAL or LOCAL_STATE_AHEAD){ - pkt_out.sequence++; + pkt_out.sequence = uhd::htonx<boost::uint32_t>(++_sequence); UHD_OCTOCLOCK_SEND_AND_RECV(_udp, SEND_GPSDO_CACHE_CMD, pkt_out, len, octoclock_data); if(UHD_OCTOCLOCK_PACKET_MATCHES(SEND_GPSDO_CACHE_ACK, pkt_out, pkt_in, len)){ memcpy(&_cache[0], pkt_in->data, _poolsize); |