commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r6556 - gnuradio/branches/developers/matt/u2f/firmware


From: eb
Subject: [Commit-gnuradio] r6556 - gnuradio/branches/developers/matt/u2f/firmware
Date: Thu, 27 Sep 2007 12:50:35 -0600 (MDT)

Author: eb
Date: 2007-09-27 12:50:35 -0600 (Thu, 27 Sep 2007)
New Revision: 6556

Modified:
   gnuradio/branches/developers/matt/u2f/firmware/buffer_pool.h
   gnuradio/branches/developers/matt/u2f/firmware/test1_main.c
   gnuradio/branches/developers/matt/u2f/firmware/timer_test.c
   gnuradio/branches/developers/matt/u2f/firmware/u2_init.c
   gnuradio/branches/developers/matt/u2f/firmware/u2_init.h
Log:
more firmware cleanup

Modified: gnuradio/branches/developers/matt/u2f/firmware/buffer_pool.h
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/buffer_pool.h        
2007-09-27 18:28:21 UTC (rev 6555)
+++ gnuradio/branches/developers/matt/u2f/firmware/buffer_pool.h        
2007-09-27 18:50:35 UTC (rev 6556)
@@ -7,8 +7,6 @@
 
 void bp_init(void);
 
-#if 1
-
 static inline void
 bp_clear_buf(int bufnum)
 {
@@ -44,31 +42,4 @@
                            | BPC_LAST_LINE(ll));
 }
 
-#else
-
-static inline void
-bp_clear_buf(int bufnum) {
-  volatile int *addr = (int *)BUFFER_POOL_RAM_BASE;
-  *addr = (bufnum << 28) | (4<<25) | (1<<24);  // disable port connections to 
this buffer, clear state
-}
-
-static inline void
-bp_disable_port(int portnum) {
-  volatile int *addr = (int *)(BUFFER_POOL_RAM_BASE);
-  *addr = (8 << 28) | (portnum<<25); // disable buffer connections to this port
-}
-
-static inline void
-bp_receive_to_buf(int bufnum, int port, int step, int fl, int ll) {
-  volatile int *addr = (int *)(BUFFER_POOL_RAM_BASE);
-  *addr = (bufnum<<28) | (port << 25) | (1<<23) | (step<<18) | (ll<<9) | fl;
-}
-
-static inline void
-bp_send_from_buf(int bufnum, int port, int step, int fl, int ll) {
-  volatile int *addr = (int *)(BUFFER_POOL_RAM_BASE);
-  *addr = (bufnum<<28) | (port << 25) | (1<<22) | (step<<18) | (ll<<9) | fl;
-}
 #endif
-
-#endif

Modified: gnuradio/branches/developers/matt/u2f/firmware/test1_main.c
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/test1_main.c 2007-09-27 
18:28:21 UTC (rev 6555)
+++ gnuradio/branches/developers/matt/u2f/firmware/test1_main.c 2007-09-27 
18:50:35 UTC (rev 6556)
@@ -30,8 +30,6 @@
   double_buffering(PORT);
 }
 
-static volatile int not_done = 1;      // FIXME CPU bug workaround
-
 int
 main(void)
 {
@@ -74,33 +72,26 @@
   dsp_tx_idle = 1;
   bp_receive_to_buf(2, PORT, 1, 5, 504);
 
+  while (buffer_pool_status->status == 0)  // wait for completion of DSP RX
+    ;
 
-  volatile unsigned int *status = (unsigned int *) 0xB020;
-  while (*status == 0)
-    {}
-
   sim_puts("Done DSP TX setup\n");
   dsp_tx_regs->run_tx = 1;
 
   // register interrupt handler
   pic_register_handler(IRQ_BUFFER, buffer_irq_handler);
 
-  while(not_done){
-  }
-  asm volatile ("or r0, r0, r0");      // FIXME CPU bug workaround
-  asm volatile ("or r0, r0, r0");
+  u2_infinite_loop();
 
-
   sim_finish();
   return 1;
 }
 
 void 
 double_buffering(int port) {
-  unsigned int *status = (unsigned int *) 0xB020;
-  unsigned int localstatus = *status;
+  unsigned int localstatus = buffer_pool_status->status;
 
-  if(localstatus & 1) {
+  if(localstatus & BPS_DONE_0) {
     bp_clear_buf(0);
     if(buffer_state[0] == FILLING) {
       buffer_state[0] = FULL;
@@ -132,7 +123,7 @@
     }
     sim_puts("Int Proc'ed 0\n");
   }
-  if(localstatus & 2) {
+  if(localstatus & BPS_DONE_1) {
     bp_clear_buf(1);
     if(buffer_state[1] == FILLING) {
       buffer_state[1] = FULL;
@@ -164,7 +155,7 @@
     }
   sim_puts("Int Proc'ed 1\n");
   }
-  if(localstatus & 4) {
+  if(localstatus & BPS_DONE_2) {
     bp_clear_buf(2);
     if(buffer_state[2] == FILLING) {
       buffer_state[2] = FULL;
@@ -196,7 +187,7 @@
     }
   sim_puts("Int Proc'ed 2\n");
   }
-  if(localstatus & 8) {
+  if(localstatus & BPS_DONE_3) {
     bp_clear_buf(3);
     if(buffer_state[3] == FILLING) {
       buffer_state[3] = FULL;

Modified: gnuradio/branches/developers/matt/u2f/firmware/timer_test.c
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/timer_test.c 2007-09-27 
18:28:21 UTC (rev 6555)
+++ gnuradio/branches/developers/matt/u2f/firmware/timer_test.c 2007-09-27 
18:50:35 UTC (rev 6556)
@@ -18,8 +18,6 @@
   sim_puthex_nl(t);
 }
 
-static volatile int not_done = 1;      // FIXME CPU bug workaround
-
 int
 main(void)
 {
@@ -33,10 +31,7 @@
   int t = timer_regs->time;
   timer_regs->time = t + DELTA_T;
 
-  while(not_done){
-  }
-  asm volatile ("or r0, r0, r0");      // FIXME CPU bug workaround
-  asm volatile ("or r0, r0, r0");
+  u2_infinite_loop();
 
   sim_puts("Done Testing\n");
   

Modified: gnuradio/branches/developers/matt/u2f/firmware/u2_init.c
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/u2_init.c    2007-09-27 
18:28:21 UTC (rev 6555)
+++ gnuradio/branches/developers/matt/u2f/firmware/u2_init.c    2007-09-27 
18:50:35 UTC (rev 6556)
@@ -69,3 +69,17 @@
   bp_init();
   return 1;
 }
+
+
+// work around for microblaze CPU bug
+
+static int _not_done_ = 1;
+
+void
+u2_infinite_loop(void)
+{
+  while(_not_done_){
+  }
+  asm volatile ("or r0, r0, r0");      // FIXME CPU bug workaround
+  asm volatile ("or r0, r0, r0");
+}

Modified: gnuradio/branches/developers/matt/u2f/firmware/u2_init.h
===================================================================
--- gnuradio/branches/developers/matt/u2f/firmware/u2_init.h    2007-09-27 
18:28:21 UTC (rev 6555)
+++ gnuradio/branches/developers/matt/u2f/firmware/u2_init.h    2007-09-27 
18:50:35 UTC (rev 6556)
@@ -1,2 +1,9 @@
+/*!
+ * one-time init
+ */
 int u2_init(void);
 
+/*!
+ * infinte loop that works around CPU bug and allows interrupts to occur ;)
+ */
+void u2_infinite_loop(void);





reply via email to

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