now reads h/w rev from eeprom. f/w app set_hw_rev sets it
[debian/gnuradio] / usrp2 / firmware / lib / u2_init.c
index cb4b679c497b2b821df270ceba71c69e6b092733..8ecba349765f42f9a70bbe3be528860e3c7bb0b5 100644 (file)
 #include "ad9777.h"
 #include "clocks.h"
 #include "db.h"
+#include "usrp2_i2c_addr.h"
 
 //#include "nonstdio.h"
 
+unsigned char u2_hw_rev_major;
+unsigned char u2_hw_rev_minor;
+
+static inline void
+get_hw_rev(void)
+{
+  bool ok = eeprom_read(I2C_ADDR_MBOARD, MBOARD_REV_LSB, &u2_hw_rev_minor, 1);
+  ok &= eeprom_read(I2C_ADDR_MBOARD, MBOARD_REV_MSB, &u2_hw_rev_major, 1);
+}
+
+
 /*
  * We ought to arrange for this to be called before main, but for now,
  * we require that the user's main call u2_init as the first thing...
@@ -85,6 +97,8 @@ u2_init(void)
   lsdac_init();            // low-speed DACs
   db_init();       // daughterboard init
   
+  get_hw_rev();
+
   hal_enable_ints();
 
   // flash all leds to let us know board is alive