diff options
author | Josh Blum <josh@joshknows.com> | 2009-09-25 17:28:52 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2009-09-25 17:28:52 -0700 |
commit | 3cb87bce0f8f20912a16f54e03d37f9fef4e0c3f (patch) | |
tree | bcbbf187f766422c132f71c4589c197e282fc827 | |
parent | 2532270b7db5be724c390bddde8b0e490f98fe6f (diff) |
use the new htonll and vrt types to send cal and lo freqs
-rw-r--r-- | vrt/lib/quadradio.cc | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/vrt/lib/quadradio.cc b/vrt/lib/quadradio.cc index 906f88df48..cc810e683b 100644 --- a/vrt/lib/quadradio.cc +++ b/vrt/lib/quadradio.cc @@ -22,6 +22,8 @@ #include <config.h> #endif #include <vrt/quadradio.h> +#include <vrt/types.h> +#include <gruel/inet.h> #include <errno.h> #include <string.h> #include <stdio.h> @@ -377,12 +379,11 @@ vrt::quadradio::set_mem32(int addr, int value) bool vrt::quadradio::set_lo_freq(double freq) { - uint64_t lo_freq = uint64_t(freq * (uint64_t(1)<<20)); //q20 format + vrt_freq_t lo_freq = htonll(double_to_vrt_freq(freq)); uint32_t cmd[4]; cmd[0] = htonl(0); // verb: set cmd[1] = htonl(6); // id: lo freq - cmd[2] = htonl((lo_freq >> 32) & 0xffffffff); - cmd[3] = htonl((lo_freq >> 0) & 0xffffffff); + memcpy(cmd+2, &lo_freq, sizeof(lo_freq)); return send_and_check(d_ctrl_fd, cmd, sizeof(cmd)); } @@ -390,12 +391,11 @@ vrt::quadradio::set_lo_freq(double freq) bool vrt::quadradio::set_cal_freq(double freq) { - uint64_t cal_freq = uint64_t(freq * (uint64_t(1)<<20)); //q20 format + vrt_freq_t cal_freq = htonll(double_to_vrt_freq(freq)); uint32_t cmd[4]; cmd[0] = htonl(0); // verb: set cmd[1] = htonl(7); // id: cal freq - cmd[2] = htonl((cal_freq >> 32) & 0xffffffff); - cmd[3] = htonl((cal_freq >> 0) & 0xffffffff); + memcpy(cmd+2, &cal_freq, sizeof(cal_freq)); return send_and_check(d_ctrl_fd, cmd, sizeof(cmd)); } |