GNU Radio Manual and C++ API Reference  3.7.4.1
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 #include <volk/volk_malloc.h>
30 
31 #include <stdlib.h>
32 #include <stdbool.h>
33 
35 
36 typedef struct volk_func_desc
37 {
38  const char **impl_names;
39  const int *impl_deps;
40  const bool *impl_alignment;
41  const size_t n_impls;
43 
44 //! Prints a list of machines available
45 VOLK_API void volk_list_machines(void);
46 
47 //! Returns the name of the machine this instance will use
48 VOLK_API const char* volk_get_machine(void);
49 
50 //! Get the machine alignment in bytes
51 VOLK_API size_t volk_get_alignment(void);
52 
53 /*!
54  * The VOLK_OR_PTR macro is a convenience macro
55  * for checking the alignment of a set of pointers.
56  * Example usage:
57  * volk_is_aligned(VOLK_OR_PTR((VOLK_OR_PTR(p0, p1), p2)))
58  */
59 #define VOLK_OR_PTR(ptr0, ptr1) \
60  (const void *)(((intptr_t)(ptr0)) | ((intptr_t)(ptr1)))
61 
62 /*!
63  * Is the pointer on a machine alignment boundary?
64  *
65  * Note: for performance reasons, this function
66  * is not usable until another volk API call is made
67  * which will perform certain initialization tasks.
68  *
69  * \param ptr the pointer to some memory buffer
70  * \return 1 for alignment boundary, else 0
71  */
72 VOLK_API bool volk_is_aligned(const void *ptr);
73 
74 #for $kern in $kernels
75 
76 //! A function pointer to the dispatcher implementation
77 extern VOLK_API $kern.pname $kern.name;
78 
79 //! A function pointer to the fastest aligned implementation
80 extern VOLK_API $kern.pname $(kern.name)_a;
81 
82 //! A function pointer to the fastest unaligned implementation
83 extern VOLK_API $kern.pname $(kern.name)_u;
84 
85 //! Call into a specific implementation given by name
86 extern VOLK_API void $(kern.name)_manual($kern.arglist_full, const char* impl_name);
87 
88 //! Get description paramaters for this kernel
89 extern VOLK_API volk_func_desc_t $(kern.name)_get_func_desc(void);
90 #end for
91 
93 
94 #endif /*INCLUDED_VOLK_RUNTIME*/
const char ** impl_names
Definition: volk.tmpl.h:38
VOLK_API const char * volk_get_machine(void)
Returns the name of the machine this instance will use.
VOLK_API void volk_list_machines(void)
Prints a list of machines available.
__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:39
#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:86
void kern($kern.arglist_types)
Definition: volk_typedefs.tmpl.h:29
const size_t n_impls
Definition: volk.tmpl.h:41
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:40
Definition: volk.tmpl.h:36