New standalone firmware, burn_dbsrx_eeprom, that burns new dbid into
authoreb <eb@221aa14e-8319-0410-a670-987f0aec2ac5>
Thu, 5 Mar 2009 01:21:44 +0000 (01:21 +0000)
committereb <eb@221aa14e-8319-0410-a670-987f0aec2ac5>
Thu, 5 Mar 2009 01:21:44 +0000 (01:21 +0000)
modified DBS Rx daughterboard.

git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10560 221aa14e-8319-0410-a670-987f0aec2ac5

gr-usrp/src/usrp_source_base.cc
usrp/host/apps/burn-db-eeprom
usrp/host/lib/inband/usrp_usb_interface.cc
usrp/host/lib/legacy/usrp_dbid.dat
usrp2/firmware/apps/Makefile.am
usrp2/firmware/apps/burn_dbsrx_eeprom.c [new file with mode: 0644]
usrp2/firmware/lib/db_init.c
usrp2/firmware/lib/hal_io.h

index b875737ce08b70cece30e111cb61f6fec3c4a54f..2c8394a95c1a65aa95e94374f4f74840efac19b4 100644 (file)
@@ -292,7 +292,6 @@ usrp_source_base::pick_rx_subdevice()
     USRP_DBID_TV_RX,
     USRP_DBID_TV_RX_REV_2,
     USRP_DBID_DBS_RX,
-    USRP_DBID_DBS_RX_REV_2_1,
     USRP_DBID_BASIC_RX
   };
 
index f7ad8ebcb6ada64738b09f3983663e95c61f9e47..e9ff9f5bc61c6e6f6cbfb657dc28e6f5924a8895 100755 (executable)
@@ -32,7 +32,7 @@ daughterboards = {
     'basictx'         : ((BASIC_TX, 0x0000),        None),
     'basicrx'         : (None,                      (BASIC_RX, 0x0000)),
     'dbsrx'           : (None,                      (DBS_RX, 0x0000)),
-    'dbsrx2'          : (None,                      (DBS_RX_REV_2_1, 0x0000)),
+    'dbsrx_clkmod'    : (None,                      (DBS_RX_CLKMOD, 0x0000)),
     'tvrx'            : (None,                      (TV_RX, 0x0000)),
     'tvrx2'           : (None,                      (TV_RX_REV_2, 0x0000)),
     'tvrx3'           : (None,                      (TV_RX_REV_3, 0x0000)),
index a0cb9552067f644e91887d2587d8356bceec5924..fb7109a5a5f29f51ad7fc463b15c76f8e2f68b72 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2007,2008 Free Software Foundation, Inc.
+ * Copyright 2007,2008,2009 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
@@ -553,7 +553,6 @@ usrp_usb_interface::pick_rx_subdevice()
     USRP_DBID_TV_RX,
     USRP_DBID_TV_RX_REV_2,
     USRP_DBID_DBS_RX,
-    USRP_DBID_DBS_RX_REV_2_1,
     USRP_DBID_BASIC_RX
   };
 
index c7dbeb213a2613edf8880ddfc89648135b2e2d30..bd7fd7ecbdc287498ef4fbac1916e050b3b23475 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright 2005 Free Software Foundation, Inc.
+# Copyright 2005,2009 Free Software Foundation, Inc.
 # 
 # This file is part of GNU Radio
 # 
@@ -36,7 +36,7 @@
 "Flex 2400 Tx"         0x000b
 
 "TV Rx Rev 2"          0x000c
-"DBS Rx Rev 2_1"       0x000d
+"DBS Rx ClkMod"                0x000d
 
 "LF Tx"                        0x000e
 "LF Rx"                        0x000f
index c624b61ea26b94afefbcbaa6fc784a6ada7d8450..5931cf726cfdfd3c5d7d360bb7517c6e2157bc3a 100644 (file)
@@ -23,6 +23,7 @@ noinst_PROGRAMS = \
        blink_leds \
        blink_leds2 \
        buf_ram_test \
