diff options
author | Josh Blum <josh@joshknows.com> | 2010-08-30 16:20:33 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2010-08-30 16:20:33 -0700 |
commit | 051b611bc304b099541706fe41f47ad5e75b7448 (patch) | |
tree | 28e9950f57614942879654bb73086f82fed63c9f /host/include | |
parent | f4115cd23ca27be13f7a80ca7d4e86392ee7b1c4 (diff) | |
parent | 99494305b35adf5c4f89b4888192c723f32d9da2 (diff) | |
download | uhd-051b611bc304b099541706fe41f47ad5e75b7448.tar.gz uhd-051b611bc304b099541706fe41f47ad5e75b7448.tar.bz2 uhd-051b611bc304b099541706fe41f47ad5e75b7448.zip |
Merge branch 'convert_types' into usrp1
Diffstat (limited to 'host/include')
-rw-r--r-- | host/include/uhd/transport/CMakeLists.txt | 1 | ||||
-rw-r--r-- | host/include/uhd/transport/convert_types.hpp | 37 | ||||
-rw-r--r-- | host/include/uhd/transport/convert_types.ipp | 43 |
3 files changed, 81 insertions, 0 deletions
diff --git a/host/include/uhd/transport/CMakeLists.txt b/host/include/uhd/transport/CMakeLists.txt index 0f1cbf2a2..2c84c0724 100644 --- a/host/include/uhd/transport/CMakeLists.txt +++ b/host/include/uhd/transport/CMakeLists.txt @@ -22,6 +22,7 @@ INSTALL(FILES bounded_buffer.hpp bounded_buffer.ipp convert_types.hpp + convert_types.ipp if_addrs.hpp udp_simple.hpp udp_zero_copy.hpp diff --git a/host/include/uhd/transport/convert_types.hpp b/host/include/uhd/transport/convert_types.hpp index a4d999240..dc7fa6c1a 100644 --- a/host/include/uhd/transport/convert_types.hpp +++ b/host/include/uhd/transport/convert_types.hpp @@ -21,6 +21,7 @@ #include <uhd/config.hpp> #include <uhd/types/io_type.hpp> #include <uhd/types/otw_type.hpp> +#include <vector> namespace uhd{ namespace transport{ @@ -40,6 +41,23 @@ UHD_API void convert_io_type_to_otw_type( ); /*! + * Convert IO samples to OWT samples + interleave. + * + * \param io_buffs buffers containing samples + * \param io_type the type of these samples + * \param otw_buff memory to write converted samples + * \param otw_type the type of these samples + * \param nsamps_per_io_buff samples per io_buff + */ +UHD_API void convert_io_type_to_otw_type( + const std::vector<const void *> &io_buffs, + const io_type_t &io_type, + void *otw_buff, + const otw_type_t &otw_type, + size_t nsamps_per_io_buff +); + +/*! * Convert OTW samples to IO samples. * * \param otw_buff memory containing samples @@ -54,6 +72,25 @@ UHD_API void convert_otw_type_to_io_type( size_t num_samps ); +/*! + * Convert OTW samples to IO samples + de-interleave. + * + * \param otw_buff memory containing samples + * \param otw_type the type of these samples + * \param io_buffs buffers to write converted samples + * \param io_type the type of these samples + * \param nsamps_per_io_buff samples per io_buff + */ +UHD_API void convert_otw_type_to_io_type( + const void *otw_buff, + const otw_type_t &otw_type, + std::vector<void *> &io_buffs, + const io_type_t &io_type, + size_t nsamps_per_io_buff +); + }} //namespace +#include <uhd/transport/convert_types.ipp> + #endif /* INCLUDED_UHD_TRANSPORT_CONVERT_TYPES_HPP */ diff --git a/host/include/uhd/transport/convert_types.ipp b/host/include/uhd/transport/convert_types.ipp new file mode 100644 index 000000000..914ca6f17 --- /dev/null +++ b/host/include/uhd/transport/convert_types.ipp @@ -0,0 +1,43 @@ +// +// Copyright 2010 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 +// 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_UHD_TRANSPORT_CONVERT_TYPES_IPP +#define INCLUDED_UHD_TRANSPORT_CONVERT_TYPES_IPP + +UHD_INLINE void uhd::transport::convert_io_type_to_otw_type( + const void *io_buff, const io_type_t &io_type, + void *otw_buff, const otw_type_t &otw_type, + size_t num_samps +){ + std::vector<const void *> buffs(1, io_buff); + return uhd::transport::convert_io_type_to_otw_type( + buffs, io_type, otw_buff, otw_type, num_samps + ); +} + +UHD_INLINE void uhd::transport::convert_otw_type_to_io_type( + const void *otw_buff, const otw_type_t &otw_type, + void *io_buff, const io_type_t &io_type, + size_t num_samps +){ + std::vector<void *> buffs(1, io_buff); + return uhd::transport::convert_otw_type_to_io_type( + otw_buff, otw_type, buffs, io_type, num_samps + ); +} + +#endif /* INCLUDED_UHD_TRANSPORT_CONVERT_TYPES_IPP */ |