60 ::close(fd); |
60 ::close(fd); |
61 } |
61 } |
62 |
62 |
63 /****************************************************************************/ |
63 /****************************************************************************/ |
64 |
64 |
|
65 void Master::outputData(int domainIndex) |
|
66 { |
|
67 if (domainIndex == -1) { |
|
68 unsigned int numDomains = domainCount(), i; |
|
69 |
|
70 for (i = 0; i < numDomains; i++) { |
|
71 outputDomainData(i); |
|
72 } |
|
73 } else { |
|
74 outputDomainData(domainIndex); |
|
75 } |
|
76 } |
|
77 |
|
78 /****************************************************************************/ |
|
79 |
65 void Master::showDomains(int domainIndex) |
80 void Master::showDomains(int domainIndex) |
66 { |
81 { |
67 if (domainIndex == -1) { |
82 if (domainIndex == -1) { |
68 unsigned int numDomains = domainCount(), i; |
83 unsigned int numDomains = domainCount(), i; |
69 |
84 |
140 } |
155 } |
141 } |
156 } |
142 |
157 |
143 /****************************************************************************/ |
158 /****************************************************************************/ |
144 |
159 |
|
160 void Master::outputDomainData(unsigned int domainIndex) |
|
161 { |
|
162 ec_ioctl_domain_t domain; |
|
163 ec_ioctl_data_t data; |
|
164 unsigned char *processData; |
|
165 unsigned int i; |
|
166 |
|
167 getDomain(&domain, domainIndex); |
|
168 |
|
169 processData = new unsigned char[domain.data_size]; |
|
170 |
|
171 data.domain_index = domainIndex; |
|
172 data.data_size = domain.data_size; |
|
173 data.target = processData; |
|
174 |
|
175 if (ioctl(fd, EC_IOCTL_DATA, &data) < 0) { |
|
176 stringstream err; |
|
177 err << "Failed to get domain data: " << strerror(errno); |
|
178 delete [] processData; |
|
179 throw MasterException(err.str()); |
|
180 } |
|
181 |
|
182 for (i = 0; i < data.data_size; i++) |
|
183 cout << processData[i]; |
|
184 cout.flush(); |
|
185 |
|
186 delete [] processData; |
|
187 } |
|
188 |
|
189 /****************************************************************************/ |
|
190 |
145 void Master::showDomain(unsigned int domainIndex) |
191 void Master::showDomain(unsigned int domainIndex) |
146 { |
192 { |
147 ec_ioctl_domain_t data; |
193 ec_ioctl_domain_t data; |
148 |
194 |
149 getDomain(&data, domainIndex); |
195 getDomain(&data, domainIndex); |
150 |
|
151 unsigned int data_size; |
|
152 uint32_t logical_base_address; |
|
153 uint16_t working_counter; |
|
154 uint16_t expected_working_counter; |
|
155 |
196 |
156 cout << "Domain" << domainIndex << ":" |
197 cout << "Domain" << domainIndex << ":" |
157 << " LogBaseAddr 0x" |
198 << " LogBaseAddr 0x" |
158 << hex << setfill('0') << setw(8) << data.logical_base_address |
199 << hex << setfill('0') << setw(8) << data.logical_base_address |
159 << ", Size " << dec << data.data_size |
200 << ", Size " << dec << data.data_size |