+       burn_dbsrx_eeprom \
        can_i_sub \
        echo \
        eth_serdes \
diff --git a/usrp2/firmware/apps/burn_dbsrx_eeprom.c b/usrp2/firmware/apps/burn_dbsrx_eeprom.c
new file mode 100644 (file)
index 0000000..cbfb37b
--- /dev/null
@@ -0,0 +1,106 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2009 Free Software Foundation, Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "u2_init.h"
+#include "i2c.h"
+#include "usrp2_i2c_addr.h"
+#include "mdelay.h"
+#include "hal_io.h"
+#include "nonstdio.h"
+#include "bool.h"
+
+
+
+int read_dboard_eeprom(int i2c_addr);
+
+
+#define USRP_DBID_DBS_RX                0x0002
+#define USRP_DBID_DBS_RX_WITH_CLOCK_MOD  0x000d
+
+const char dbs_rx_rev2_eeprom[] = {
+  0xdb, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18
+};
+
+#define        LED_VALS   (LED_A | LED_B | LED_C | LED_D)
+#define        LED_MASK   (LED_A | LED_B | LED_C | LED_D)
+
+int
+main(void)
+{
+  u2_init();
+
+  puts("\nburn_dbsrx_eeprom\n");
+
+  hal_set_leds(0, ~0); // all off
+
+  int i2c_addr = I2C_ADDR_RX_A;
+  int dbid = read_dboard_eeprom(i2c_addr);
+  bool ok;
+  const char *msg = 0;
+
+  switch (dbid){
+  case -1:
+    msg = "No RX daughterboard found";
+    goto bad;
+
+  case -2:
+    msg = "Invalid RX EEPROM contents";
+    goto bad;
+
+  case USRP_DBID_DBS_RX_WITH_CLOCK_MOD:
+    msg = "RX Daughterboard already reports being a DBS RX w/ CLOCK_MOD";
+    goto good;
+
+  case USRP_DBID_DBS_RX:
+    // Says it's a DBS_RX, attempt to burn the EEPROM
+    ok = eeprom_write(i2c_addr, 0,
+                     dbs_rx_rev2_eeprom, sizeof(dbs_rx_rev2_eeprom));
+    if (ok){
+      msg = "Successfully programmed db as DBS RX Rev 2.1";
+      goto good;
+    }
+    else {
+      msg = "Failed to write daugherboard eeprom";
+      goto bad;
+    }
+
+  default:
+    msg = "Daughterboard is not a DBS RX; ignored";
+    goto bad;
+  }
+  
+ good:
+  puts(msg);
+  hal_set_leds(LED_VALS, LED_MASK);
+  while (1)
+    ;
+
+ bad:
+  puts(msg);
+  while(1){
+    hal_toggle_leds(LED_VALS);
+    mdelay(50);
+  }
+}
index 0aef75e57e2560f5820efea24f97b6e98f6bb1e7..f54fc0ae3ed2cda08d429f5dbfb524f1d8c8183c 100644 (file)
@@ -104,7 +104,7 @@ read_raw_dboard_eeprom (unsigned char *buf, int i2c_addr)
 /*
  * Return DBID, -1 <none> or -2 <invalid eeprom contents>
  */
-static int
+int
 read_dboard_eeprom(int i2c_addr)
 {
   unsigned char buf[DB_EEPROM_CLEN];
index 5ffebf57b0acdeb17f2d221d5a578beace5fa4b3..a49750a6dd4a57c8bdefc8afaf8b34b060aa5ce6 100644 (file)
@@ -91,12 +91,6 @@ int  hal_gpio_read(int bank);
  * ------------------------------------------------------------------------
  */
 
-#define        LED_0           0x0001
-#define        LED_1           0x0002
-#define        LED_3           0x0004
-#define        LED_4           0x0008
-#define        LED_ETH_CONN    0x0010
-
 void hal_set_leds(int value, int mask);
 void hal_toggle_leds(int mask);