commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r4867 - in gnuradio/branches/developers/eb/ibu: . mblo


From: eb
Subject: [Commit-gnuradio] r4867 - in gnuradio/branches/developers/eb/ibu: . mblock/src/lib mblock/src/scheme/gnuradio pmt/src/lib usrp/host/lib/inband
Date: Tue, 3 Apr 2007 20:11:58 -0600 (MDT)

Author: eb
Date: 2007-04-03 20:11:57 -0600 (Tue, 03 Apr 2007)
New Revision: 4867

Added:
   gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_server.cc
   gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_server.h
Modified:
   gnuradio/branches/developers/eb/ibu/Makefile.common
   gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_port.cc
   gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_port.h
   gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_protocol_class.cc
   
gnuradio/branches/developers/eb/ibu/mblock/src/scheme/gnuradio/compile-mbh.scm
   gnuradio/branches/developers/eb/ibu/pmt/src/lib/pmt.cc
   gnuradio/branches/developers/eb/ibu/pmt/src/lib/pmt.h
   gnuradio/branches/developers/eb/ibu/pmt/src/lib/pmt_serialize.cc
   gnuradio/branches/developers/eb/ibu/pmt/src/lib/qa_pmt_prims.cc
   gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/
   gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/Makefile.am
   gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_server.mbh
Log:
mblock/inband work-in-progress.  Has beginnings of usrp_server.cc


Modified: gnuradio/branches/developers/eb/ibu/Makefile.common
===================================================================
--- gnuradio/branches/developers/eb/ibu/Makefile.common 2007-04-04 01:55:52 UTC 
(rev 4866)
+++ gnuradio/branches/developers/eb/ibu/Makefile.common 2007-04-04 02:11:57 UTC 
(rev 4867)
@@ -94,4 +94,5 @@
 # using AM_PATH_PROG, but now here have to add a -f to be like GNU make
 RM=$(RM_PROG) -f
 
-RUN_GUILE = 
GUILE_LOAD_PATH="$(abs_top_srcdir)/pmt/src/scheme/gnuradio:$(abs_top_srcdir)/mblock/src/scheme/gnuradio"
 @GUILE@ -e main -s
+RUN_GUILE = 
GUILE_LOAD_PATH="@abs_top_srcdir@/pmt/src/scheme:@abs_top_srcdir@/mblock/src/scheme"
 @GUILE@ -e main -s
+COMPILE_MBH = $(RUN_GUILE) 
$(top_srcdir)/mblock/src/scheme/gnuradio/compile-mbh.scm

Modified: gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_port.cc
===================================================================
--- gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_port.cc       
2007-04-04 01:55:52 UTC (rev 4866)
+++ gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_port.cc       
2007-04-04 02:11:57 UTC (rev 4867)
@@ -31,7 +31,8 @@
                 const std::string &protocol_class_name,
                 bool conjugated,
                 mb_port::port_type_t port_type)
-  : d_port_name(port_name), d_conjugated(conjugated), d_port_type(port_type),
+  : d_port_name(port_name), d_port_symbol(pmt_intern(port_name)),
+    d_conjugated(conjugated), d_port_type(port_type),
     d_mblock(mblock)
 {
   pmt_t pc = mb_protocol_class_lookup(pmt_intern(protocol_class_name));

Modified: gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_port.h
===================================================================
--- gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_port.h        
2007-04-04 01:55:52 UTC (rev 4866)
+++ gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_port.h        
2007-04-04 02:11:57 UTC (rev 4867)
@@ -40,6 +40,7 @@
 private:
 
   std::string          d_port_name;
+  pmt_t                        d_port_symbol;          // the port_name as a 
pmt symbol
   pmt_t                        d_protocol_class;
   bool                 d_conjugated;
   port_type_t          d_port_type;
@@ -58,6 +59,7 @@
 
 public:
   std::string  port_name() const { return d_port_name; }
+  pmt_t                port_symbol() const { return d_port_symbol; }
   pmt_t                protocol_class() const { return d_protocol_class; }
   bool          conjugated() const { return d_conjugated; }
   port_type_t  port_type() const { return d_port_type; }

Modified: 
gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_protocol_class.cc
===================================================================
--- gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_protocol_class.cc     
2007-04-04 01:55:52 UTC (rev 4866)
+++ gnuradio/branches/developers/eb/ibu/mblock/src/lib/mb_protocol_class.cc     
2007-04-04 02:11:57 UTC (rev 4867)
@@ -95,6 +95,8 @@
     if (pmt_is_eof_object(obj))
       return;
 
-    mb_make_protocol_class(pmt_car(obj), pmt_cadr(obj), pmt_caddr(obj));
+    mb_make_protocol_class(pmt_nth(0, obj),   // protocol-class name
+                          pmt_nth(1, obj),   // list of incoming msg names
+                          pmt_nth(2, obj));  // list of outgoing msg names
   }
 }

