commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r7392 - in usrp2/trunk/firmware: . apps lib


From: eb
Subject: [Commit-gnuradio] r7392 - in usrp2/trunk/firmware: . apps lib
Date: Thu, 10 Jan 2008 10:46:10 -0700 (MST)

Author: eb
Date: 2008-01-10 10:46:09 -0700 (Thu, 10 Jan 2008)
New Revision: 7392

Modified:
   usrp2/trunk/firmware/Makefile.common
   usrp2/trunk/firmware/apps/
   usrp2/trunk/firmware/apps/rx_only.c
   usrp2/trunk/firmware/apps/tx_only.c
   usrp2/trunk/firmware/lib/buffer_pool.h
   usrp2/trunk/firmware/lib/dbsm.c
   usrp2/trunk/firmware/lib/dbsm.h
Log:
merged -r7386:7391 eb/u2-precompute into u2-trunk.  Speeds up
ethernet handling by precomputing buffer ctrl words in dbsm.


Modified: usrp2/trunk/firmware/Makefile.common
===================================================================
--- usrp2/trunk/firmware/Makefile.common        2008-01-10 10:47:48 UTC (rev 
7391)
+++ usrp2/trunk/firmware/Makefile.common        2008-01-10 17:46:09 UTC (rev 
7392)
@@ -33,6 +33,7 @@
 
 LINKER_SCRIPT = $(top_srcdir)/lib/microblaze.ld
 #AM_LDFLAGS = -Wl,-T$(LINKER_SCRIPT) -Wl,-defsym -Wl,_STACK_SIZE=1024
+#AM_LDFLAGS = -Wl,-T$(LINKER_SCRIPT) -Wl,-Map -Wl,address@hidden
 AM_LDFLAGS = -Wl,-T$(LINKER_SCRIPT)
 
 


Property changes on: usrp2/trunk/firmware/apps
___________________________________________________________________
Name: svn:ignore
   - *-stamp
*.a
*.bin
*.dump
*.log
*.rom
.deps
Makefile
Makefile.in
aclocal.m4
autom4te.cache
blink_leds
blink_leds2
build
compile
config.h
config.h.in
config.log
config.status
configure
depcomp
eth_test
gen_eth_packets
ibs_rx_test
ibs_tx_test
install-sh
libtool
ltmain.sh
missing
py-compile
rcv_eth_packets
run_tests.sh
stamp-h1
test1
test_phy_comm
timer_test
buf_ram_test
buf_ram_zero
hello
test_printf
test_spi
test_i2c
gen_pause_frames
test_serdes
rx_only
tx_only
tx_standalone

   + *-stamp
*.a
*.bin
*.dump
*.log
*.rom
*.map
.deps
Makefile
Makefile.in
aclocal.m4
autom4te.cache
blink_leds
blink_leds2
build
compile
config.h
config.h.in
config.log
config.status
configure
depcomp
eth_test
gen_eth_packets
ibs_rx_test
ibs_tx_test
install-sh
libtool
ltmain.sh
missing
py-compile
rcv_eth_packets
run_tests.sh
stamp-h1
test1
test_phy_comm
timer_test
buf_ram_test
buf_ram_zero
hello
test_printf
test_spi
test_i2c
gen_pause_frames
test_serdes
rx_only
tx_only
tx_standalone


Modified: usrp2/trunk/firmware/apps/rx_only.c
===================================================================
--- usrp2/trunk/firmware/apps/rx_only.c 2008-01-10 10:47:48 UTC (rev 7391)
+++ usrp2/trunk/firmware/apps/rx_only.c 2008-01-10 17:46:09 UTC (rev 7392)
@@ -37,9 +37,6 @@
 #include <string.h>
 
 
