commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r7738 - in gnuradio/branches/developers/eb/gcell/src:


From: eb
Subject: [Commit-gnuradio] r7738 - in gnuradio/branches/developers/eb/gcell/src: apps include lib lib/spu
Date: Mon, 18 Feb 2008 17:42:54 -0700 (MST)

Author: eb
Date: 2008-02-18 17:42:54 -0700 (Mon, 18 Feb 2008)
New Revision: 7738

Added:
   gnuradio/branches/developers/eb/gcell/src/include/gc_proc_ids.h
Removed:
   gnuradio/branches/developers/eb/gcell/src/include/gc_methods.h
Modified:
   gnuradio/branches/developers/eb/gcell/src/apps/benchmark_nop.cc
   gnuradio/branches/developers/eb/gcell/src/include/gc_job_desc.h
   gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager_impl.cc
   gnuradio/branches/developers/eb/gcell/src/lib/qa_job_manager.cc
   gnuradio/branches/developers/eb/gcell/src/lib/spu/gcell_spu_main.c
Log:
work-in-progress on DMA args

Modified: gnuradio/branches/developers/eb/gcell/src/apps/benchmark_nop.cc
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/apps/benchmark_nop.cc     
2008-02-18 22:42:05 UTC (rev 7737)
+++ gnuradio/branches/developers/eb/gcell/src/apps/benchmark_nop.cc     
2008-02-19 00:42:54 UTC (rev 7738)
@@ -20,7 +20,7 @@
  */
 
 #include "gc_job_manager.h"
-#include "gc_methods.h"
+#include "gc_proc_ids.h"
 #include "mb_time.h"
 #include <getopt.h>
 #include <stdlib.h>
@@ -28,12 +28,11 @@
 static void
 init_jd(gc_job_desc *jd, unsigned int usecs)
 {
-  jd->method = GCM_UDELAY;
-  jd->input.n_direct = 1;
-  jd->input.dir_val[0].u32 = usecs;
-  jd->input.n_indirect = 0;
-  jd->output.n_direct = 0;
-  jd->output.n_indirect = 0;
+  jd->proc_id = GCP_UDELAY;
+  jd->input.nargs = 1;
+  jd->input.arg[0].u32 = usecs;
+  jd->output.nargs = 0;
+  jd->ea.nargs = 0;
 }
 
 static void

Modified: gnuradio/branches/developers/eb/gcell/src/include/gc_job_desc.h
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/include/gc_job_desc.h     
2008-02-18 22:42:05 UTC (rev 7737)
+++ gnuradio/branches/developers/eb/gcell/src/include/gc_job_desc.h     
2008-02-19 00:42:54 UTC (rev 7738)
@@ -1,6 +1,6 @@
 /* -*- c -*- */
 /*
- * Copyright 2007 Free Software Foundation, Inc.
+ * Copyright 2007,2008 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
@@ -54,25 +54,27 @@
 
 
 //! opaque ID that specifies which code to invoke on the SPE
-typedef uint32_t gc_method_t;
+typedef uint32_t gc_proc_id_t;
 
 //! final job status
 typedef enum {
   JS_OK,
   JS_SHUTTING_DOWN,        // job mananger is shutting down
   JS_TOO_MANY_CLIENTS,     // too many client threads
-  JS_UNKNOWN_METHOD,       // didn't recognize the method ID
+  JS_UNKNOWN_PROC,         // didn't recognize the procedure ID
   JS_BAD_SIGNATURE,        // arg counts and/or types are wrong for given 
method
-  JS_BAD_ALIGNMENT,        // indirect arg EA not 16-byte aligned
-  JS_BAD_LENGTH,           // indirect arg length not a multiple of 16 bytes 
long
+  JS_BAD_DIRECTION,        // EA arg has invalid direction
+  JS_BAD_ALIGNMENT,        // EA arg not 16-byte aligned
+  JS_BAD_LENGTH,           // EA arg length not a multiple of 16 bytes long
   JS_BAD_N_DIRECT,         // too many direct args
-  JS_BAD_N_INDIRECT,       // too many indirect args
-  JS_ARGS_TOO_LONG,        // total length of indirect args exceeds limit
+  JS_BAD_N_EA,             // too many EA args
+  JS_ARGS_TOO_LONG,        // total length of EA args exceeds limit
   JS_BAD_JUJU,             // misc problem: you're having a bad day
+
 } gc_job_status_t;
 
-#define MAX_ARGS_DIRECT                8
-#define MAX_ARGS_INDIRECT      8
+#define MAX_ARGS_DIRECT  8  // maximum number of args passed using "direct" 
method
+#define MAX_ARGS_EA     8  // maximum number of args passed via EA memory (dma)
 
 /*
  * We support two classes of arguments,
@@ -93,6 +95,7 @@
   GCT_FLT_CMPLX,
   GCT_DBL_CMPLX,
   GCT_EADDR,
+
 } gc_tag_t;
 
 
@@ -107,41 +110,91 @@
   uint64_t      u64;
   float                 f;
   double        d;
-  //float complex  fc; //  64-bits (C99)
-  //double complex dc;  // 128-bits (C99)
+  //float complex  cf; //  64-bits (C99)
+  //double complex cd;  // 128-bits (C99)
   gc_eaddr_t    ea;    //  64-bits
 } _AL8 gc_arg_union_t;
 
 
 /*!
- * \brief input or output arguments
+ * \brief "direct" input or output arguments
  */
