[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r7896 - in gnuradio/branches/developers/eb/gcell-wip/s
From: |
eb |
Subject: |
[Commit-gnuradio] r7896 - in gnuradio/branches/developers/eb/gcell-wip/src: include lib lib/spu |
Date: |
Fri, 29 Feb 2008 00:34:59 -0700 (MST) |
Author: eb
Date: 2008-02-29 00:34:58 -0700 (Fri, 29 Feb 2008)
New Revision: 7896
Removed:
gnuradio/branches/developers/eb/gcell-wip/src/lib/spu/gc_spu_procs.h
Modified:
gnuradio/branches/developers/eb/gcell-wip/src/include/gc_declare_proc.h
gnuradio/branches/developers/eb/gcell-wip/src/include/gc_spu_args.h
gnuradio/branches/developers/eb/gcell-wip/src/lib/gc_job_manager_impl.cc
gnuradio/branches/developers/eb/gcell-wip/src/lib/gc_job_manager_impl.h
gnuradio/branches/developers/eb/gcell-wip/src/lib/gc_proc_def_utils.cc
gnuradio/branches/developers/eb/gcell-wip/src/lib/gc_proc_def_utils.h
gnuradio/branches/developers/eb/gcell-wip/src/lib/spu/
gnuradio/branches/developers/eb/gcell-wip/src/lib/spu/Makefile.am
gnuradio/branches/developers/eb/gcell-wip/src/lib/spu/gc_spu_procs.c
gnuradio/branches/developers/eb/gcell-wip/src/lib/spu/gcell_spu_main.c
Log:
work-in-progress on supporting user SPU code
Modified:
gnuradio/branches/developers/eb/gcell-wip/src/include/gc_declare_proc.h
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/src/include/gc_declare_proc.h
2008-02-29 07:04:31 UTC (rev 7895)
+++ gnuradio/branches/developers/eb/gcell-wip/src/include/gc_declare_proc.h
2008-02-29 07:34:58 UTC (rev 7896)
@@ -33,14 +33,14 @@
#define GC_PROC_DEF_SECTION ".gcell.proc_def"
-struct gc_proc_def {
+typedef struct gc_proc_def {
#if defined(__SPU__)
gc_spu_proc_t proc;
#else
uint32_t proc;
#endif
char name[28];
-};
+} _AL16 gc_proc_def_t;
#if defined(__SPU__)
Modified: gnuradio/branches/developers/eb/gcell-wip/src/include/gc_spu_args.h
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/src/include/gc_spu_args.h
2008-02-29 07:04:31 UTC (rev 7895)
+++ gnuradio/branches/developers/eb/gcell-wip/src/include/gc_spu_args.h
2008-02-29 07:34:58 UTC (rev 7896)
@@ -30,6 +30,8 @@
gc_eaddr_t comp_info[2]; // completion info (gc_comp_info_t *)
uint32_t spu_idx; // which spu we are: [0,nspus-1]
uint32_t nspus; // number of spus we're using
+ uint32_t proc_def_ls_addr; // LS addr of proc_def table
+ uint32_t nproc_defs; // number of proc_defs in table
} _AL16 gc_spu_args_t;
Modified:
gnuradio/branches/developers/eb/gcell-wip/src/lib/gc_job_manager_impl.cc
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/src/lib/gc_job_manager_impl.cc
2008-02-29 07:04:31 UTC (rev 7895)
+++ gnuradio/branches/developers/eb/gcell-wip/src/lib/gc_job_manager_impl.cc
2008-02-29 07:34:58 UTC (rev 7896)
@@ -116,7 +116,7 @@
d_eh_cond(&d_eh_mutex), d_eh_thread(0), d_eh_state(EHS_INIT),
d_shutdown_requested(false),
d_client_thread(0), d_ea_args_maxsize(0),
- d_proc_defs(0), d_nproc_defs(0)
+ d_proc_def(0), d_proc_def_ls_addr(0), d_nproc_defs(0)
{
if (!s_key_initialized){
int r = pthread_key_create(&s_client_key, client_key_destructor);
@@ -218,7 +218,7 @@
// get a handle to the spe program
// FIXME pass this in (or something)
- const char *spu_progname = "../lib/spu/gcell_spu_main";
+ const char *spu_progname = "../lib/spu/gcell_qa";
spe_program_handle_t *spe_image = spe_image_open(spu_progname);
if (spe_image == 0){
@@ -231,10 +231,11 @@
// fish proc_def table out of SPE ELF file
- if (!gcpd_find_table(d_spe_image.get(), &d_proc_defs, &d_nproc_defs)){
+ if (!gcpd_find_table(d_spe_image.get(), &d_proc_def, &d_nproc_defs,
&d_proc_def_ls_addr)){
fprintf(stderr, "gc_job_manager_impl: couldn't find gc_proc_defs in SPE
ELF file.\n");
throw std::runtime_error("no gc_proc_defs");
}
+ // fprintf(stderr, "d_proc_def_ls_addr = 0x%0x\n", d_proc_def_ls_addr);
int spe_flags = (SPE_EVENTS_ENABLE
| SPE_CFG_SIGNOTIFY1_OR
@@ -254,6 +255,8 @@
d_worker[i].spu_args->comp_info[1] = ptr_to_ea(&d_comp_info[2*i+1]);
d_worker[i].spu_args->spu_idx = i;
d_worker[i].spu_args->nspus = d_options.nspes;
+ d_worker[i].spu_args->proc_def_ls_addr = d_proc_def_ls_addr;
+ d_worker[i].spu_args->nproc_defs = d_nproc_defs;
d_worker[i].state = WS_INIT;
int r = spe_program_load(d_worker[i].spe_ctx, spe_image);
@@ -1156,13 +1159,13 @@
////////////////////////////////////////////////////////////////////////
//
-// lookup proc names in d_proc_defs table
+// lookup proc names in d_proc_def table
gc_proc_id_t
gc_job_manager_impl::lookup_proc(const std::string &proc_name)
{
- for (size_t i = 0; i < d_nproc_defs; i++)
- if (proc_name == d_proc_defs[i].name)
+ for (int i = 0; i < d_nproc_defs; i++)
+ if (proc_name == d_proc_def[i].name)
return i;
return GCP_UNKNOWN_PROC;
@@ -1172,8 +1175,8 @@
gc_job_manager_impl::proc_names()
{
std::vector<std::string> r;
- for (size_t i = 0; i < d_nproc_defs; i++)
- r.push_back(d_proc_defs[i].name);
+ for (int i = 0; i < d_nproc_defs; i++)
+ r.push_back(d_proc_def[i].name);
return r;
}
Modified:
gnuradio/branches/developers/eb/gcell-wip/src/lib/gc_job_manager_impl.h
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/src/lib/gc_job_manager_impl.h
2008-02-29 07:04:31 UTC (rev 7895)
+++ gnuradio/branches/developers/eb/gcell-wip/src/lib/gc_job_manager_impl.h
2008-02-29 07:34:58 UTC (rev 7896)
@@ -135,7 +135,8 @@
int d_ea_args_maxsize;
- struct gc_proc_def *d_proc_defs; // the SPE procedure table
+ struct gc_proc_def *d_proc_def; // the SPE procedure table
+ uint32_t d_proc_def_ls_addr; // the LS address of the table
int d_nproc_defs; // number of proc_defs in table
gc_client_thread_info *alloc_cti();
Modified: gnuradio/branches/developers/eb/gcell-wip/src/lib/gc_proc_def_utils.cc
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/src/lib/gc_proc_def_utils.cc
2008-02-29 07:04:31 UTC (rev 7895)
+++ gnuradio/branches/developers/eb/gcell-wip/src/lib/gc_proc_def_utils.cc
2008-02-29 07:34:58 UTC (rev 7896)
@@ -48,7 +48,8 @@
* section are gc_proc_def's
*/
bool
-gcpd_find_table(spe_program_handle_t *handle, struct gc_proc_def **table, int
*nentries)
+gcpd_find_table(spe_program_handle_t *handle,
+ struct gc_proc_def **table, int *nentries, uint32_t *ls_addr)
{
if (!handle || !table || !nentries)
return false;
@@ -102,7 +103,7 @@
for (sh = shdr; sh < &shdr[ehdr->e_shnum]; sh++){
if (0){
- fprintf(stderr, "section name: %s ( start: 0x%04x, size: 0x%04x)\n",
+ fprintf(stderr, "section name: %s (start: 0x%04x, size: 0x%04x)\n",
str_table + sh->sh_name, sh->sh_offset, sh->sh_size);
}
@@ -113,6 +114,7 @@
return false;
}
*nentries = sh->sh_size / sizeof(struct gc_proc_def);
+ *ls_addr = sh->sh_addr;
return true;
}
}
Modified: gnuradio/branches/developers/eb/gcell-wip/src/lib/gc_proc_def_utils.h
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/src/lib/gc_proc_def_utils.h
2008-02-29 07:04:31 UTC (rev 7895)
+++ gnuradio/branches/developers/eb/gcell-wip/src/lib/gc_proc_def_utils.h
2008-02-29 07:34:58 UTC (rev 7896)
@@ -30,11 +30,13 @@
* \param[in] program is the handle to the loaded SPE program
* \param[out] table points to the table, if it's found
* \param[out] nentries is set to the number of entries in the table.
+ * \param[out] ls_addr is set to the Local Store address of the table
*
* \returns true if successful, else false
*/
bool
-gcpd_find_table(spe_program_handle_t *program, struct gc_proc_def **table, int
*nentries);
+gcpd_find_table(spe_program_handle_t *program,
+ struct gc_proc_def **table, int *nentries, uint32_t *ls_addr);
#endif /* INCLUDED_GC_PROC_DEF_UTILS_H */
Property changes on: gnuradio/branches/developers/eb/gcell-wip/src/lib/spu
___________________________________________________________________
Name: svn:ignore
- Makefile
Makefile.in
*.a
*.la
*.lo
.deps
.libs
test_spu
gcell_spu_main
+ Makefile
Makefile.in
*.a
*.la
*.lo
.deps
.libs
test_spu
gcell_spu_main
gcell_qa
Modified: gnuradio/branches/developers/eb/gcell-wip/src/lib/spu/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/src/lib/spu/Makefile.am
2008-02-29 07:04:31 UTC (rev 7895)
+++ gnuradio/branches/developers/eb/gcell-wip/src/lib/spu/Makefile.am
2008-02-29 07:34:58 UTC (rev 7896)
@@ -30,8 +30,8 @@
libgcell_spu_a_SOURCES = \
gc_delay.c \
gc_spu_jd_queue.c \
- gc_spu_procs.c \
- spu_buffers.c
+ spu_buffers.c \
+ gcell_spu_main.c
# SPU executables
@@ -39,4 +39,6 @@
LDADD = libgcell_spu.a
noinst_PROGRAMS = \
- gcell_spu_main
+ gcell_qa
+
+gcell_qa_SOURCES = gc_spu_procs.c
Modified: gnuradio/branches/developers/eb/gcell-wip/src/lib/spu/gc_spu_procs.c
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/src/lib/spu/gc_spu_procs.c
2008-02-29 07:04:31 UTC (rev 7895)
+++ gnuradio/branches/developers/eb/gcell-wip/src/lib/spu/gc_spu_procs.c
2008-02-29 07:34:58 UTC (rev 7896)
@@ -19,7 +19,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include <gc_spu_procs.h>
#include <gc_delay.h>
#include <gc_declare_proc.h>
#include <string.h>
@@ -30,17 +29,17 @@
// FIXME move these out of here; only for QA usage
static void
-gcp_qa_nop(const gc_job_direct_args_t *input _UNUSED,
- gc_job_direct_args_t *output _UNUSED,
- const gc_job_ea_args_t *eaa _UNUSED)
+qa_nop(const gc_job_direct_args_t *input _UNUSED,
+ gc_job_direct_args_t *output _UNUSED,
+ const gc_job_ea_args_t *eaa _UNUSED)
{
}
static void
-gcp_qa_udelay(const gc_job_direct_args_t *input,
- gc_job_direct_args_t *output _UNUSED,
- const gc_job_ea_args_t *eaa _UNUSED)
+qa_udelay(const gc_job_direct_args_t *input,
+ gc_job_direct_args_t *output _UNUSED,
+ const gc_job_ea_args_t *eaa _UNUSED)
{
gc_udelay(input->arg[0].u32);
}
@@ -56,9 +55,9 @@
}
static void
-gcp_qa_sum_shorts(const gc_job_direct_args_t *input _UNUSED,
- gc_job_direct_args_t *output,
- const gc_job_ea_args_t *eaa)
+qa_sum_shorts(const gc_job_direct_args_t *input _UNUSED,
+ gc_job_direct_args_t *output,
+ const gc_job_ea_args_t *eaa)
{
for (unsigned int i = 0; i < eaa->nargs; i++){
short *p = eaa->arg[i].ls_addr;
@@ -76,9 +75,9 @@
}
static void
-gcp_qa_put_seq(const gc_job_direct_args_t *input,
- gc_job_direct_args_t *output _UNUSED,
- const gc_job_ea_args_t *eaa)
+qa_put_seq(const gc_job_direct_args_t *input,
+ gc_job_direct_args_t *output _UNUSED,
+ const gc_job_ea_args_t *eaa)
{
int counter = input->arg[0].s32;
@@ -91,9 +90,9 @@
}
static void
-gcp_qa_put_zeros(const gc_job_direct_args_t *input _UNUSED,
- gc_job_direct_args_t *output _UNUSED,
- const gc_job_ea_args_t *eaa)
+qa_put_zeros(const gc_job_direct_args_t *input _UNUSED,
+ gc_job_direct_args_t *output _UNUSED,
+ const gc_job_ea_args_t *eaa)
{
for (unsigned int i = 0; i < eaa->nargs; i++){
if (eaa->arg[i].direction == GCJD_DMA_PUT)
@@ -102,9 +101,9 @@
}
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)
+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
@@ -121,19 +120,10 @@
memcpy(eaa->arg[0].ls_addr, eaa->arg[1].ls_addr, n);
}
-GC_DECLARE_PROC(gcp_qa_nop, "qa_nop");
-GC_DECLARE_PROC(gcp_qa_udelay, "qa_udelay");
-GC_DECLARE_PROC(gcp_qa_sum_shorts, "qa_sum_shorts");
-GC_DECLARE_PROC(gcp_qa_put_seq, "qa_put_seq");
-GC_DECLARE_PROC(gcp_qa_put_zeros, "qa_put_zeros");
-GC_DECLARE_PROC(gcp_qa_copy, "qa_copy");
+GC_DECLARE_PROC(qa_nop, "qa_nop");
+GC_DECLARE_PROC(qa_udelay, "qa_udelay");
+GC_DECLARE_PROC(qa_sum_shorts, "qa_sum_shorts");
+GC_DECLARE_PROC(qa_put_seq, "qa_put_seq");
+GC_DECLARE_PROC(qa_put_zeros, "qa_put_zeros");
+GC_DECLARE_PROC(qa_copy, "qa_copy");
-
-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_PUT_ZEROS] = gcp_qa_put_zeros,
- [GCP_QA_COPY] = gcp_qa_copy,
-};
Deleted: gnuradio/branches/developers/eb/gcell-wip/src/lib/spu/gc_spu_procs.h
Modified: gnuradio/branches/developers/eb/gcell-wip/src/lib/spu/gcell_spu_main.c
===================================================================
--- gnuradio/branches/developers/eb/gcell-wip/src/lib/spu/gcell_spu_main.c
2008-02-29 07:04:31 UTC (rev 7895)
+++ gnuradio/branches/developers/eb/gcell-wip/src/lib/spu/gcell_spu_main.c
2008-02-29 07:34:58 UTC (rev 7896)
@@ -28,7 +28,7 @@
#include "gc_mbox.h"
#include "gc_jd_queue.h"
#include "gc_delay.h"
-#include "gc_spu_procs.h"
+#include "gc_declare_proc.h"
#include "spu_buffers.h"
#include <string.h>
#include <assert.h>
@@ -50,6 +50,8 @@
int gc_sys_tag; // tag for misc DMA operations
static gc_spu_args_t spu_args;
+static struct gc_proc_def *gc_proc_def; // procedure entry points
+
// ------------------------------------------------------------------------
// state for DMA'ing arguments in and out
@@ -163,7 +165,7 @@
17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 21, 21
};
-void
+static void
backoff_init(void)
{
_backoff_cap = (1 << (log2_backoff_cap[(spu_args.nspus - 1) & 0xf])) - 1;
@@ -172,13 +174,13 @@
backoff = _backoff_start;
}
-void
+static void
backoff_reset(void)
{
backoff = _backoff_start;
}
-void
+static void
backoff_delay(void)
{
gc_cdelay(backoff);
@@ -261,14 +263,13 @@
{
jd->status = JS_OK; // assume success
- if (jd->proc_id >= GCP_NPROC_IDS || gc_proc_table[jd->proc_id] == 0){
+ if (jd->proc_id >= spu_args.nproc_defs)
jd->status = JS_UNKNOWN_PROC;
- }
-
+
else {
if (jd->eaa.nargs == 0)
- (*gc_proc_table[jd->proc_id])(&jd->input, &jd->output, &jd->eaa);
+ (*gc_proc_def[jd->proc_id].proc)(&jd->input, &jd->output, &jd->eaa);
else { // handle EA args that must be DMA'd in/out
@@ -400,8 +401,9 @@
mfc_read_tag_status_all(); // wait for DMA to complete
// do the work
- (*gc_proc_table[jd->proc_id])(&jd->input, &jd->output, eaa);
+ (*gc_proc_def[jd->proc_id].proc)(&jd->input, &jd->output, &jd->eaa);
+
// Do we have any "put" args? If so copy them out
if (jd->sys.direction_union & GCJD_DMA_PUT){
@@ -640,6 +642,9 @@
mfc_write_tag_mask(1 << gc_sys_tag); // the tag we're interested in
mfc_read_tag_status_all(); // wait for DMA to complete
+ // initialize pointer to procedure entry table
+ gc_proc_def = (gc_proc_def_t *) spu_args.proc_def_ls_addr;
+
backoff_init(); // initialize backoff parameters
main_loop();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r7896 - in gnuradio/branches/developers/eb/gcell-wip/src: include lib lib/spu,
eb <=