Modified: 
gnuradio/branches/developers/eb/ibu/mblock/src/scheme/gnuradio/compile-mbh.scm
===================================================================
--- 
gnuradio/branches/developers/eb/ibu/mblock/src/scheme/gnuradio/compile-mbh.scm  
    2007-04-04 01:55:52 UTC (rev 4866)
+++ 
gnuradio/branches/developers/eb/ibu/mblock/src/scheme/gnuradio/compile-mbh.scm  
    2007-04-04 02:11:57 UTC (rev 4867)
@@ -199,9 +199,14 @@
                  
                  
        (map (lambda (pc)
-              (let ((obj-to-dump (list (protocol-class-name pc)
-                                       (protocol-class-incoming pc)
-                                       (protocol-class-outgoing pc))))
+              (let ((obj-to-dump
+                     (list (protocol-class-name pc)                    ; class 
name
+                           (map car (protocol-class-incoming pc))      ; 
incoming msg names
+                           (map car (protocol-class-outgoing pc))      ; 
outgoing msg names
+                           ;;(protocol-class-incoming pc)              ; full 
incoming msg descriptions
+                           ;;(protocol-class-outgoing pc)              ; full 
outgoing msg descriptions
+                           ))) 
+                ;;(pretty-print obj-to-dump)  
                 (pmt-serialize obj-to-dump (so-stream 'put-byte))))
             classes)
 

Modified: gnuradio/branches/developers/eb/ibu/pmt/src/lib/pmt.cc
===================================================================
--- gnuradio/branches/developers/eb/ibu/pmt/src/lib/pmt.cc      2007-04-04 
01:55:52 UTC (rev 4866)
+++ gnuradio/branches/developers/eb/ibu/pmt/src/lib/pmt.cc      2007-04-04 
02:11:57 UTC (rev 4867)
@@ -112,8 +112,8 @@
 //                           Globals
 ////////////////////////////////////////////////////////////////////////////
 
-const pmt_t PMT_BOOL_T = pmt_t(new pmt_bool());                // singleton
-const pmt_t PMT_BOOL_F = pmt_t(new pmt_bool());                // singleton
+const pmt_t PMT_T = pmt_t(new pmt_bool());             // singleton
+const pmt_t PMT_F = pmt_t(new pmt_bool());             // singleton
 const pmt_t PMT_NIL = pmt_t(new pmt_null());           // singleton
 const pmt_t PMT_EOF = pmt_cons(PMT_NIL, PMT_NIL);      // singleton
 
@@ -126,13 +126,13 @@
 bool
 pmt_is_true(pmt_t obj)
 {
-  return obj != PMT_BOOL_F;
+  return obj != PMT_F;
 }
 
 bool
 pmt_is_false(pmt_t obj)
 {
-  return obj == PMT_BOOL_F;
+  return obj == PMT_F;
 }
 
 bool
@@ -144,15 +144,15 @@
 pmt_t
 pmt_from_bool(bool val)
 {
-  return val ? PMT_BOOL_T : PMT_BOOL_F;
+  return val ? PMT_T : PMT_F;
 }
 
 bool
 pmt_to_bool(pmt_t val)
 {
-  if (val == PMT_BOOL_T)
+  if (val == PMT_T)
     return true;
-  if (val == PMT_BOOL_F)
+  if (val == PMT_F)
     return false;
   throw pmt_wrong_type("pmt_to_bool", val);
 }
@@ -693,14 +693,14 @@
   while (pmt_is_pair(alist)){
     pmt_t p = pmt_car(alist);
     if (!pmt_is_pair(p))       // malformed alist
-      return PMT_BOOL_F;
+      return PMT_F;
 
     if (pmt_eq(obj, pmt_car(p)))
       return p;
 
     alist = pmt_cdr(alist);
   }
-  return PMT_BOOL_F;
+  return PMT_F;
 }
 
 pmt_t
@@ -709,14 +709,14 @@
   while (pmt_is_pair(alist)){
     pmt_t p = pmt_car(alist);
     if (!pmt_is_pair(p))       // malformed alist
-      return PMT_BOOL_F;
+      return PMT_F;
 
     if (pmt_eqv(obj, pmt_car(p)))
       return p;
 
     alist = pmt_cdr(alist);
   }
-  return PMT_BOOL_F;
+  return PMT_F;
 }
 
 pmt_t
@@ -725,14 +725,14 @@
   while (pmt_is_pair(alist)){
     pmt_t p = pmt_car(alist);
     if (!pmt_is_pair(p))       // malformed alist
-      return PMT_BOOL_F;
+      return PMT_F;
 
     if (pmt_equal(obj, pmt_car(p)))
       return p;
 
     alist = pmt_cdr(alist);
   }
-  return PMT_BOOL_F;
+  return PMT_F;
 }
 
 pmt_t
@@ -809,7 +809,7 @@
       return list;
     list = pmt_cdr(list);
   }
-  return PMT_BOOL_F;
+  return PMT_F;
 }
 
 pmt_t
