Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

l1394_toponode.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002                           node.cpp  -  description
00003                              -------------------
00004     begin                : Mon Jun 26 2000
00005     copyright            : (C) 2000-2004 by Michael Repplinger
00006     email                : repplix@studcs.uni-sb.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #include "l1394_toponode.h"
00019 
00020 
00021 using std::dec;
00022 using namespace std;
00023 namespace L1394{
00024 namespace internal{
00025 const char* TopoNode::port_value[] =
00026              {" Port not present",  "Not active",
00027               "Active and connected to parent node",
00028               "Active and connected to child node" };
00029 
00030 
00031 const char* TopoNode::phy_speed_spec[] =
00032       {"98.304 Mbit/s", "196.608 Mbit/s",
00033        "393.216 Mbit/s", "<reserved>"};
00034 
00035 const char* TopoNode::pwr_class_spec[] =
00036       {"Node does need bus power and does not repeat power.",
00037        "Self powered and provides 15W (minimum) to bus.",
00038        "Self powered and provides 30W (minimum) to bus.",
00039        "Self powered and provides 45W (minimum) to bus.",
00040        "Node need 3W from the bus.",
00041        "<reserved>",
00042        "Node need 3W from the bus. Additional 3W(max) is need to enable link.",
00043        "Node need 3W from the bus. Additional 7W(max) is need to enable link."};
00044 
00045 
00046 
00047 
00048 const char* TopoNode::phy_delay_spec[] =
00049       {"<=144ns (~14/Base_Rate)", "<reserved>", "<reserved>","<reserved>"};
00050 
00051 TopoNode::TopoNode(int maxp,TopoNode *p)
00052 {
00053   parent = p;
00054 
00055   max_port = maxp;
00056 
00057   child = new TopoNode*[max_port];
00058   for (int i = 0; i<max_port; i++)
00059     child[i] = NULL  ;
00060   port_status = new unsigned short int[max_port];
00061 }
00062 
00063 
00064 TopoNode::~TopoNode()
00065 {
00066    for (int i = 0; i < max_port; i++)
00067     delete child[i];
00068   delete[] port_status;
00069 }
00070 
00071 
00072 
00073 void TopoNode::setPortStatus(int i, unsigned short int p)
00074 {
00075   if (i < max_port) port_status[i] = p;
00076 }
00077 
00078 
00079 
00080 void TopoNode::printNode()
00081 {
00082   for (int i = 0; i < max_port; i++)
00083   {
00084     cout << "Actual node id :  " << dec << getPhyId() << endl;
00085     cout << i << " th port : "<< port_value[port_status[i]] << "   " << endl;
00086   }
00087   for (int j = 0; j < max_port; j++)
00088       if (getChild(j) != NULL) getChild(j)->printNode();
00089   cout << endl;
00090 }
00091 
00092 void TopoNode::setNodeInfo(Quadlet *t)
00093 {
00094   node_info = *t;
00095 }
00096 
00097 ostream& operator<<(ostream& o, TopoNode& n)
00098 {
00099   o << "Node Information: \n";
00100   o << "  Speed        : " << n.phy_speed_spec[n.getPhySpeed()] << '\n';
00101   o << "  Delay        : " << n.phy_delay_spec[n.getPhyDelay()] << '\n';
00102   o << "  Power Class : " << n.pwr_class_spec[n.getPwrClass()] << endl;
00103   return o;
00104 }
00105 }
00106 }

Generated on Wed Aug 24 00:36:41 2005 for L1394 by doxygen 1.4.2
L1394 library (NMM) grahics.cs.uni-sb.de/~repplix/l1394_home/