tool/MasterDevice.cpp
branchstable-1.4
changeset 1686 e206f4485f60
parent 1643 cf5a5c511408
child 1707 11ec009e145d
equal deleted inserted replaced
1685:399ef727bf62 1686:e206f4485f60
   145     data->config_index = index;
   145     data->config_index = index;
   146     data->sdo_pos = sdo_pos;
   146     data->sdo_pos = sdo_pos;
   147 
   147 
   148     if (ioctl(fd, EC_IOCTL_CONFIG_SDO, data) < 0) {
   148     if (ioctl(fd, EC_IOCTL_CONFIG_SDO, data) < 0) {
   149         stringstream err;
   149         stringstream err;
   150         err << "Failed to get slave config Sdo: " << strerror(errno);
   150         err << "Failed to get slave config SDO: " << strerror(errno);
   151         throw MasterDeviceException(err);
   151         throw MasterDeviceException(err);
   152     }
   152     }
   153 }
   153 }
   154 
   154 
   155 /****************************************************************************/
   155 /****************************************************************************/
   291     sdo->slave_position = slaveIndex;
   291     sdo->slave_position = slaveIndex;
   292     sdo->sdo_position = sdoPosition;
   292     sdo->sdo_position = sdoPosition;
   293 
   293 
   294     if (ioctl(fd, EC_IOCTL_SLAVE_SDO, sdo)) {
   294     if (ioctl(fd, EC_IOCTL_SLAVE_SDO, sdo)) {
   295         stringstream err;
   295         stringstream err;
   296         err << "Failed to get Sdo: " << strerror(errno);
   296         err << "Failed to get SDO: " << strerror(errno);
   297         throw MasterDeviceException(err);
   297         throw MasterDeviceException(err);
   298     }
   298     }
   299 }
   299 }
   300 
   300 
   301 /****************************************************************************/
   301 /****************************************************************************/
   311     entry->sdo_spec = sdoSpec;
   311     entry->sdo_spec = sdoSpec;
   312     entry->sdo_entry_subindex = entrySubindex;
   312     entry->sdo_entry_subindex = entrySubindex;
   313 
   313 
   314     if (ioctl(fd, EC_IOCTL_SLAVE_SDO_ENTRY, entry)) {
   314     if (ioctl(fd, EC_IOCTL_SLAVE_SDO_ENTRY, entry)) {
   315         stringstream err;
   315         stringstream err;
   316         err << "Failed to get Sdo entry: " << strerror(errno);
   316         err << "Failed to get SDO entry: " << strerror(errno);
   317         throw MasterDeviceException(err);
   317         throw MasterDeviceException(err);
   318     }
   318     }
   319 }
   319 }
   320 
   320 
   321 /****************************************************************************/
   321 /****************************************************************************/
   362     if (ioctl(fd, EC_IOCTL_SLAVE_SDO_DOWNLOAD, data) < 0) {
   362     if (ioctl(fd, EC_IOCTL_SLAVE_SDO_DOWNLOAD, data) < 0) {
   363         stringstream err;
   363         stringstream err;
   364         if (errno == EIO && data->abort_code) {
   364         if (errno == EIO && data->abort_code) {
   365             throw MasterDeviceSdoAbortException(data->abort_code);
   365             throw MasterDeviceSdoAbortException(data->abort_code);
   366         } else {
   366         } else {
   367             err << "Failed to download Sdo: " << strerror(errno);
   367             err << "Failed to download SDO: " << strerror(errno);
   368             throw MasterDeviceException(err);
   368             throw MasterDeviceException(err);
   369         }
   369         }
   370 	}
   370 	}
   371 }
   371 }
   372 
   372 
   377     if (ioctl(fd, EC_IOCTL_SLAVE_SDO_UPLOAD, data) < 0) {
   377     if (ioctl(fd, EC_IOCTL_SLAVE_SDO_UPLOAD, data) < 0) {
   378         stringstream err;
   378         stringstream err;
   379         if (errno == EIO && data->abort_code) {
   379         if (errno == EIO && data->abort_code) {
   380             throw MasterDeviceSdoAbortException(data->abort_code);
   380             throw MasterDeviceSdoAbortException(data->abort_code);
   381         } else {
   381         } else {
   382             err << "Failed to upload Sdo: " << strerror(errno);
   382             err << "Failed to upload SDO: " << strerror(errno);
   383             throw MasterDeviceException(err);
   383             throw MasterDeviceException(err);
   384         }
   384         }
   385     }
   385     }
   386 }
   386 }
   387 
   387