tool/CommandSlaves.cpp
author Florian Pose <fp@igh-essen.com>
Wed, 05 Dec 2012 12:02:44 +0100
branchstable-1.5
changeset 2472 50b861e981f7
parent 2421 bc2d4bf9cbe5
permissions -rw-r--r--
Fixed __e1000_maybe_stop_tx() for e1000e.
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
/*****************************************************************************
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
 *
1363
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1337
diff changeset
     3
 *  $Id$
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1337
diff changeset
     4
 *
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1337
diff changeset
     5
 *  Copyright (C) 2006-2009  Florian Pose, Ingenieurgemeinschaft IgH
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1337
diff changeset
     6
 *
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1337
diff changeset
     7
 *  This file is part of the IgH EtherCAT Master.
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1337
diff changeset
     8
 *
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1337
diff changeset
     9
 *  The IgH EtherCAT Master is free software; you can redistribute it and/or
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1337
diff changeset
    10
 *  modify it under the terms of the GNU General Public License version 2, as
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1337
diff changeset
    11
 *  published by the Free Software Foundation.
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1337
diff changeset
    12
 *
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1337
diff changeset
    13
 *  The IgH EtherCAT Master is distributed in the hope that it will be useful,
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1337
diff changeset
    14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1337
diff changeset
    15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1337
diff changeset
    16
 *  Public License for more details.
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1337
diff changeset
    17
 *
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1337
diff changeset
    18
 *  You should have received a copy of the GNU General Public License along
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1337
diff changeset
    19
 *  with the IgH EtherCAT Master; if not, write to the Free Software
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1337
diff changeset
    20
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1337
diff changeset
    21
 *
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1337
diff changeset
    22
 *  ---
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1337
diff changeset
    23
 *
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1337
diff changeset
    24
 *  The license mentioned above concerns the source code only. Using the
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1337
diff changeset
    25
 *  EtherCAT technology and brand is only permitted in compliance with the
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1337
diff changeset
    26
 *  industrial property and similar rights of Beckhoff Automation GmbH.
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    27
 *
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    28
 ****************************************************************************/
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    30
#include <iostream>
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    31
#include <iomanip>
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
#include <list>
1222
7348d6abb6cb Applied patch by Karsten Schwinne, adding a few header files necessary
Florian Pose <fp@igh-essen.com>
parents: 1220
diff changeset
    33
#include <string.h>
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    34
using namespace std;
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    35
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    36
#include "CommandSlaves.h"
1826
ec6223c3b7ec Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents: 1463
diff changeset
    37
#include "MasterDevice.h"
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    38
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    39
/*****************************************************************************/
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    40
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    41
CommandSlaves::CommandSlaves():
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    42
    Command("slaves", "Display slaves on the bus.")
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    43
{
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    44
}
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    45
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    46
/*****************************************************************************/
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    47
1968
4f682084c643 Implemented drive_no for command-line tool; binary base name is now a
Florian Pose <fp@igh-essen.com>
parents: 1869
diff changeset
    48
