commit-gnuradio
[Top][All Lists]
Advanced

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

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


From: eb
Subject: [Commit-gnuradio] r7852 - in gnuradio/branches/developers/eb/gcell/src: include lib lib/spu
Date: Tue, 26 Feb 2008 17:05:37 -0700 (MST)

Author: eb
Date: 2008-02-26 17:05:37 -0700 (Tue, 26 Feb 2008)
New Revision: 7852

Modified:
   gnuradio/branches/developers/eb/gcell/src/include/gc_proc_ids_private.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/gc_spu_procs.c
Log:
additional QA code

Modified: 
gnuradio/branches/developers/eb/gcell/src/include/gc_proc_ids_private.h
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/include/gc_proc_ids_private.h     
2008-02-26 23:26:52 UTC (rev 7851)
+++ gnuradio/branches/developers/eb/gcell/src/include/gc_proc_ids_private.h     
2008-02-27 00:05:37 UTC (rev 7852)
@@ -29,6 +29,7 @@
 #define        GCP_QA_UDELAY       1  // delay by arg[0] microseconds
 #define        GCP_QA_SUM_SHORTS   2  // sum elements of ea.arg[i], return in 
output.arg[i].s32
 #define        GCP_QA_PUT_SEQ      3  // write seq of chars to ea.arg[i], 
initial value in input.arg[0].s32
+#define GCP_QA_COPY        4  // copy ea.arg[0] = ea.arg[1]
 
 #define        GCP_NPROC_IDS   16
 

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-26 23:26:52 UTC (rev 7851)
+++ gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager_impl.cc        
2008-02-27 00:05:37 UTC (rev 7852)
@@ -1153,7 +1153,8 @@
   { "qa_nop",          GCP_QA_NOP },
   { "qa_udelay",       GCP_QA_UDELAY },
   { "qa_sum_shorts",   GCP_QA_SUM_SHORTS },
-  { "qa_put_seq",      GCP_QA_PUT_SEQ }
+  { "qa_put_seq",      GCP_QA_PUT_SEQ },
+  { "qa_copy",         GCP_QA_COPY }
 };
   
 static const size_t nname_map_entries = sizeof(name_map) / sizeof(name_map[0]);

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-26 23:26:52 UTC (rev 7851)
+++ gnuradio/branches/developers/eb/gcell/src/lib/qa_job_manager.cc     
2008-02-27 00:05:37 UTC (rev 7852)
@@ -29,6 +29,7 @@
 
 #include <malloc.h>
 
+#if 0
 static void
 gc_msleep(unsigned long millisecs)
 {
@@ -47,6 +48,7 @@
     return;
   }
 }
+#endif
 
 void
 qa_job_manager::leak_check(test_t t, const std::string &name)
@@ -423,7 +425,7 @@
 }
 
 //
-// test MAX_ARGS_EA case
+// test MAX_ARGS_EA "get" case
 //
 void
 qa_job_manager::t9_body()
@@ -547,28 +549,154 @@
   opts.nspes = 1;
   mgr = gc_make_job_manager(&opts);
 