-typedef struct gc_job_args
+typedef struct gc_job_direct_args
 {
-  uint32_t      n_direct;                         // # of "direct" args
-  uint32_t      n_indirect;                       // # of "indirct" args 
(DMA'd in/out)
-  uint32_t      _pad[2];                          // (padding)
-  gc_tag_t      dir_tag[MAX_ARGS_DIRECT] _AL16;   // type of "direct" 
argument[i]
-  gc_arg_union_t dir_val[MAX_ARGS_DIRECT] _AL16;   // "direct" argument values
-  uint32_t      ind_len[MAX_ARGS_INDIRECT] _AL16; // length in bytes of 
"indirect" arg[i]
-  gc_eaddr_t    ind_ea[MAX_ARGS_INDIRECT] _AL16;  // address of "indirect" 
arg[i]
-} _AL16 gc_job_args_t;
+  uint32_t       nargs;                        // # of "direct" args
+  gc_tag_t       tag[MAX_ARGS_DIRECT] _AL16;   // type of direct arg[i]
+  gc_arg_union_t  arg[MAX_ARGS_DIRECT] _AL16;   // direct argument values
 
+} _AL16 gc_job_direct_args_t;
 
+
+// specifies direction for args passed in EA memory
+
+#define GCJD_DMA_GET           0x01            // in to SPE
+#define        GCJD_DMA_PUT            0x02            // out from SPE
+#define        GCJD_DMA_GET_PUT        (GCJD_DMA_GET | GCJD_DMA_PUT)
+
 /*!
+ * \brief Description of args passed in EA memory.
+ * These are DMA'd between EA and LS as specified.
+ */
+typedef struct gc_job_ea_arg {
+  //! EA address of buffer (in)
+  gc_eaddr_t     ea_addr;      
+
+  //! GC_JD_DMA_* get arg, put arg or both (in)
+  uint32_t      direction;
+
+  //! number of bytes to get (in)
+  uint32_t      get_size;         
+
+  //! maximum number of bytes to put (in: GCJD_DMA_PUT and GCJD_DMA_GET_PUT)
+  uint32_t      max_put_size;
+
+  //! actual number of bytes put (out: GCJD_DMA_GET and GCJD_DMA_GET_PUT)
+  uint32_t      actual_put_size;       // must be <= max_put_size
+
+#if defined(__SPU__)
+  //! local store address (filled in by SPU runtime)
+  void         *ls_addr;
+  uint32_t      _pad[1];
+#else
+  uint32_t       _pad[2];
+#endif
+
+} _AL16 gc_job_ea_arg_t;
+
+
+typedef struct gc_job_ea_args {
+  uint32_t             nargs;
+  gc_job_ea_arg_t      arg[MAX_ARGS_EA];
+
+} _AL16 gc_job_ea_args_t;
+
+
+/*!
  * \brief "job description" that is DMA'd to/from the SPE.
  */
 typedef struct gc_job_desc
 {
-  gc_job_desc_private_t  sys;  // internals
-  gc_method_t      method;     // specifies what to run (details to follow)
-  gc_job_status_t   status;    // what happened (output)
-  gc_job_args_t            input;      // input args (to SPE)
-  gc_job_args_t            output;     // output args (from SPE)
+  gc_job_desc_private_t sys;     // internals
+  gc_job_status_t      status;   // what happened (output)
+  gc_proc_id_t          proc_id;  // specifies which procedure to run
+  gc_job_direct_args_t input;    // direct args to SPE
+  gc_job_direct_args_t output;   // direct args from SPE
+  gc_job_ea_args_t     ea;       // args passed via EA memory
 
 } _AL128 gc_job_desc_t;
 
 