@@ -820,7 +820,7 @@
       return list;
     list = pmt_cdr(list);
   }
-  return PMT_BOOL_F;
+  return PMT_F;
 }
 
 pmt_t
@@ -831,7 +831,7 @@
       return list;
     list = pmt_cdr(list);
   }
-  return PMT_BOOL_F;
+  return PMT_F;
 }
 
 bool

Modified: gnuradio/branches/developers/eb/ibu/pmt/src/lib/pmt.h
===================================================================
--- gnuradio/branches/developers/eb/ibu/pmt/src/lib/pmt.h       2007-04-04 
01:55:52 UTC (rev 4866)
+++ gnuradio/branches/developers/eb/ibu/pmt/src/lib/pmt.h       2007-04-04 
02:11:57 UTC (rev 4867)
@@ -82,8 +82,8 @@
  * I.e., there is a single false value, #f.
  * ------------------------------------------------------------------------
  */
-extern const pmt_t PMT_BOOL_T; //< #t : boolean true constant
-extern const pmt_t PMT_BOOL_F; //< #f : boolean false constant
+extern const pmt_t PMT_T;      //< #t : boolean true constant
+extern const pmt_t PMT_F;      //< #f : boolean false constant
 
 //! Return true if obj is #t or #f, else return false.
 bool pmt_is_bool(pmt_t obj);
@@ -97,7 +97,7 @@
 //! Return #f is val is false, else return #t.
 pmt_t pmt_from_bool(bool val);
 
-//! Return true if val is PMT_BOOL_T, return false when val is PMT_BOOL_F, 
+//! Return true if val is PMT_T, return false when val is PMT_F, 
 // else raise wrong_type exception.
 bool pmt_to_bool(pmt_t val);
 

