summaryrefslogtreecommitdiff
path: root/gcell/src/lib/runtime/spu/gc_main.c
diff options
context:
space:
mode:
authoreb2008-06-19 00:06:42 +0000
committereb2008-06-19 00:06:42 +0000
commitdf0ae475f782814c95d4f9be166aaffbcc7d47b1 (patch)
treecd7076e4a5fb524b393e8ad9d9a5ef29e7a8e5da /gcell/src/lib/runtime/spu/gc_main.c
parenta22202008689a4a893c29af118febf5c57cb8103 (diff)
downloadgnuradio-df0ae475f782814c95d4f9be166aaffbcc7d47b1.tar.gz
gnuradio-df0ae475f782814c95d4f9be166aaffbcc7d47b1.tar.bz2
gnuradio-df0ae475f782814c95d4f9be166aaffbcc7d47b1.zip
Merged eb/gcell-wip -r8559:8571 into trunk. The shared queue
structure is slightly modified, and the spu dequeue has been streamlined. In addition, the spu Lost-Lock Line Reservation event is now work correctly, though it is still disabled because it's slower than the expontial backoff alternative. git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@8618 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'gcell/src/lib/runtime/spu/gc_main.c')
-rw-r--r--gcell/src/lib/runtime/spu/gc_main.c36
1 files changed, 32 insertions, 4 deletions
diff --git a/gcell/src/lib/runtime/spu/gc_main.c b/gcell/src/lib/runtime/spu/gc_main.c
index 867a21de8..1e5b03de2 100644
--- a/gcell/src/lib/runtime/spu/gc_main.c
+++ b/gcell/src/lib/runtime/spu/gc_main.c
@@ -31,6 +31,7 @@
#include "gc_jd_queue.h"
#include "gc_delay.h"
#include "gc_declare_proc.h"
+#include "gc_random.h"
#include "spu_buffers.h"
#include <string.h>
#include <assert.h>
@@ -195,6 +196,8 @@ backoff_reset(void)
backoff = _backoff_start;
}
+#if 0
+
static void
backoff_delay(void)
{
@@ -204,6 +207,25 @@ backoff_delay(void)
backoff = ((backoff << 1) + 1) & _backoff_cap;
}
+#else
+
+#define RANDOM_WEIGHT 0.2
+
+static void
+backoff_delay(void)
+{
+ gc_cdelay(backoff);
+
+ backoff = ((backoff << 1) + 1);
+ if (backoff > _backoff_cap)
+ backoff = _backoff_cap;
+
+ float r = (RANDOM_WEIGHT * (2.0 * (gc_uniform_deviate() - 0.5)));
+ backoff = backoff * (1.0 + r);
+}
+
+#endif
+
// ------------------------------------------------------------------------
static inline unsigned int
@@ -565,9 +587,15 @@ main_loop(void)
gc_eaddr_t jd_ea;
int total_jobs = 0;
+#if (USE_LLR_LOST_EVENT)
// setup events
spu_writech(SPU_WrEventMask, MFC_LLR_LOST_EVENT);
- gc_jd_queue_getllar(spu_args.queue); // get a line reservation on the queue
+
+ // prime the pump
+ while (gc_jd_queue_dequeue(spu_args.queue, &jd_ea, ci_tags + ci_idx, &jd))
+ process_job(jd_ea, &jd);
+ // we're now holding a lock-line reservation
+#endif
while (1){
@@ -590,10 +618,8 @@ main_loop(void)
// by somebody doing something to the queue. Go look and see
// if there's anything for us.
//
- if (gc_jd_queue_dequeue(spu_args.queue, &jd_ea, ci_tags + ci_idx, &jd))
+ while (gc_jd_queue_dequeue(spu_args.queue, &jd_ea, ci_tags + ci_idx, &jd))
process_job(jd_ea, &jd);
-
- gc_jd_queue_getllar(spu_args.queue); // get a new reservation
}
//
@@ -669,6 +695,8 @@ main(unsigned long long spe_id __attribute__((unused)),
// initialize pointer to procedure entry table
gc_proc_def = (gc_proc_def_t *) spu_args.proc_def_ls_addr;
+ gc_set_seed(spu_args.spu_idx);
+
// initialize logging
_gc_log_init(spu_args.log);