This is the mail archive of the sid@sources.redhat.com mailing list for the SID project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch][rfa] Dynamic Configuration enhancements


Hi,

This patch adds the loader as a child of the session or each board to make it possible for various components to make use of the ulog functionality. This patch also changes the ulog implementation to use sid-io-fileio so that the output can be written to a file and to change the name representing stdout from "*" to the more traditional "-".

ok to commit?

Dave
2003-10-21  Dave Brolley  <brolley@redhat.com>

	* mainDynamic.cxx (try_load_file): Call set_loader of
	session or board as appropriate.
	* commonCfg.h (loader): New member of SessionCfg.
	(set_loader): New method of SessionCfg.
	(loader): New member of SessionCfg.
	(set_loader): New method of BoardCfg.
	* commonCfg.cxx (SessionCfg): Initialize loader.
	(set_loader): New method of SessionCfg.
	(BoardCfg): Initialize loader.
	(set_loader): New method of SessionCfg.
	(set_loader): New method of BoardCfg.

Index: sid/main/dynamic/commonCfg.cxx
===================================================================
RCS file: /cvs/src/src/sid/main/dynamic/commonCfg.cxx,v
retrieving revision 1.4
diff -c -p -r1.4 commonCfg.cxx
*** sid/main/dynamic/commonCfg.cxx	10 Jun 2003 18:29:51 -0000	1.4
--- sid/main/dynamic/commonCfg.cxx	21 Oct 2003 19:43:20 -0000
*************** SessionCfg::SessionCfg (const string nam
*** 528,533 ****
--- 528,534 ----
      tksched (NULL),
      tksm (NULL),
      tcl_bridge (NULL),
+     loader (NULL),
      verbose (false),
      use_stdio (true)
  {
*************** SessionCfg::SessionCfg (const string nam
*** 546,556 ****
    yield_net->add_output (0, host_sched, "yield");
    init_seq->add_output (0, reset_net, "input");
  
!   AtomicCfg *ulog = new AtomicCfg ("ulog-*",
  				   "libconsoles.la", 
  				   "console_component_library", 
! 				   "sid-io-stdio");
!   ulog_map["*"] = ulog;
    add_child (ulog);
  }
  
--- 547,557 ----
    yield_net->add_output (0, host_sched, "yield");
    init_seq->add_output (0, reset_net, "input");
  
!   AtomicCfg *ulog = new AtomicCfg ("ulog-cout",
  				   "libconsoles.la", 
  				   "console_component_library", 
! 				   "sid-io-fileio");
!   ulog_map["-"] = ulog;
    add_child (ulog);
  }
  
*************** SessionCfg::add_ulog_file (const string 
*** 564,575 ****
    AtomicCfg *ulog = new AtomicCfg ("ulog-" + name, 
  				   "libconsoles.la", 
  				   "console_component_library", 
! 				   "sid-io-stdio");
    set (ulog, "filename", name);
    ulog_map[name] = ulog;
    add_child (ulog);
  }
  
  void SessionCfg::use_no_stdio ()
  {
    use_stdio = false;
--- 565,584 ----
    AtomicCfg *ulog = new AtomicCfg ("ulog-" + name, 
  				   "libconsoles.la", 
  				   "console_component_library", 
! 				   "sid-io-fileio");
    set (ulog, "filename", name);
    ulog_map[name] = ulog;
    add_child (ulog);
  }
  
+ void SessionCfg::set_loader (LoaderCfg *l)
+ {
+   if (loader)
+     return;
+   loader = l;
+   add_child (l);
+ }
+ 
  void SessionCfg::use_no_stdio ()
  {
    use_stdio = false;
*************** BoardCfg::BoardCfg (const string name, 
*** 862,868 ****
    gloss (NULL),
    main_mapper (NULL),
    icache (NULL),
!   dcache (NULL)
  {
    assert (sess);
    cpu = new CpuCfg ("cpu", default_cpu_variant, sess);
--- 871,878 ----
    gloss (NULL),
    main_mapper (NULL),
    icache (NULL),
!   dcache (NULL),
!   loader (NULL)
  {
    assert (sess);
    cpu = new CpuCfg ("cpu", default_cpu_variant, sess);
*************** void BoardCfg::set_gdb (const string por
*** 909,914 ****
--- 919,933 ----
    gdb = new GdbCfg ("gdb", port, cpu, this, sess);
    add_child (gdb);
    sess->use_no_stdio ();
+ }
+ 
+ 
+ void BoardCfg::set_loader (LoaderCfg *l)
+ {
+   if (loader)
+     return;
+   loader = l;
+   add_child (l);
  }
  
  void BoardCfg::write_config (Writer &w)
Index: sid/main/dynamic/commonCfg.h
===================================================================
RCS file: /cvs/src/src/sid/main/dynamic/commonCfg.h,v
retrieving revision 1.2
diff -c -p -r1.2 commonCfg.h
*** sid/main/dynamic/commonCfg.h	10 Jun 2003 18:29:51 -0000	1.2
--- sid/main/dynamic/commonCfg.h	21 Oct 2003 19:43:20 -0000
*************** struct UlogCfg
*** 182,187 ****
--- 182,189 ----
  
  // you should really only make one of these, with an empty name,
  // unless you want some crazy multi-session support.
+ class LoaderCfg;
+ 
  struct SessionCfg :
    virtual public AggregateCfg, public UlogCfg
  {
*************** struct SessionCfg :
*** 195,200 ****
--- 197,203 ----
    GlueSeqCfg *yield_net;
    AtomicCfg *stdio_obj;
    AtomicCfg *main_obj;
+   LoaderCfg *loader;
    // optional bits
    virtual void write_load (Writer &w);
    void use_audio();
*************** struct SessionCfg :
*** 202,207 ****
--- 205,211 ----
    void use_tksm();
    void use_tcl_bridge();
    void use_no_stdio ();
+   virtual void set_loader (LoaderCfg *l);
    AtomicCfg *audio;
    AtomicCfg *tksched;
    AtomicCfg *tksm;
*************** class GdbCfg :
*** 293,298 ****
--- 297,303 ----
    AtomicCfg *sock;
  };
  
+ class LoaderCfg;
  class BoardCfg :
  virtual public AggregateCfg, public UlogCfg
  {
*************** public:
*** 305,310 ****
--- 310,316 ----
  	    bool with_cpu_main_mem_connect = false);    
    virtual void use_gloss ();
    virtual void set_cpu (const string variant);
+   virtual void set_loader (LoaderCfg *l);
    virtual void set_gdb (const string port);
    virtual void set_gprof (const string filename, gprof_type type, int interval);
    virtual void set_engine (const string engine);
*************** public:
*** 339,344 ****
--- 345,351 ----
    AtomicCfg *core_probe;
    AtomicCfg *icache;
    AtomicCfg *dcache;  
+   LoaderCfg *loader;
  };
  
  #endif // __commonCfg_h__
Index: sid/main/dynamic/mainDynamic.cxx
===================================================================
RCS file: /cvs/src/src/sid/main/dynamic/mainDynamic.cxx,v
retrieving revision 1.4
diff -c -p -r1.4 mainDynamic.cxx
*** sid/main/dynamic/mainDynamic.cxx	10 Jun 2003 18:29:51 -0000	1.4
--- sid/main/dynamic/mainDynamic.cxx	21 Oct 2003 19:43:20 -0000
*************** usage ()
*** 123,129 ****
    cout << "--ulog-level=LEVEL    Set the logging level for the current board" << endl;
    cout << "--ulog-mode=less|match|equal" << endl
         << "                      Set the logging mode for the current board" << endl;
!   cout << "--ulog-file=*|FILE    Set the log file name" << endl;
    cout << endl
         << " note: most board-specific options can be used in board-neutral position " << endl
         << " where they are interpreted as session-specific or default settings. " << endl;
--- 123,129 ----
    cout << "--ulog-level=LEVEL    Set the logging level for the current board" << endl;
    cout << "--ulog-mode=less|match|equal" << endl
         << "                      Set the logging mode for the current board" << endl;
!   cout << "--ulog-file=-|FILE    Set the log file name" << endl;
    cout << endl
         << " note: most board-specific options can be used in board-neutral position " << endl
         << " where they are interpreted as session-specific or default settings. " << endl;
*************** void try_load_file (const string memspec
*** 226,232 ****
    if (map)
      {
        loader->set_target (map, "access-port");
!       sess->add_child (loader);
      }
    else
      {
--- 226,232 ----
    if (map)
      {
        loader->set_target (map, "access-port");
!       sess->set_loader (loader);
      }
    else
      {
*************** void try_load_file (const string memspec
*** 234,240 ****
  	{
  	  assert (board->main_mapper);
  	  loader->set_target (board->main_mapper, "access-port");
! 	  board->add_child (loader);
  	}
        else
  	{
--- 234,240 ----
  	{
  	  assert (board->main_mapper);
  	  loader->set_target (board->main_mapper, "access-port");
! 	  board->set_loader (loader);
  	}
        else
  	{
*************** void try_add_memory (const string memspe
*** 376,382 ****
  	}
      } 
  
-   assert (map);
    assert (mem);
    string port ( read_only_p ? "read-only-port" : "read-write-port");
  
--- 376,381 ----

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]