GNU Radio 3.3.0 C++ API
|
00001 /* -*- c -*- */ 00002 /* 00003 * Copyright 2007,2008 Free Software Foundation, Inc. 00004 * 00005 * This file is part of GNU Radio 00006 * 00007 * GNU Radio is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 3, or (at your option) 00010 * any later version. 00011 * 00012 * GNU Radio is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License along 00018 * with this program; if not, write to the Free Software Foundation, Inc., 00019 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00020 */ 00021 00022 #ifndef INCLUDED_GCELL_GC_JOB_DESC_H 00023 #define INCLUDED_GCELL_GC_JOB_DESC_H 00024 00025 /*! 00026 * This file contains the structures that are used to describe how to 00027 * call "jobs" that execute on the SPEs. A "job" is a task, or piece of 00028 * work that you want to run on an SPE. 00029 * 00030 * There is code running in the SPE that knows how to interpret 00031 * these job descriptions. Thus, in most cases, the overhead 00032 * of invoking these is very low. 00033 * 00034 * The whole "job idea" is SPE centric. At first pass, 00035 * the PPE will be constructing jobs and enqueing them. 00036 * However, there is nothing in the implementation that 00037 * prohibits SPEs from creating their own jobs in the 00038 * future. Also, there is nothing prohibiting SPE-to-SPE 00039 * DMA's. 00040 * 00041 * SPE's dequeue and "pull" jobs to themselves, do the work, then 00042 * notify the entity that submitted the job. 00043 */ 00044 00045 #include <gcell/gc_types.h> 00046 #include <gcell/gc_job_desc_private.h> 00047 00048 /* 00049 * This is C, not C++ code... 00050 * 00051 * ...and is used by both PPE and SPE code 00052 */ 00053 __GC_BEGIN_DECLS 00054 00055 00056 //! opaque ID that specifies which code to invoke on the SPE 00057 typedef uint32_t gc_proc_id_t; 00058 #define GCP_UNKNOWN_PROC ((gc_proc_id_t) -1) 00059 00060 00061 //! final job status 00062 typedef enum { 00063 JS_OK, 00064 JS_SHUTTING_DOWN, // job mananger is shutting down 00065 JS_TOO_MANY_CLIENTS, // too many client threads 00066 JS_UNKNOWN_PROC, // didn't recognize the procedure ID 00067 JS_BAD_DIRECTION, // EA arg has invalid direction 00068 JS_BAD_EAH, // not all EA args have the same high 32 address bits 00069 JS_BAD_N_DIRECT, // too many direct args 00070 JS_BAD_N_EA, // too many EA args 00071 JS_ARGS_TOO_LONG, // total length of EA args exceeds limit 00072 JS_BAD_JUJU, // misc problem: you're having a bad day 00073 JS_BAD_JOB_DESC, // gc_job_desc was not allocated using mgr->alloc_job_desc() 00074 00075 } gc_job_status_t; 00076 00077 #define MAX_ARGS_DIRECT 8 // maximum number of args passed using "direct" method 00078 #define MAX_ARGS_EA 8 // maximum number of args passed via EA memory (dma) 00079 00080 /* 00081 * We support two classes of arguments, 00082 * "direct", which are contained in the gc_job_desc_args and 00083 * "EA", which are copied in/out according to info in gc_job_desc_args 00084 */ 00085 00086 /*! 00087 * \brief Tag type of "direct" argument 00088 */ 00089 typedef enum { 00090 GCT_S32, 00091 GCT_U32, 00092 GCT_S64, 00093 GCT_U64, 00094 GCT_FLOAT, 00095 GCT_DOUBLE, 00096 GCT_FLT_CMPLX, 00097 GCT_DBL_CMPLX, 00098 GCT_EADDR, 00099 00100 } gc_tag_t; 00101 00102 00103 /*! 00104 * \brief union for passing "direct" argument 00105 */ 00106 typedef union gc_arg_union 00107 { 00108 int32_t s32; 00109 uint32_t u32; 00110 int64_t s64; 00111 uint64_t u64; 00112 float f; 00113 double d; 00114 //float complex cf; // 64-bits (C99) 00115 //double complex cd; // 128-bits (C99) 00116 gc_eaddr_t ea; // 64-bits 00117 } _AL8 gc_arg_union_t; 00118 00119 00120 /*! 00121 * \brief "direct" input or output arguments 00122 */ 00123 typedef struct gc_job_direct_args 00124 { 00125 uint32_t nargs; // # of "direct" args 00126 gc_tag_t tag[MAX_ARGS_DIRECT] _AL16; // type of direct arg[i] 00127 gc_arg_union_t arg[MAX_ARGS_DIRECT] _AL16; // direct argument values 00128 00129 } _AL16 gc_job_direct_args_t; 00130 00131 00132 // specifies direction for args passed in EA memory 00133 00134 #define GCJD_DMA_GET 0x01 // in to SPE 00135 #define GCJD_DMA_PUT 0x02 // out from SPE 00136 00137 /*! 00138 * \brief Description of args passed in EA memory. 00139 * These are DMA'd between EA and LS as specified. 00140 */ 00141 typedef struct gc_job_ea_arg { 00142 //! EA address of buffer 00143 gc_eaddr_t ea_addr; 00144 00145 //! GC_JD_DMA_* get arg or put arg 00146 uint32_t direction; 00147 00148 //! number of bytes to get 00149 uint32_t get_size; 00150 00151 //! number of bytes to put 00152 uint32_t put_size; 00153 00154 #if defined(__SPU__) 00155 //! local store address (filled in by SPU runtime) 00156 void *ls_addr; 00157 uint32_t _pad[2]; 00158 #else 00159 uint32_t _pad[3]; 00160 #endif 00161 00162 } _AL16 gc_job_ea_arg_t; 00163 00164 00165 typedef struct gc_job_ea_args { 00166 uint32_t nargs; 00167 gc_job_ea_arg_t arg[MAX_ARGS_EA]; 00168 00169 } _AL16 gc_job_ea_args_t; 00170 00171 00172 /*! 00173 * \brief "job description" that is DMA'd to/from the SPE. 00174 * \ingroup gcell 00175 */ 00176 typedef struct gc_job_desc 00177 { 00178 gc_job_desc_private_t sys; // internals 00179 gc_job_status_t status; // what happened (output) 00180 gc_proc_id_t proc_id; // specifies which procedure to run 00181 gc_job_direct_args_t input; // direct args to SPE 00182 gc_job_direct_args_t output; // direct args from SPE 00183 gc_job_ea_args_t eaa; // args passed via EA memory 00184 00185 } _AL128 gc_job_desc_t; 00186 00187 00188 /*! 00189 * type of procedure invoked on spu 00190 */ 00191 typedef void (*gc_spu_proc_t)(const gc_job_direct_args_t *input, 00192 gc_job_direct_args_t *output, 00193 const gc_job_ea_args_t *eaa); 00194 00195 #if !defined(__SPU__) 00196 00197 static inline gc_job_desc_t * 00198 ea_to_jdp(gc_eaddr_t ea) 00199 { 00200 return (gc_job_desc_t *) ea_to_ptr(ea); 00201 } 00202 00203 static inline gc_eaddr_t 00204 jdp_to_ea(gc_job_desc_t *item) 00205 { 00206 return ptr_to_ea(item); 00207 } 00208 00209 #endif 00210 00211 00212 __GC_END_DECLS 00213 00214 #endif /* INCLUDED_GCELL_GC_JOB_DESC_H */