commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r10722 - in gnuradio/branches/developers/jcorgan/gpio2


From: jcorgan
Subject: [Commit-gnuradio] r10722 - in gnuradio/branches/developers/jcorgan/gpio2: . usrp2/firmware/apps
Date: Tue, 31 Mar 2009 12:26:47 -0600 (MDT)

Author: jcorgan
Date: 2009-03-31 12:26:47 -0600 (Tue, 31 Mar 2009)
New Revision: 10722

Modified:
   gnuradio/branches/developers/jcorgan/gpio2/
   
gnuradio/branches/developers/jcorgan/gpio2/usrp2/firmware/apps/app_common_v2.c
Log:
Merged r10427:10429 from jcorgan/fw-optimize into jcorgan/gpio2.  This is 
cleanup and slight reorganization of firmware to save a few hundred bytes of 
blockram usage.


Property changes on: gnuradio/branches/developers/jcorgan/gpio2
___________________________________________________________________
Modified: svn:mergeinfo
   - /gnuradio/branches/developers/eb/t348:10638-10648
/gnuradio/branches/developers/eb/t378:10683-10688
/gnuradio/branches/developers/jblum/gui_guts:10464-10658
/gnuradio/branches/developers/jblum/vlen:10667-10677
/gnuradio/branches/developers/michaelld/am_swig_4:10555-10595
/gnuradio/branches/developers/michaelld/two_mods:10540-10546
   + /gnuradio/branches/developers/eb/t348:10638-10648
/gnuradio/branches/developers/eb/t378:10683-10688
/gnuradio/branches/developers/jblum/gui_guts:10464-10658
/gnuradio/branches/developers/jblum/vlen:10667-10677
/gnuradio/branches/developers/jcorgan/fw-optimize:10428-10429
/gnuradio/branches/developers/michaelld/am_swig_4:10555-10595
/gnuradio/branches/developers/michaelld/two_mods:10540-10546

Modified: 
gnuradio/branches/developers/jcorgan/gpio2/usrp2/firmware/apps/app_common_v2.c
===================================================================
--- 
gnuradio/branches/developers/jcorgan/gpio2/usrp2/firmware/apps/app_common_v2.c  
    2009-03-31 18:03:20 UTC (rev 10721)
+++ 
gnuradio/branches/developers/jcorgan/gpio2/usrp2/firmware/apps/app_common_v2.c  
    2009-03-31 18:26:47 UTC (rev 10722)
@@ -40,17 +40,11 @@
 
 static unsigned char exp_seqno __attribute__((unused)) = 0;
 
-static bool
-burn_mac_addr(const op_burn_mac_addr_t *p)
-{
-  return ethernet_set_mac_addr(&p->addr);
-}
-
-static bool
+static inline bool
 sync_to_pps(const op_generic_t *p)
 {
   timesync_regs->sync_on_next_pps = 1;
-  putstr("SYNC to PPS\n");
+  //putstr("SYNC to PPS\n");
   return true;
 }
 
@@ -65,7 +59,7 @@
   return true;
 }
 