string CommandSlaves::helpString(const string &binaryBaseName) const
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    49
{
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    50
    stringstream str;
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    51
1968
4f682084c643 Implemented drive_no for command-line tool; binary base name is now a
Florian Pose <fp@igh-essen.com>
parents: 1869
diff changeset
    52
    str << binaryBaseName << " " << getName() << " [OPTIONS]" << endl
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    53
        << endl
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    54
        << getBriefDescription() << endl
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    55
        << endl
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    56
        << "If the --verbose option is not given, the slaves are" << endl
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    57
        << "displayed one-per-line. Example:" << endl
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    58
        << endl
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    59
        << "1  5555:0  PREOP  +  EL3162 2C. Ana. Input 0-10V" << endl
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    60
        << "|  |    |  |      |  |" << endl
1144
7dbfdd61812c Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents: 1142
diff changeset
    61
        << "|  |    |  |      |  \\- Name from the SII if avaliable," << endl
7dbfdd61812c Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents: 1142
diff changeset
    62
        << "|  |    |  |      |     otherwise vendor ID and product" << endl
7dbfdd61812c Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents: 1142
diff changeset
    63
        << "|  |    |  |      |     code (both hexadecimal)." << endl
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    64
        << "|  |    |  |      \\- Error flag. '+' means no error," << endl
1144
7dbfdd61812c Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents: 1142
diff changeset
    65
        << "|  |    |  |         'E' means that scan or" << endl
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    66
        << "|  |    |  |         configuration failed." << endl
1144
7dbfdd61812c Bugfixes and improvements.
Florian Pose <fp@igh-essen.com>
parents: 1142
diff changeset
    67
        << "|  |    |  \\- Current application-layer state." << endl
1157
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
    68
        << "|  |    \\- Decimal relative position to the last" << endl
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    69
        << "|  |       slave with an alias address set." << endl
1157
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
    70
        << "|  \\- Decimal alias address of this slave (if set)," << endl
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
    71
        << "|     otherwise of the last slave with an alias set," << endl
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
    72
        << "|     or zero, if no alias was encountered up to this" << endl
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
    73
        << "|     position." << endl
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
    74
        << "\\- Absolute ring position in the bus." << endl
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    75
        << endl
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    76
        << "If the --verbose option is given, a detailed (multi-line)" << endl
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    77
        << "description is output for each slave." << endl
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    78
        << endl
1157
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
    79
        << "Slave selection:" << endl
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
    80
        << "  Slaves for this and other commands can be selected with" << endl
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
    81
        << "  the --alias and --position parameters as follows:" << endl
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
    82
        << endl
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
    83
        << "  1) If neither the --alias nor the --position option" << endl
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
    84
        << "     is given, all slaves are selected." << endl
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
    85
        << "  2) If only the --position option is given, it is" << endl
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
    86
        << "     interpreted as an absolute ring position and" << endl
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
    87
        << "     a slave with this position is matched." << endl
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
    88
        << "  3) If only the --alias option is given, all slaves" << endl
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
    89
        << "     with the given alias address and subsequent" << endl
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
    90
        << "     slaves before a slave with a different alias" << endl
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
    91
        << "     address match (use -p0 if only the slaves" << endl
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
    92
        << "     with the given alias are desired, see 4))." << endl
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
    93
        << "  4) If both the --alias and the --position option are" << endl
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
    94
        << "     given, the latter is interpreted as relative" << endl
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
    95
        << "     position behind any slave with the given alias." << endl
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
    96
        << endl
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    97
        << "Command-specific options:" << endl
1157
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
    98
        << "  --alias    -a <alias>  Slave alias (see above)." << endl
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
    99
        << "  --position -p <pos>    Slave position (see above)." << endl
04d1c950cf9d Added --help for alias and position parameters.
Florian Pose <fp@igh-essen.com>
parents: 1151
diff changeset
   100
        << "  --verbose  -v          Show detailed slave information." << endl
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   101
        << endl
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   102
        << numericInfo();
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   103
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   104
    return str.str();
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   105
}
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   106
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   107
/****************************************************************************/
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   108
1826
ec6223c3b7ec Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents: 1463
diff changeset
   109