Modified: gnuradio/branches/developers/eb/ibu/pmt/src/lib/pmt_serialize.cc
===================================================================
--- gnuradio/branches/developers/eb/ibu/pmt/src/lib/pmt_serialize.cc    
2007-04-04 01:55:52 UTC (rev 4866)
+++ gnuradio/branches/developers/eb/ibu/pmt/src/lib/pmt_serialize.cc    
2007-04-04 02:11:57 UTC (rev 4867)
@@ -170,7 +170,7 @@
  tail_recursion:
 
   if (pmt_is_bool(obj)){
-    if (pmt_eq(obj, PMT_BOOL_T))
+    if (pmt_eq(obj, PMT_T))
       return serialize_untagged_u8(PST_TRUE, sb);
     else
       return serialize_untagged_u8(PST_FALSE, sb);
@@ -252,10 +252,10 @@
 
   switch (tag){
   case PST_TRUE:
-    return PMT_BOOL_T;
+    return PMT_T;
     
   case PST_FALSE:
-    return PMT_BOOL_F;
+    return PMT_F;
 
   case PST_NULL:
     return PMT_NIL;
@@ -265,7 +265,7 @@
       goto error;
     if (u16 > sizeof(tmpbuf))
       throw pmt_notimplemented("pmt_deserialize: very long symbol",
-                              PMT_BOOL_F);
+                              PMT_F);
     if (sb.sgetn(tmpbuf, u16) != u16)
       goto error;
     return pmt_intern(std::string(tmpbuf, u16));
@@ -293,7 +293,7 @@
   }
 
  error:
