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.
22 #include <gcell/gc_declare_proc.h>
23 #include <gcell/spu/gc_delay.h>
28 qa_nop(const gc_job_direct_args_t *input _UNUSED,
29 gc_job_direct_args_t *output _UNUSED,
30 const gc_job_ea_args_t *eaa _UNUSED)
34 GC_DECLARE_PROC(qa_nop, "qa_nop");
37 sum_shorts(short *p, int nshorts)
40 for (int i = 0; i < nshorts; i++)
47 qa_sum_shorts(const gc_job_direct_args_t *input _UNUSED,
48 gc_job_direct_args_t *output,
49 const gc_job_ea_args_t *eaa)
51 for (unsigned int i = 0; i < eaa->nargs; i++){
52 short *p = eaa->arg[i].ls_addr;
53 int n = eaa->arg[i].get_size / sizeof(short);
54 output->arg[i].s32 = sum_shorts(p, n);
55 //printf("qa_sum_shorts(%p, %d) = %d\n", p, n, output->arg[i].s32);
59 GC_DECLARE_PROC(qa_sum_shorts, "qa_sum_shorts");
62 write_seq(unsigned char *p, int nbytes, int counter)
64 for (int i = 0; i < nbytes; i++)
69 qa_put_seq(const gc_job_direct_args_t *input,
70 gc_job_direct_args_t *output _UNUSED,
71 const gc_job_ea_args_t *eaa)
73 int counter = input->arg[0].s32;
75 for (unsigned int i = 0; i < eaa->nargs; i++){
76 unsigned char *p = eaa->arg[i].ls_addr;
77 int n = eaa->arg[i].put_size;
78 write_seq(p, n, counter);
83 GC_DECLARE_PROC(qa_put_seq, "qa_put_seq");
86 qa_copy(const gc_job_direct_args_t *input _UNUSED,
87 gc_job_direct_args_t *output,
88 const gc_job_ea_args_t *eaa)
91 || eaa->arg[0].direction != GCJD_DMA_PUT
92 || eaa->arg[1].direction != GCJD_DMA_GET){
93 output->arg[0].s32 = -1;
97 output->arg[0].s32 = 0;
98 unsigned n = eaa->arg[0].put_size;
99 if (eaa->arg[1].get_size < n)
100 n = eaa->arg[1].get_size;
102 memcpy(eaa->arg[0].ls_addr, eaa->arg[1].ls_addr, n);
105 GC_DECLARE_PROC(qa_copy, "qa_copy");