void CommandSlaves::execute(const StringVector &args)
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   110
{
1869
14f634f5b613 Open master device as late as possible.
Florian Pose <fp@igh-essen.com>
parents: 1827
diff changeset
   111
	MasterIndexList masterIndices;
1151
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   112
    SlaveList slaves;
1826
ec6223c3b7ec Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents: 1463
diff changeset
   113
    bool doIndent;
2421
bc2d4bf9cbe5 Removed trailing spaces.
Florian Pose <fp@igh-essen.com>
parents: 2374
diff changeset
   114
1373
e651000f1ff1 Complain about given arguments if none are required.
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
   115
    if (args.size()) {
e651000f1ff1 Complain about given arguments if none are required.
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
   116
        stringstream err;
e651000f1ff1 Complain about given arguments if none are required.
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
   117
        err << "'" << getName() << "' takes no arguments!";
e651000f1ff1 Complain about given arguments if none are required.
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
   118
        throwInvalidUsageException(err);
e651000f1ff1 Complain about given arguments if none are required.
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
   119
    }
e651000f1ff1 Complain about given arguments if none are required.
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
   120
1869
14f634f5b613 Open master device as late as possible.
Florian Pose <fp@igh-essen.com>
parents: 1827
diff changeset
   121
	masterIndices = getMasterIndices();
14f634f5b613 Open master device as late as possible.
Florian Pose <fp@igh-essen.com>
parents: 1827
diff changeset
   122
    doIndent = masterIndices.size() > 1;
1826
ec6223c3b7ec Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents: 1463
diff changeset
   123
    MasterIndexList::const_iterator mi;
1869
14f634f5b613 Open master device as late as possible.
Florian Pose <fp@igh-essen.com>
parents: 1827
diff changeset
   124
    for (mi = masterIndices.begin();
14f634f5b613 Open master device as late as possible.
Florian Pose <fp@igh-essen.com>
parents: 1827
diff changeset
   125
            mi != masterIndices.end(); mi++) {
1826
ec6223c3b7ec Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents: 1463
diff changeset
   126
        MasterDevice m(*mi);
ec6223c3b7ec Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents: 1463
diff changeset
   127
        m.open(MasterDevice::Read);
ec6223c3b7ec Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents: 1463
diff changeset
   128
        slaves = selectedSlaves(m);
ec6223c3b7ec Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents: 1463
diff changeset
   129
ec6223c3b7ec Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents: 1463
diff changeset
   130
        if (getVerbosity() == Verbose) {
ec6223c3b7ec Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents: 1463
diff changeset
   131
            showSlaves(m, slaves);
ec6223c3b7ec Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents: 1463
diff changeset
   132
        } else {
ec6223c3b7ec Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents: 1463
diff changeset
   133
            listSlaves(m, slaves, doIndent);
ec6223c3b7ec Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents: 1463
diff changeset
   134
        }
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   135
    }
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   136
}
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   137
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   138
/****************************************************************************/
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   139
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   140
void CommandSlaves::listSlaves(
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   141
        MasterDevice &m,
1826
ec6223c3b7ec Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents: 1463
diff changeset
   142
        const SlaveList &slaves,
ec6223c3b7ec Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents: 1463
diff changeset
   143
        bool doIndent
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   144
        )
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   145
{
1160
f02ff486b313 Removed MasterDevice::slaveCount().
Florian Pose <fp@igh-essen.com>
parents: 1157
diff changeset
   146
    ec_ioctl_master_t master;
2374
e898451c054a Slave scanning and configuration on all links.
Florian Pose <fp@igh-essen.com>
parents: 1968
diff changeset
   147
    unsigned int i, lastDevice;
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   148
    ec_ioctl_slave_t slave;
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   149
    uint16_t lastAlias, aliasIndex;
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   150
    Info info;
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   151
    typedef list<Info> InfoList;
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   152
    InfoList infoList;
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   153
    InfoList::const_iterator iter;
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   154
    stringstream str;
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   155
    unsigned int maxPosWidth = 0, maxAliasWidth = 0,
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   156
                 maxRelPosWidth = 0, maxStateWidth = 0;
1826
ec6223c3b7ec Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents: 1463
diff changeset
   157
    string indent(doIndent ? "  " : "");
2421
bc2d4bf9cbe5 Removed trailing spaces.
Florian Pose <fp@igh-essen.com>
parents: 2374
diff changeset
   158
1160
f02ff486b313 Removed MasterDevice::slaveCount().
Florian Pose <fp@igh-essen.com>
parents: 1157
diff changeset
   159
    m.getMaster(&master);
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   160
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   161
    lastAlias = 0;
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   162
    aliasIndex = 0;
1160
f02ff486b313 Removed MasterDevice::slaveCount().
Florian Pose <fp@igh-essen.com>
parents: 1157
diff changeset
   163
    for (i = 0; i < master.slave_count; i++) {
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   164
        m.getSlave(&slave, i);
2421
bc2d4bf9cbe5 Removed trailing spaces.
Florian Pose <fp@igh-essen.com>
parents: 2374
diff changeset
   165
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   166
        if (slave.alias) {
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   167
            lastAlias = slave.alias;
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   168
            aliasIndex = 0;
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   169
        }
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   170
1151
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   171
        if (slaveInList(slave, slaves)) {
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   172
            str << dec << i;
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   173
            info.pos = str.str();
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   174
            str.clear();
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   175
            str.str("");
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   176
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   177
            str << lastAlias;
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   178
            info.alias = str.str();
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   179
            str.str("");
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   180
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   181
            str << aliasIndex;
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   182
            info.relPos = str.str();
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   183
            str.str("");
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   184
1148
1762296870bd Renamed state field to al_state.
Florian Pose <fp@igh-essen.com>
parents: 1146
diff changeset
   185
            info.state = alStateString(slave.al_state);
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   186
            info.flag = (slave.error_flag ? 'E' : '+');
2374
e898451c054a Slave scanning and configuration on all links.
Florian Pose <fp@igh-essen.com>
parents: 1968
diff changeset
   187
            info.device = slave.device_index;
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   188
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   189
            if (strlen(slave.name)) {
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   190
                info.name = slave.name;
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   191
            } else {
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   192
                str << "0x" << hex << setfill('0')
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   193
                    << setw(8) << slave.vendor_id << ":0x"
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   194
                    << setw(8) << slave.product_code;
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   195
                info.name = str.str();
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   196
                str.str("");
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   197
            }
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   198
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   199
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   200
            infoList.push_back(info);
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   201
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   202
            if (info.pos.length() > maxPosWidth)
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   203
                maxPosWidth = info.pos.length();
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   204
            if (info.alias.length() > maxAliasWidth)
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   205
                maxAliasWidth = info.alias.length();
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   206
            if (info.relPos.length() > maxRelPosWidth)
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   207
                maxRelPosWidth = info.relPos.length();
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   208
            if (info.state.length() > maxStateWidth)
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   209
                maxStateWidth = info.state.length();
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   210
        }
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   211
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   212
        aliasIndex++;
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   213
    }
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   214
1827
489be2180f71 Improved multi-master capabilities of ethercat tool.
Florian Pose <fp@igh-essen.com>
parents: 1826
diff changeset
   215
    if (infoList.size() && doIndent) {
489be2180f71 Improved multi-master capabilities of ethercat tool.
Florian Pose <fp@igh-essen.com>
parents: 1826
diff changeset
   216
        cout << "Master" << dec << m.getIndex() << endl;
489be2180f71 Improved multi-master capabilities of ethercat tool.
Florian Pose <fp@igh-essen.com>
parents: 1826
diff changeset
   217
    }
489be2180f71 Improved multi-master capabilities of ethercat tool.
Florian Pose <fp@igh-essen.com>
parents: 1826
diff changeset
   218
2374
e898451c054a Slave scanning and configuration on all links.
Florian Pose <fp@igh-essen.com>
parents: 1968
diff changeset
   219
    lastDevice = EC_DEVICE_MAIN;
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   220
    for (iter = infoList.begin(); iter != infoList.end(); iter++) {
2374
e898451c054a Slave scanning and configuration on all links.
Florian Pose <fp@igh-essen.com>
parents: 1968
diff changeset
   221
        if (iter->device != lastDevice) {
e898451c054a Slave scanning and configuration on all links.
Florian Pose <fp@igh-essen.com>
parents: 1968
diff changeset
   222
            lastDevice = iter->device;
e898451c054a Slave scanning and configuration on all links.
Florian Pose <fp@igh-essen.com>
parents: 1968
diff changeset
   223
            cout << "xxx LINK FAILURE xxx" << endl;
e898451c054a Slave scanning and configuration on all links.
Florian Pose <fp@igh-essen.com>
parents: 1968
diff changeset
   224
        }
1826
ec6223c3b7ec Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents: 1463
diff changeset
   225
        cout << indent << setfill(' ') << right
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   226
            << setw(maxPosWidth) << iter->pos << "  "
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   227
            << setw(maxAliasWidth) << iter->alias
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   228
            << ":" << left
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   229
            << setw(maxRelPosWidth) << iter->relPos << "  "
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   230
            << setw(maxStateWidth) << iter->state << "  "
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   231
            << iter->flag << "  "
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   232
            << iter->name << endl;
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   233
    }
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   234
}
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   235
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   236
/****************************************************************************/
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   237
1151
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   238
void CommandSlaves::showSlaves(
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   239
        MasterDevice &m,
1151
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   240
        const SlaveList &slaves
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   241
        )
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   242
{
1151
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   243
    SlaveList::const_iterator si;
1379
cbceb0e2f2a0 Reading more base information (incl. whether DC supported).
Florian Pose <fp@igh-essen.com>
parents: 1373
diff changeset
   244
    int i;
1151
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   245
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   246
    for (si = slaves.begin(); si != slaves.end(); si++) {
1826
ec6223c3b7ec Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents: 1463
diff changeset
   247
        cout << "=== Master " << dec << m.getIndex()
ec6223c3b7ec Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents: 1463
diff changeset
   248
            << ", Slave " << dec << si->position << " ===" << endl;
1151
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   249
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   250
        if (si->alias)
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   251
            cout << "Alias: " << si->alias << endl;
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   252
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   253
        cout
2374
e898451c054a Slave scanning and configuration on all links.
Florian Pose <fp@igh-essen.com>
parents: 1968
diff changeset
   254
            << "Device: " << (si->device_index ? "Backup" : "Main") << endl
1151
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   255
            << "State: " << alStateString(si->al_state) << endl
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   256
            << "Flag: " << (si->error_flag ? 'E' : '+') << endl
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   257
            << "Identity:" << endl
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   258
            << "  Vendor Id:       0x"
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   259
            << hex << setfill('0')
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   260
            << setw(8) << si->vendor_id << endl
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   261
            << "  Product code:    0x"
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   262
            << setw(8) << si->product_code << endl
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   263
            << "  Revision number: 0x"
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   264
            << setw(8) << si->revision_number << endl
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   265
            << "  Serial number:   0x"
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   266
            << setw(8) << si->serial_number << endl;
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   267
1379
cbceb0e2f2a0 Reading more base information (incl. whether DC supported).
Florian Pose <fp@igh-essen.com>
parents: 1373
diff changeset
   268
        cout << "DL information:" << endl
cbceb0e2f2a0 Reading more base information (incl. whether DC supported).
Florian Pose <fp@igh-essen.com>
parents: 1373
diff changeset
   269
            << "  FMMU bit operation: "
cbceb0e2f2a0 Reading more base information (incl. whether DC supported).
Florian Pose <fp@igh-essen.com>
parents: 1373
diff changeset
   270
            << (si->fmmu_bit ? "yes" : "no") << endl
cbceb0e2f2a0 Reading more base information (incl. whether DC supported).
Florian Pose <fp@igh-essen.com>
parents: 1373
diff changeset
   271
            << "  Distributed clocks: ";
cbceb0e2f2a0 Reading more base information (incl. whether DC supported).
Florian Pose <fp@igh-essen.com>
parents: 1373
diff changeset
   272
        if (si->dc_supported) {
1419
8fc38c37d86e Determine type of DC implementation (full or delay meas. only); update scan FSM graph.
Florian Pose <fp@igh-essen.com>
parents: 1379
diff changeset
   273
            if (si->has_dc_system_time) {
8fc38c37d86e Determine type of DC implementation (full or delay meas. only); update scan FSM graph.
Florian Pose <fp@igh-essen.com>
parents: 1379
diff changeset
   274
                cout << "yes, ";
8fc38c37d86e Determine type of DC implementation (full or delay meas. only); update scan FSM graph.
Florian Pose <fp@igh-essen.com>
parents: 1379
diff changeset
   275
                switch (si->dc_range) {
8fc38c37d86e Determine type of DC implementation (full or delay meas. only); update scan FSM graph.
Florian Pose <fp@igh-essen.com>
parents: 1379
diff changeset
   276
                    case EC_DC_32:
8fc38c37d86e Determine type of DC implementation (full or delay meas. only); update scan FSM graph.
Florian Pose <fp@igh-essen.com>
parents: 1379
diff changeset
   277
                        cout << "32 bit";
8fc38c37d86e Determine type of DC implementation (full or delay meas. only); update scan FSM graph.
Florian Pose <fp@igh-essen.com>
parents: 1379
diff changeset
   278
                        break;
8fc38c37d86e Determine type of DC implementation (full or delay meas. only); update scan FSM graph.
Florian Pose <fp@igh-essen.com>
parents: 1379
diff changeset
   279
                    case EC_DC_64:
8fc38c37d86e Determine type of DC implementation (full or delay meas. only); update scan FSM graph.
Florian Pose <fp@igh-essen.com>
parents: 1379
diff changeset
   280
                        cout << "64 bit";
8fc38c37d86e Determine type of DC implementation (full or delay meas. only); update scan FSM graph.
Florian Pose <fp@igh-essen.com>
parents: 1379
diff changeset
   281
                        break;
8fc38c37d86e Determine type of DC implementation (full or delay meas. only); update scan FSM graph.
Florian Pose <fp@igh-essen.com>
parents: 1379
diff changeset
   282
                    default:
8fc38c37d86e Determine type of DC implementation (full or delay meas. only); update scan FSM graph.
Florian Pose <fp@igh-essen.com>
parents: 1379
diff changeset
   283
                        cout << "???";
8fc38c37d86e Determine type of DC implementation (full or delay meas. only); update scan FSM graph.
Florian Pose <fp@igh-essen.com>
parents: 1379
diff changeset
   284
                }
1420
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   285
                cout << endl;
1419
8fc38c37d86e Determine type of DC implementation (full or delay meas. only); update scan FSM graph.
Florian Pose <fp@igh-essen.com>
parents: 1379
diff changeset
   286
            } else {
1420
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   287
                cout << "yes, delay measurement only" << endl;
1419
8fc38c37d86e Determine type of DC implementation (full or delay meas. only); update scan FSM graph.
Florian Pose <fp@igh-essen.com>
parents: 1379
diff changeset
   288
            }
1426
af45bba80d85 Transition->Transmission.
Florian Pose <fp@igh-essen.com>
parents: 1425
diff changeset
   289
            cout << "  DC system time transmission delay: "
1429
07969876120f Decimal transmission delay.
Florian Pose <fp@igh-essen.com>
parents: 1426
diff changeset
   290
                << dec << si->transmission_delay << " ns" << endl;
1379
cbceb0e2f2a0 Reading more base information (incl. whether DC supported).
Florian Pose <fp@igh-essen.com>
parents: 1373
diff changeset
   291
        } else {
1420
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   292
            cout << "no" << endl;
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   293
        }
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   294
1421
043a518831b2 Bus topology calculation.
Florian Pose <fp@igh-essen.com>
parents: 1420
diff changeset
   295
        cout << "Port  Type  Link  Loop    Signal  NextSlave";
1420
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   296
        if (si->dc_supported)
1425
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   297
            cout << "  RxTime [ns]  Diff [ns]   NextDc [ns]";
1379
cbceb0e2f2a0 Reading more base information (incl. whether DC supported).
Florian Pose <fp@igh-essen.com>
parents: 1373
diff changeset
   298
        cout << endl;
2421
bc2d4bf9cbe5 Removed trailing spaces.
Florian Pose <fp@igh-essen.com>
parents: 2374
diff changeset
   299
1420
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   300
        for (i = 0; i < EC_MAX_PORTS; i++) {
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   301
            cout << "   " << i << "  " << setfill(' ') << left << setw(4);
1425
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   302
            switch (si->ports[i].desc) {
1420
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   303
                case EC_PORT_NOT_IMPLEMENTED:
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   304
                    cout << "N/A";
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   305
                    break;
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   306
                case EC_PORT_NOT_CONFIGURED:
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   307
                    cout << "N/C";
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   308
                    break;
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   309
                case EC_PORT_EBUS:
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   310
                    cout << "EBUS";
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   311
                    break;
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   312
                case EC_PORT_MII:
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   313
                    cout << "MII";
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   314
                    break;
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   315
                default:
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   316
                    cout << "???";
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   317
            }
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   318
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   319
            cout << "  " << setw(4)
1425
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   320
                << (si->ports[i].link.link_up ? "up" : "down")
1420
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   321
                << "  " << setw(6)
1425
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   322
                << (si->ports[i].link.loop_closed ? "closed" : "open")
1421
043a518831b2 Bus topology calculation.
Florian Pose <fp@igh-essen.com>
parents: 1420
diff changeset
   323
                << "  " << setw(6)
1425
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   324
                << (si->ports[i].link.signal_detected ? "yes" : "no")
1421
043a518831b2 Bus topology calculation.
Florian Pose <fp@igh-essen.com>
parents: 1420
diff changeset
   325
                << "  " << setw(9) << right;
043a518831b2 Bus topology calculation.
Florian Pose <fp@igh-essen.com>
parents: 1420
diff changeset
   326
1425
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   327
            if (si->ports[i].next_slave != 0xffff) {
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   328
                cout << dec << si->ports[i].next_slave;
1421
043a518831b2 Bus topology calculation.
Florian Pose <fp@igh-essen.com>
parents: 1420
diff changeset
   329
            } else {
043a518831b2 Bus topology calculation.
Florian Pose <fp@igh-essen.com>
parents: 1420
diff changeset
   330
                cout << "-";
043a518831b2 Bus topology calculation.
Florian Pose <fp@igh-essen.com>
parents: 1420
diff changeset
   331
            }
2421
bc2d4bf9cbe5 Removed trailing spaces.
Florian Pose <fp@igh-essen.com>
parents: 2374
diff changeset
   332
1420
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   333
            if (si->dc_supported) {
1425
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   334
                cout << "  " << setw(11) << right;
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   335
                if (!si->ports[i].link.loop_closed) {
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   336
                    cout << dec << si->ports[i].receive_time;
1420
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   337
                } else {
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   338
                    cout << "-";
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   339
                }
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   340
                cout << "  " << setw(10);
1425
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   341
                if (!si->ports[i].link.loop_closed) {
2374
e898451c054a Slave scanning and configuration on all links.
Florian Pose <fp@igh-essen.com>
parents: 1968
diff changeset
   342
                    cout << si->ports[i].receive_time -
e898451c054a Slave scanning and configuration on all links.
Florian Pose <fp@igh-essen.com>
parents: 1968
diff changeset
   343
                        si->ports[0].receive_time;
1425
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   344
                } else {
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   345
                    cout << "-";
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   346
                }
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   347
                cout << "  " << setw(10);
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   348
                if (!si->ports[i].link.loop_closed) {
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   349
                    cout << si->ports[i].delay_to_next_dc;
1420
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   350
                } else {
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   351
                    cout << "-";
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   352
                }
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   353
            }
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   354
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   355
            cout << endl;
5eb814732c46 Measure port receive times.
Florian Pose <fp@igh-essen.com>
parents: 1419
diff changeset
   356
        }
1379
cbceb0e2f2a0 Reading more base information (incl. whether DC supported).
Florian Pose <fp@igh-essen.com>
parents: 1373
diff changeset
   357
1151
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   358
        if (si->mailbox_protocols) {
1220
15e8768b304f Fixed minor supported mailbox protocol display bug.
Florian Pose <fp@igh-essen.com>
parents: 1160
diff changeset
   359
            list<string> protoList;
15e8768b304f Fixed minor supported mailbox protocol display bug.
Florian Pose <fp@igh-essen.com>
parents: 1160
diff changeset
   360
            list<string>::const_iterator protoIter;
15e8768b304f Fixed minor supported mailbox protocol display bug.
Florian Pose <fp@igh-essen.com>
parents: 1160
diff changeset
   361
1151
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   362
            cout << "Mailboxes:" << endl
1463
37361de7b34e Minor: Added missing setfill().
Florian Pose <fp@igh-essen.com>
parents: 1429
diff changeset
   363
                << "  Bootstrap RX: 0x" << setfill('0')
1337
0253c74d0940 merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   364
                << hex << setw(4) << si->boot_rx_mailbox_offset << "/"
0253c74d0940 merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   365
                << dec << si->boot_rx_mailbox_size
1151
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   366
                << ", TX: 0x"
1337
0253c74d0940 merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   367
                << hex << setw(4) << si->boot_tx_mailbox_offset << "/"
0253c74d0940 merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   368
                << dec << si->boot_tx_mailbox_size << endl
0253c74d0940 merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   369
                << "  Standard  RX: 0x"
0253c74d0940 merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   370
                << hex << setw(4) << si->std_rx_mailbox_offset << "/"
0253c74d0940 merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   371
                << dec << si->std_rx_mailbox_size
0253c74d0940 merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   372
                << ", TX: 0x"
0253c74d0940 merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   373
                << hex << setw(4) << si->std_tx_mailbox_offset << "/"
0253c74d0940 merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   374
                << dec << si->std_tx_mailbox_size << endl
1151
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   375
                << "  Supported protocols: ";
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   376
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   377
            if (si->mailbox_protocols & EC_MBOX_AOE) {
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   378
                protoList.push_back("AoE");
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   379
            }
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   380
            if (si->mailbox_protocols & EC_MBOX_EOE) {
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   381
                protoList.push_back("EoE");
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   382
            }
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   383
            if (si->mailbox_protocols & EC_MBOX_COE) {
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   384
                protoList.push_back("CoE");
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   385
            }
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   386
            if (si->mailbox_protocols & EC_MBOX_FOE) {
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   387
                protoList.push_back("FoE");
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   388
            }
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   389
            if (si->mailbox_protocols & EC_MBOX_SOE) {
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   390
                protoList.push_back("SoE");
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   391
            }
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   392
            if (si->mailbox_protocols & EC_MBOX_VOE) {
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   393
                protoList.push_back("VoE");
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   394
            }
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   395
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   396
            for (protoIter = protoList.begin(); protoIter != protoList.end();
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   397
                    protoIter++) {
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   398
                if (protoIter != protoList.begin())
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   399
                    cout << ", ";
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   400
                cout << *protoIter;
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   401
            }
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   402
            cout << endl;
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   403
        }
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   404
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   405
        if (si->has_general_category) {
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   406
            cout << "General:" << endl
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   407
                << "  Group: " << si->group << endl
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   408
                << "  Image name: " << si->image << endl
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   409
                << "  Order number: " << si->order << endl
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   410
                << "  Device name: " << si->name << endl;
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   411
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   412
            if (si->mailbox_protocols & EC_MBOX_COE) {
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   413
                cout << "  CoE details:" << endl
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1222
diff changeset
   414
                    << "    Enable SDO: "
1151
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   415
                    << (si->coe_details.enable_sdo ? "yes" : "no") << endl
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1222
diff changeset
   416
                    << "    Enable SDO Info: "
2374
e898451c054a Slave scanning and configuration on all links.
Florian Pose <fp@igh-essen.com>
parents: 1968
diff changeset
   417
                    << (si->coe_details.enable_sdo_info ? "yes" : "no")
e898451c054a Slave scanning and configuration on all links.
Florian Pose <fp@igh-essen.com>
parents: 1968
diff changeset
   418
                    << endl
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1222
diff changeset
   419
                    << "    Enable PDO Assign: "
1151
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   420
                    << (si->coe_details.enable_pdo_assign
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   421
                            ? "yes" : "no") << endl
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1222
diff changeset
   422
                    << "    Enable PDO Configuration: "
1151
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   423
                    << (si->coe_details.enable_pdo_configuration
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   424
                            ? "yes" : "no") << endl
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   425
                    << "    Enable Upload at startup: "
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   426
                    << (si->coe_details.enable_upload_at_startup
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   427
                            ? "yes" : "no") << endl
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1222
diff changeset
   428
                    << "    Enable SDO complete access: "
1151
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   429
                    << (si->coe_details.enable_sdo_complete_access
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   430
                            ? "yes" : "no") << endl;
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   431
            }
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   432
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   433
            cout << "  Flags:" << endl
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   434
                << "    Enable SafeOp: "
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   435
                << (si->general_flags.enable_safeop ? "yes" : "no") << endl
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   436
                << "    Enable notLRW: "
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   437
                << (si->general_flags.enable_not_lrw ? "yes" : "no") << endl
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   438
                << "  Current consumption: "
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   439
                << dec << si->current_on_ebus << " mA" << endl;
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   440
        }
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   441
    }
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   442
}
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   443
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   444
/****************************************************************************/
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   445
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   446
bool CommandSlaves::slaveInList(
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   447
        const ec_ioctl_slave_t &slave,
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   448
        const SlaveList &slaves
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   449
        )
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   450
{
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   451
    SlaveList::const_iterator si;
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   452
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   453
    for (si = slaves.begin(); si != slaves.end(); si++) {
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   454
        if (si->position == slave.position) {
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   455
            return true;
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   456
        }
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   457
    }
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   458
1fc1535dec29 Alias/Position selection.
Florian Pose <fp@igh-essen.com>
parents: 1148
diff changeset
   459
    return false;
1142
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   460
}
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   461
59be91dfcbe1 Redesigned command interface.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   462
/*****************************************************************************/