commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r8875 - gnuradio/branches/developers/trondeau/dbs/gr-u


From: trondeau
Subject: [Commit-gnuradio] r8875 - gnuradio/branches/developers/trondeau/dbs/gr-usrp/src
Date: Sun, 13 Jul 2008 11:21:50 -0600 (MDT)

Author: trondeau
Date: 2008-07-13 11:21:49 -0600 (Sun, 13 Jul 2008)
New Revision: 8875

Added:
   gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_boards.cc
   gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_boards.h
Log:
function to build daughterboard objects

Added: gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_boards.cc
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_boards.cc          
                (rev 0)
+++ gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_boards.cc  
2008-07-13 17:21:49 UTC (rev 8875)
@@ -0,0 +1,77 @@
+/* -*- c++ -*- */
+//
+// Copyright 2008 Free Software Foundation, Inc.
+// 
+// This file is part of GNU Radio
+// 
+// GNU Radio 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 asversion 3, or (at your option)
+// any later version.
+// 
+// GNU Radio 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 GNU Radio; see the file COPYING.  If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street,
+// Boston, MA 02110-1301, USA.
+//
+
+#include <db_boards.h>
+
+db_base * instantiate_dbs(int dbid, usrp1_base * usrp, int which)
+{
+  db_base *db;
+
+  switch(dbid) {
+  case(USRP_DBID_BASIC_TX):
+    printf("USRP_DBID_BASIC_TX matches\n");
+    db = new db_basic_tx(usrp, which);
+    break;
+
+  case(USRP_DBID_TV_RX):
+    printf("USRP_DBID_TV_RX matches\n");
+    db = new db_tv_rx(usrp, which, 43.75e6, 5.75e6);
+    break;
+
+  case(USRP_DBID_TV_RX_REV_2):
+    printf("USRP_DBID_TV_RX_REV_2 matches\n");
+    db = new db_tv_rx(usrp, which, 44e6, 20e6);
+    break;
+
+  case(USRP_DBID_TV_RX_REV_3):
+    printf("USRP_DBID_TV_RX_REV_3 matches\n");
+    db = new db_tv_rx(usrp, which, 44e6, 20e6);
+    break;
+  
+  case(-1):
+    try { 
+      usrp->tx_freq(0);
+      db = new db_basic_tx(usrp, which);
+    }
+    catch (int e) {
+      db = NULL; //new db_basic_rx(usrp, which);
+    }
+    break;
+  
+  case(-2):
+  default:
+    try {
+      usrp->tx_freq(0);
+      fprintf(stderr, "\n\aWarning: Treating daughterboard with invalid EEPROM 
contents as if it were a \"Basic Tx.\"\n");
+      fprintf(stderr, "Warning: This is almost certainly wrong...  Use 
appropriate burn-*-eeprom utility.\n\n");
+      db = new db_basic_tx(usrp, which);
+    }
+    catch (int e) {
+      fprintf(stderr, "\n\aWarning: Treating daughterboard with invalid EEPROM 
contents as if it were a \"Basic Rx.\"\n");
+      fprintf(stderr, "Warning: This is almost certainly wrong...  Use 
appropriate burn-*-eeprom utility.\n\n");
+      db = NULL; //new db_basic_rx(usrp, which);
+    }
+    break;
+  }
+
+  return db;
+}

Added: gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_boards.h
===================================================================
--- gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_boards.h           
                (rev 0)
+++ gnuradio/branches/developers/trondeau/dbs/gr-usrp/src/db_boards.h   
2008-07-13 17:21:49 UTC (rev 8875)
@@ -0,0 +1,36 @@
+/* -*- c++ -*- */
+//
+// Copyright 2008 Free Software Foundation, Inc.
+// 
+// This file is part of GNU Radio
+// 
+// GNU Radio 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 asversion 3, or (at your option)
+// any later version.
+// 
+// GNU Radio 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 GNU Radio; see the file COPYING.  If not, write to
+// the Free Software Foundation, Inc., 51 Franklin Street,
+// Boston, MA 02110-1301, USA.
+//
+
+#ifndef DB_BOARDS_H
+#define DB_BOARDS_H
+
+#include <usrp1_base.h>
+#include <usrp_dbid.h>
+#include <db_base.h>
+#include <db_basic.h>
+#include <db_tv_rx.h>
+
+db_base * instantiate_dbs(int dbid, usrp1_base *usrp, int which);
+
+#endif 
+
+





reply via email to

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