[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r7081 - in gnuradio/branches/developers/eb/gcell/src:
From: |
eb |
Subject: |
[Commit-gnuradio] r7081 - in gnuradio/branches/developers/eb/gcell/src: ibm/sync/spu_source include lib/spu spu-include |
Date: |
Thu, 6 Dec 2007 18:11:27 -0700 (MST) |
Author: eb
Date: 2007-12-06 18:11:26 -0700 (Thu, 06 Dec 2007)
New Revision: 7081
Added:
gnuradio/branches/developers/eb/gcell/src/lib/spu/gc_spu_jd_queue.c
gnuradio/branches/developers/eb/gcell/src/lib/spu/sys_tags.c
gnuradio/branches/developers/eb/gcell/src/lib/spu/sys_tags.h
Modified:
gnuradio/branches/developers/eb/gcell/src/ibm/sync/spu_source/sync_utils.h
gnuradio/branches/developers/eb/gcell/src/include/compiler.h
gnuradio/branches/developers/eb/gcell/src/include/gc_job_desc_private.h
gnuradio/branches/developers/eb/gcell/src/include/gc_types.h
gnuradio/branches/developers/eb/gcell/src/lib/spu/
gnuradio/branches/developers/eb/gcell/src/lib/spu/Makefile.am
gnuradio/branches/developers/eb/gcell/src/lib/spu/test_spu.c
gnuradio/branches/developers/eb/gcell/src/spu-include/gc_jd_queue.h
Log:
work-in-progress on cell job manager
Modified:
gnuradio/branches/developers/eb/gcell/src/ibm/sync/spu_source/sync_utils.h
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/ibm/sync/spu_source/sync_utils.h
2007-12-07 00:37:15 UTC (rev 7080)
+++ gnuradio/branches/developers/eb/gcell/src/ibm/sync/spu_source/sync_utils.h
2007-12-07 01:11:26 UTC (rev 7081)
@@ -59,11 +59,12 @@
u32 ui[2];
} addr64;
+#ifndef likely
#define likely(_c) \
__builtin_expect((_c), 1)
-
#define unlikely(_c) \
__builtin_expect((_c), 0)
+#endif
#define ALLOCA(_nbytes, _size) \
alloca((_nbytes) + (_size)-1)
Modified: gnuradio/branches/developers/eb/gcell/src/include/compiler.h
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/include/compiler.h
2007-12-07 00:37:15 UTC (rev 7080)
+++ gnuradio/branches/developers/eb/gcell/src/include/compiler.h
2007-12-07 01:11:26 UTC (rev 7081)
@@ -30,8 +30,14 @@
#define _AL16 __attribute__((aligned (16)))
#define _AL128 __attribute__((aligned (128)))
+#ifndef likely
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
+#endif
+#ifndef offsetof
+#define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER)
+#endif
+
#endif /* INCLUDED_COMPILER_H */
Modified:
gnuradio/branches/developers/eb/gcell/src/include/gc_job_desc_private.h
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/include/gc_job_desc_private.h
2007-12-07 00:37:15 UTC (rev 7080)
+++ gnuradio/branches/developers/eb/gcell/src/include/gc_job_desc_private.h
2007-12-07 01:11:26 UTC (rev 7081)
@@ -29,13 +29,9 @@
*/
typedef struct gc_job_desc_private
{
- volatile gc_eaddr_t next; // used to implement job queue and free
list
- uint16_t job_id;
-
- // FIXME:
- // notifier_method
- // notifier_arg
-
+ gc_eaddr_t next; // used to implement job queue and free list
+ uint16_t job_id;
+ uint16_t client_id;
} gc_job_desc_private_t;
#endif /* INCLUDED_GC_JOB_PRIVATE_H */
Modified: gnuradio/branches/developers/eb/gcell/src/include/gc_types.h
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/include/gc_types.h
2007-12-07 00:37:15 UTC (rev 7080)
+++ gnuradio/branches/developers/eb/gcell/src/include/gc_types.h
2007-12-07 01:11:26 UTC (rev 7081)
@@ -28,6 +28,12 @@
__GC_BEGIN_DECLS
+#ifndef __cplusplus
+typedef int bool;
+#define true 1
+#define false 0
+#endif
+
/*!
* \brief 64-bit integer type representing an effective address (EA)
*
Property changes on: gnuradio/branches/developers/eb/gcell/src/lib/spu
___________________________________________________________________
Name: svn:ignore
- Makefile
Makefile.in
.la
.lo
.deps
.libs
*.la
*.lo
test_spu
+ Makefile
Makefile.in
*.a
*.la
*.lo
.deps
.libs
test_spu
Modified: gnuradio/branches/developers/eb/gcell/src/lib/spu/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/lib/spu/Makefile.am
2007-12-07 00:37:15 UTC (rev 7080)
+++ gnuradio/branches/developers/eb/gcell/src/lib/spu/Makefile.am
2007-12-07 01:11:26 UTC (rev 7081)
@@ -23,14 +23,34 @@
CC=spu-cc
LD=spu-ld
-# Need to override user stuff (for PPU) even though it gives a warning
+WARNINGS = \
+ -Wall -Wextra -Wstrict-prototypes -Werror-implicit-function-declaration
+
+# Need to override user stuff even though it gives a warning.
+# (Otherwise these contain PPE related info.)
+
CPPFLAGS=
LDFLAGS=
+CFLAGS = -O3 --std=gnu99 -fstrict-aliasing $(WARNINGS)
+# -funroll-all-loops
-
include $(top_srcdir)/Makefile.common
AM_CPPFLAGS = $(SPU_DEFINES_AND_INCLUDES) $(IBM_SPU_SYNC_INCLUDES)
+# libraray of SPU code
+
+noinst_LIBRARIES = \
+ libgcell_spu.a
+
+libgcell_spu_a_SOURCES = \
+ gc_spu_jd_queue.c \
+ sys_tags.c
+
+
+# SPU executables
+
+LDADD = libgcell_spu.a
+
noinst_PROGRAMS = \
test_spu
Added: gnuradio/branches/developers/eb/gcell/src/lib/spu/gc_spu_jd_queue.c
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/lib/spu/gc_spu_jd_queue.c
(rev 0)
+++ gnuradio/branches/developers/eb/gcell/src/lib/spu/gc_spu_jd_queue.c
2007-12-07 01:11:26 UTC (rev 7081)
@@ -0,0 +1,66 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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.
+ */
+
+#include "gc_jd_queue.h"
+#include "mutex_lock.h"
+#include "mutex_unlock.h"
+#include "sys_tags.h"
+
+bool
+gc_jd_queue_dequeue(gc_eaddr_t q, gc_eaddr_t *item_ea, gc_job_desc_t *item)
+{
+ gc_jd_queue_t local_q;
+
+ _mutex_lock(q + offsetof(gc_jd_queue_t, mutex));
+
+ // copy in the queue structure
+ mfc_get(&local_q, q, sizeof(gc_jd_queue_t), sys_tag, 0, 0);
+ mfc_write_tag_mask(1 << sys_tag); // the tag we're interested in
+ mfc_read_tag_status_all(); // wait for DMA to complete
+
+ if (local_q.head == 0){ // empty
+ _mutex_unlock(q + offsetof(gc_jd_queue_t, mutex));
+ return false;
+ }
+
+ // copy in job descriptor at head of queue
+ *item_ea = local_q.head;
+ mfc_get(item, local_q.head, sizeof(gc_job_desc_t), sys_tag, 0, 0);
+ mfc_read_tag_status_all(); // wait for DMA to complete
+
+ local_q.head = item->sys.next;
+ item->sys.next = 0;
+ if (local_q.head == 0) // now empty?
+ local_q.tail = 0;
+
+
+ // copy the queue structure back out
+ mfc_put(&local_q, q, sizeof(gc_jd_queue_t), sys_tag, 0, 0);
+ mfc_read_tag_status_all(); // wait for DMA to complete
+
+ // FIXME do we need to order stores in EA or can we just clear the
+ // local copy of the mutex above and blast it out, removing the need
+ // for this explicit unlock?
+
+ _mutex_unlock(q + offsetof(gc_jd_queue_t, mutex));
+ return true;
+}
+
Property changes on:
gnuradio/branches/developers/eb/gcell/src/lib/spu/gc_spu_jd_queue.c
___________________________________________________________________
Name: svn:eol-style
+ native
Added: gnuradio/branches/developers/eb/gcell/src/lib/spu/sys_tags.c
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/lib/spu/sys_tags.c
(rev 0)
+++ gnuradio/branches/developers/eb/gcell/src/lib/spu/sys_tags.c
2007-12-07 01:11:26 UTC (rev 7081)
@@ -0,0 +1,30 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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.
+ */
+
+#include <spu_mfcio.h>
+
+unsigned int sys_tag;
+
+void
+sys_tags_init(void)
+{
+ sys_tag = mfc_tag_reserve(); // allocate a tag for our misc DMA operations
+}
Property changes on:
gnuradio/branches/developers/eb/gcell/src/lib/spu/sys_tags.c
___________________________________________________________________
Name: svn:eol-style
+ native
Added: gnuradio/branches/developers/eb/gcell/src/lib/spu/sys_tags.h
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/lib/spu/sys_tags.h
(rev 0)
+++ gnuradio/branches/developers/eb/gcell/src/lib/spu/sys_tags.h
2007-12-07 01:11:26 UTC (rev 7081)
@@ -0,0 +1,31 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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_SYS_TAGS_H
+#define INCLUDED_SYS_TAGS_H
+
+extern unsigned int sys_tag; // tag used by system for misc DMA operations
+
+void sys_tags_init(void);
+
+
+#endif /* INCLUDED_SYS_TAGS_H */
+
Property changes on:
gnuradio/branches/developers/eb/gcell/src/lib/spu/sys_tags.h
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: gnuradio/branches/developers/eb/gcell/src/lib/spu/test_spu.c
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/lib/spu/test_spu.c
2007-12-07 00:37:15 UTC (rev 7080)
+++ gnuradio/branches/developers/eb/gcell/src/lib/spu/test_spu.c
2007-12-07 01:11:26 UTC (rev 7081)
@@ -23,32 +23,75 @@
#include <spu_intrinsics.h>
#include <spu_mfcio.h>
#include "gc_spu_args.h"
+#include "gc_job_desc.h"
#include "gc_mbox.h"
+#include "sys_tags.h"
+#include "gc_jd_queue.h"
gc_spu_args_t spu_args;
-int main(unsigned long long spe_id,
- unsigned long long argp,
- unsigned long long envp)
+void
+process_job(gc_eaddr_t jd_ea, gc_job_desc_t *jd)
{
- int tag = 0;
+ // FIXME do something useful ;)
- // start the dma to get the args
- mfc_get(&spu_args, argp, sizeof(spu_args), tag, 0, 0);
+ printf("spu[%d]: job_id = %3d client_id = %3d\n",
+ spu_args.spu_idx, jd->sys.job_id, jd->sys.client_id);
- mfc_write_tag_mask(1 << tag); // the tag we're interested in
- mfc_read_tag_status_all(); // wait for DMA to complete
- printf("spu[%d] queue = 0x%llx\n", spu_args.spu_idx, spu_args.queue);
+ // FIXME lookup method
+ // FIXME copy indirect args in
+ // FIXME invoke method
+ // FIXME copy indirect args out
+ // FIXME copy jd back out
+ // Tell PPE we're done with the job
+ spu_writech(SPU_WrOutIntrMbox,
+ MK_MBOX_MSG(OP_JOB_DONE, jd->sys.job_id));
+}
+
+
+void
+main_loop(void)
+{
+ static gc_job_desc_t jd; // static gets us proper alignment
+ gc_eaddr_t jd_ea;
+
while (1){
+
+ // any msgs for us?
int cnt = spu_readchcnt(SPU_RdInMbox);
if (unlikely(cnt > 0)){
int msg = spu_readch(SPU_RdInMbox);
printf("spu[%d] mbox_msg: 0x%08x\n", spu_args.spu_idx, msg);
if (MBOX_MSG_OP(msg) == OP_EXIT)
- return 0;
+ return;
}
+
+ // try to get a job from the job queue
+ if (gc_jd_queue_dequeue(spu_args.queue, &jd_ea, &jd)){
+ process_job(jd_ea, &jd);
+ }
}
+}
+
+
+int
+main(unsigned long long spe_id __attribute__((unused)),
+ unsigned long long argp,
+ unsigned long long envp __attribute__((unused)))
+{
+ sys_tags_init();
+
+ // start the dma to get the args
+ mfc_get(&spu_args, argp, sizeof(spu_args), sys_tag, 0, 0);
+
+ mfc_write_tag_mask(1 << sys_tag); // the tag we're interested in
+ mfc_read_tag_status_all(); // wait for DMA to complete
+
+ printf("spu[%d] queue = 0x%llx\n", spu_args.spu_idx, spu_args.queue);
+
+ main_loop();
+
return 0;
}
Modified: gnuradio/branches/developers/eb/gcell/src/spu-include/gc_jd_queue.h
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/spu-include/gc_jd_queue.h
2007-12-07 00:37:15 UTC (rev 7080)
+++ gnuradio/branches/developers/eb/gcell/src/spu-include/gc_jd_queue.h
2007-12-07 01:11:26 UTC (rev 7081)
@@ -39,7 +39,7 @@
* \returns false if the queue is empty, otherwise returns true
* and sets \p item_ea and DMA's job descriptor into \p item
*/
-bool
+bool
gc_jd_queue_dequeue(gc_eaddr_t q, gc_eaddr_t *item_ea, gc_job_desc_t *item);
__GC_END_DECLS
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r7081 - in gnuradio/branches/developers/eb/gcell/src: ibm/sync/spu_source include lib/spu spu-include,
eb <=