44 |
44 |
45 string CommandDomains::helpString() const |
45 string CommandDomains::helpString() const |
46 { |
46 { |
47 stringstream str; |
47 stringstream str; |
48 |
48 |
49 str << getName() << " [OPTIONS]" << endl |
49 str << getName() << " [OPTIONS]" << endl |
50 << endl |
|
51 << getBriefDescription() << endl |
|
52 << endl |
50 << endl |
53 << "Without the --verbose option, the domains are displayed" << endl |
51 << getBriefDescription() << endl |
|
52 << endl |
|
53 << "Without the --verbose option, the domains are displayed" << endl |
54 << "one-per-line. Example:" << endl |
54 << "one-per-line. Example:" << endl |
55 << endl |
55 << endl |
56 << "Domain0: LogBaseAddr 0x00000000, Size 6, WorkingCounter 0/1" |
56 << "Domain0: LogBaseAddr 0x00000000, Size 6, WorkingCounter 0/1" |
57 << endl << endl |
57 << endl << endl |
58 << "The domain's base address for the logical datagram" << endl |
58 << "The domain's base address for the logical datagram" << endl |
59 << "(LRD/LWR/LRW) is displayed followed by the domain's" << endl |
59 << "(LRD/LWR/LRW) is displayed followed by the domain's" << endl |
60 << "process data size in byte. The last values are the current" << endl |
60 << "process data size in byte. The last values are the current" << endl |
61 << "datagram working counter sum and the expected working" << endl |
61 << "datagram working counter sum and the expected working" << endl |
62 << "counter sum. If the values are equal, all PDOs were" << endl |
62 << "counter sum. If the values are equal, all PDOs were" << endl |
63 << "exchanged during the last cycle." << endl |
63 << "exchanged during the last cycle." << endl |
64 << endl |
64 << endl |
65 << "If the --verbose option is given, the participating slave" << endl |
65 << "If the --verbose option is given, the participating slave" << endl |
66 << "configurations/FMMUs and the current process data are" << endl |
66 << "configurations/FMMUs and the current process data are" << endl |
67 << "additionally displayed:" << endl |
67 << "additionally displayed:" << endl |
68 << endl |
68 << endl |
69 << "Domain1: LogBaseAddr 0x00000006, Size 6, WorkingCounter 0/1" |
69 << "Domain1: LogBaseAddr 0x00000006, Size 6, WorkingCounter 0/1" |
70 << endl |
70 << endl |
71 << " SlaveConfig 1001:0, SM3 ( Input), LogAddr 0x00000006, Size 6" |
71 << " SlaveConfig 1001:0, SM3 ( Input), LogAddr 0x00000006, Size 6" |
72 << endl |
72 << endl |
73 << " 0x00 0x00 0x00 0x00 0x00 0x00" << endl |
73 << " 0x00 0x00 0x00 0x00 0x00 0x00" << endl |
74 << endl |
74 << endl |
75 << "The process data are displayed as hexadecimal bytes." << endl |
75 << "The process data are displayed as hexadecimal bytes." << endl |
76 << endl |
76 << endl |
77 << "Command-specific options:" << endl |
77 << "Command-specific options:" << endl |
78 << " --domain -d <index> Positive numerical domain index." << endl |
78 << " --domain -d <index> Positive numerical domain index." << endl |
79 << " If ommitted, all domains are" << endl |
79 << " If ommitted, all domains are" << endl |
80 << " displayed." << endl |
80 << " displayed." << endl |
81 << endl |
81 << endl |
82 << " --verbose -v Show FMMUs and process data" << endl |
82 << " --verbose -v Show FMMUs and process data" << endl |
83 << " in addition." << endl |
83 << " in addition." << endl |
84 << endl |
84 << endl |
85 << numericInfo(); |
85 << numericInfo(); |
86 |
86 |
87 return str.str(); |
87 return str.str(); |
88 } |
88 } |
89 |
89 |
90 /****************************************************************************/ |
90 /****************************************************************************/ |
91 |
91 |
92 void CommandDomains::execute(MasterDevice &m, const StringVector &args) |
92 void CommandDomains::execute(MasterDevice &m, const StringVector &args) |
93 { |
93 { |
94 DomainList domains; |
94 DomainList domains; |
95 DomainList::const_iterator di; |
95 DomainList::const_iterator di; |
96 |
96 |
97 if (args.size()) { |
97 if (args.size()) { |
98 stringstream err; |
98 stringstream err; |
99 err << "'" << getName() << "' takes no arguments!"; |
99 err << "'" << getName() << "' takes no arguments!"; |
100 throwInvalidUsageException(err); |
100 throwInvalidUsageException(err); |
101 } |
101 } |
102 |
102 |
103 m.open(MasterDevice::Read); |
103 m.open(MasterDevice::Read); |
104 domains = selectedDomains(m); |
104 domains = selectedDomains(m); |
105 |
105 |
106 for (di = domains.begin(); di != domains.end(); di++) { |
106 for (di = domains.begin(); di != domains.end(); di++) { |
107 showDomain(m, *di); |
107 showDomain(m, *di); |
108 } |
108 } |
109 } |
109 } |
110 |
110 |
111 /****************************************************************************/ |
111 /****************************************************************************/ |
112 |
112 |
113 void CommandDomains::showDomain( |
113 void CommandDomains::showDomain( |
114 MasterDevice &m, |
114 MasterDevice &m, |
115 const ec_ioctl_domain_t &domain |
115 const ec_ioctl_domain_t &domain |
116 ) |
116 ) |
117 { |
117 { |
118 unsigned char *processData; |
118 unsigned char *processData; |
119 ec_ioctl_domain_data_t data; |
119 ec_ioctl_domain_data_t data; |
120 unsigned int i, j; |
120 unsigned int i, j; |
121 ec_ioctl_domain_fmmu_t fmmu; |
121 ec_ioctl_domain_fmmu_t fmmu; |
122 unsigned int dataOffset; |
122 unsigned int dataOffset; |
123 |
123 |
124 cout << "Domain" << dec << domain.index << ":" |
124 cout << "Domain" << dec << domain.index << ":" |
125 << " LogBaseAddr 0x" |
125 << " LogBaseAddr 0x" |
126 << hex << setfill('0') |
126 << hex << setfill('0') |
127 << setw(8) << domain.logical_base_address |
127 << setw(8) << domain.logical_base_address |
128 << ", Size " << dec << setfill(' ') |
128 << ", Size " << dec << setfill(' ') |
129 << setw(3) << domain.data_size |
129 << setw(3) << domain.data_size |
130 << ", WorkingCounter " |
130 << ", WorkingCounter " |
131 << domain.working_counter << "/" |
131 << domain.working_counter << "/" |
132 << domain.expected_working_counter << endl; |
132 << domain.expected_working_counter << endl; |
133 |
133 |
134 if (!domain.data_size || getVerbosity() != Verbose) |
134 if (!domain.data_size || getVerbosity() != Verbose) |
135 return; |
135 return; |
136 |
136 |