-  for (int offset = 0; offset <= 256; offset++){
-    for (int len = 0; len <= 256; len++){
+  for (int offset = 0; offset <= 128; offset++){
+    for (int len = 0; len <= 128; len++){
       test_put_seq(mgr, offset, len, starting_val++);
     }
   }
 
+  int ea_args_maxsize = mgr->ea_args_maxsize();
+
+  // confirm maximum length
+  for (int offset = 0; offset <= 64; offset++){
+    test_put_seq(mgr, offset, ea_args_maxsize, starting_val++);
+  }
+
   delete mgr;
 }
 
+//
+// test "put" args too long
+//
 void
 qa_job_manager::t11_body()
 {
+  gc_job_manager *mgr;
+  gc_jm_options opts;
+  opts.nspes = 1;
+  mgr = gc_make_job_manager(&opts);
+  gc_job_desc *jd = mgr->alloc_job_desc();
+  gc_proc_id_t gcp_qa_put_seq = mgr->lookup_proc("qa_put_seq");
+
+  init_jd(jd, gcp_qa_put_seq);
+  jd->input.nargs = 1;
+  jd->input.arg[0].s32 = 0;
+  jd->eaa.nargs = 1;
+  jd->eaa.arg[0].ea_addr = 0;
+  jd->eaa.arg[0].direction = GCJD_DMA_PUT;
+  jd->eaa.arg[0].put_size = 1 << 20;
+
+  if (!mgr->submit_job(jd)){
+    printf("%d: submit_job(jd) failed, status = %d\n", __LINE__, jd->status);
+  }
+  else {
+    mgr->wait_job(jd);
+    CPPUNIT_ASSERT_EQUAL(JS_ARGS_TOO_LONG, jd->status);
+  }
+
+  mgr->free_job_desc(jd);
+  delete mgr;
 }
 
+//
+// test MAX_ARGS_EA "put" case
+//
 void
 qa_job_manager::t12_body()
 {
+  static const int N = 127;
+  static const int M = 201;
+  gc_job_manager *mgr;
+  gc_jm_options opts;
+  opts.nspes = 1;
+  mgr = gc_make_job_manager(&opts);
+  gc_job_desc *jd = mgr->alloc_job_desc();
+  gc_proc_id_t gcp_qa_put_seq = mgr->lookup_proc("qa_put_seq");
+
+  unsigned char *buf = (unsigned char *) short_buf;
+  size_t buf_len = sizeof(short_buf);
+  memset(buf, 0xff, buf_len);
+
+  // two cache lines into the buffer, so we can check before and after
+  int fixed_offset = 256;
+
+  int starting_val = 13;
+
+  init_jd(jd, gcp_qa_put_seq);
+  jd->input.nargs = 1;
+  jd->input.arg[0].s32 = starting_val;
+  jd->eaa.nargs = MAX_ARGS_EA;
+  for (int i = 0; i < MAX_ARGS_EA; i++){
+    jd->eaa.arg[i].direction = GCJD_DMA_PUT;
+    jd->eaa.arg[i].ea_addr = ptr_to_ea(&buf[i * M + fixed_offset]);
+    jd->eaa.arg[i].put_size = N;
+  }
+
+  if (!mgr->submit_job(jd)){
+    printf("%d: submit_job(jd) failed, status = %d\n", __LINE__, jd->status);
+  }
+  else {
+    mgr->wait_job(jd);
+    CPPUNIT_ASSERT_EQUAL(JS_OK, jd->status);
+    for (int i = 0; i < MAX_ARGS_EA; i++){
+      CPPUNIT_ASSERT(confirm_seq(&buf[i * M + fixed_offset], N, starting_val));
+      starting_val += N;
+    }
+  }
+
+  mgr->free_job_desc(jd);
+  delete mgr;
 }
 
+//
+// test qa_copy primitive
+//
 void
 qa_job_manager::t13_body()
 {
+  gc_job_manager *mgr;
+  gc_jm_options opts;
+  opts.nspes = 1;
+  mgr = gc_make_job_manager(&opts);
+
+  memset(short_buf, 0, sizeof(short_buf));
+  for (int i = 0; i < NS/2; i++)       // init buffer with known qty
+    short_buf[i] = 0x1234 + i;
+
+  int nshorts = NS/2;
+
+  gc_job_desc *jd = mgr->alloc_job_desc();
+  gc_proc_id_t gcp_qa_copy = mgr->lookup_proc("qa_copy");
+
+  init_jd(jd, gcp_qa_copy);
+  jd->eaa.nargs = 2;
+  jd->eaa.arg[0].ea_addr = ptr_to_ea(&short_buf[nshorts]);
+  jd->eaa.arg[0].direction = GCJD_DMA_PUT;
+  jd->eaa.arg[0].put_size = nshorts * sizeof(short);
+  
+  jd->eaa.arg[1].ea_addr = ptr_to_ea(&short_buf[0]);
+  jd->eaa.arg[1].direction = GCJD_DMA_GET;
+  jd->eaa.arg[1].get_size = nshorts * sizeof(short);
+  
+
+  if (!mgr->submit_job(jd)){
+    printf("%d: submit_job(jd) failed, status = %d\n", __LINE__, jd->status);
+  }
+  else {
+    mgr->wait_job(jd);
+    CPPUNIT_ASSERT_EQUAL(JS_OK, jd->status);
+    CPPUNIT_ASSERT_EQUAL(0, jd->output.arg[0].s32);
+
+    bool ok = true;
+    for (int i = 0; i < nshorts; i++){
+      if (short_buf[i] != short_buf[i + nshorts])
+       ok = false;
+    }
+    CPPUNIT_ASSERT(ok);
+  }
+  mgr->free_job_desc(jd);
+
+  delete mgr;
 }
 
 void

Modified: gnuradio/branches/developers/eb/gcell/src/lib/spu/gc_spu_procs.c
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/lib/spu/gc_spu_procs.c    
2008-02-26 23:26:52 UTC (rev 7851)
+++ gnuradio/branches/developers/eb/gcell/src/lib/spu/gc_spu_procs.c    
2008-02-27 00:05:37 UTC (rev 7852)
@@ -22,6 +22,7 @@
 #include <gc_spu_procs.h>
 #include <gc_delay.h>
 #include <stdio.h>
+#include <string.h>
 
 
 #define _UNUSED __attribute__((unused))
@@ -88,11 +89,31 @@
   }
 }
 
+static void
+gcp_qa_copy(const gc_job_direct_args_t *input _UNUSED,
+           gc_job_direct_args_t *output,
+           const gc_job_ea_args_t *eaa)
+{
+  if (eaa->nargs != 2
+      || eaa->arg[0].direction != GCJD_DMA_PUT
+      || eaa->arg[1].direction != GCJD_DMA_GET){
+    output->arg[0].s32 = -1;
+    return;
+  }
 
+  output->arg[0].s32 = 0;
+  unsigned n = eaa->arg[0].put_size;
+  if (eaa->arg[1].get_size < n)
+    n = eaa->arg[1].get_size;
+  
+  memcpy(eaa->arg[0].ls_addr, eaa->arg[1].ls_addr, n);
+}
+
+
 gc_spu_proc_t gc_proc_table[GCP_NPROC_IDS] = {
   [GCP_QA_NOP] = gcp_qa_nop,
   [GCP_QA_UDELAY] = gcp_qa_udelay,
   [GCP_QA_SUM_SHORTS] = gcp_qa_sum_shorts,
   [GCP_QA_PUT_SEQ] = gcp_qa_put_seq,
+  [GCP_QA_COPY] = gcp_qa_copy,
 };
-





reply via email to

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