3 * Copyright 2008 Free Software Foundation, Inc.
5 * This file is part of GNU Radio
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)
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.
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include <gc_declare_proc.h>
27 #define _UNUSED __attribute__((unused))
29 // FIXME move these out of here; only for QA usage
32 qa_nop(const gc_job_direct_args_t *input _UNUSED,
33 gc_job_direct_args_t *output _UNUSED,
34 const gc_job_ea_args_t *eaa _UNUSED)
38 GC_DECLARE_PROC(qa_nop, "qa_nop");
41 sum_shorts(short *p, int nshorts)
44 for (int i = 0; i < nshorts; i++)
51 qa_sum_shorts(const gc_job_direct_args_t *input _UNUSED,
52 gc_job_direct_args_t *output,
53 const gc_job_ea_args_t *eaa)
55 for (unsigned int i = 0; i < eaa->nargs; i++){
56 short *p = eaa->arg[i].ls_addr;
57 int n = eaa->arg[i].get_size / sizeof(short);
58 output->arg[i].s32 = sum_shorts(p, n);
59 //printf("qa_sum_shorts(%p, %d) = %d\n", p, n, output->arg[i].s32);
63 GC_DECLARE_PROC(qa_sum_shorts, "qa_sum_shorts");
66 write_seq(unsigned char *p, int nbytes, int counter)
68 for (int i = 0; i < nbytes; i++)
73 qa_put_seq(const gc_job_direct_args_t *input,
74 gc_job_direct_args_t *output _UNUSED,
75 const gc_job_ea_args_t *eaa)
77 int counter = input->arg[0].s32;
79 for (unsigned int i = 0; i < eaa->nargs; i++){
80 unsigned char *p = eaa->arg[i].ls_addr;
81 int n = eaa->arg[i].put_size;
82 write_seq(p, n, counter);
87 GC_DECLARE_PROC(qa_put_seq, "qa_put_seq");
90 qa_copy(const gc_job_direct_args_t *input _UNUSED,
91 gc_job_direct_args_t *output,
92 const gc_job_ea_args_t *eaa)
95 || eaa->arg[0].direction != GCJD_DMA_PUT
96 || eaa->arg[1].direction != GCJD_DMA_GET){
97 output->arg[0].s32 = -1;
101 output->arg[0].s32 = 0;
102 unsigned n = eaa->arg[0].put_size;
103 if (eaa->arg[1].get_size < n)
104 n = eaa->arg[1].get_size;
106 memcpy(eaa->arg[0].ls_addr, eaa->arg[1].ls_addr, n);
109 GC_DECLARE_PROC(qa_copy, "qa_copy");