tool/CommandPdos.cpp
branchstable-1.4
changeset 1686 e206f4485f60
parent 1187 aa616c3286ce
child 1363 11c0b2caa253
equal deleted inserted replaced
1685:399ef727bf62 1686:e206f4485f60
    11 #include "CommandPdos.h"
    11 #include "CommandPdos.h"
    12 
    12 
    13 /*****************************************************************************/
    13 /*****************************************************************************/
    14 
    14 
    15 CommandPdos::CommandPdos():
    15 CommandPdos::CommandPdos():
    16     Command("pdos", "List Sync managers, Pdo assignment and mapping.")
    16     Command("pdos", "List Sync managers, PDO assignment and mapping.")
    17 {
    17 {
    18 }
    18 }
    19 
    19 
    20 /*****************************************************************************/
    20 /*****************************************************************************/
    21 
    21 
    35     	<< "   size, control register and enable word. Example:" << endl
    35     	<< "   size, control register and enable word. Example:" << endl
    36 		<< endl
    36 		<< endl
    37     	<< "   SM3: PhysAddr 0x1100, DefaultSize 0, ControlRegister 0x20, "
    37     	<< "   SM3: PhysAddr 0x1100, DefaultSize 0, ControlRegister 0x20, "
    38 		<< "Enable 1" << endl
    38 		<< "Enable 1" << endl
    39     	<< endl
    39     	<< endl
    40     	<< "2) Assigned Pdos - Pdo direction, hexadecimal index and" << endl
    40     	<< "2) Assigned PDOs - PDO direction, hexadecimal index and" << endl
    41 		<< "   the Pdo name, if avaliable. Note that a 'Tx' and 'Rx'" << endl
    41 		<< "   the PDO name, if avaliable. Note that a 'Tx' and 'Rx'" << endl
    42         << "   are seen from the slave's point of view. Example:" << endl
    42         << "   are seen from the slave's point of view. Example:" << endl
    43     	<< endl
    43     	<< endl
    44     	<< "   TxPdo 0x1a00 \"Channel1\"" << endl
    44     	<< "   TxPDO 0x1a00 \"Channel1\"" << endl
    45     	<< endl
    45     	<< endl
    46     	<< "3) Mapped Pdo entries - Pdo entry index and subindex (both" << endl
    46     	<< "3) Mapped PDO entries - PDO entry index and subindex (both" << endl
    47     	<< "   hexadecimal), the length in bit and the description, if" << endl
    47     	<< "   hexadecimal), the length in bit and the description, if" << endl
    48     	<< "   available. Example:" << endl
    48     	<< "   available. Example:" << endl
    49     	<< endl
    49     	<< endl
    50     	<< "   Pdo entry 0x3101:01, 8 bit, \"Status\"" << endl
    50     	<< "   PDO entry 0x3101:01, 8 bit, \"Status\"" << endl
    51     	<< endl
    51     	<< endl
    52     	<< "Note, that the displayed Pdo assignment and Pdo mapping" << endl
    52     	<< "Note, that the displayed PDO assignment and PDO mapping" << endl
    53     	<< "information can either originate from the SII or from the" << endl
    53     	<< "information can either originate from the SII or from the" << endl
    54 		<< "CoE communication area." << endl
    54 		<< "CoE communication area." << endl
    55     	<< endl
    55     	<< endl
    56     	<< "Command-specific options:" << endl
    56     	<< "Command-specific options:" << endl
    57         << "  --alias    -a <alias>" << endl
    57         << "  --alias    -a <alias>" << endl
   113 
   113 
   114         for (j = 0; j < sync.pdo_count; j++) {
   114         for (j = 0; j < sync.pdo_count; j++) {
   115             m.getPdo(&pdo, slave.position, i, j);
   115             m.getPdo(&pdo, slave.position, i, j);
   116 
   116 
   117             cout << "  " << (sync.control_register & 0x04 ? "R" : "T")
   117             cout << "  " << (sync.control_register & 0x04 ? "R" : "T")
   118                 << "xPdo 0x"
   118                 << "xPDO 0x"
   119                 << hex << setfill('0')
   119                 << hex << setfill('0')
   120                 << setw(4) << pdo.index
   120                 << setw(4) << pdo.index
   121                 << " \"" << pdo.name << "\"" << endl;
   121                 << " \"" << pdo.name << "\"" << endl;
   122 
   122 
   123             if (getVerbosity() == Quiet)
   123             if (getVerbosity() == Quiet)
   124                 continue;
   124                 continue;
   125 
   125 
   126             for (k = 0; k < pdo.entry_count; k++) {
   126             for (k = 0; k < pdo.entry_count; k++) {
   127                 m.getPdoEntry(&entry, slave.position, i, j, k);
   127                 m.getPdoEntry(&entry, slave.position, i, j, k);
   128 
   128 
   129                 cout << "    Pdo entry 0x"
   129                 cout << "    PDO entry 0x"
   130                     << hex << setfill('0')
   130                     << hex << setfill('0')
   131                     << setw(4) << entry.index
   131                     << setw(4) << entry.index
   132                     << ":" << setw(2) << (unsigned int) entry.subindex
   132                     << ":" << setw(2) << (unsigned int) entry.subindex
   133                     << ", " << dec << setfill(' ')
   133                     << ", " << dec << setfill(' ')
   134                     << setw(2) << (unsigned int) entry.bit_length
   134                     << setw(2) << (unsigned int) entry.bit_length