root / gnuradio-core / src / lib / filter / gr_fir_sysconfig_armv7_a.cc @ 3ac56587
History | View | Annotate | Download (7.7 kB)
| 1 | /* -*- c++ -*- */
|
|---|---|
| 2 | /*
|
| 3 | * Copyright 2002,2008,2009 Free Software Foundation, Inc. |
| 4 | * |
| 5 | * This file is part of GNU Radio |
| 6 | * |
| 7 | * GNU Radio is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 3, or (at your option) |
| 10 | * any later version. |
| 11 | * |
| 12 | * GNU Radio is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with GNU Radio; see the file COPYING. If not, write to |
| 19 | * the Free Software Foundation, Inc., 51 Franklin Street, |
| 20 | * Boston, MA 02110-1301, USA. |
| 21 | */ |
| 22 | #ifdef HAVE_CONFIG_H
|
| 23 | #include <config.h> |
| 24 | #endif
|
| 25 | |
| 26 | #include <gr_fir_sysconfig_armv7_a.h> |
| 27 | #include <gr_cpu.h> |
| 28 | |
| 29 | #include <gr_fir_ccf.h> |
| 30 | #include <gr_fir_ccf_generic.h> |
| 31 | #include <gr_fir_fcc.h> |
| 32 | #include <gr_fir_fcc_generic.h> |
| 33 | #include <gr_fir_fff.h> |
| 34 | #include <gr_fir_fff_generic.h> |
| 35 | #include <gr_fir_fff_armv7_a.h> |
| 36 | #include <gr_fir_fsf.h> |
| 37 | #include <gr_fir_fsf_generic.h> |
| 38 | #include <gr_fir_ccc.h> |
| 39 | #include <gr_fir_ccc_generic.h> |
| 40 | #include <gr_fir_scc.h> |
| 41 | #include <gr_fir_scc_generic.h> |
| 42 | |
| 43 | #include <iostream> |
| 44 | using std::cerr;
|
| 45 | |
| 46 | ///\todo Remove commented out code for altivec and replace with NEON versions.
|
| 47 | |
| 48 | /*
|
| 49 | * ---------------------------------------------------------------- |
| 50 | * static functions that serve as constructors... |
| 51 | * ---------------------------------------------------------------- |
| 52 | */ |
| 53 | |
| 54 | #if 0
|
| 55 | static gr_fir_ccf * |
| 56 | make_gr_fir_ccf_altivec(const std::vector<float> &taps) |
| 57 | {
|
| 58 | return new gr_fir_ccf_altivec(taps); |
| 59 | } |
| 60 | |
| 61 | static gr_fir_fcc * |
| 62 | make_gr_fir_fcc_altivec(const std::vector<gr_complex> &taps) |
| 63 | {
|
| 64 | return new gr_fir_fcc_altivec(taps); |
| 65 | } |
| 66 | |
| 67 | static gr_fir_ccc * |
| 68 | make_gr_fir_ccc_altivec (const std::vector<gr_complex> &taps) |
| 69 | {
|
| 70 | return new gr_fir_ccc_altivec (taps); |
| 71 | } |
| 72 | #endif |
| 73 | |
| 74 | static gr_fir_fff *
|
| 75 | make_gr_fir_fff_armv7_a (const std::vector<float> &taps) |
| 76 | {
|
| 77 | return new gr_fir_fff_armv7_a (taps); |
| 78 | } |
| 79 | |
| 80 | #if 0
|
| 81 | static gr_fir_fsf * |
| 82 | make_gr_fir_fsf_altivec (const std::vector<float> &taps) |
| 83 | {
|
| 84 | return new gr_fir_fsf_altivec (taps); |
| 85 | } |
| 86 | |
| 87 | static gr_fir_scc * |
| 88 | make_gr_fir_scc_altivec(const std::vector<gr_complex> &taps) |
| 89 | {
|
| 90 | return new gr_fir_scc_altivec(taps); |
| 91 | } |
| 92 | #endif |
| 93 | |
| 94 | /*
|
| 95 | * ---------------------------------------------------------------- |
| 96 | * Return instances of the fastest arm versions of these classes. |
| 97 | * |
| 98 | * check CPUID, if has armv7-a, return armv7-a version, |
| 99 | * else return generic version. This will break |
| 100 | * when someone makes an armv7-a without a NEON |
| 101 | * coprocessor. |
| 102 | * ---------------------------------------------------------------- |
| 103 | */ |
| 104 | |
| 105 | gr_fir_ccf * |
| 106 | gr_fir_sysconfig_armv7_a::create_gr_fir_ccf (const std::vector<float> &taps) |
| 107 | {
|
| 108 | static bool first = true; |
| 109 | |
| 110 | #if 0
|
| 111 | if (gr_cpu::has_altivec ()){
|
| 112 | if (first){
|
| 113 | cerr << ">>> gr_fir_ccf: using altivec\n"; |
| 114 | first = false; |
| 115 | } |
| 116 | return make_gr_fir_ccf_altivec (taps); |
| 117 | } |
| 118 | #endif |
| 119 | |
| 120 | if (0 && first){ |
| 121 | cerr << ">>> gr_fir_ccf: handing off to parent class\n";
|
| 122 | first = false;
|
| 123 | } |
| 124 | return gr_fir_sysconfig_generic::create_gr_fir_ccf (taps);
|
| 125 | } |
| 126 | |
| 127 | gr_fir_fcc * |
| 128 | gr_fir_sysconfig_armv7_a::create_gr_fir_fcc (const std::vector<gr_complex> &taps)
|
| 129 | {
|
| 130 | static bool first = true; |
| 131 | |
| 132 | #if 0
|
| 133 | if (gr_cpu::has_altivec ()){
|
| 134 | if (first){
|
| 135 | cerr << ">>> gr_fir_fcc: using altivec\n"; |
| 136 | first = false; |
| 137 | } |
| 138 | return make_gr_fir_fcc_altivec (taps); |
| 139 | } |
| 140 | #endif |
| 141 | |
| 142 | if (0 && first){ |
| 143 | cerr << ">>> gr_fir_fcc: handing off to parent class\n";
|
| 144 | first = false;
|
| 145 | } |
| 146 | return gr_fir_sysconfig_generic::create_gr_fir_fcc (taps);
|
| 147 | } |
| 148 | |
| 149 | gr_fir_ccc * |
| 150 | gr_fir_sysconfig_armv7_a::create_gr_fir_ccc (const std::vector<gr_complex> &taps)
|
| 151 | {
|
| 152 | static bool first = true; |
| 153 | |
| 154 | #if 0
|
| 155 | if (gr_cpu::has_altivec ()){
|
| 156 | if (first){
|
| 157 | cerr << ">>> gr_fir_ccc: using altivec\n"; |
| 158 | first = false; |
| 159 | } |
| 160 | return make_gr_fir_ccc_altivec (taps); |
| 161 | } |
| 162 | #endif |
| 163 | |
| 164 | if (0 && first){ |
| 165 | cerr << ">>> gr_fir_ccc: handing off to parent class\n";
|
| 166 | first = false;
|
| 167 | } |
| 168 | return gr_fir_sysconfig_generic::create_gr_fir_ccc (taps);
|
| 169 | } |
| 170 | |
| 171 | gr_fir_fff * |
| 172 | gr_fir_sysconfig_armv7_a::create_gr_fir_fff (const std::vector<float> &taps) |
| 173 | {
|
| 174 | static bool first = true; |
| 175 | |
| 176 | if (gr_cpu::has_armv7_a ()){
|
| 177 | if (first){
|
| 178 | cerr << ">>> gr_fir_fff: using armv7_a\n";
|
| 179 | first = false;
|
| 180 | } |
| 181 | return make_gr_fir_fff_armv7_a (taps);
|
| 182 | } |
| 183 | |
| 184 | if (0 && first){ |
| 185 | cerr << ">>> gr_fir_fff: handing off to parent class\n";
|
| 186 | first = false;
|
| 187 | } |
| 188 | return gr_fir_sysconfig_generic::create_gr_fir_fff (taps);
|
| 189 | } |
| 190 | |
| 191 | gr_fir_fsf * |
| 192 | gr_fir_sysconfig_armv7_a::create_gr_fir_fsf (const std::vector<float> &taps) |
| 193 | {
|
| 194 | static bool first = true; |
| 195 | |
| 196 | #if 0
|
| 197 | if (gr_cpu::has_altivec ()){
|
| 198 | if (first){
|
| 199 | cerr << ">>> gr_fir_fsf: using altivec\n"; |
| 200 | first = false; |
| 201 | } |
| 202 | return make_gr_fir_fsf_altivec (taps); |
| 203 | } |
| 204 | #endif |
| 205 | |
| 206 | if (0 && first){ |
| 207 | cerr << ">>> gr_fir_fsf: handing off to parent class\n";
|
| 208 | first = false;
|
| 209 | } |
| 210 | return gr_fir_sysconfig_generic::create_gr_fir_fsf (taps);
|
| 211 | } |
| 212 | |
| 213 | |
| 214 | gr_fir_scc * |
| 215 | gr_fir_sysconfig_armv7_a::create_gr_fir_scc (const std::vector<gr_complex> &taps)
|
| 216 | {
|
| 217 | static bool first = true; |
| 218 | |
| 219 | #if 0
|
| 220 | if (gr_cpu::has_altivec ()){
|
| 221 | if (first){
|
| 222 | cerr << ">>> gr_fir_scc: using altivec\n"; |
| 223 | first = false; |
| 224 | } |
| 225 | return make_gr_fir_scc_altivec (taps); |
| 226 | } |
| 227 | #endif |
| 228 | |
| 229 | if (0 && first){ |
| 230 | cerr << ">>> gr_fir_scc: handing off to parent class\n";
|
| 231 | first = false;
|
| 232 | } |
| 233 | return gr_fir_sysconfig_generic::create_gr_fir_scc (taps);
|
| 234 | } |
| 235 | |
| 236 | /*
|
| 237 | * ---------------------------------------------------------------- |
| 238 | * Return info about available implementations |
| 239 | * ---------------------------------------------------------------- |
| 240 | */ |
| 241 | |
| 242 | void
|
| 243 | gr_fir_sysconfig_armv7_a::get_gr_fir_ccf_info (std::vector<gr_fir_ccf_info> *info) |
| 244 | {
|
| 245 | // invoke parent..
|
| 246 | gr_fir_sysconfig_generic::get_gr_fir_ccf_info (info); |
| 247 | |
| 248 | #if 0
|
| 249 | // add our stuff... |
| 250 | gr_fir_ccf_info t; |
| 251 | if (gr_cpu::has_altivec ()){
|
| 252 | t.name = "altivec"; |
| 253 | t.create = make_gr_fir_ccf_altivec; |
| 254 | (*info).push_back (t); |
| 255 | } |
| 256 | #endif |
| 257 | } |
| 258 | |
| 259 | void
|
| 260 | gr_fir_sysconfig_armv7_a::get_gr_fir_fcc_info (std::vector<gr_fir_fcc_info> *info) |
| 261 | {
|
| 262 | // invoke parent..
|
| 263 | gr_fir_sysconfig_generic::get_gr_fir_fcc_info (info); |
| 264 | |
| 265 | #if 0
|
| 266 | // add our stuff... |
| 267 | gr_fir_fcc_info t; |
| 268 | if (gr_cpu::has_altivec ()){
|
| 269 | t.name = "altivec"; |
| 270 | t.create = make_gr_fir_fcc_altivec; |
| 271 | (*info).push_back (t); |
| 272 | } |
| 273 | #endif |
| 274 | } |
| 275 | |
| 276 | void
|
| 277 | gr_fir_sysconfig_armv7_a::get_gr_fir_ccc_info (std::vector<gr_fir_ccc_info> *info) |
| 278 | {
|
| 279 | // invoke parent..
|
| 280 | gr_fir_sysconfig_generic::get_gr_fir_ccc_info (info); |
| 281 | |
| 282 | #if 0
|
| 283 | // add our stuff... |
| 284 | gr_fir_ccc_info t; |
| 285 | if (gr_cpu::has_altivec ()){
|
| 286 | t.name = "altivec"; |
| 287 | t.create = make_gr_fir_ccc_altivec; |
| 288 | (*info).push_back (t); |
| 289 | } |
| 290 | #endif |
| 291 | } |
| 292 | |
| 293 | void
|
| 294 | gr_fir_sysconfig_armv7_a::get_gr_fir_fff_info (std::vector<gr_fir_fff_info> *info) |
| 295 | {
|
| 296 | // invoke parent..
|
| 297 | gr_fir_sysconfig_generic::get_gr_fir_fff_info (info); |
| 298 | |
| 299 | // add our stuff...
|
| 300 | gr_fir_fff_info t; |
| 301 | if (gr_cpu::has_armv7_a ()){
|
| 302 | t.name = "armv7_a";
|
| 303 | t.create = make_gr_fir_fff_armv7_a; |
| 304 | (*info).push_back (t); |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | void
|
| 309 | gr_fir_sysconfig_armv7_a::get_gr_fir_fsf_info (std::vector<gr_fir_fsf_info> *info) |
| 310 | {
|
| 311 | // invoke parent..
|
| 312 | gr_fir_sysconfig_generic::get_gr_fir_fsf_info (info); |
| 313 | |
| 314 | #if 0
|
| 315 | // add our stuff... |
| 316 | gr_fir_fsf_info t; |
| 317 | if (gr_cpu::has_altivec ()){
|
| 318 | t.name = "altivec"; |
| 319 | t.create = make_gr_fir_fsf_altivec; |
| 320 | (*info).push_back (t); |
| 321 | } |
| 322 | #endif |
| 323 | } |
| 324 | |
| 325 | void
|
| 326 | gr_fir_sysconfig_armv7_a::get_gr_fir_scc_info (std::vector<gr_fir_scc_info> *info) |
| 327 | {
|
| 328 | // invoke parent..
|
| 329 | gr_fir_sysconfig_generic::get_gr_fir_scc_info (info); |
| 330 | |
| 331 | #if 0
|
| 332 | // add our stuff... |
| 333 | gr_fir_scc_info t; |
| 334 | if (gr_cpu::has_altivec ()){
|
| 335 | t.name = "altivec"; |
| 336 | t.create = make_gr_fir_scc_altivec; |
| 337 | (*info).push_back (t); |
| 338 | } |
| 339 | #endif |
| 340 | } |