tool/CommandDomains.cpp
changeset 2589 2b9c78543663
parent 2004 be807e224b0e
equal deleted inserted replaced
2415:af21f0bdc7c9 2589:2b9c78543663
   106 	masterIndices = getMasterIndices();
   106 	masterIndices = getMasterIndices();
   107     doIndent = masterIndices.size() > 1;
   107     doIndent = masterIndices.size() > 1;
   108     MasterIndexList::const_iterator mi;
   108     MasterIndexList::const_iterator mi;
   109     for (mi = masterIndices.begin();
   109     for (mi = masterIndices.begin();
   110             mi != masterIndices.end(); mi++) {
   110             mi != masterIndices.end(); mi++) {
       
   111         ec_ioctl_master_t io;
   111         MasterDevice m(*mi);
   112         MasterDevice m(*mi);
   112         m.open(MasterDevice::Read);
   113         m.open(MasterDevice::Read);
   113         domains = selectedDomains(m);
   114         m.getMaster(&io);
       
   115         domains = selectedDomains(m, io);
   114 
   116 
   115         if (domains.size() && doIndent) {
   117         if (domains.size() && doIndent) {
   116             cout << "Master" << dec << *mi << endl;
   118             cout << "Master" << dec << *mi << endl;
   117         }
   119         }
   118 
   120 
   119         for (di = domains.begin(); di != domains.end(); di++) {
   121         for (di = domains.begin(); di != domains.end(); di++) {
   120             showDomain(m, *di, doIndent);
   122             showDomain(m, io, *di, doIndent);
   121         }
   123         }
   122     }
   124     }
   123 }
   125 }
   124 
   126 
   125 /****************************************************************************/
   127 /****************************************************************************/
   126 
   128 
   127 void CommandDomains::showDomain(
   129 void CommandDomains::showDomain(
   128         MasterDevice &m,
   130         MasterDevice &m,
       
   131         const ec_ioctl_master_t &master,
   129         const ec_ioctl_domain_t &domain,
   132         const ec_ioctl_domain_t &domain,
   130         bool doIndent
   133         bool doIndent
   131         )
   134         )
   132 {
   135 {
   133     unsigned char *processData;
   136     unsigned char *processData;
   134     ec_ioctl_domain_data_t data;
   137     ec_ioctl_domain_data_t data;
   135     unsigned int i, j;
   138     unsigned int i, j;
   136     ec_ioctl_domain_fmmu_t fmmu;
   139     ec_ioctl_domain_fmmu_t fmmu;
   137     unsigned int dataOffset;
   140     unsigned int dataOffset;
   138     string indent(doIndent ? "  " : "");
   141     string indent(doIndent ? "  " : "");
       
   142     unsigned int wc_sum = 0, dev_idx;
       
   143 
       
   144     for (dev_idx = EC_DEVICE_MAIN; dev_idx < master.num_devices; dev_idx++) {
       
   145         wc_sum += domain.working_counter[dev_idx];
       
   146     }
   139 
   147 
   140     cout << indent << "Domain" << dec << domain.index << ":"
   148     cout << indent << "Domain" << dec << domain.index << ":"
   141         << " LogBaseAddr 0x"
   149         << " LogBaseAddr 0x"
   142         << hex << setfill('0')
   150         << hex << setfill('0')
   143         << setw(8) << domain.logical_base_address
   151         << setw(8) << domain.logical_base_address
   144         << ", Size " << dec << setfill(' ')
   152         << ", Size " << dec << setfill(' ')
   145         << setw(3) << domain.data_size
   153         << setw(3) << domain.data_size
   146         << ", TxSize " << dec << setfill(' ')
       
   147         << setw(3) << domain.tx_size
       
   148         << ", WorkingCounter "
   154         << ", WorkingCounter "
   149         << domain.working_counter << "/"
   155         << wc_sum << "/"
   150         << domain.expected_working_counter << endl;
   156         << domain.expected_working_counter;
       
   157     if (master.num_devices > 1) {
       
   158         cout << " (";
       
   159         for (dev_idx = EC_DEVICE_MAIN; dev_idx < master.num_devices;
       
   160                 dev_idx++) {
       
   161             cout << domain.working_counter[dev_idx];
       
   162             if (dev_idx + 1 < master.num_devices) {
       
   163                 cout << "+";
       
   164             }
       
   165         }
       
   166         cout << ")";
       
   167     }
       
   168     cout << endl;
   151 
   169 
   152     if (!domain.data_size || getVerbosity() != Verbose)
   170     if (!domain.data_size || getVerbosity() != Verbose)
   153         return;
   171         return;
   154 
   172 
   155     processData = new unsigned char[domain.data_size];
   173     processData = new unsigned char[domain.data_size];
   173             << "), LogAddr 0x"
   191             << "), LogAddr 0x"
   174             << hex << setfill('0')
   192             << hex << setfill('0')
   175             << setw(8) << fmmu.logical_address
   193             << setw(8) << fmmu.logical_address
   176             << ", Size " << dec << fmmu.data_size << endl;
   194             << ", Size " << dec << fmmu.data_size << endl;
   177 
   195 
   178         dataOffset = fmmu.domain_address - domain.logical_base_address;
   196         dataOffset = fmmu.logical_address - domain.logical_base_address;
   179         if (dataOffset + fmmu.data_size > domain.data_size) {
   197         if (dataOffset + fmmu.data_size > domain.data_size) {
   180             stringstream err;
   198             stringstream err;
   181             delete [] processData;
   199             delete [] processData;
   182             err << "Fmmu information corrupted!";
   200             err << "Fmmu information corrupted!";
   183             throwCommandException(err);
   201             throwCommandException(err);