-static bool
+static inline bool
 config_mimo_cmd(const op_config_mimo_t *p)
 {
   clocks_mimo_config(p->flags);
@@ -348,8 +342,8 @@
 {
   op_generic_t *r = (op_generic_t *) reply_payload;
 
-  putstr("peek: addr="); puthex32(p->addr);
-  printf(" bytes=%u\n", p->bytes);
+  //putstr("peek: addr="); puthex32(p->addr);
+  //printf(" bytes=%u\n", p->bytes);
 
   if ((reply_payload_space < (sizeof(*r) + p->bytes)) ||
       p->bytes > MAX_SUBPKT_LEN - sizeof(op_generic_t)) {
@@ -371,8 +365,8 @@
 poke_cmd(const op_poke_t *p)
 {
   int bytes = p->len - sizeof(*p);
-  putstr("poke: addr="); puthex32(p->addr);
-  printf(" bytes=%u\n", bytes);
+  //putstr("poke: addr="); puthex32(p->addr);
+  //printf(" bytes=%u\n", bytes);
 
   uint8_t *src = (uint8_t *)p + sizeof(*p);
   memcpy_wa((void *)p->addr, src, bytes);
@@ -438,6 +432,7 @@
   int payload_len = len - sizeof(u2_eth_packet_t);
   
   size_t subpktlen = 0;
+  bool ok = false;
 
   while (payload_len >= sizeof(op_generic_t)){
     const op_generic_t *gp = (const op_generic_t *) payload;
@@ -454,34 +449,30 @@
       break;
     
     case OP_CONFIG_TX_V2:
-      subpktlen = config_tx_v2_cmd((op_config_tx_v2_t *) payload,
-                                  reply_payload, reply_payload_space);
+      subpktlen = config_tx_v2_cmd((op_config_tx_v2_t *) payload, 
reply_payload, reply_payload_space);
       break;
 
     case OP_CONFIG_RX_V2:
-      subpktlen = config_rx_v2_cmd((op_config_rx_v2_t *) payload,
-                                  reply_payload, reply_payload_space);
+      subpktlen = config_rx_v2_cmd((op_config_rx_v2_t *) payload, 
reply_payload, reply_payload_space);
       break;
 
     case OP_START_RX_STREAMING:
       start_rx_streaming_cmd(&pkt->ehdr.src, (op_start_rx_streaming_t *) 
payload);
-      subpktlen = generic_reply(gp, reply_payload, reply_payload_space, true);
-      break;
+      ok = true;
+      goto generic_reply;
     
     case OP_STOP_RX:
       stop_rx_cmd();
-      subpktlen = generic_reply(gp, reply_payload, reply_payload_space, true);
-      break;
+      ok = true;
+      goto generic_reply;
     
     case OP_BURN_MAC_ADDR:
-      subpktlen = generic_reply(gp, reply_payload, reply_payload_space,
-                               burn_mac_addr((op_burn_mac_addr_t *) payload));
-      break;
+      ok = ethernet_set_mac_addr(&((op_burn_mac_addr_t *)payload)->addr);
+      goto generic_reply;
 
     case OP_CONFIG_MIMO:
-      subpktlen = generic_reply(gp, reply_payload, reply_payload_space,
-                               config_mimo_cmd((op_config_mimo_t *) payload));
-      break;
+      ok = config_mimo_cmd((op_config_mimo_t *) payload);
+      goto generic_reply;
 
     case OP_READ_TIME:
       subpktlen = read_time_cmd(gp, reply_payload, reply_payload_space);
@@ -492,33 +483,36 @@
       break;
 
     case OP_SYNC_TO_PPS:
-      subpktlen = generic_reply(gp, reply_payload, reply_payload_space,
-                               sync_to_pps((op_generic_t *) payload));
-      break;
+      sync_to_pps((op_generic_t *) payload);
+      ok = true;
+      goto generic_reply;
 
     case OP_PEEK:
       subpktlen = peek_cmd((op_peek_t *)payload, reply_payload, 
reply_payload_space);
       break;
 
     case OP_POKE:
-      subpktlen = generic_reply(gp, reply_payload, reply_payload_space,
-                               poke_cmd((op_poke_t *)payload));
-      break;
+      ok = poke_cmd((op_poke_t *)payload);
+      goto generic_reply;
 
     case OP_SET_TX_LO_OFFSET:
     case OP_SET_RX_LO_OFFSET:
-      subpktlen = generic_reply(gp, reply_payload, reply_payload_space,
-                               set_lo_offset_cmd((op_freq_t *)payload));
-      break;
+      ok = set_lo_offset_cmd((op_freq_t *)payload);
+      goto generic_reply;
 
     case OP_RESET_DB:
       db_init();
-      subpktlen = generic_reply(gp, reply_payload, reply_payload_space, true);
-      break;
+      ok = true;
+      goto generic_reply;
 
     case OP_SYNC_EVERY_PPS:
-      subpktlen = generic_reply(gp, reply_payload, reply_payload_space,
-                               sync_every_pps((op_generic_t *) payload));
+      ok = sync_every_pps((op_generic_t *) payload);
+      goto generic_reply;
+
+    // Add new opcode handlers here
+
+    generic_reply:
+      subpktlen = generic_reply(gp, reply_payload, reply_payload_space, ok);
       break;
 
     default:





reply via email to

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