+/*!
+ * type of procedure invoked on spu
+ */
+typedef void (*gc_spu_proc_t)(gc_proc_id_t proc_id,
+                             const gc_job_direct_args_t *input,
+                             gc_job_direct_args_t *output,
+                             gc_job_ea_args_t *ea);
+
 #if !defined(__SPU__)
 
 static inline gc_job_desc_t *

Deleted: gnuradio/branches/developers/eb/gcell/src/include/gc_methods.h

Copied: gnuradio/branches/developers/eb/gcell/src/include/gc_proc_ids.h (from 
rev 7737, gnuradio/branches/developers/eb/gcell/src/include/gc_methods.h)
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/include/gc_proc_ids.h             
                (rev 0)
+++ gnuradio/branches/developers/eb/gcell/src/include/gc_proc_ids.h     
2008-02-19 00:42:54 UTC (rev 7738)
@@ -0,0 +1,29 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2008 Free Software Foundation, Inc.
+ * 
+ * This file is part of GNU Radio
+ * 
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ * 
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_GC_PROC_IDS_H
+#define INCLUDED_GC_METHODS_H
+
+// list of pre-defined procedure id's
+
+#define GCP_NOP                0       // do nothing
+#define        GCP_UDELAY      1       // delay by arg[0] microseconds
+
+#endif /* INCLUDED_GC_PROC_IDS_H */

Modified: gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager_impl.cc
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager_impl.cc        
2008-02-18 22:42:05 UTC (rev 7737)
+++ gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager_impl.cc        
2008-02-19 00:42:54 UTC (rev 7738)
@@ -423,36 +423,38 @@
  * doesn't have to.
  */
 static bool