-  throw pmt_exception("pmt_deserialize: malformed input stream", PMT_BOOL_F);
+  throw pmt_exception("pmt_deserialize: malformed input stream", PMT_F);
 }
 
 /*
@@ -323,7 +323,7 @@
     lastnptr = nptr;
 
     if (!deserialize_untagged_u8(&tag, sb))  // get tag of cdr
-      throw pmt_exception("pmt_deserialize: malformed input stream", 
PMT_BOOL_F);
+      throw pmt_exception("pmt_deserialize: malformed input stream", PMT_F);
 
     if (tag == PST_PAIR)
       continue;                        // keep on looping...

Modified: gnuradio/branches/developers/eb/ibu/pmt/src/lib/qa_pmt_prims.cc
===================================================================
--- gnuradio/branches/developers/eb/ibu/pmt/src/lib/qa_pmt_prims.cc     
2007-04-04 01:55:52 UTC (rev 4866)
+++ gnuradio/branches/developers/eb/ibu/pmt/src/lib/qa_pmt_prims.cc     
2007-04-04 02:11:57 UTC (rev 4867)
@@ -29,9 +29,9 @@
 void
 qa_pmt_prims::test_symbols()
 {
-  CPPUNIT_ASSERT(!pmt_is_symbol(PMT_BOOL_T));
-  CPPUNIT_ASSERT(!pmt_is_symbol(PMT_BOOL_F));
-  CPPUNIT_ASSERT_THROW(pmt_symbol_to_string(PMT_BOOL_F), pmt_wrong_type);
+  CPPUNIT_ASSERT(!pmt_is_symbol(PMT_T));
+  CPPUNIT_ASSERT(!pmt_is_symbol(PMT_F));
+  CPPUNIT_ASSERT_THROW(pmt_symbol_to_string(PMT_F), pmt_wrong_type);
 
   pmt_t sym1 = pmt_string_to_symbol("test");
   CPPUNIT_ASSERT(pmt_is_symbol(sym1));
@@ -77,13 +77,13 @@
 qa_pmt_prims::test_booleans()
 {
   pmt_t sym = pmt_string_to_symbol("test");
-  CPPUNIT_ASSERT(pmt_is_bool(PMT_BOOL_T));
-  CPPUNIT_ASSERT(pmt_is_bool(PMT_BOOL_F));
+  CPPUNIT_ASSERT(pmt_is_bool(PMT_T));
+  CPPUNIT_ASSERT(pmt_is_bool(PMT_F));
   CPPUNIT_ASSERT(!pmt_is_bool(sym));
-  CPPUNIT_ASSERT_EQUAL(pmt_from_bool(false), PMT_BOOL_F);
-  CPPUNIT_ASSERT_EQUAL(pmt_from_bool(true), PMT_BOOL_T);
-  CPPUNIT_ASSERT_EQUAL(false, pmt_to_bool(PMT_BOOL_F));
-  CPPUNIT_ASSERT_EQUAL(true, pmt_to_bool(PMT_BOOL_T));
+  CPPUNIT_ASSERT_EQUAL(pmt_from_bool(false), PMT_F);
+  CPPUNIT_ASSERT_EQUAL(pmt_from_bool(true), PMT_T);
+  CPPUNIT_ASSERT_EQUAL(false, pmt_to_bool(PMT_F));
+  CPPUNIT_ASSERT_EQUAL(true, pmt_to_bool(PMT_T));
   CPPUNIT_ASSERT_THROW(pmt_to_bool(sym), pmt_wrong_type);
 }
 
@@ -92,10 +92,10 @@
 {
   pmt_t p1 = pmt_from_long(1);
   pmt_t m1 = pmt_from_long(-1);
-  CPPUNIT_ASSERT(!pmt_is_integer(PMT_BOOL_T));
+  CPPUNIT_ASSERT(!pmt_is_integer(PMT_T));
   CPPUNIT_ASSERT(pmt_is_integer(p1));
   CPPUNIT_ASSERT(pmt_is_integer(m1));
-  CPPUNIT_ASSERT_THROW(pmt_to_long(PMT_BOOL_T), pmt_wrong_type);
+  CPPUNIT_ASSERT_THROW(pmt_to_long(PMT_T), pmt_wrong_type);
   CPPUNIT_ASSERT_EQUAL(-1L, pmt_to_long(m1));
   CPPUNIT_ASSERT_EQUAL(1L, pmt_to_long(p1));
 }
@@ -105,10 +105,10 @@
 {
   pmt_t p1 = pmt_from_double(1);
   pmt_t m1 = pmt_from_double(-1);
-  CPPUNIT_ASSERT(!pmt_is_real(PMT_BOOL_T));
+  CPPUNIT_ASSERT(!pmt_is_real(PMT_T));
   CPPUNIT_ASSERT(pmt_is_real(p1));
   CPPUNIT_ASSERT(pmt_is_real(m1));
-  CPPUNIT_ASSERT_THROW(pmt_to_double(PMT_BOOL_T), pmt_wrong_type);
+  CPPUNIT_ASSERT_THROW(pmt_to_double(PMT_T), pmt_wrong_type);
   CPPUNIT_ASSERT_EQUAL(-1.0, pmt_to_double(m1));
   CPPUNIT_ASSERT_EQUAL(1.0, pmt_to_double(p1));
   CPPUNIT_ASSERT_EQUAL(1.0, pmt_to_double(pmt_from_long(1)));
@@ -119,10 +119,10 @@
 {
   pmt_t p1 = pmt_make_rectangular(2, -3);
   pmt_t m1 = pmt_make_rectangular(-3, 2);
-  CPPUNIT_ASSERT(!pmt_is_complex(PMT_BOOL_T));
+  CPPUNIT_ASSERT(!pmt_is_complex(PMT_T));
   CPPUNIT_ASSERT(pmt_is_complex(p1));
   CPPUNIT_ASSERT(pmt_is_complex(m1));
-  CPPUNIT_ASSERT_THROW(pmt_to_complex(PMT_BOOL_T), pmt_wrong_type);
+  CPPUNIT_ASSERT_THROW(pmt_to_complex(PMT_T), pmt_wrong_type);
   CPPUNIT_ASSERT_EQUAL(std::complex<double>(2, -3), pmt_to_complex(p1));
   CPPUNIT_ASSERT_EQUAL(std::complex<double>(-3, 2), pmt_to_complex(m1));
   CPPUNIT_ASSERT_EQUAL(std::complex<double>(1.0, 0), 
pmt_to_complex(pmt_from_long(1)));
@@ -243,7 +243,7 @@
   
   pmt_t alist = pmt_cons(p0, pmt_cons(p1, pmt_cons(p2, PMT_NIL)));
   CPPUNIT_ASSERT(pmt_eq(p1, pmt_assv(k1, alist)));
-  CPPUNIT_ASSERT(pmt_eq(PMT_BOOL_F, pmt_assv(k3, alist)));
+  CPPUNIT_ASSERT(pmt_eq(PMT_F, pmt_assv(k3, alist)));
   
   pmt_t keys = pmt_cons(k0, pmt_cons(k1, pmt_cons(k2, PMT_NIL)));
   pmt_t vals = pmt_cons(v0, pmt_cons(v1, pmt_cons(v2, PMT_NIL)));
@@ -317,8 +317,8 @@
   pmt_serialize(pmt_list2(a, b), sb);
   pmt_serialize(pmt_list3(a, b, c), sb);
   pmt_serialize(pmt_list3(a, pmt_list3(c, b, a), c), sb);
-  pmt_serialize(PMT_BOOL_T, sb);
-  pmt_serialize(PMT_BOOL_F, sb);
+  pmt_serialize(PMT_T, sb);
+  pmt_serialize(PMT_F, sb);
 
   // read it back
 
@@ -332,8 +332,8 @@
   CPPUNIT_ASSERT(pmt_equal(pmt_deserialize(sb), pmt_list2(a, b)));
   CPPUNIT_ASSERT(pmt_equal(pmt_deserialize(sb), pmt_list3(a, b, c)));
   CPPUNIT_ASSERT(pmt_equal(pmt_deserialize(sb), pmt_list3(a, pmt_list3(c, b, 
a), c)));
-  CPPUNIT_ASSERT(pmt_equal(pmt_deserialize(sb), PMT_BOOL_T));
-  CPPUNIT_ASSERT(pmt_equal(pmt_deserialize(sb), PMT_BOOL_F));
+  CPPUNIT_ASSERT(pmt_equal(pmt_deserialize(sb), PMT_T));
+  CPPUNIT_ASSERT(pmt_equal(pmt_deserialize(sb), PMT_F));
 
   CPPUNIT_ASSERT(pmt_equal(pmt_deserialize(sb), PMT_EOF));     // last item
 


Property changes on: gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband
___________________________________________________________________
Name: svn:ignore
   - Makefile
Makefile.in
.la
.lo
.deps
.libs
*.la
*.lo
test_fusb
std_paths.h
usrp_dbid.py
usrp_dbid.h
usrp_dbid.cc

   + Makefile
Makefile.in
.la
.lo
.deps
.libs
*.la
*.lo
test_fusb
std_paths.h
usrp_dbid.py
usrp_dbid.h
usrp_dbid.cc
usrp_server_mbh.cc


Modified: gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/Makefile.am        
2007-04-04 01:55:52 UTC (rev 4866)
+++ gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/Makefile.am        
2007-04-04 02:11:57 UTC (rev 4867)
@@ -20,20 +20,33 @@
 
 include $(top_srcdir)/Makefile.common
 
-INCLUDES = $(DEFINES) $(OMNITHREAD_INCLUDES) $(PMT_INCLUDES) 
$(MBLOCK_INCLUDES) $(USRP_INCLUDES) $(BOOST_CFLAGS)
+INCLUDES =     \
+       $(DEFINES) $(OMNITHREAD_INCLUDES) $(PMT_INCLUDES) $(MBLOCK_INCLUDES) \
+       $(USRP_INCLUDES) $(BOOST_CFLAGS)
 
 EXTRA_DIST =                           
 
-BUILT_SOURCES =                                
+noinst_LTLIBRARIES = libinband.la
 
 
-noinst_LTLIBRARIES = libinband.la
+BUILT_SOURCES =                                \
+       usrp_server_mbh.cc              
 
-libinband_la_SOURCES =
+usrp_server_mbh.cc : usrp_server.mbh
+       $(COMPILE_MBH) usrp_server.mbh usrp_server_mbh.cc
+
+
+libinband_la_SOURCES =                 \
+       $(BUILT_SOURCES)                \
+       usrp_server.cc                  
+
 libinband_la_LIBADD =                  \
        $(MBLOCK_LA)                    
 
 
+include_HEADERS =                      \
+       usrp_server.h                   
+
 MOSTLYCLEANFILES = \
        $(BUILT_SOURCES) *~ *.pyc
 

Added: gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_server.cc
===================================================================
--- gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_server.cc     
                        (rev 0)
+++ gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_server.cc     
2007-04-04 02:11:57 UTC (rev 4867)
@@ -0,0 +1,144 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 version 2, 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <usrp_server.h>
+
+
+// FIXME We should machine generate these by a simple preprocessor run over 
this file
+//
+// These are all the messages that we expect to receive.
+//
+// We "intern" these here (make them into symbols) so that our
+// comparisions below are effectively pointer comparisons.
+
+static pmt_t s_cmd_allocate_channel = pmt_intern("cmd-allocate-channel");
+static pmt_t s_cmd_close = pmt_intern("cmd-close");
+static pmt_t s_cmd_deallocate_channel = pmt_intern("cmd-deallocate-channel");
+static pmt_t s_cmd_open = pmt_intern("cmd-open");
+static pmt_t s_cmd_start_recv_raw_samples = 
pmt_intern("cmd-start-recv-raw-samples");
+static pmt_t s_cmd_stop_recv_raw_samples = 
pmt_intern("cmd-stop-recv-raw-samples");
+static pmt_t s_cmd_to_control_channel = pmt_intern("cmd-to-control-channel");
+static pmt_t s_cmd_xmit_raw_frame  = pmt_intern("cmd-xmit-raw-frame");
+static pmt_t s_response_allocate_channel = 
pmt_intern("response-allocate-channel");
+static pmt_t s_response_close = pmt_intern("response-close");
+static pmt_t s_response_deallocate_channel = 
pmt_intern("response-deallocate-channel");
+static pmt_t s_response_from_control_channel = 
pmt_intern("response-from-control-channel");
+static pmt_t s_response_open = pmt_intern("response-open");
+static pmt_t s_response_recv_raw_samples = 
pmt_intern("response-recv-raw-samples");
+static pmt_t s_response_xmit_raw_frame = pmt_intern("response-xmit-raw-frame");
+
+
+usrp_server::usrp_server()
+{
+  // define our ports
+
+  // control & status port
+  d_cs = define_port("cs", "usrp-server-cs", true, mb_port::EXTERNAL); 
+
+  // rx ports
+  //
+  // (if/when we do replicated ports, these will be replaced by a
+  //  single replicated port)
+  d_rx0 = define_port("rx0", "usrp-rx", true, mb_port::EXTERNAL);
+  d_rx1 = define_port("rx1", "usrp-rx", true, mb_port::EXTERNAL);
+  d_rx2 = define_port("rx2", "usrp-rx", true, mb_port::EXTERNAL);
+  d_rx3 = define_port("rx3", "usrp-rx", true, mb_port::EXTERNAL);
+  
+  // tx ports
+  //
+  // (if/when we do replicated ports, these will be replaced by a
+  //  single replicated port)
+  d_tx0 = define_port("tx0", "usrp-tx", true, mb_port::EXTERNAL);
+  d_tx1 = define_port("tx1", "usrp-tx", true, mb_port::EXTERNAL);
+  d_tx2 = define_port("tx2", "usrp-tx", true, mb_port::EXTERNAL);
+  d_tx3 = define_port("tx3", "usrp-tx", true, mb_port::EXTERNAL);
+  
+}
+
+usrp_server::~usrp_server()
+{
+}
+
+
+void
+usrp_server::init_fsm()
+{
+  // the initial transition
+}
+
+void
+usrp_server::handle_message(mb_message_sptr msg)
+{
+  pmt_t event = msg->signal();         // the "name" of the message
+  pmt_t port_id = msg->port_id();      // which port it came in on
+  pmt_t data = msg->data();
+  pmt_t metadata = msg->metadata();
+  pmt_t invocation_handle;
+  pmt_t reply_data;
+  pmt_t status;
+
+  if (1){
+    std::cout << "event: " << event << std::endl;
+    std::cout << "port_id: " << port_id << std::endl;
+  }
+
+  // It would be nice if this were all table driven, and we could
+  // compute our state transition as f(current_state, port_id, signal)
+
+  if (pmt_eq(port_id, d_cs->port_symbol())){   // message came in on our 
control/status port
+
+    if (pmt_eq(event, s_cmd_open)){
+      // extract args from data
+      invocation_handle = pmt_nth(0, data);
+      long which_usrp = pmt_to_long(pmt_nth(1, data)); // integer usrp id, 
usually 0
+      
+      // Do the right thing....
+      // build a reply
+
+      // if everything OK
+      status = PMT_T;
+      reply_data = pmt_list2(invocation_handle, status);
+
+      //  ...and send it
+      d_cs->send(s_response_open, reply_data);
+      return;
+    }
+    else if (pmt_eq(event, s_cmd_close)){
+      // ...
+    }
+    goto unhandled;
+  }
+
+  if (pmt_eq(event, s_cmd_allocate_channel)){
+    // blah blah blah, do something here
+    return;
+  }
+  if (pmt_eq(event, s_cmd_allocate_channel)){
+    // ...
+    return;
+  }
+
+ unhandled:
+  std::cout << "unhandled msg: " << msg << std::endl;
+}

Added: gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_server.h
===================================================================
--- gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_server.h      
                        (rev 0)
+++ gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_server.h      
2007-04-04 02:11:57 UTC (rev 4867)
@@ -0,0 +1,52 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007 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 version 2, 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_USRP_SERVER_H
+#define INCLUDED_USRP_SERVER_H
+
+#include <mb_mblock.h>
+
+/*!
+ * \brief Implements the lowest-level mblock interface to the USRP
+ */
+class usrp_server : public mb_mblock
+{
+  // our ports
+  mb_port_sptr d_cs;
+  mb_port_sptr d_rx0;
+  mb_port_sptr d_rx1;
+  mb_port_sptr d_rx2;
+  mb_port_sptr d_rx3;
+  mb_port_sptr d_tx0;
+  mb_port_sptr d_tx1;
+  mb_port_sptr d_tx2;
+  mb_port_sptr d_tx3;
+
+  // add more stuff here...
+
+public:
+  usrp_server();
+  ~usrp_server();
+
+  void init_fsm();
+  void handle_message(mb_message_sptr msg);
+};
+
+#endif /* INCLUDED_USRP_SERVER_H */

Modified: 
gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_server.mbh
===================================================================
--- gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_server.mbh    
2007-04-04 01:55:52 UTC (rev 4866)
+++ gnuradio/branches/developers/eb/ibu/usrp/host/lib/inband/usrp_server.mbh    
2007-04-04 02:11:57 UTC (rev 4867)
@@ -224,3 +224,25 @@
 
    )
   )
+
+
+;; ----------------------------------------------------------------
+;; usrp-server-cs
+;;
+;; Control and status port for usrp-server
+;;
+;; The protocol class is defined from the client's point-of-view.
+;; (The client port is unconjugated, the server port is conjugated.)
+
+(define-protocol-class usrp-server-cs
+
+  (:outgoing
+   (cmd-open invocation-handle which-usrp)
+   (cmd-close invocation-handle)
+   )
+
+  (:incoming
+   (response-open invocation-handle status)
+   (response-close invocation-handle status)
+   )
+  )





reply via email to

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