GNU Radio 3.7.2 C++ API
volk.tmpl.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2012 Free Software Foundation, Inc.
3  *
4  * This file is part of GNU Radio
5  *
6  * GNU Radio is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3, or (at your option)
9  * any later version.
10  *
11  * GNU Radio is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with GNU Radio; see the file COPYING. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 #ifndef INCLUDED_VOLK_RUNTIME
23 #define INCLUDED_VOLK_RUNTIME
24 
25 #include <volk/volk_typedefs.h>
26 #include <volk/volk_config_fixed.h>
27 #include <volk/volk_common.h>
28 #include <volk/volk_complex.h>
29 
30 #include <stdlib.h>
31 #include <stdbool.h>
32 
34 
35 typedef struct volk_func_desc
36 {
37  const char **impl_names;
38  const int *impl_deps;
39  const bool *impl_alignment;
40  const size_t n_impls;
42 
43 //! Get the machine alignment in bytes
44 VOLK_API size_t volk_get_alignment(void);
45 
46 /*!
47  * The VOLK_OR_PTR macro is a convenience macro
48  * for checking the alignment of a set of pointers.
49  * Example usage:
50  * volk_is_aligned(VOLK_OR_PTR((VOLK_OR_PTR(p0, p1), p2)))
51  */
52 #define VOLK_OR_PTR(ptr0, ptr1) \
53  (const void *)(((intptr_t)(ptr0)) | ((intptr_t)(ptr1)))
54 
55 /*!
56  * Is the pointer on a machine alignment boundary?
57  *
58  * Note: for performance reasons, this function
59  * is not usable until another volk API call is made
60  * which will perform certain initialization tasks.
61  *
62  * \param ptr the pointer to some memory buffer
63  * \return 1 for alignment boundary, else 0
64  */
65 VOLK_API bool volk_is_aligned(const void *ptr);
66 
67 #for $kern in $kernels
68 
69 //! A function pointer to the dispatcher implementation
70 extern VOLK_API $kern.pname $kern.name;
71 
72 //! A function pointer to the fastest aligned implementation
73 extern VOLK_API $kern.pname $(kern.name)_a;
74 
75 //! A function pointer to the fastest unaligned implementation
76 extern VOLK_API $kern.pname $(kern.name)_u;
77 
78 //! Call into a specific implementation given by name
79 extern VOLK_API void $(kern.name)_manual($kern.arglist_full, const char* impl_name);
80 
81 //! Get description paramaters for this kernel
82 extern VOLK_API volk_func_desc_t $(kern.name)_get_func_desc(void);
83 #end for
84 
86 
87 #endif /*INCLUDED_VOLK_RUNTIME*/
const char ** impl_names
Definition: volk.tmpl.h:37
__VOLK_DECL_BEGIN struct volk_func_desc volk_func_desc_t
#define __VOLK_DECL_BEGIN
Definition: volk_common.h:51
const int * impl_deps
Definition: volk.tmpl.h:38
#define __VOLK_DECL_END
Definition: volk_common.h:52
#define VOLK_API
Definition: volk_common.h:62
VOLK_API const char * impl_name
Definition: volk.tmpl.h:79
void kern($kern.arglist_types)
Definition: volk_typedefs.tmpl.h:29
const size_t n_impls
Definition: volk.tmpl.h:40
VOLK_API size_t volk_get_alignment(void)
Get the machine alignment in bytes.
VOLK_API bool volk_is_aligned(const void *ptr)
const bool * impl_alignment
Definition: volk.tmpl.h:39
Definition: volk.tmpl.h:35