[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r7772 - in gnuradio/branches/developers/eb/gcell/src:
From: |
eb |
Subject: |
[Commit-gnuradio] r7772 - in gnuradio/branches/developers/eb/gcell/src: apps include lib lib/spu |
Date: |
Thu, 21 Feb 2008 13:20:14 -0700 (MST) |
Author: eb
Date: 2008-02-21 13:20:14 -0700 (Thu, 21 Feb 2008)
New Revision: 7772
Added:
gnuradio/branches/developers/eb/gcell/src/include/gc_proc_ids_private.h
Removed:
gnuradio/branches/developers/eb/gcell/src/include/gc_proc_ids.h
Modified:
gnuradio/branches/developers/eb/gcell/src/apps/benchmark_dma.cc
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.h
gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager_impl.cc
gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager_impl.h
gnuradio/branches/developers/eb/gcell/src/lib/qa_job_manager.cc
gnuradio/branches/developers/eb/gcell/src/lib/spu/gc_spu_procs.h
gnuradio/branches/developers/eb/gcell/src/lib/spu/gcell_spu_main.c
Log:
Defined an interface for mapping spu procedure names to gc_proc_ids
and refactored all code to use it. (The current implementation uses a
hard coded table. The plan is to extract the names and entry points
from the SPU executable or plugin file(s).)
Modified: gnuradio/branches/developers/eb/gcell/src/apps/benchmark_dma.cc
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/apps/benchmark_dma.cc
2008-02-21 19:18:39 UTC (rev 7771)
+++ gnuradio/branches/developers/eb/gcell/src/apps/benchmark_dma.cc
2008-02-21 20:20:14 UTC (rev 7772)
@@ -20,17 +20,19 @@
*/
#include "gc_job_manager.h"
-#include "gc_proc_ids.h"
#include "mb_time.h"
#include <getopt.h>
#include <stdlib.h>
+#include <stdio.h>
#include <boost/scoped_array.hpp>
+static gc_proc_id_t gcp_qa_udelay = GCP_UNKNOWN_PROC;
+
static void
init_jd(gc_job_desc *jd, unsigned int usecs,
unsigned char *getbuf, size_t getbuf_len)
{
- jd->proc_id = GCP_QA_UDELAY;
+ jd->proc_id = gcp_qa_udelay;
jd->input.nargs = 1;
jd->input.arg[0].u32 = usecs;
jd->output.nargs = 0;
@@ -69,6 +71,11 @@
opts.gang_schedule = true;
gc_job_manager *mgr = gc_make_job_manager(&opts);
+ if ((gcp_qa_udelay = mgr->lookup_proc("qa_udelay")) == GCP_UNKNOWN_PROC){
+ fprintf(stderr, "lookup_proc: failed to find \"qa_udelay\"\n");
+ return;
+ }
+
// allocate and init all job descriptors
for (int i = 0; i < NJDS; i++){
all_jds[i] = mgr->alloc_job_desc();
Modified: gnuradio/branches/developers/eb/gcell/src/apps/benchmark_nop.cc
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/apps/benchmark_nop.cc
2008-02-21 19:18:39 UTC (rev 7771)
+++ gnuradio/branches/developers/eb/gcell/src/apps/benchmark_nop.cc
2008-02-21 20:20:14 UTC (rev 7772)
@@ -20,15 +20,17 @@
*/
#include "gc_job_manager.h"
-#include "gc_proc_ids.h"
#include "mb_time.h"
#include <getopt.h>
#include <stdlib.h>
+#include <stdio.h>
+static gc_proc_id_t gcp_qa_udelay = GCP_UNKNOWN_PROC;
+
static void
init_jd(gc_job_desc *jd, unsigned int usecs)
{
- jd->proc_id = GCP_QA_UDELAY;
+ jd->proc_id = gcp_qa_udelay;
jd->input.nargs = 1;
jd->input.arg[0].u32 = usecs;
jd->output.nargs = 0;
@@ -52,6 +54,11 @@
opts.gang_schedule = true;
gc_job_manager *mgr = gc_make_job_manager(&opts);
+ if ((gcp_qa_udelay = mgr->lookup_proc("qa_udelay")) == GCP_UNKNOWN_PROC){
+ fprintf(stderr, "lookup_proc: failed to find \"qa_udelay\"\n");
+ return;
+ }
+
// allocate and init all job descriptors
for (int i = 0; i < NJDS; i++){
all_jds[i] = mgr->alloc_job_desc();
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-21 19:18:39 UTC (rev 7771)
+++ gnuradio/branches/developers/eb/gcell/src/include/gc_job_desc.h
2008-02-21 20:20:14 UTC (rev 7772)
@@ -55,7 +55,9 @@
//! opaque ID that specifies which code to invoke on the SPE
typedef uint32_t gc_proc_id_t;
+#define GCP_UNKNOWN_PROC ((gc_proc_id_t) -1)
+
//! final job status
typedef enum {
JS_OK,
Deleted: gnuradio/branches/developers/eb/gcell/src/include/gc_proc_ids.h
Copied: gnuradio/branches/developers/eb/gcell/src/include/gc_proc_ids_private.h
(from rev 7755, gnuradio/branches/developers/eb/gcell/src/include/gc_proc_ids.h)
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/include/gc_proc_ids_private.h
(rev 0)
+++ gnuradio/branches/developers/eb/gcell/src/include/gc_proc_ids_private.h
2008-02-21 20:20:14 UTC (rev 7772)
@@ -0,0 +1,34 @@
+/* -*- 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_PRIVATE_H
+#define INCLUDED_GC_PROC_IDS_PRIVATE_H
+
+// FIXME list of pre-defined procedure id's
+// This file will be removed as soon as we've got the real code working.
+
+
+#define GCP_QA_NOP 0 // do nothing
+#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_NPROC_IDS 16
+
+#endif /* INCLUDED_GC_PROC_IDS_PRIVATE_H */
Modified: gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager.h
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager.h
2008-02-21 19:18:39 UTC (rev 7771)
+++ gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager.h
2008-02-21 20:20:14 UTC (rev 7772)
@@ -23,6 +23,8 @@
#define INCLUDED_GC_JOB_MANAGER_H
#include <boost/utility.hpp>
+#include <vector>
+#include <string>
#include "gc_job_desc.h"
class gc_job_manager;
@@ -136,7 +138,6 @@
wait_jobs(unsigned int njobs,
gc_job_desc *jd[], bool done[], gc_wait_mode mode) = 0;
-
/*!
* Return the maximum number of bytes of EA arguments that may be
* copied to or from the SPE in a single job. The limit applies
@@ -145,6 +146,17 @@
*/
virtual int ea_args_maxsize() = 0;
+ /*!
+ * Return gc_proc_id_t associated with spu procedure \p proc_name if one
+ * exists, otherwise return GCP_UNKNOWN_PROC.
+ */
+ virtual gc_proc_id_t lookup_proc(const std::string &proc_name) = 0;
+
+ /*!
+ * Return a vector of all known spu procedure names.
+ */
+ virtual std::vector<std::string> proc_names() = 0;
+
virtual void set_debug(int debug);
virtual int debug();
};
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-21 19:18:39 UTC (rev 7771)
+++ gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager_impl.cc
2008-02-21 20:20:14 UTC (rev 7772)
@@ -483,7 +483,10 @@
}
}
- // FIXME map and/or check method against all known methods
+ if (jd->proc_id == GCP_UNKNOWN_PROC){
+ jd->status = JS_UNKNOWN_PROC;
+ return false;
+ }
if (!check_direct_args(jd, &jd->input))
return false;
@@ -1123,7 +1126,46 @@
}
////////////////////////////////////////////////////////////////////////
+//
+// FIXME fake implementation of proc lookups for now
+#include <gc_proc_ids_private.h>
+
+struct name_map {
+ char *proc_name;
+ gc_proc_id_t proc_id;
+};
+
+static struct name_map name_map[] = {
+ { "qa_nop", GCP_QA_NOP },
+ { "qa_udelay", GCP_QA_UDELAY },
+ { "qa_sum_shorts", GCP_QA_SUM_SHORTS }
+};
+
+static const size_t nname_map_entries = sizeof(name_map) / sizeof(name_map[0]);
+
+gc_proc_id_t
+gc_job_manager_impl::lookup_proc(const std::string &proc_name)
+{
+ for (size_t i = 0; i < nname_map_entries; i++)
+ if (proc_name == name_map[i].proc_name)
+ return name_map[i].proc_id;
+
+ return GCP_UNKNOWN_PROC;
+}
+
+std::vector<std::string>
+gc_job_manager_impl::proc_names()
+{
+ std::vector<std::string> r;
+ for (size_t i = 0; i < nname_map_entries; i++)
+ r.push_back(name_map[i].proc_name);
+
+ return r;
+}
+
+////////////////////////////////////////////////////////////////////////
+
worker_ctx::~worker_ctx()
{
if (spe_ctx){
@@ -1135,4 +1177,3 @@
}
state = WS_FREE;
}
-
Modified: gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager_impl.h
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager_impl.h
2008-02-21 19:18:39 UTC (rev 7771)
+++ gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager_impl.h
2008-02-21 20:20:14 UTC (rev 7772)
@@ -234,10 +234,13 @@
wait_jobs(unsigned int njobs,
gc_job_desc *jd[], bool done[], gc_wait_mode mode);
+ virtual int ea_args_maxsize();
+
+ virtual gc_proc_id_t lookup_proc(const std::string &name);
+ virtual std::vector<std::string> proc_names();
+
virtual void set_debug(int debug);
virtual int debug();
-
- virtual int ea_args_maxsize();
};
#endif /* INCLUDED_GC_JOB_MANAGER_IMPL_H */
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-21 19:18:39 UTC (rev 7771)
+++ gnuradio/branches/developers/eb/gcell/src/lib/qa_job_manager.cc
2008-02-21 20:20:14 UTC (rev 7772)
@@ -26,7 +26,6 @@
#include <stdio.h>
#include <time.h>
#include <errno.h>
-#include <gc_proc_ids.h>
#include <malloc.h>
@@ -192,14 +191,21 @@
gc_job_desc *jds[NJOBS];
bool done[NJOBS];
+ gc_proc_id_t gcp_no_such = mgr->lookup_proc("--no-such-proc-name--");
+ CPPUNIT_ASSERT_EQUAL(GCP_UNKNOWN_PROC, gcp_no_such);
+
+ gc_proc_id_t gcp_qa_nop = mgr->lookup_proc("qa_nop");
+ CPPUNIT_ASSERT(gcp_qa_nop != GCP_UNKNOWN_PROC);
+
for (int i = 0; i < NJOBS; i++){
jds[i] = mgr->alloc_job_desc();
- init_jd(jds[i], GCP_QA_NOP);
+ init_jd(jds[i], gcp_qa_nop);
}
for (int i = 0; i < NJOBS; i++){
if (!mgr->submit_job(jds[i])){
- printf("submit_job(jds[%d]) failed, status = %d\n", i, jds[i]->status);
+ printf("%d: submit_job(jds[%d]) failed, status = %d\n",
+ __LINE__, i, jds[i]->status);
}
}
@@ -226,14 +232,17 @@
gc_job_desc *jds[NJOBS];
bool done[NJOBS];
+ gc_proc_id_t gcp_qa_nop = mgr->lookup_proc("qa_nop");
+
for (int i = 0; i < NJOBS; i++){
jds[i] = mgr->alloc_job_desc();
- init_jd(jds[i], GCP_QA_NOP);
+ init_jd(jds[i], gcp_qa_nop);
}
for (int i = 0; i < NJOBS; i++){
if (!mgr->submit_job(jds[i])){
- printf("submit_job(jds[%d]) failed, status = %d\n", i, jds[i]->status);
+ printf("%d: submit_job(jds[%d]) failed, status = %d\n",
+ __LINE__, i, jds[i]->status);
}
}
@@ -254,14 +263,14 @@
gc_jm_options opts;
opts.nspes = 1;
mgr = gc_make_job_manager(&opts);
-
+ gc_proc_id_t gcp_qa_nop = mgr->lookup_proc("qa_nop");
gc_job_desc *jd = mgr->alloc_job_desc();
- // test for success with GCP_QA_NOP procedure
- init_jd(jd, GCP_QA_NOP);
+ // test for success with gcp_qa_nop procedure
+ init_jd(jd, gcp_qa_nop);
if (!mgr->submit_job(jd)){
- printf("submit_job(jd) failed, status = %d\n", jd->status);
+ printf("%d: submit_job(jd) failed, status = %d\n", __LINE__, jd->status);
}
else {
mgr->wait_job(jd);
@@ -269,9 +278,9 @@
}
// test for JS_UNKNOWN_PROC with bogus procedure
- init_jd(jd, ~0);
+ init_jd(jd, -2);
if (!mgr->submit_job(jd)){
- printf("submit_job(jd) failed, status = %d\n", jd->status);
+ printf("%d: submit_job(jd) failed, status = %d\n", __LINE__, jd->status);
}
else {
mgr->wait_job(jd);
@@ -296,8 +305,9 @@
test_sum_shorts(gc_job_manager *mgr, short *buf, int nshorts)
{
gc_job_desc *jd = mgr->alloc_job_desc();
+ gc_proc_id_t gcp_qa_sum_shorts = mgr->lookup_proc("qa_sum_shorts");
- init_jd(jd, GCP_QA_SUM_SHORTS);
+ init_jd(jd, gcp_qa_sum_shorts);
jd->eaa.nargs = 1;
jd->eaa.arg[0].ea_addr = ptr_to_ea(buf);
jd->eaa.arg[0].direction = GCJD_DMA_GET;
@@ -305,7 +315,7 @@
if (!mgr->submit_job(jd)){
- printf("submit_job(jd) failed, status = %d\n", jd->status);
+ printf("%d: submit_job(jd) failed, status = %d\n", __LINE__, jd->status);
}
else {
mgr->wait_job(jd);
@@ -362,15 +372,16 @@
opts.nspes = 1;
mgr = gc_make_job_manager(&opts);
gc_job_desc *jd = mgr->alloc_job_desc();
+ gc_proc_id_t gcp_qa_sum_shorts = mgr->lookup_proc("qa_sum_shorts");
- init_jd(jd, GCP_QA_SUM_SHORTS);
+ init_jd(jd, gcp_qa_sum_shorts);
jd->eaa.nargs = 1;
jd->eaa.arg[0].ea_addr = 0;
jd->eaa.arg[0].direction = GCJD_DMA_GET;
jd->eaa.arg[0].get_size = 1 << 20;
if (!mgr->submit_job(jd)){
- printf("submit_job(jd) failed, status = %d\n", jd->status);
+ printf("%d: submit_job(jd) failed, status = %d\n", __LINE__, jd->status);
}
else {
mgr->wait_job(jd);
@@ -394,8 +405,9 @@
opts.nspes = 1;
mgr = gc_make_job_manager(&opts);
gc_job_desc *jd = mgr->alloc_job_desc();
+ gc_proc_id_t gcp_qa_sum_shorts = mgr->lookup_proc("qa_sum_shorts");
- init_jd(jd, GCP_QA_SUM_SHORTS);
+ init_jd(jd, gcp_qa_sum_shorts);
jd->eaa.nargs = MAX_ARGS_EA;
for (int i = 0; i < MAX_ARGS_EA; i++){
jd->eaa.arg[i].direction = GCJD_DMA_GET;
@@ -404,7 +416,7 @@
}
if (!mgr->submit_job(jd)){
- printf("submit_job(jd) failed, status = %d\n", jd->status);
+ printf("%d: submit_job(jd) failed, status = %d\n", __LINE__, jd->status);
}
else {
mgr->wait_job(jd);
Modified: gnuradio/branches/developers/eb/gcell/src/lib/spu/gc_spu_procs.h
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/lib/spu/gc_spu_procs.h
2008-02-21 19:18:39 UTC (rev 7771)
+++ gnuradio/branches/developers/eb/gcell/src/lib/spu/gc_spu_procs.h
2008-02-21 20:20:14 UTC (rev 7772)
@@ -22,7 +22,7 @@
#define INCLUDED_GC_SPU_PROCS_H
#include <gc_job_desc.h>
-#include <gc_proc_ids.h>
+#include <gc_proc_ids_private.h>
extern gc_spu_proc_t gc_proc_table[GCP_NPROC_IDS];
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-21 19:18:39 UTC (rev 7771)
+++ gnuradio/branches/developers/eb/gcell/src/lib/spu/gcell_spu_main.c
2008-02-21 20:20:14 UTC (rev 7772)
@@ -29,7 +29,6 @@
#include "gc_mbox.h"
#include "sys_tags.h"
#include "gc_jd_queue.h"
-#include "gc_proc_ids.h"
#include "gc_delay.h"
#include "gc_spu_procs.h"
#include "spu_buffers.h"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r7772 - in gnuradio/branches/developers/eb/gcell/src: apps include lib lib/spu,
eb <=