3 * Copyright 2007,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 #ifndef INCLUDED_GCELL_GC_JOB_DESC_H
23 #define INCLUDED_GCELL_GC_JOB_DESC_H
26 * This file contains the structures that are used to describe how to
27 * call "jobs" that execute on the SPEs. A "job" is a task, or piece of
28 * work that you want to run on an SPE.
30 * There is code running in the SPE that knows how to interpret
31 * these job descriptions. Thus, in most cases, the overhead
32 * of invoking these is very low.
34 * The whole "job idea" is SPE centric. At first pass,
35 * the PPE will be constructing jobs and enqueing them.
36 * However, there is nothing in the implementation that
37 * prohibits SPEs from creating their own jobs in the
38 * future. Also, there is nothing prohibiting SPE-to-SPE
41 * SPE's dequeue and "pull" jobs to themselves, do the work, then
42 * notify the entity that submitted the job.
45 #include <gcell/gc_types.h>
46 #include <gcell/gc_job_desc_private.h>
49 * This is C, not C++ code...
51 * ...and is used by both PPE and SPE code
56 //! opaque ID that specifies which code to invoke on the SPE
57 typedef uint32_t gc_proc_id_t;
58 #define GCP_UNKNOWN_PROC ((gc_proc_id_t) -1)
64 JS_SHUTTING_DOWN, // job mananger is shutting down
65 JS_TOO_MANY_CLIENTS, // too many client threads
66 JS_UNKNOWN_PROC, // didn't recognize the procedure ID
67 JS_BAD_DIRECTION, // EA arg has invalid direction
68 JS_BAD_EAH, // not all EA args have the same high 32 address bits
69 JS_BAD_N_DIRECT, // too many direct args
70 JS_BAD_N_EA, // too many EA args
71 JS_ARGS_TOO_LONG, // total length of EA args exceeds limit
72 JS_BAD_JUJU, // misc problem: you're having a bad day
73 JS_BAD_JOB_DESC, // gc_job_desc was not allocated using mgr->alloc_job_desc()
77 #define MAX_ARGS_DIRECT 8 // maximum number of args passed using "direct" method
78 #define MAX_ARGS_EA 8 // maximum number of args passed via EA memory (dma)
81 * We support two classes of arguments,
82 * "direct", which are contained in the gc_job_desc_args and
83 * "EA", which are copied in/out according to info in gc_job_desc_args
87 * \brief Tag type of "direct" argument
104 * \brief union for passing "direct" argument
106 typedef union gc_arg_union
114 //float complex cf; // 64-bits (C99)
115 //double complex cd; // 128-bits (C99)
116 gc_eaddr_t ea; // 64-bits
117 } _AL8 gc_arg_union_t;
121 * \brief "direct" input or output arguments
123 typedef struct gc_job_direct_args
125 uint32_t nargs; // # of "direct" args
126 gc_tag_t tag[MAX_ARGS_DIRECT] _AL16; // type of direct arg[i]
127 gc_arg_union_t arg[MAX_ARGS_DIRECT] _AL16; // direct argument values
129 } _AL16 gc_job_direct_args_t;
132 // specifies direction for args passed in EA memory
134 #define GCJD_DMA_GET 0x01 // in to SPE
135 #define GCJD_DMA_PUT 0x02 // out from SPE
138 * \brief Description of args passed in EA memory.
139 * These are DMA'd between EA and LS as specified.
141 typedef struct gc_job_ea_arg {
142 //! EA address of buffer
145 //! GC_JD_DMA_* get arg or put arg
148 //! number of bytes to get
151 //! number of bytes to put
155 //! local store address (filled in by SPU runtime)
162 } _AL16 gc_job_ea_arg_t;
165 typedef struct gc_job_ea_args {
167 gc_job_ea_arg_t arg[MAX_ARGS_EA];
169 } _AL16 gc_job_ea_args_t;
173 * \brief "job description" that is DMA'd to/from the SPE.
176 typedef struct gc_job_desc
178 gc_job_desc_private_t sys; // internals
179 gc_job_status_t status; // what happened (output)
180 gc_proc_id_t proc_id; // specifies which procedure to run
181 gc_job_direct_args_t input; // direct args to SPE
182 gc_job_direct_args_t output; // direct args from SPE
183 gc_job_ea_args_t eaa; // args passed via EA memory
185 } _AL128 gc_job_desc_t;
189 * type of procedure invoked on spu
191 typedef void (*gc_spu_proc_t)(const gc_job_direct_args_t *input,
192 gc_job_direct_args_t *output,
193 const gc_job_ea_args_t *eaa);
195 #if !defined(__SPU__)
197 static inline gc_job_desc_t *
198 ea_to_jdp(gc_eaddr_t ea)
200 return (gc_job_desc_t *) ea_to_ptr(ea);
203 static inline gc_eaddr_t
204 jdp_to_ea(gc_job_desc_t *item)
206 return ptr_to_ea(item);
214 #endif /* INCLUDED_GCELL_GC_JOB_DESC_H */