commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r7851 - gnuradio/branches/developers/eb/gcell/src/lib/


From: eb
Subject: [Commit-gnuradio] r7851 - gnuradio/branches/developers/eb/gcell/src/lib/spu
Date: Tue, 26 Feb 2008 16:26:52 -0700 (MST)

Author: eb
Date: 2008-02-26 16:26:52 -0700 (Tue, 26 Feb 2008)
New Revision: 7851

Modified:
   gnuradio/branches/developers/eb/gcell/src/lib/spu/gcell_spu_main.c
Log:
minor cleanup

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-26 23:14:44 UTC (rev 7850)
+++ gnuradio/branches/developers/eb/gcell/src/lib/spu/gcell_spu_main.c  
2008-02-26 23:26:52 UTC (rev 7851)
@@ -208,28 +208,33 @@
   return ~(~0 << nbits);
 }
 
+static unsigned int   dc_work;
+static int            dc_put_tag;
+static unsigned char *dc_ls_base;
+static gc_eaddr_t     dc_ea_base;
+
 // divide and conquer
 static void
-d_and_c(unsigned int work,  unsigned int offset, unsigned int len,
-       int put_tag, unsigned char *ls_base, gc_eaddr_t ea_base)
+d_and_c(unsigned int offset, unsigned int len)
 {
   unsigned int mask = make_mask(len) << offset;
-  unsigned int t = mask & work;
+  unsigned int t = mask & dc_work;
   if (t == 0)          // nothing to do
     return;
   if (t == mask){      // got a match, generate dma
-    mfc_put(ls_base + offset, ea_base + offset, len, put_tag, 0, 0);
+    mfc_put(dc_ls_base + offset, dc_ea_base + offset, len, dc_put_tag, 0, 0);
   }
   else {
     len >>= 1;
-    d_and_c(work, offset, len, put_tag, ls_base, ea_base);
-    d_and_c(work, offset + len, len, put_tag, ls_base, ea_base);
+    d_and_c(offset, len);
+    d_and_c(offset + len, len);
   }
 }
 
 static void
 handle_slow_and_tedious_dma(gc_eaddr_t ea, unsigned char *ls, unsigned int 
len, int put_tag)
 {
+  // special case two likely cases, otherwise handle with divide and conquer
   unsigned int t = (((uintptr_t) ls) | len) & 0x7;
   if (1 && t == 0){            // 8 byte aligned and len is multiple of 8
     mfc_put(ls, ea, 8, put_tag, 0, 0);
@@ -246,15 +251,16 @@
     }
   }
   else {
-    // general case (divide and conquer)
+    // General case (divide and conquer)
+    // This code is also correct for the two cases above
     unsigned int alignment = ((uintptr_t) ls) & 0x7;
-    unsigned int work = make_mask(len) << alignment;
-    unsigned char *ls_base = (unsigned char *) ROUND_DN((uintptr_t) ls, 8);
-    gc_eaddr_t ea_base = ROUND_DN(ea, (gc_eaddr_t) 8);
+    dc_work = make_mask(len) << alignment;
+    dc_ls_base = (unsigned char *) ROUND_DN((uintptr_t) ls, 8);
+    dc_ea_base = ROUND_DN(ea, (gc_eaddr_t) 8);
 
-    d_and_c(work,  0, 8, put_tag, ls_base, ea_base);
-    d_and_c(work,  8, 8, put_tag, ls_base, ea_base);
-    d_and_c(work, 16, 8, put_tag, ls_base, ea_base);
+    d_and_c( 0, 8);
+    d_and_c( 8, 8);
+    d_and_c(16, 8);
   }
 }
 





reply via email to

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