diff options
Diffstat (limited to 'vrt/include')
-rw-r--r-- | vrt/include/Makefile.am | 23 | ||||
-rw-r--r-- | vrt/include/vrt/Makefile.am | 30 | ||||
-rw-r--r-- | vrt/include/vrt/bits.h | 92 | ||||
-rw-r--r-- | vrt/include/vrt/copiers.h | 49 | ||||
-rw-r--r-- | vrt/include/vrt/expanded_header.h | 112 | ||||
-rw-r--r-- | vrt/include/vrt/rx.h | 93 | ||||
-rw-r--r-- | vrt/include/vrt/rx_packet_handler.h | 62 | ||||
-rw-r--r-- | vrt/include/vrt/types.h | 138 |
8 files changed, 0 insertions, 599 deletions
diff --git a/vrt/include/Makefile.am b/vrt/include/Makefile.am deleted file mode 100644 index 3ce6a8f32..000000000 --- a/vrt/include/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright 2009 Free Software Foundation, Inc. -# -# This file is part of GNU Radio -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# - -include $(top_srcdir)/Makefile.common - -SUBDIRS = vrt diff --git a/vrt/include/vrt/Makefile.am b/vrt/include/vrt/Makefile.am deleted file mode 100644 index 183eaf9ce..000000000 --- a/vrt/include/vrt/Makefile.am +++ /dev/null @@ -1,30 +0,0 @@ -# -# Copyright 2008,2009 Free Software Foundation, Inc. -# -# 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 -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# - -include $(top_srcdir)/Makefile.common - -INCLUDES = - -vrtincludedir = $(includedir)/vrt - -vrtinclude_HEADERS = \ - bits.h \ - copiers.h \ - expanded_header.h \ - rx.h \ - rx_packet_handler.h \ - types.h diff --git a/vrt/include/vrt/bits.h b/vrt/include/vrt/bits.h deleted file mode 100644 index 54eeec7b4..000000000 --- a/vrt/include/vrt/bits.h +++ /dev/null @@ -1,92 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ -#ifndef INCLUDED_VRT_BITS_H -#define INCLUDED_VRT_BITS_H - -#include <stdint.h> - - -/* VRT Header bits */ - -#define VRTH_PT_MASK (0xf << 28) -#define VRTH_PT_IF_DATA_NO_SID (0x0 << 28) // IF-Data, no stream id -#define VRTH_PT_IF_DATA_WITH_SID (0x1 << 28) // IF-Data, w/ stream id -#define VRTH_PT_EXT_DATA_NO_SID (0x2 << 28) -#define VRTH_PT_EXT_DATA_WITH_SID (0x3 << 28) -#define VRTH_PT_IF_CONTEXT (0x4 << 28) -#define VRTH_PT_EXT_CONTEXT (0x5 << 28) - -#define VRTH_HAS_CLASSID (1 << 27) -#define VRTH_HAS_TRAILER (1 << 26) // Data pkts only -#define VRTH_START_OF_BURST (1 << 25) // Data (Tx) pkts only -#define VRTH_END_OF_BURST (1 << 24) // Data (Tx) pkts only -#define VRTH_TSM (1 << 24) // Context pkts only - -#define VRTH_TSI_MASK (0x3 << 22) -#define VRTH_TSI_NONE (0x0 << 22) -#define VRTH_TSI_UTC (0x1 << 22) -#define VRTH_TSI_GPS (0x2 << 22) -#define VRTH_TSI_OTHER (0x3 << 22) - -#define VRTH_TSF_MASK (0x3 << 20) -#define VRTH_TSF_NONE (0x0 << 20) -#define VRTH_TSF_SAMPLE_CNT (0x1 << 20) -#define VRTH_TSF_REAL_TIME_PS (0x2 << 20) -#define VRTH_TSF_FREE_RUNNING (0x3 << 20) - -#define VRTH_PKT_CNT_SHIFT 16 -#define VRTH_PKT_CNT_MASK (0xf << 16) - -#define VRTH_PKT_SIZE_MASK 0xffff - - -static inline int -vrth_pkt_cnt(uint32_t h) -{ - return (h & VRTH_PKT_CNT_MASK) >> 16; -} - -static inline int -vrth_pkt_size(uint32_t h) -{ - return h & VRTH_PKT_SIZE_MASK; -} - -/* - * Trailer bits - */ -#define TR_E (1 << 8) - -#define TR_ENABLE(x) ((x) << 20) -#define TR_STATE(x) ((x) << 8) - -// Use these with TR_ENABLE and TR_STATE -#define TR_CAL_TIME (1 << 11) -#define TR_VALID_DATA (1 << 10) -#define TR_REF_LOCK (1 << 9) -#define TR_AGC (1 << 8) -#define TR_DETECTED_SIG (1 << 7) -#define TR_SPECTRAL_INVERSION (1 << 6) -#define TR_OVER_RANGE (1 << 5) -#define TR_SAMPLE_LOSS (1 << 4) -#define TR_USER_3 (1 << 3) -#define TR_USER_2 (1 << 2) -#define TR_USER_1 (1 << 1) -#define TR_USER_0 (1 << 0) - -#endif /* INCLUDED_VRT_BITS_H */ diff --git a/vrt/include/vrt/copiers.h b/vrt/include/vrt/copiers.h deleted file mode 100644 index 990538c42..000000000 --- a/vrt/include/vrt/copiers.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef INCLUDED_VRT_COPIERS_H -#define INCLUDED_VRT_COPIERS_H - -#include <stdint.h> -#include <stddef.h> -#include <complex> - -namespace vrt { - - /*! - * \brief Copy and convert from net format to host format - */ - void - copy_net_16sc_to_host_16sc(size_t nitems, - const uint32_t *items, - std::complex<int16_t> *host_items); - - - /*! - * \brief Copy and convert from net format to host format mapping [-32768, 32767] -> [1.0, +1.0) - */ - void - copy_net_16sc_to_host_32fc(size_t nitems, - const uint32_t *items, - std::complex<float> *host_items); -}; - -#endif /* INCLUDED_VRT_COPIERS_H */ diff --git a/vrt/include/vrt/expanded_header.h b/vrt/include/vrt/expanded_header.h deleted file mode 100644 index b3333a72e..000000000 --- a/vrt/include/vrt/expanded_header.h +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_VRT_EXPANDED_HEADER_H -#define INCLUDED_VRT_EXPANDED_HEADER_H - -#include <stdint.h> -#include <stddef.h> -#include <vrt/bits.h> - -namespace vrt { - - static const size_t HEADER_MAX_N32_BIT_WORDS = 7; - static const size_t TRAILER_MAX_N32_BIT_WORDS = 1; - - /*! - * \brief All headers and trailer for VRT IF-Data, Extension-Data, - * IF-Context and Extension-Context packets. - * - * There are fields allocated for each possible header. Their content may - * or may not be valid. Check the header field to confirm their validity. - * All values are in host-endian format. - */ - struct expanded_header { - uint32_t header; // first word of all packets - uint32_t stream_id; // optional stream identifier - uint64_t class_id; // optional class identifier - uint32_t integer_secs; // optional integer seconds timestamp - uint64_t fractional_secs; // optional fractional seconds timestamp - uint32_t trailer; // optional trailer (only possible in data pkts) - - expanded_header() - : header(0) /*, stream_id(0), class_id(0), - integer_secs(0), fractional_secs(0), trailer(0)*/ {} - - - int pkt_type() const { - return (header & VRTH_PT_MASK) >> 28; - } - - int pkt_cnt() const { return vrth_pkt_cnt(header); } - size_t pkt_size() const { return vrth_pkt_size(header); } - - - // packet type predicates - bool if_data_p() const { return s_if_data[pkt_type()]; } - bool ext_data_p() const { return s_ext_data[pkt_type()]; } - bool if_context_p() const { return (header & VRTH_PT_MASK) == VRTH_PT_IF_CONTEXT; } - bool ext_context_p() const { return (header & VRTH_PT_MASK) == VRTH_PT_EXT_CONTEXT; } - - bool data_p() const { return s_data[pkt_type()]; } // if_data_p() || ext_data_p() - bool context_p() const { return s_context[pkt_type()]; } // if_context_p() || ext_context_p() - - // optional info predicates - bool stream_id_p() const { return s_stream_id[pkt_type()]; } - bool class_id_p() const { return (header & VRTH_HAS_CLASSID) != 0; } - bool integer_secs_p() const { return (header & VRTH_TSI_MASK) != 0; } - bool fractional_secs_p() const { return (header & VRTH_TSF_MASK) != 0; } - bool trailer_p() const { return (header & VRTH_HAS_TRAILER) != 0 && data_p(); } - - - /*! - * \brief unparse expanded header, fill-in the words of a vrt packet header and trailer - * This method is only intended to fill the buffers with header and trailer information. - * The actual handling of the separate header, payload, trailer buffers is up to the caller. - */ - static void unparse(const expanded_header *hdr, // in - size_t n32_bit_words_payload, // in - uint32_t *header, // out - size_t *n32_bit_words_header, // out - uint32_t *trailer, // out - size_t *n32_bit_words_trailer);// out - - /*! - * \brief parse packet, fill-in expanded header, start of payload and len of payload - */ - static bool parse(const uint32_t *packet, // in - size_t n32_bit_words_packet, // in - expanded_header *hdr, // out - const uint32_t **payload, // out - size_t *n32_bit_words_payload); // out - - private: - static unsigned char s_if_data[16]; - static unsigned char s_ext_data[16]; - static unsigned char s_data[16]; - static unsigned char s_context[16]; - static unsigned char s_stream_id[16]; - - }; - -}; // vrt - - -#endif /* INCLUDED_VRT_EXPANDED_HEADER_H */ diff --git a/vrt/include/vrt/rx.h b/vrt/include/vrt/rx.h deleted file mode 100644 index ff3ce85fb..000000000 --- a/vrt/include/vrt/rx.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_VRT_RX_H -#define INCLUDED_VRT_RX_H - -#include <boost/shared_ptr.hpp> -#include <boost/utility.hpp> -#include <vrt/rx_packet_handler.h> - -namespace vrt { - - class socket_rx_buffer; - - /*! - * Relatively low-level interface to receive VRT packets over a datagram socket. - * - * (We'll refactor this if/when we use a non-UDP transport.) - * No VRT control issues are addressed here. - */ - class rx : boost::noncopyable - { - int d_socket_fd; - socket_rx_buffer *d_srb; - - public: - /*! - * Shared pointer to this class - */ - typedef boost::shared_ptr<rx> sptr; - - /*! - * \brief Static function to return an instance of rx as a shared pointer. - * - * \param socket_fd file descriptor that data grams will be received from. - * It is assumed that some higher-level control software - * opened the appropriate UDP socket for us. This object - * assumes management of the socket's lifetime. The - * socket will be closed when our destructor fires. - * - * \param rx_bufsize is a hint as to the number of bytes of memory - * to allocate for received ethernet frames (0 -> reasonable default) - */ - static sptr make(int socket_fd, size_t rx_bufsize = 0); - - /*! - * \param socket_fd file descriptor that data grams will be received from. - * It is assumed that some higher-level control software - * opened the appropriate UDP socket for us. This object - * assumes management of the socket's lifetime. The - * socket will be closed when our destructor fires. - * - * \param rx_bufsize is a hint as to the number of bytes of memory - * to allocate for received ethernet frames (0 -> reasonable default) - */ - rx(int socket_fd, size_t rx_bufsize = 0); - ~rx(); - - /*! - * \brief Receive packets from the given socket file descriptor. - * - * \p handler will be invoked for all available packets. - * Unless \p dont_wait is true, this function blocks until at - * least one packet has been processed. - */ - bool rx_packets(rx_packet_handler *handler, bool dont_wait = false); - - /* - * \returns the socket_fd. Useful for select or poll. - */ - int socket_fd() const { return d_socket_fd; } - }; - -} - -#endif /* INCLUDED_VRT_RX_H */ diff --git a/vrt/include/vrt/rx_packet_handler.h b/vrt/include/vrt/rx_packet_handler.h deleted file mode 100644 index ad3407813..000000000 --- a/vrt/include/vrt/rx_packet_handler.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * This file is part of GNU Radio - * - * GNU Radio is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3, or (at your option) - * any later version. - * - * GNU Radio is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef INCLUDED_VRT_RX_PACKET_HANDLER_H -#define INCLUDED_VRT_RX_PACKET_HANDLER_H - -#include <vrt/expanded_header.h> -#include <stddef.h> - -namespace vrt { - - /*! - * \brief Abstract function object called to handle received VRT packets. - * - * An object derived from this class is passed to vrt_rx_udp::rx_packets - * to process the received packets. - */ - class rx_packet_handler { - public: - virtual ~rx_packet_handler(); - - /*! - * \param payload points to the first 32-bit word of the payload field. - * \param n32_bit_words is the number of 32-bit words in the payload field. - * \param hdr is the expanded version of the mandatory and optional header fields (& trailer). - * - * \p payload points to the raw payload section of the packet received off - * the wire. The data is network-endian (aka big-endian) 32-bit integers. - * - * This is the general purpose, low level interface and relies on other - * functions to handle all required endian-swapping and format conversion - * of the payload. \sa FIXME. - * - * \returns true if the object wants to be called again with new data; - * false if no additional data is wanted. - */ - virtual bool operator()(const uint32_t *payload, - size_t n32_bit_words, - const expanded_header *hdr); - }; - -}; // vrt - - -#endif /* INCLUDED_VRT_RX_PACKET_HANDLER_H */ diff --git a/vrt/include/vrt/types.h b/vrt/include/vrt/types.h deleted file mode 100644 index edfa4ec37..000000000 --- a/vrt/include/vrt/types.h +++ /dev/null @@ -1,138 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2009 Free Software Foundation, Inc. - * - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ -#ifndef INCLUDED_VRT_TYPES_H -#define INCLUDED_VRT_TYPES_H - -#include <stdint.h> - -/* macros for dealing with fixed point numbers */ -#define _FXPT_C(_type, _x, _rp) ((_type)((_x)*(1ll << _rp))) -#define _FXPT_TO_INT(_x, _one) (((_x) + ((_one)/2))/(_one)) -#define _FXPT_TO_DOUBLE(_x, _one) ((double)(_x) * (1.0/(_one))) - -/*********************************************************************** - * The VRT Altitude Type (meters) - **********************************************************************/ -typedef int32_t vrt_altitude_t; -#define VRT_ALTITUDE_RP 5 -#define VRT_ALTITUDE_C(_x) _FXPT_C(vrt_altitude_t, _x, VRT_ALTITUDE_RP) - -static inline vrt_altitude_t -double_to_vrt_altitude(double num){ - return VRT_ALTITUDE_C(num); -} - -static inline int32_t -vrt_altitude_round_to_int(vrt_altitude_t fx){ - return _FXPT_TO_INT(fx, VRT_ALTITUDE_C(1)); -} - -static inline double -vrt_altitude_to_double(vrt_altitude_t fx){ - return _FXPT_TO_DOUBLE(fx, VRT_ALTITUDE_C(1)); -} - -/*********************************************************************** - * The VRT Geolocation Angle Type (degrees) - **********************************************************************/ -typedef int32_t vrt_geo_angle_t; -#define VRT_GEO_ANGLE_RP 22 -#define VRT_GEO_ANGLE_C(_x) _FXPT_C(vrt_geo_angle_t, _x, VRT_GEO_ANGLE_RP) - -static inline vrt_geo_angle_t -double_to_vrt_geo_angle(double num){ - return VRT_GEO_ANGLE_C(num); -} - -static inline int16_t -vrt_geo_angle_round_to_int(vrt_geo_angle_t fx){ - return _FXPT_TO_INT(fx, VRT_GEO_ANGLE_C(1)); -} - -static inline double -vrt_geo_angle_to_double(vrt_geo_angle_t fx){ - return _FXPT_TO_DOUBLE(fx, VRT_GEO_ANGLE_C(1)); -} - -/*********************************************************************** - * The VRT Frequency Type (Hz) - **********************************************************************/ -typedef int64_t vrt_freq_t; -#define VRT_FREQ_RP 20 -#define VRT_FREQ_C(_x) _FXPT_C(vrt_freq_t, _x, VRT_FREQ_RP) - -static inline vrt_freq_t -double_to_vrt_freq(double num){ - return VRT_FREQ_C(num); -} - -static inline int64_t -vrt_freq_round_to_int(vrt_freq_t fx){ - return _FXPT_TO_INT(fx, VRT_FREQ_C(1)); -} - -static inline double -vrt_freq_to_double(vrt_freq_t fx){ - return _FXPT_TO_DOUBLE(fx, VRT_FREQ_C(1)); -} - -/*********************************************************************** - * The VRT Gain Type (dB) - **********************************************************************/ -typedef int16_t vrt_gain_t; -#define VRT_GAIN_RP 7 -#define VRT_GAIN_C(_x) _FXPT_C(vrt_gain_t, _x, VRT_GAIN_RP) - -static inline vrt_gain_t -double_to_vrt_gain(double num){ - return VRT_GAIN_C(num); -} - -static inline int16_t -vrt_gain_round_to_int(vrt_gain_t fx){ - return _FXPT_TO_INT(fx, VRT_GAIN_C(1)); -} - -static inline double -vrt_gain_to_double(vrt_gain_t fx){ - return _FXPT_TO_DOUBLE(fx, VRT_GAIN_C(1)); -} - -/*********************************************************************** - * The VRT Temperature Type (Celcius) - **********************************************************************/ -typedef int16_t vrt_temp_t; -#define VRT_TEMP_RP 6 -#define VRT_TEMP_C(_x) _FXPT_C(vrt_temp_t, _x, VRT_TEMP_RP) - -static inline vrt_temp_t -double_to_vrt_temp(double num){ - return VRT_TEMP_C(num); -} - -static inline int16_t -vrt_temp_round_to_int(vrt_temp_t fx){ - return _FXPT_TO_INT(fx, VRT_TEMP_C(1)); -} - -static inline double -vrt_temp_to_double(vrt_temp_t fx){ - return _FXPT_TO_DOUBLE(fx, VRT_TEMP_C(1)); -} - -#endif /* INCLUDED_VRT_TYPES_H */ |