tool/CommandDomains.cpp
changeset 1166 006244d53f68
parent 1144 7dbfdd61812c
child 1167 9e0ebb38e301
equal deleted inserted replaced
1165:c5d6e28eec91 1166:006244d53f68
    64 
    64 
    65 /****************************************************************************/
    65 /****************************************************************************/
    66 
    66 
    67 void CommandDomains::execute(MasterDevice &m, const StringVector &args)
    67 void CommandDomains::execute(MasterDevice &m, const StringVector &args)
    68 {
    68 {
       
    69 	DomainList domains;
       
    70 	DomainList::const_iterator di;
       
    71 	
    69     m.open(MasterDevice::Read);
    72     m.open(MasterDevice::Read);
       
    73 	domains = selectedDomains(m);
    70 
    74 
    71     if (domainIndex == -1) {
    75 	for (di = domains.begin(); di != domains.end(); di++) {
    72         unsigned int i;
    76 		showDomain(m, *di);
    73         ec_ioctl_master_t master;
    77 	}
    74 
       
    75         m.getMaster(&master);
       
    76 
       
    77         for (i = 0; i < master.domain_count; i++) {
       
    78             showDomain(m, i);
       
    79         }
       
    80     } else {
       
    81         showDomain(m, domainIndex);
       
    82     }
       
    83 }
    78 }
    84 
    79 
    85 /****************************************************************************/
    80 /****************************************************************************/
    86 
    81 
    87 void CommandDomains::showDomain(MasterDevice &m, unsigned int domainIndex)
    82 void CommandDomains::showDomain(
       
    83 		MasterDevice &m,
       
    84 		const ec_ioctl_domain_t &domain
       
    85 		)
    88 {
    86 {
    89     ec_ioctl_domain_t domain;
       
    90     unsigned char *processData;
    87     unsigned char *processData;
    91     ec_ioctl_domain_data_t data;
    88     ec_ioctl_domain_data_t data;
    92     unsigned int i, j;
    89     unsigned int i, j;
    93     ec_ioctl_domain_fmmu_t fmmu;
    90     ec_ioctl_domain_fmmu_t fmmu;
    94     unsigned int dataOffset;
    91     unsigned int dataOffset;
    95     
    92     
    96     m.getDomain(&domain, domainIndex);
    93 	cout << "Domain" << dec << domain.index << ":"
    97 
       
    98 	cout << "Domain" << dec << domainIndex << ":"
       
    99 		<< " LogBaseAddr 0x"
    94 		<< " LogBaseAddr 0x"
   100 		<< hex << setfill('0')
    95 		<< hex << setfill('0')
   101         << setw(8) << domain.logical_base_address
    96         << setw(8) << domain.logical_base_address
   102 		<< ", Size " << dec << setfill(' ')
    97 		<< ", Size " << dec << setfill(' ')
   103         << setw(3) << domain.data_size
    98         << setw(3) << domain.data_size
   109         return;
   104         return;
   110 
   105 
   111     processData = new unsigned char[domain.data_size];
   106     processData = new unsigned char[domain.data_size];
   112 
   107 
   113     try {
   108     try {
   114         m.getData(&data, domainIndex, domain.data_size, processData);
   109         m.getData(&data, domain.index, domain.data_size, processData);
   115     } catch (MasterDeviceException &e) {
   110     } catch (MasterDeviceException &e) {
   116         delete [] processData;
   111         delete [] processData;
   117         throw e;
   112         throw e;
   118     }
   113     }
   119 
   114 
   120     for (i = 0; i < domain.fmmu_count; i++) {
   115     for (i = 0; i < domain.fmmu_count; i++) {
   121         m.getFmmu(&fmmu, domainIndex, i);
   116         m.getFmmu(&fmmu, domain.index, i);
   122 
   117 
   123         cout << "  SlaveConfig "
   118         cout << "  SlaveConfig "
   124             << dec << fmmu.slave_config_alias
   119             << dec << fmmu.slave_config_alias
   125             << ":" << fmmu.slave_config_position
   120             << ":" << fmmu.slave_config_position
   126             << ", SM" << (unsigned int) fmmu.sync_index << " ("
   121             << ", SM" << (unsigned int) fmmu.sync_index << " ("