GNU Radio 3.7.1 C++ API
volk.tmpl.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2011-2012 Free Software Foundation, Inc.
00003  *
00004  * This file is part of GNU Radio
00005  *
00006  * GNU Radio is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 3, or (at your option)
00009  * any later version.
00010  *
00011  * GNU Radio is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with GNU Radio; see the file COPYING.  If not, write to
00018  * the Free Software Foundation, Inc., 51 Franklin Street,
00019  * Boston, MA 02110-1301, USA.
00020  */
00021 
00022 #ifndef INCLUDED_VOLK_RUNTIME
00023 #define INCLUDED_VOLK_RUNTIME
00024 
00025 #include <volk/volk_typedefs.h>
00026 #include <volk/volk_config_fixed.h>
00027 #include <volk/volk_common.h>
00028 #include <volk/volk_complex.h>
00029 
00030 #include <stdlib.h>
00031 #include <stdbool.h>
00032 
00033 __VOLK_DECL_BEGIN
00034 
00035 typedef struct volk_func_desc
00036 {
00037     const char **impl_names;
00038     const int *impl_deps;
00039     const bool *impl_alignment;
00040     const size_t n_impls;
00041 } volk_func_desc_t;
00042 
00043 //! Get the machine alignment in bytes
00044 VOLK_API size_t volk_get_alignment(void);
00045 
00046 /*!
00047  * The VOLK_OR_PTR macro is a convenience macro
00048  * for checking the alignment of a set of pointers.
00049  * Example usage:
00050  * volk_is_aligned(VOLK_OR_PTR((VOLK_OR_PTR(p0, p1), p2)))
00051  */
00052 #define VOLK_OR_PTR(ptr0, ptr1) \
00053     (const void *)(((intptr_t)(ptr0)) | ((intptr_t)(ptr1)))
00054 
00055 /*!
00056  * Is the pointer on a machine alignment boundary?
00057  *
00058  * Note: for performance reasons, this function
00059  * is not usable until another volk API call is made
00060  * which will perform certain initialization tasks.
00061  *
00062  * \param ptr the pointer to some memory buffer
00063  * \return 1 for alignment boundary, else 0
00064  */
00065 VOLK_API bool volk_is_aligned(const void *ptr);
00066 
00067 #for $kern in $kernels
00068 
00069 //! A function pointer to the dispatcher implementation
00070 extern VOLK_API $kern.pname $kern.name;
00071 
00072 //! A function pointer to the fastest aligned implementation
00073 extern VOLK_API $kern.pname $(kern.name)_a;
00074 
00075 //! A function pointer to the fastest unaligned implementation
00076 extern VOLK_API $kern.pname $(kern.name)_u;
00077 
00078 //! Call into a specific implementation given by name
00079 extern VOLK_API void $(kern.name)_manual($kern.arglist_full, const char* impl_name);
00080 
00081 //! Get description paramaters for this kernel
00082 extern VOLK_API volk_func_desc_t $(kern.name)_get_func_desc(void);
00083 #end for
00084 
00085 __VOLK_DECL_END
00086 
00087 #endif /*INCLUDED_VOLK_RUNTIME*/