From 85a8e6cdb0fb05b12b071c81f9eb025b380fb155 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 28 Sep 2009 19:04:38 -0700 Subject: [PATCH] added access methods and parsing for caldiv if context --- gr-vrt/src/vrt_quadradio_source_32fc.h | 11 +++++++++-- gr-vrt/src/vrt_source_32fc.cc | 9 ++++++++- gr-vrt/src/vrt_source_32fc.h | 12 ++++++++++-- gruel/src/include/gruel/inet.h.in | 2 ++ vrt/include/vrt/if_context.h | 14 +++++++++++++- 5 files changed, 42 insertions(+), 6 deletions(-) diff --git a/gr-vrt/src/vrt_quadradio_source_32fc.h b/gr-vrt/src/vrt_quadradio_source_32fc.h index 4589908f..799b07e8 100644 --- a/gr-vrt/src/vrt_quadradio_source_32fc.h +++ b/gr-vrt/src/vrt_quadradio_source_32fc.h @@ -113,8 +113,15 @@ public: bool set_beamforming(std::vector gains); bool set_cal_enb(bool enb); - double get_cal_freq(void){return d_actual_cal_freq;} - double get_lo_freq(void){return d_actual_lo_freq;} + //caldiv public access methods + double get_cal_freq(void){return d_cal_freq;} + bool get_cal_locked(void){return d_cal_locked;} + bool get_cal_enabled(void){return d_cal_enabled;} + double get_lo_freq(void){return d_lo_freq;} + bool get_lo_locked(void){return d_lo_locked;} + double get_caldiv_temp(void){return d_caldiv_temp;} + int get_caldiv_ser_no(void){return d_caldiv_rev;} + int get_caldiv_rev_no(void){return d_caldiv_ser;} }; diff --git a/gr-vrt/src/vrt_source_32fc.cc b/gr-vrt/src/vrt_source_32fc.cc index 551ea982..0091619a 100644 --- a/gr-vrt/src/vrt_source_32fc.cc +++ b/gr-vrt/src/vrt_source_32fc.cc @@ -171,7 +171,14 @@ vrt_source_32fc::work(int noutput_items, //we have a context packet, grab its useful information... //remember that things are in network byte order! if (h.get_if_context()){ - d_actual_lo_freq = vrt_freq_to_double(ntohll(h.get_if_context()->beamformer.rf_ref_freq)); + d_lo_freq = vrt_freq_to_double(ntohll(h.get_if_context()->caldiv.lo_freq)); + d_cal_freq = vrt_freq_to_double(ntohll(h.get_if_context()->caldiv.cal_freq)); + d_lo_locked = bool(ntohl(h.get_if_context()->caldiv.lo_locked)); + d_cal_locked = bool(ntohl(h.get_if_context()->caldiv.cal_locked)); + d_cal_enabled = bool(ntohl(h.get_if_context()->caldiv.cal_enabled)); + d_caldiv_temp = vrt_temp_to_double(ntohl(h.get_if_context()->caldiv.temp)); + d_caldiv_ser = ntohl(h.get_if_context()->caldiv.ser); + d_caldiv_rev = ntohl(h.get_if_context()->caldiv.rev); } return oo; diff --git a/gr-vrt/src/vrt_source_32fc.h b/gr-vrt/src/vrt_source_32fc.h index 96e9cac4..9d53fae3 100644 --- a/gr-vrt/src/vrt_source_32fc.h +++ b/gr-vrt/src/vrt_source_32fc.h @@ -33,8 +33,16 @@ protected: std::vector< std::complex > d_remainder; missing_pkt_checker d_checker; - double d_actual_lo_freq; - double d_actual_cal_freq; + + //caldiv settings parsed from if context + double d_cal_freq; + bool d_cal_locked; + bool d_cal_enabled; + double d_lo_freq; + bool d_lo_locked; + double d_caldiv_temp; + int d_caldiv_rev; + int d_caldiv_ser; public: ~vrt_source_32fc(); diff --git a/gruel/src/include/gruel/inet.h.in b/gruel/src/include/gruel/inet.h.in index 32027072..7ac01eb5 100644 --- a/gruel/src/include/gruel/inet.h.in +++ b/gruel/src/include/gruel/inet.h.in @@ -19,6 +19,8 @@ #ifndef INCLUDED_INET_H #define INCLUDED_INET_H +#include + #if 1 /* missing htonll or ntohll */ #if @GR_ARCH_BIGENDIAN@ /* GR_ARCH_BIGENDIAN */ // Nothing to do... diff --git a/vrt/include/vrt/if_context.h b/vrt/include/vrt/if_context.h index e51a7df6..b1d54245 100644 --- a/vrt/include/vrt/if_context.h +++ b/vrt/include/vrt/if_context.h @@ -206,19 +206,31 @@ typedef struct gain_if_cntx_tag { uint32_t gain; } __attribute__((packed)) gain_if_cntx_t; +typedef struct caldiv_if_cntx_tag { + if_context_hdr_t cntx_hdr; + uint64_t lo_freq; + uint32_t lo_locked; + uint64_t cal_freq; + uint32_t cal_locked; + uint32_t cal_enabled; + uint32_t temp; + uint32_t rev; + uint32_t ser; +} __attribute__((packed)) caldiv_if_cntx_t; // FIXME the rest... // ------------------------------------------------------------------------ // All of them concatenated -#define NCONTEXT_PKTS 6 // number of context pkts aggregated here +#define NCONTEXT_PKTS 7 // number of context pkts aggregated here typedef struct all_context_tag { beamformer_if_cntx_t beamformer; gain_if_cntx_t db[4]; // FIXME add Extension Context for board types, revs, serial numbers, temps + caldiv_if_cntx_t caldiv; gps_if_cntx_t gps; // must be last } __attribute__((packed)) all_context_t; -- 2.30.2