-check_args(gc_job_desc *jd, gc_job_args *args)
+check_direct_args(gc_job_desc *jd, gc_job_direct_args *args)
 {
-  if (unlikely(args->n_direct > MAX_ARGS_DIRECT)){
+  if (args->nargs > MAX_ARGS_DIRECT){
     jd->status = JS_BAD_N_DIRECT;
     return false;
   }
 
-  if (unlikely(args->n_indirect > MAX_ARGS_INDIRECT)){
-    jd->status = JS_BAD_N_INDIRECT;
+  return true;
+}
+
+static bool
+check_ea_args(gc_job_desc *jd, gc_job_ea_args *p)
+{
+  if (p->nargs > MAX_ARGS_EA){
+    jd->status = JS_BAD_N_EA;
     return false;
   }
 
-  size_t total_len = 0;
-  for (unsigned int i = 0; i < args->n_indirect; i++){
-    if (unlikely((args->ind_len[i] & 0xf) != 0)){
-      jd->status = JS_BAD_LENGTH;
+  for (unsigned int i = 0; i < p->nargs; i++){
+
+    switch(p->arg[i].direction & GCJD_DMA_GET_PUT){
+    case GCJD_DMA_GET:
+    case GCJD_DMA_PUT:
+    case GCJD_DMA_GET_PUT:
+      break;
+
+    default:
+      jd->status = JS_BAD_DIRECTION;
       return false;
     }
-    if (unlikely((args->ind_ea[i] & 0xf) != 0)){
-      jd->status = JS_BAD_ALIGNMENT;
-      return false;
-    }
-    total_len += args->ind_len[i];
   }
 
-  if (unlikely(total_len > MAX_TOTAL_INDIRECT_LENGTH)){
-    jd->status = JS_ARGS_TOO_LONG;
-    return false;
-  }
-
   return true;
 }
 
@@ -484,12 +486,15 @@
 
   // FIXME map and/or check method against all known methods
 
-  if (!check_args(jd, &jd->input))
+  if (!check_direct_args(jd, &jd->input))
     return false;
 
-  if (!check_args(jd, &jd->output))
+  if (!check_direct_args(jd, &jd->output))
     return false;
 
+  if (!check_ea_args(jd, &jd->ea))
+    return false;
+
   jd->status = JS_OK;
   jd->sys.client_id = cti->d_client_id;
 

Modified: gnuradio/branches/developers/eb/gcell/src/lib/qa_job_manager.cc
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/lib/qa_job_manager.cc     
2008-02-18 22:42:05 UTC (rev 7737)
+++ gnuradio/branches/developers/eb/gcell/src/lib/qa_job_manager.cc     
2008-02-19 00:42:54 UTC (rev 7738)
@@ -170,13 +170,12 @@
 }
 
 static void
-init_jd(gc_job_desc *jd, gc_method_t method)
+init_jd(gc_job_desc *jd, gc_proc_id_t proc_id)
 {
-  jd->method = method;
-  jd->input.n_direct = 0;
-  jd->input.n_indirect = 0;
-  jd->output.n_direct = 0;
-  jd->output.n_indirect = 0;
+  jd->proc_id = proc_id;
+  jd->input.nargs = 0;
+  jd->output.nargs = 0;
+  jd->ea.nargs = 0;
 }
 
 void

Modified: gnuradio/branches/developers/eb/gcell/src/lib/spu/gcell_spu_main.c
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/lib/spu/gcell_spu_main.c  
2008-02-18 22:42:05 UTC (rev 7737)
+++ gnuradio/branches/developers/eb/gcell/src/lib/spu/gcell_spu_main.c  
2008-02-19 00:42:54 UTC (rev 7738)
@@ -28,7 +28,7 @@
 #include "gc_mbox.h"
 #include "sys_tags.h"
 #include "gc_jd_queue.h"
-#include "gc_methods.h"
+#include "gc_proc_ids.h"
 #include "gc_delay.h"
 
 
@@ -159,7 +159,8 @@
 // ------------------------------------------------------------------------
 
 void
-process_job(gc_eaddr_t jd_ea, gc_job_desc_t *jd)
+process_job(gc_eaddr_t jd_ea  __attribute__ ((unused)),
+           gc_job_desc_t *jd)
 {
   // FIXME do something useful ;)
 
@@ -175,17 +176,17 @@
 
   jd->status = JS_OK;  // assume success
 
-  switch(jd->method){  // FIXME lookup method
+  switch(jd->proc_id){ // FIXME lookup procedure
 
-  case GCM_NOP:
+  case GCP_NOP:
     break;
 
-  case GCM_UDELAY:
-    gc_udelay(jd->input.dir_val[0].u32);
+  case GCP_UDELAY:
+    gc_udelay(jd->input.arg[0].u32);
     break;
 
   default:
-    jd->status = JS_UNKNOWN_METHOD;
+    jd->status = JS_UNKNOWN_PROC;
     break;
   }
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]