-#define USE_BUFFER_INTERRUPT   0       // 0 or 1
-
-
 static int timer_delta = MASTER_CLK_RATE/1000; // tick at 1kHz
 
 /*
@@ -172,7 +169,7 @@
   bp_clear_buf(DSP_RX_BUF_1);
 }
 
-void
+inline static void
 buffer_irq_handler(unsigned irq)
 {
   uint32_t  status = buffer_pool_status->status;
@@ -210,9 +207,6 @@
   // Control LEDs
   hal_set_leds(0x0, 0x3);
 
-  if (USE_BUFFER_INTERRUPT)
-    pic_register_handler(IRQ_BUFFER,   buffer_irq_handler);
-
   pic_register_handler(IRQ_OVERRUN,  overrun_irq_handler);
   pic_register_handler(IRQ_UNDERRUN, underrun_irq_handler);
 
@@ -251,8 +245,6 @@
   }
 
   while(1){
-    if (!USE_BUFFER_INTERRUPT)
-      buffer_irq_handler(0);
-    // FIXME perhaps handle low-pri stuff here
+    buffer_irq_handler(0);
   }
 }

Modified: usrp2/trunk/firmware/apps/tx_only.c
===================================================================
--- usrp2/trunk/firmware/apps/tx_only.c 2008-01-10 10:47:48 UTC (rev 7391)
+++ usrp2/trunk/firmware/apps/tx_only.c 2008-01-10 17:46:09 UTC (rev 7392)
@@ -35,9 +35,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#define USE_BUFFER_INTERRUPT   0       // 0 or 1
 
-
 static int timer_delta = MASTER_CLK_RATE/1000; // tick at 1kHz
 
 /*
@@ -199,7 +197,7 @@
 #endif
 
 
-void
+inline static void
 buffer_irq_handler(unsigned irq)
 {
   //hal_toggle_leds(0x2);
@@ -231,9 +229,6 @@
   // Control LEDs
   hal_set_leds(0x0, 0x3);
 
-  if (USE_BUFFER_INTERRUPT)
-    pic_register_handler(IRQ_BUFFER,   buffer_irq_handler);
-
   pic_register_handler(IRQ_OVERRUN,  overrun_irq_handler);
   pic_register_handler(IRQ_UNDERRUN, underrun_irq_handler);
 
@@ -257,8 +252,7 @@
   dbsm_start(&dsp_tx_sm);
 
   while(1){
-    if (!USE_BUFFER_INTERRUPT)
-      buffer_irq_handler(0);
+    buffer_irq_handler(0);
   }
 }
 

Modified: usrp2/trunk/firmware/lib/buffer_pool.h
===================================================================
--- usrp2/trunk/firmware/lib/buffer_pool.h      2008-01-10 10:47:48 UTC (rev 
7391)
+++ usrp2/trunk/firmware/lib/buffer_pool.h      2008-01-10 17:46:09 UTC (rev 
7392)
@@ -24,7 +24,7 @@
 
 
 // define to have common buffer operations inlined
-//#define INLINE_BUFFER_POOL 1
+#define INLINE_BUFFER_POOL 1
 
 void bp_init(void);
 

Modified: usrp2/trunk/firmware/lib/dbsm.c
===================================================================
--- usrp2/trunk/firmware/lib/dbsm.c     2008-01-10 10:47:48 UTC (rev 7391)
+++ usrp2/trunk/firmware/lib/dbsm.c     2008-01-10 17:46:09 UTC (rev 7392)
@@ -62,9 +62,55 @@
 
   buffer_state[sm->buf0] = BS_EMPTY;
   buffer_state[sm->buf0 ^ 1] = BS_EMPTY;
+
+  sm->precomputed_receive_to_buf_ctrl_word[0] =
+    (BPC_READ
+     | BPC_BUFFER(sm->buf0)
+     | BPC_PORT(sm->recv_args.port)
+     | BPC_STEP(1)
+     | BPC_FIRST_LINE(sm->recv_args.first_line)
+     | BPC_LAST_LINE(sm->recv_args.last_line));
+    
+  sm->precomputed_receive_to_buf_ctrl_word[1] =
+    (BPC_READ
+     | BPC_BUFFER(sm->buf0 ^ 1)
+     | BPC_PORT(sm->recv_args.port)
+     | BPC_STEP(1)
+     | BPC_FIRST_LINE(sm->recv_args.first_line)
+     | BPC_LAST_LINE(sm->recv_args.last_line));
+    
+  sm->precomputed_send_from_buf_ctrl_word[0] =
+    (BPC_WRITE
+     | BPC_BUFFER(sm->buf0)
+     | BPC_PORT(sm->send_args.port)
+     | BPC_STEP(1)
+     | BPC_FIRST_LINE(sm->send_args.first_line)
+     | BPC_LAST_LINE(0));              // last line filled in at runtime
+    
+  sm->precomputed_send_from_buf_ctrl_word[1] =
+    (BPC_WRITE
+     | BPC_BUFFER(sm->buf0 ^ 1)
+     | BPC_PORT(sm->send_args.port)
+     | BPC_STEP(1)
+     | BPC_FIRST_LINE(sm->send_args.first_line)
+     | BPC_LAST_LINE(0));              // last line filled in at runtime
+    
 }
 
+static inline void
+dbsm_receive_to_buf(dbsm_t *sm, int bufno)
+{
+  buffer_pool_ctrl->ctrl = sm->precomputed_receive_to_buf_ctrl_word[bufno & 1];
+}
 
+static inline void
+dbsm_send_from_buf(dbsm_t *sm, int bufno)
+{
+  buffer_pool_ctrl->ctrl =
+    (sm->precomputed_send_from_buf_ctrl_word[bufno & 1]
+     | BPC_LAST_LINE(buffer_pool_status->last_line[bufno] - 1));
+}
+
 void
 dbsm_start(dbsm_t *sm)
 {
@@ -80,8 +126,7 @@
 
   sm->tx_idle = true;
   sm->rx_idle = false;
-  bp_receive_to_buf(sm->buf0, sm->recv_args.port, 1,
-                   sm->recv_args.first_line, sm->recv_args.last_line);
+  dbsm_receive_to_buf(sm, sm->buf0);
   buffer_state[sm->buf0] = BS_FILLING;
 
 }
@@ -124,16 +169,14 @@
       //
       if (sm->inspect(sm, buf_this)){
        // s/w handled the packet; refill the buffer
-       bp_receive_to_buf(buf_this, sm->recv_args.port, 1,
-                         sm->recv_args.first_line, sm->recv_args.last_line);
+       dbsm_receive_to_buf(sm, buf_this);
        buffer_state[buf_this] = BS_FILLING;
       }
 
       else {   // s/w didn't handle this; pass it on
 
        if(buffer_state[buf_other] == BS_EMPTY){
-         bp_receive_to_buf(buf_other, sm->recv_args.port, 1,
-                           sm->recv_args.first_line, sm->recv_args.last_line);
+         dbsm_receive_to_buf(sm, buf_other);
          buffer_state[buf_other] = BS_FILLING;
        }
        else
@@ -141,9 +184,7 @@
 
        if (sm->tx_idle){
          sm->tx_idle = false;
-         bp_send_from_buf(buf_this, sm->send_args.port, 1,
-                          sm->send_args.first_line,
-                          buffer_pool_status->last_line[buf_this] - 1);
+         dbsm_send_from_buf(sm, buf_this);
          buffer_state[buf_this] = BS_EMPTYING;
        }
       }
@@ -152,14 +193,11 @@
       buffer_state[buf_this] = BS_EMPTY;
       if (sm->rx_idle){
        sm->rx_idle = false;
-       bp_receive_to_buf(buf_this, sm->recv_args.port, 1,
-                         sm->recv_args.first_line, sm->recv_args.last_line);
+       dbsm_receive_to_buf(sm, buf_this);
        buffer_state[buf_this] = BS_FILLING;
       }
       if (buffer_state[buf_other] == BS_FULL){
-       bp_send_from_buf(buf_other, sm->send_args.port, 1,
-                        sm->send_args.first_line,
-                        buffer_pool_status->last_line[buf_other] - 1);
+       dbsm_send_from_buf(sm, buf_other);
        buffer_state[buf_other] = BS_EMPTYING;
       }
       else

Modified: usrp2/trunk/firmware/lib/dbsm.h
===================================================================
--- usrp2/trunk/firmware/lib/dbsm.h     2008-01-10 10:47:48 UTC (rev 7391)
+++ usrp2/trunk/firmware/lib/dbsm.h     2008-01-10 17:46:09 UTC (rev 7392)
@@ -59,6 +59,8 @@
   buf_cmd_args_t  recv_args;
   buf_cmd_args_t  send_args;
   inspector_t    inspect;
+  uint32_t       precomputed_receive_to_buf_ctrl_word[2];
+  uint32_t       precomputed_send_from_buf_ctrl_word[2];
 };
 
 void dbsm_init(dbsm_t *sm, int buf0,





reply via email to

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