author | Edouard Tisserant <edouard.tisserant@gmail.com> |
Fri, 05 Oct 2018 17:45:44 +0200 | |
branch | stable-1.5 |
changeset 2720 | 4645c990fd79 |
parent 2673 | 459758a800b3 |
permissions | -rw-r--r-- |
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/***************************************************************************** |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
* |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
* $Id$ |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
* |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5 |
* Copyright (C) 2006-2009 Florian Pose, Ingenieurgemeinschaft IgH |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
* |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
* This file is part of the IgH EtherCAT Master. |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8 |
* |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9 |
* The IgH EtherCAT Master is free software; you can redistribute it and/or |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
10 |
* modify it under the terms of the GNU General Public License version 2, as |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
11 |
* published by the Free Software Foundation. |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
12 |
* |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
13 |
* The IgH EtherCAT Master is distributed in the hope that it will be useful, |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
16 |
* Public License for more details. |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
17 |
* |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
18 |
* You should have received a copy of the GNU General Public License along |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
19 |
* with the IgH EtherCAT Master; if not, write to the Free Software |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
* |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
22 |
* --- |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
23 |
* |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
24 |
* The license mentioned above concerns the source code only. Using the |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
25 |
* EtherCAT technology and brand is only permitted in compliance with the |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
26 |
* industrial property and similar rights of Beckhoff Automation GmbH. |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
27 |
* |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
28 |
****************************************************************************/ |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
|
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
#include <iostream> |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
#include <map> |
2673
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
32 |
#include <algorithm> |
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
using namespace std; |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
|
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
#include "CommandGraph.h" |
1826
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
1804
diff
changeset
|
36 |
#include "MasterDevice.h" |
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
|
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
/*****************************************************************************/ |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
|
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
CommandGraph::CommandGraph(): |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
Command("graph", "Output the bus topology as a graph.") |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
{ |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
43 |
} |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
44 |
|
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
45 |
/*****************************************************************************/ |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
46 |
|
1968
4f682084c643
Implemented drive_no for command-line tool; binary base name is now a
Florian Pose <fp@igh-essen.com>
parents:
1870
diff
changeset
|
47 |
string CommandGraph::helpString(const string &binaryBaseName) const |
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
48 |
{ |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
49 |
stringstream str; |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
50 |
|
2673
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
51 |
str |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
52 |
<< binaryBaseName << " " << getName() << " [OPTIONS]" << endl |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
53 |
<< binaryBaseName << " " << getName() << " [OPTIONS] <INFO>" << endl |
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
54 |
<< endl |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
55 |
<< getBriefDescription() << endl |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
56 |
<< endl |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
57 |
<< "The bus is output in DOT language (see" << endl |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
58 |
<< "http://www.graphviz.org/doc/info/lang.html), which can" << endl |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
59 |
<< "be processed with the tools from the Graphviz" << endl |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
60 |
<< "package. Example:" << endl |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
61 |
<< endl |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
62 |
<< " ethercat graph | dot -Tsvg > bus.svg" << endl |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
63 |
<< endl |
2673
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
64 |
<< "See 'man dot' for more information." << endl |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
65 |
<< endl |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
66 |
<< "Additional information at edges and nodes is selected via" << endl |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
67 |
<< "the first argument:" << endl |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
68 |
<< " DC - DC timing" << endl |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
69 |
<< " CRC - CRC error register information" << endl |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
70 |
<< endl; |
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
71 |
|
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
72 |
return str.str(); |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
73 |
} |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
74 |
|
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
75 |
/****************************************************************************/ |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
76 |
|
2673
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
77 |
enum Info { |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
78 |
None, |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
79 |
DC, |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
80 |
CRC |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
81 |
}; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
82 |
|
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
83 |
#define REG_SIZE (20) |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
84 |
|
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
85 |
struct CrcInfo { |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
86 |
unsigned int crc[EC_MAX_PORTS]; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
87 |
unsigned int phy[EC_MAX_PORTS]; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
88 |
unsigned int fwd[EC_MAX_PORTS]; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
89 |
unsigned int lnk[EC_MAX_PORTS]; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
90 |
}; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
91 |
|
1826
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
1804
diff
changeset
|
92 |
void CommandGraph::execute(const StringVector &args) |
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
93 |
{ |
2673
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
94 |
Info info = None; |
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
95 |
ec_ioctl_master_t master; |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
96 |
typedef vector<ec_ioctl_slave_t> SlaveVector; |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
97 |
SlaveVector slaves; |
2673
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
98 |
typedef vector<CrcInfo> CrcInfoVector; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
99 |
CrcInfoVector crcInfos; |
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
100 |
ec_ioctl_slave_t slave; |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
101 |
SlaveVector::const_iterator si; |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
102 |
map<int, string> portMedia; |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
103 |
map<int, string>::const_iterator mi; |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
104 |
map<int, int> mediaWeights; |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
105 |
map<int, int>::const_iterator wi; |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
106 |
|
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
107 |
portMedia[EC_PORT_MII] = "MII"; |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
108 |
mediaWeights[EC_PORT_MII] = 1; |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
109 |
|
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
110 |
portMedia[EC_PORT_EBUS] = "EBUS"; |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
111 |
mediaWeights[EC_PORT_EBUS] = 5; |
2421 | 112 |
|
2673
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
113 |
if (args.size() > 1) { |
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
114 |
stringstream err; |
2673
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
115 |
err << "'" << getName() << "' takes either one or no arguments!"; |
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
116 |
throwInvalidUsageException(err); |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
117 |
} |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
118 |
|
2673
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
119 |
if (args.size() == 1) { |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
120 |
string arg = args[0]; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
121 |
transform(arg.begin(), arg.end(), |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
122 |
arg.begin(), (int (*) (int)) std::toupper); |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
123 |
if (arg == "DC") { |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
124 |
info = DC; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
125 |
} |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
126 |
else if (arg == "CRC") { |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
127 |
info = CRC; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
128 |
} |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
129 |
else { |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
130 |
stringstream err; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
131 |
err << "Unknown argument \"" << args[0] << "\"!"; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
132 |
throwInvalidUsageException(err); |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
133 |
} |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
134 |
} |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
135 |
|
1870
0cee1fb7f0fd
Added getSingleMasterIndex() for command-line tool.
Florian Pose <fp@igh-essen.com>
parents:
1869
diff
changeset
|
136 |
MasterDevice m(getSingleMasterIndex()); |
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
137 |
m.open(MasterDevice::Read); |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
138 |
m.getMaster(&master); |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
139 |
|
2673
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
140 |
for (unsigned int i = 0; i < master.slave_count; i++) { |
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
141 |
m.getSlave(&slave, i); |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
142 |
slaves.push_back(slave); |
2673
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
143 |
|
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
144 |
} |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
145 |
|
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
146 |
if (info == CRC) { |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
147 |
uint8_t data[REG_SIZE]; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
148 |
ec_ioctl_slave_reg_t io; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
149 |
io.emergency = 0; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
150 |
io.address = 0x0300; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
151 |
io.size = REG_SIZE; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
152 |
io.data = data; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
153 |
|
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
154 |
for (unsigned int i = 0; i < master.slave_count; i++) { |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
155 |
io.slave_position = i; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
156 |
try { |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
157 |
m.readReg(&io); |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
158 |
} catch (MasterDeviceException &e) { |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
159 |
throw e; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
160 |
} |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
161 |
|
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
162 |
CrcInfo crcInfo; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
163 |
for (int port = 0; port < EC_MAX_PORTS; port++) { |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
164 |
crcInfo.crc[port] = io.data[ 0 + port * 2]; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
165 |
crcInfo.phy[port] = io.data[ 1 + port * 2]; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
166 |
crcInfo.fwd[port] = io.data[ 8 + port]; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
167 |
crcInfo.lnk[port] = io.data[16 + port]; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
168 |
} |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
169 |
crcInfos.push_back(crcInfo); |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
170 |
} |
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
171 |
} |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
172 |
|
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
173 |
cout << "/* EtherCAT bus graph. Generated by 'ethercat graph'. */" << endl |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
174 |
<< endl |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
175 |
<< "strict graph bus {" << endl |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
176 |
<< " rankdir=\"LR\"" << endl |
1425
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
177 |
<< " ranksep=0.8" << endl |
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
178 |
<< " nodesep=0.8" << endl |
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
179 |
<< " node [fontname=\"Helvetica\"]" << endl |
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
180 |
<< " edge [fontname=\"Helvetica\",fontsize=\"10\"]" << endl |
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
181 |
<< endl |
1425
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
182 |
<< " master [label=\"EtherCAT\\nMaster\"]" << endl; |
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
183 |
|
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
184 |
if (slaves.size()) { |
2421 | 185 |
cout << " master -- slave0"; |
1425
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
186 |
mi = portMedia.find(slaves.front().ports[0].desc); |
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
187 |
if (mi != portMedia.end()) |
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
188 |
cout << "[label=\"" << mi->second << "\"]"; |
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
189 |
|
1425
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
190 |
cout << endl; |
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
191 |
} |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
192 |
cout << endl; |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
193 |
|
2671
5d7a83195c80
Display alias adressing in graph.
Florian Pose <fp@igh-essen.com>
parents:
2421
diff
changeset
|
194 |
uint16_t alias = 0x0000; |
5d7a83195c80
Display alias adressing in graph.
Florian Pose <fp@igh-essen.com>
parents:
2421
diff
changeset
|
195 |
uint16_t pos = 0; |
5d7a83195c80
Display alias adressing in graph.
Florian Pose <fp@igh-essen.com>
parents:
2421
diff
changeset
|
196 |
|
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
197 |
for (si = slaves.begin(); si != slaves.end(); si++) { |
2671
5d7a83195c80
Display alias adressing in graph.
Florian Pose <fp@igh-essen.com>
parents:
2421
diff
changeset
|
198 |
if (si->alias) { |
5d7a83195c80
Display alias adressing in graph.
Florian Pose <fp@igh-essen.com>
parents:
2421
diff
changeset
|
199 |
alias = si->alias; |
5d7a83195c80
Display alias adressing in graph.
Florian Pose <fp@igh-essen.com>
parents:
2421
diff
changeset
|
200 |
pos = 0; |
5d7a83195c80
Display alias adressing in graph.
Florian Pose <fp@igh-essen.com>
parents:
2421
diff
changeset
|
201 |
} |
5d7a83195c80
Display alias adressing in graph.
Florian Pose <fp@igh-essen.com>
parents:
2421
diff
changeset
|
202 |
|
1804 | 203 |
cout << " slave" << si->position << " [shape=\"box\"" |
2671
5d7a83195c80
Display alias adressing in graph.
Florian Pose <fp@igh-essen.com>
parents:
2421
diff
changeset
|
204 |
<< ",label=\"" << si->position |
5d7a83195c80
Display alias adressing in graph.
Florian Pose <fp@igh-essen.com>
parents:
2421
diff
changeset
|
205 |
<< " / " << alias << ":" << pos; |
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
206 |
if (string(si->order).size()) |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
207 |
cout << "\\n" << si->order; |
2673
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
208 |
if (info == DC && si->dc_supported) { |
1425
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
209 |
cout << "\\nDC: "; |
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
210 |
if (si->has_dc_system_time) { |
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
211 |
switch (si->dc_range) { |
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
212 |
case EC_DC_32: |
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
213 |
cout << "32 bit"; |
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
214 |
break; |
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
215 |
case EC_DC_64: |
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
216 |
cout << "64 bit"; |
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
217 |
break; |
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
218 |
default: |
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
219 |
break; |
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
220 |
} |
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
221 |
} else { |
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
222 |
cout << "Delay meas."; |
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
223 |
} |
1426 | 224 |
cout << "\\nDelay: " << si->transmission_delay << " ns"; |
1425
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
225 |
} |
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
226 |
cout << "\"]" << endl; |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
227 |
|
2673
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
228 |
|
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
229 |
for (int port = 1; port < EC_MAX_PORTS; port++) { |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
230 |
uint16_t next_pos = si->ports[port].next_slave; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
231 |
|
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
232 |
if (next_pos == 0xffff) { |
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
233 |
continue; |
2673
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
234 |
} |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
235 |
|
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
236 |
if (next_pos >= slaves.size()) { |
1425
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
237 |
cerr << "Invalid next slave pointer." << endl; |
2673
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
238 |
continue; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
239 |
} |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
240 |
|
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
241 |
ec_ioctl_slave_t *next = &slaves[next_pos]; |
1425
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
242 |
|
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
243 |
cout << " slave" << si->position << " -- " |
2673
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
244 |
<< "slave" << next_pos << " [taillabel=\"" << port; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
245 |
|
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
246 |
if (info == DC && si->dc_supported) { |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
247 |
cout << " [" << si->ports[port].delay_to_next_dc << "]"; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
248 |
} |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
249 |
if (info == CRC) { |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
250 |
CrcInfo *crcInfo = &crcInfos[si->position]; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
251 |
cout << " [" << crcInfo->crc[port] << "/" |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
252 |
<< crcInfo->fwd[port] << "]"; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
253 |
} |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
254 |
|
1425
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
255 |
cout << "\",headlabel=\"0"; |
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
256 |
|
2673
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
257 |
if (info == DC && next->dc_supported) { |
1425
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
258 |
cout << " [" << next->ports[0].delay_to_next_dc << "]"; |
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
259 |
} |
2673
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
260 |
if (info == CRC) { |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
261 |
CrcInfo *crcInfo = &crcInfos[next_pos]; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
262 |
cout << " [" << crcInfo->crc[0] << "/" |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
263 |
<< crcInfo->fwd[0] << "]"; |
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
264 |
} |
1425
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
265 |
cout << "\""; |
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
266 |
|
2673
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
267 |
mi = portMedia.find(si->ports[port].desc); |
1425
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
268 |
if (mi == portMedia.end() && next) { |
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
269 |
/* Try medium of next-hop slave. */ |
1425
c1322a8793c0
Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents:
1422
diff
changeset
|
270 |
mi = portMedia.find(next->ports[0].desc); |
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
271 |
} |
2421 | 272 |
|
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
273 |
if (mi != portMedia.end()) |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
274 |
cout << ",label=\"" << mi->second << "\""; |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
275 |
|
2673
459758a800b3
Optionally output CRC diagnosis information in graph.
Florian Pose <fp@igh-essen.com>
parents:
2671
diff
changeset
|
276 |
wi = mediaWeights.find(si->ports[port].desc); |
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
277 |
if (wi != mediaWeights.end()) |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
278 |
cout << ",weight=\"" << wi->second << "\""; |
2421 | 279 |
|
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
280 |
cout << "]" << endl; |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
281 |
} |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
282 |
|
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
283 |
cout << endl; |
2671
5d7a83195c80
Display alias adressing in graph.
Florian Pose <fp@igh-essen.com>
parents:
2421
diff
changeset
|
284 |
pos++; |
1422
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
285 |
} |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
286 |
|
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
287 |
cout << "}" << endl; |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
288 |
} |
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
289 |
|
d41e4537b75f
Added 'ethercat graph' command.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
290 |
/*****************************************************************************/ |