tool/CommandSlaves.cpp
branchstable-1.5
changeset 2421 bc2d4bf9cbe5
parent 2374 e898451c054a
equal deleted inserted replaced
2420:69056c46aa4d 2421:bc2d4bf9cbe5
   109 void CommandSlaves::execute(const StringVector &args)
   109 void CommandSlaves::execute(const StringVector &args)
   110 {
   110 {
   111 	MasterIndexList masterIndices;
   111 	MasterIndexList masterIndices;
   112     SlaveList slaves;
   112     SlaveList slaves;
   113     bool doIndent;
   113     bool doIndent;
   114     
   114 
   115     if (args.size()) {
   115     if (args.size()) {
   116         stringstream err;
   116         stringstream err;
   117         err << "'" << getName() << "' takes no arguments!";
   117         err << "'" << getName() << "' takes no arguments!";
   118         throwInvalidUsageException(err);
   118         throwInvalidUsageException(err);
   119     }
   119     }
   153     InfoList::const_iterator iter;
   153     InfoList::const_iterator iter;
   154     stringstream str;
   154     stringstream str;
   155     unsigned int maxPosWidth = 0, maxAliasWidth = 0,
   155     unsigned int maxPosWidth = 0, maxAliasWidth = 0,
   156                  maxRelPosWidth = 0, maxStateWidth = 0;
   156                  maxRelPosWidth = 0, maxStateWidth = 0;
   157     string indent(doIndent ? "  " : "");
   157     string indent(doIndent ? "  " : "");
   158     
   158 
   159     m.getMaster(&master);
   159     m.getMaster(&master);
   160 
   160 
   161     lastAlias = 0;
   161     lastAlias = 0;
   162     aliasIndex = 0;
   162     aliasIndex = 0;
   163     for (i = 0; i < master.slave_count; i++) {
   163     for (i = 0; i < master.slave_count; i++) {
   164         m.getSlave(&slave, i);
   164         m.getSlave(&slave, i);
   165         
   165 
   166         if (slave.alias) {
   166         if (slave.alias) {
   167             lastAlias = slave.alias;
   167             lastAlias = slave.alias;
   168             aliasIndex = 0;
   168             aliasIndex = 0;
   169         }
   169         }
   170 
   170 
   294 
   294 
   295         cout << "Port  Type  Link  Loop    Signal  NextSlave";
   295         cout << "Port  Type  Link  Loop    Signal  NextSlave";
   296         if (si->dc_supported)
   296         if (si->dc_supported)
   297             cout << "  RxTime [ns]  Diff [ns]   NextDc [ns]";
   297             cout << "  RxTime [ns]  Diff [ns]   NextDc [ns]";
   298         cout << endl;
   298         cout << endl;
   299             
   299 
   300         for (i = 0; i < EC_MAX_PORTS; i++) {
   300         for (i = 0; i < EC_MAX_PORTS; i++) {
   301             cout << "   " << i << "  " << setfill(' ') << left << setw(4);
   301             cout << "   " << i << "  " << setfill(' ') << left << setw(4);
   302             switch (si->ports[i].desc) {
   302             switch (si->ports[i].desc) {
   303                 case EC_PORT_NOT_IMPLEMENTED:
   303                 case EC_PORT_NOT_IMPLEMENTED:
   304                     cout << "N/A";
   304                     cout << "N/A";
   327             if (si->ports[i].next_slave != 0xffff) {
   327             if (si->ports[i].next_slave != 0xffff) {
   328                 cout << dec << si->ports[i].next_slave;
   328                 cout << dec << si->ports[i].next_slave;
   329             } else {
   329             } else {
   330                 cout << "-";
   330                 cout << "-";
   331             }
   331             }
   332             
   332 
   333             if (si->dc_supported) {
   333             if (si->dc_supported) {
   334                 cout << "  " << setw(11) << right;
   334                 cout << "  " << setw(11) << right;
   335                 if (!si->ports[i].link.loop_closed) {
   335                 if (!si->ports[i].link.loop_closed) {
   336                     cout << dec << si->ports[i].receive_time;
   336                     cout << dec << si->ports[i].receive_time;
   337                 } else {
   337                 } else {