Improved locking between ioctl()s and master state machine; separate
functions for ioctls(); removed master's sii_sem and sdo_sem.
This commit is contained in:
parent
20911256c3
commit
8265fb115f
1993
master/cdev.c
1993
master/cdev.c
File diff suppressed because it is too large
Load Diff
|
|
@ -296,17 +296,14 @@ int ec_fsm_master_action_process_sii(
|
|||
|
||||
// search the first request to be processed
|
||||
while (1) {
|
||||
down(&master->sii_sem);
|
||||
if (list_empty(&master->sii_requests)) {
|
||||
up(&master->sii_sem);
|
||||
if (list_empty(&master->sii_requests))
|
||||
break;
|
||||
}
|
||||
|
||||
// get first request
|
||||
request = list_entry(master->sii_requests.next,
|
||||
ec_sii_write_request_t, list);
|
||||
list_del_init(&request->list); // dequeue
|
||||
request->state = EC_REQUEST_BUSY;
|
||||
up(&master->sii_sem);
|
||||
|
||||
// found pending SII write operation. execute it!
|
||||
if (master->debug_level)
|
||||
|
|
@ -379,17 +376,14 @@ int ec_fsm_master_action_process_sdo(
|
|||
|
||||
// search the first external request to be processed
|
||||
while (1) {
|
||||
down(&master->sdo_sem);
|
||||
if (list_empty(&master->slave_sdo_requests)) {
|
||||
up(&master->sdo_sem);
|
||||
if (list_empty(&master->slave_sdo_requests))
|
||||
break;
|
||||
}
|
||||
|
||||
// get first request
|
||||
request = list_entry(master->slave_sdo_requests.next,
|
||||
ec_master_sdo_request_t, list);
|
||||
list_del_init(&request->list); // dequeue
|
||||
request->req.state = EC_REQUEST_BUSY;
|
||||
up(&master->sdo_sem);
|
||||
|
||||
slave = request->slave;
|
||||
if (slave->current_state == EC_SLAVE_STATE_INIT) {
|
||||
|
|
@ -778,11 +772,16 @@ void ec_fsm_master_state_write_sii(
|
|||
if (master->debug_level)
|
||||
EC_DBG("Finished writing %u words of SII data to slave %u.\n",
|
||||
request->nwords, slave->ring_position);
|
||||
|
||||
if (request->offset <= 4 && request->offset + request->nwords > 4) {
|
||||
// alias was written
|
||||
slave->sii.alias = EC_READ_U16(request->words + 4);
|
||||
}
|
||||
// TODO: Evaluate other SII contents!
|
||||
|
||||
request->state = EC_REQUEST_SUCCESS;
|
||||
wake_up(&master->sii_queue);
|
||||
|
||||
// TODO: Evaluate new SII contents!
|
||||
|
||||
// check for another SII write request
|
||||
if (ec_fsm_master_action_process_sii(fsm))
|
||||
return; // processing another request
|
||||
|
|
|
|||
|
|
@ -47,33 +47,33 @@
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define EC_IOCTL_TYPE 0xa4
|
||||
#define EC_IOCTL_TYPE 0xa4
|
||||
|
||||
#define EC_IO(nr) _IO(EC_IOCTL_TYPE,nr)
|
||||
#define EC_IOR(nr,type) _IOR(EC_IOCTL_TYPE,nr,type)
|
||||
#define EC_IOW(nr,type) _IOW(EC_IOCTL_TYPE,nr,type)
|
||||
#define EC_IOWR(nr,type) _IOWR(EC_IOCTL_TYPE,nr,type)
|
||||
#define EC_IO(nr) _IO(EC_IOCTL_TYPE, nr)
|
||||
#define EC_IOR(nr, type) _IOR(EC_IOCTL_TYPE, nr, type)
|
||||
#define EC_IOW(nr, type) _IOW(EC_IOCTL_TYPE, nr, type)
|
||||
#define EC_IOWR(nr, type) _IOWR(EC_IOCTL_TYPE, nr, type)
|
||||
|
||||
#define EC_IOCTL_MASTER EC_IOR(0x00, ec_ioctl_master_t)
|
||||
#define EC_IOCTL_SLAVE EC_IOWR(0x01, ec_ioctl_slave_t)
|
||||
#define EC_IOCTL_SYNC EC_IOWR(0x02, ec_ioctl_sync_t)
|
||||
#define EC_IOCTL_PDO EC_IOWR(0x03, ec_ioctl_pdo_t)
|
||||
#define EC_IOCTL_PDO_ENTRY EC_IOWR(0x04, ec_ioctl_pdo_entry_t)
|
||||
#define EC_IOCTL_DOMAIN EC_IOWR(0x05, ec_ioctl_domain_t)
|
||||
#define EC_IOCTL_DOMAIN_FMMU EC_IOWR(0x06, ec_ioctl_domain_fmmu_t)
|
||||
#define EC_IOCTL_DATA EC_IOWR(0x07, ec_ioctl_data_t)
|
||||
#define EC_IOCTL_SET_DEBUG EC_IO(0x08)
|
||||
#define EC_IOCTL_SLAVE_STATE EC_IOW(0x09, ec_ioctl_slave_state_t)
|
||||
#define EC_IOCTL_SDO EC_IOWR(0x0a, ec_ioctl_sdo_t)
|
||||
#define EC_IOCTL_SDO_ENTRY EC_IOWR(0x0b, ec_ioctl_sdo_entry_t)
|
||||
#define EC_IOCTL_SDO_UPLOAD EC_IOWR(0x0c, ec_ioctl_sdo_upload_t)
|
||||
#define EC_IOCTL_SDO_DOWNLOAD EC_IOWR(0x0d, ec_ioctl_sdo_download_t)
|
||||
#define EC_IOCTL_SII_READ EC_IOWR(0x0e, ec_ioctl_sii_t)
|
||||
#define EC_IOCTL_SII_WRITE EC_IOW(0x0f, ec_ioctl_sii_t)
|
||||
#define EC_IOCTL_CONFIG EC_IOWR(0x10, ec_ioctl_config_t)
|
||||
#define EC_IOCTL_CONFIG_PDO EC_IOWR(0x11, ec_ioctl_config_pdo_t)
|
||||
#define EC_IOCTL_CONFIG_PDO_ENTRY EC_IOWR(0x12, ec_ioctl_config_pdo_entry_t)
|
||||
#define EC_IOCTL_CONFIG_SDO EC_IOWR(0x13, ec_ioctl_config_sdo_t)
|
||||
#define EC_IOCTL_MASTER EC_IOR(0x00, ec_ioctl_master_t)
|
||||
#define EC_IOCTL_SLAVE EC_IOWR(0x01, ec_ioctl_slave_t)
|
||||
#define EC_IOCTL_SLAVE_SYNC EC_IOWR(0x02, ec_ioctl_slave_sync_t)
|
||||
#define EC_IOCTL_SLAVE_SYNC_PDO EC_IOWR(0x03, ec_ioctl_slave_sync_pdo_t)
|
||||
#define EC_IOCTL_SLAVE_SYNC_PDO_ENTRY EC_IOWR(0x04, ec_ioctl_slave_sync_pdo_entry_t)
|
||||
#define EC_IOCTL_DOMAIN EC_IOWR(0x05, ec_ioctl_domain_t)
|
||||
#define EC_IOCTL_DOMAIN_FMMU EC_IOWR(0x06, ec_ioctl_domain_fmmu_t)
|
||||
#define EC_IOCTL_DOMAIN_DATA EC_IOWR(0x07, ec_ioctl_domain_data_t)
|
||||
#define EC_IOCTL_MASTER_DEBUG EC_IO(0x08)
|
||||
#define EC_IOCTL_SLAVE_STATE EC_IOW(0x09, ec_ioctl_slave_state_t)
|
||||
#define EC_IOCTL_SLAVE_SDO EC_IOWR(0x0a, ec_ioctl_slave_sdo_t)
|
||||
#define EC_IOCTL_SLAVE_SDO_ENTRY EC_IOWR(0x0b, ec_ioctl_slave_sdo_entry_t)
|
||||
#define EC_IOCTL_SLAVE_SDO_UPLOAD EC_IOWR(0x0c, ec_ioctl_slave_sdo_upload_t)
|
||||
#define EC_IOCTL_SLAVE_SDO_DOWNLOAD EC_IOWR(0x0d, ec_ioctl_slave_sdo_download_t)
|
||||
#define EC_IOCTL_SLAVE_SII_READ EC_IOWR(0x0e, ec_ioctl_slave_sii_t)
|
||||
#define EC_IOCTL_SLAVE_SII_WRITE EC_IOW(0x0f, ec_ioctl_slave_sii_t)
|
||||
#define EC_IOCTL_CONFIG EC_IOWR(0x10, ec_ioctl_config_t)
|
||||
#define EC_IOCTL_CONFIG_PDO EC_IOWR(0x11, ec_ioctl_config_pdo_t)
|
||||
#define EC_IOCTL_CONFIG_PDO_ENTRY EC_IOWR(0x12, ec_ioctl_config_pdo_entry_t)
|
||||
#define EC_IOCTL_CONFIG_SDO EC_IOWR(0x13, ec_ioctl_config_sdo_t)
|
||||
|
||||
#define EC_IOCTL_STRING_SIZE 64
|
||||
|
||||
|
|
@ -135,7 +135,7 @@ typedef struct {
|
|||
uint8_t enable;
|
||||
uint8_t assign_source;
|
||||
uint8_t pdo_count;
|
||||
} ec_ioctl_sync_t;
|
||||
} ec_ioctl_slave_sync_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
@ -149,7 +149,7 @@ typedef struct {
|
|||
uint16_t index;
|
||||
uint8_t entry_count;
|
||||
int8_t name[EC_IOCTL_STRING_SIZE];
|
||||
} ec_ioctl_pdo_t;
|
||||
} ec_ioctl_slave_sync_pdo_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
@ -165,7 +165,7 @@ typedef struct {
|
|||
uint8_t subindex;
|
||||
uint8_t bit_length;
|
||||
int8_t name[EC_IOCTL_STRING_SIZE];
|
||||
} ec_ioctl_pdo_entry_t;
|
||||
} ec_ioctl_slave_sync_pdo_entry_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
@ -204,7 +204,7 @@ typedef struct {
|
|||
uint32_t domain_index;
|
||||
uint32_t data_size;
|
||||
uint8_t *target;
|
||||
} ec_ioctl_data_t;
|
||||
} ec_ioctl_domain_data_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
@ -225,7 +225,7 @@ typedef struct {
|
|||
uint16_t sdo_index;
|
||||
uint8_t max_subindex;
|
||||
int8_t name[EC_IOCTL_STRING_SIZE];
|
||||
} ec_ioctl_sdo_t;
|
||||
} ec_ioctl_slave_sdo_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
@ -239,7 +239,7 @@ typedef struct {
|
|||
uint16_t data_type;
|
||||
uint16_t bit_length;
|
||||
int8_t description[EC_IOCTL_STRING_SIZE];
|
||||
} ec_ioctl_sdo_entry_t;
|
||||
} ec_ioctl_slave_sdo_entry_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
@ -254,7 +254,7 @@ typedef struct {
|
|||
// outputs
|
||||
uint32_t data_size;
|
||||
uint32_t abort_code;
|
||||
} ec_ioctl_sdo_upload_t;
|
||||
} ec_ioctl_slave_sdo_upload_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
@ -268,7 +268,7 @@ typedef struct {
|
|||
|
||||
// outputs
|
||||
uint32_t abort_code;
|
||||
} ec_ioctl_sdo_download_t;
|
||||
} ec_ioctl_slave_sdo_download_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
@ -278,7 +278,7 @@ typedef struct {
|
|||
uint16_t offset;
|
||||
uint32_t nwords;
|
||||
uint16_t *words;
|
||||
} ec_ioctl_sii_t;
|
||||
} ec_ioctl_slave_sii_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -136,11 +136,9 @@ int ec_master_init(ec_master_t *master, /**< EtherCAT master */
|
|||
master->cb_data = NULL;
|
||||
|
||||
INIT_LIST_HEAD(&master->sii_requests);
|
||||
init_MUTEX(&master->sii_sem);
|
||||
init_waitqueue_head(&master->sii_queue);
|
||||
|
||||
INIT_LIST_HEAD(&master->slave_sdo_requests);
|
||||
init_MUTEX(&master->sdo_sem);
|
||||
init_waitqueue_head(&master->sdo_queue);
|
||||
|
||||
// init devices
|
||||
|
|
|
|||
|
|
@ -152,14 +152,10 @@ struct ec_master {
|
|||
void *ext_cb_data; /**< Data parameter of external locking callbacks. */
|
||||
|
||||
struct list_head sii_requests; /**< SII write requests. */
|
||||
struct semaphore sii_sem; /**< Semaphore protecting the list of
|
||||
SII write requests. */
|
||||
wait_queue_head_t sii_queue; /**< Wait queue for SII
|
||||
write requests from user space. */
|
||||
|
||||
struct list_head slave_sdo_requests; /**< Sdo access requests. */
|
||||
struct semaphore sdo_sem; /**< Semaphore protecting the list of
|
||||
Sdo access requests. */
|
||||
wait_queue_head_t sdo_queue; /**< Wait queue for Sdo access requests
|
||||
from user space. */
|
||||
};
|
||||
|
|
|
|||
|
|
@ -508,64 +508,6 @@ char *ec_slave_sii_string(
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Writes SII contents to a slave.
|
||||
* \return Zero on success, otherwise error code.
|
||||
*/
|
||||
|
||||
int ec_slave_write_sii(
|
||||
ec_slave_t *slave, /**< EtherCAT slave */
|
||||
uint16_t offset, /**< SII word offset. */
|
||||
unsigned int nwords, /**< Number of words. */
|
||||
const uint16_t *words /**< New SII data. */
|
||||
)
|
||||
{
|
||||
ec_master_t *master = slave->master;
|
||||
ec_sii_write_request_t request;
|
||||
|
||||
// init SII write request
|
||||
INIT_LIST_HEAD(&request.list);
|
||||
request.slave = slave;
|
||||
request.words = words;
|
||||
request.offset = offset;
|
||||
request.nwords = nwords;
|
||||
request.state = EC_REQUEST_QUEUED;
|
||||
|
||||
// schedule SII write request.
|
||||
down(&master->sii_sem);
|
||||
list_add_tail(&request.list, &master->sii_requests);
|
||||
up(&master->sii_sem);
|
||||
|
||||
// wait for processing through FSM
|
||||
if (wait_event_interruptible(master->sii_queue,
|
||||
request.state != EC_REQUEST_QUEUED)) {
|
||||
// interrupted by signal
|
||||
down(&master->sii_sem);
|
||||
if (request.state == EC_REQUEST_QUEUED) {
|
||||
list_del(&request.list);
|
||||
up(&master->sii_sem);
|
||||
return -EINTR;
|
||||
}
|
||||
// request already processing: interrupt not possible.
|
||||
up(&master->sii_sem);
|
||||
}
|
||||
|
||||
// wait until master FSM has finished processing
|
||||
wait_event(master->sii_queue,
|
||||
request.state != EC_REQUEST_BUSY);
|
||||
|
||||
if (request.state == EC_REQUEST_SUCCESS) {
|
||||
if (offset <= 4 && offset + nwords > 4) { // alias was written
|
||||
slave->sii.alias = EC_READ_U16(words + 4);
|
||||
}
|
||||
return 0;
|
||||
} else {
|
||||
return -EIO;
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Get the sync manager given an index.
|
||||
*
|
||||
* \return pointer to sync manager, or NULL.
|
||||
|
|
|
|||
|
|
@ -171,9 +171,6 @@ const ec_sdo_t *ec_slave_get_sdo_by_pos_const(const ec_slave_t *, uint16_t);
|
|||
uint16_t ec_slave_sdo_count(const ec_slave_t *);
|
||||
const ec_pdo_t *ec_slave_find_pdo(const ec_slave_t *, uint16_t);
|
||||
|
||||
int ec_slave_write_sii(ec_slave_t *, uint16_t, unsigned int,
|
||||
const uint16_t *);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ void Master::writeAlias(
|
|||
const vector<string> &commandArgs
|
||||
)
|
||||
{
|
||||
ec_ioctl_sii_t data;
|
||||
ec_ioctl_slave_sii_t data;
|
||||
ec_ioctl_slave_t slave;
|
||||
unsigned int i;
|
||||
uint16_t alias;
|
||||
|
|
@ -230,7 +230,7 @@ void Master::setDebug(const vector<string> &commandArgs)
|
|||
|
||||
open(ReadWrite);
|
||||
|
||||
if (ioctl(fd, EC_IOCTL_SET_DEBUG, debugLevel) < 0) {
|
||||
if (ioctl(fd, EC_IOCTL_MASTER_DEBUG, debugLevel) < 0) {
|
||||
stringstream err;
|
||||
err << "Failed to set debug level: " << strerror(errno);
|
||||
throw MasterException(err.str());
|
||||
|
|
@ -353,7 +353,7 @@ void Master::sdoDownload(
|
|||
)
|
||||
{
|
||||
stringstream strIndex, strSubIndex, strValue, err;
|
||||
ec_ioctl_sdo_download_t data;
|
||||
ec_ioctl_slave_sdo_download_t data;
|
||||
unsigned int i, number;
|
||||
const CoEDataType *dataType = NULL;
|
||||
|
||||
|
|
@ -393,7 +393,7 @@ void Master::sdoDownload(
|
|||
throw MasterException(err.str());
|
||||
}
|
||||
} else { // no data type specified: fetch from dictionary
|
||||
ec_ioctl_sdo_entry_t entry;
|
||||
ec_ioctl_slave_sdo_entry_t entry;
|
||||
unsigned int entryByteSize;
|
||||
|
||||
open(ReadWrite);
|
||||
|
|
@ -497,7 +497,7 @@ void Master::sdoDownload(
|
|||
|
||||
open(ReadWrite);
|
||||
|
||||
if (ioctl(fd, EC_IOCTL_SDO_DOWNLOAD, &data) < 0) {
|
||||
if (ioctl(fd, EC_IOCTL_SLAVE_SDO_DOWNLOAD, &data) < 0) {
|
||||
stringstream err;
|
||||
err << "Failed to download Sdo: ";
|
||||
if (errno == EIO && data.abort_code) {
|
||||
|
|
@ -523,7 +523,7 @@ void Master::sdoUpload(
|
|||
{
|
||||
stringstream strIndex, strSubIndex;
|
||||
int sval;
|
||||
ec_ioctl_sdo_upload_t data;
|
||||
ec_ioctl_slave_sdo_upload_t data;
|
||||
unsigned int i, uval;
|
||||
const CoEDataType *dataType = NULL;
|
||||
|
||||
|
|
@ -568,7 +568,7 @@ void Master::sdoUpload(
|
|||
throw MasterException(err.str());
|
||||
}
|
||||
} else { // no data type specified: fetch from dictionary
|
||||
ec_ioctl_sdo_entry_t entry;
|
||||
ec_ioctl_slave_sdo_entry_t entry;
|
||||
unsigned int entryByteSize;
|
||||
|
||||
open(Read);
|
||||
|
|
@ -601,7 +601,7 @@ void Master::sdoUpload(
|
|||
|
||||
open(Read);
|
||||
|
||||
if (ioctl(fd, EC_IOCTL_SDO_UPLOAD, &data) < 0) {
|
||||
if (ioctl(fd, EC_IOCTL_SLAVE_SDO_UPLOAD, &data) < 0) {
|
||||
stringstream err;
|
||||
err << "Failed to upload Sdo: ";
|
||||
if (errno == EIO && data.abort_code) {
|
||||
|
|
@ -688,7 +688,7 @@ void Master::showSlaves(int slavePosition, bool verbose)
|
|||
|
||||
void Master::siiRead(int slavePosition)
|
||||
{
|
||||
ec_ioctl_sii_t data;
|
||||
ec_ioctl_slave_sii_t data;
|
||||
ec_ioctl_slave_t slave;
|
||||
unsigned int i;
|
||||
|
||||
|
|
@ -710,7 +710,7 @@ void Master::siiRead(int slavePosition)
|
|||
data.nwords = slave.sii_nwords;
|
||||
data.words = new uint16_t[data.nwords];
|
||||
|
||||
if (ioctl(fd, EC_IOCTL_SII_READ, &data) < 0) {
|
||||
if (ioctl(fd, EC_IOCTL_SLAVE_SII_READ, &data) < 0) {
|
||||
stringstream err;
|
||||
delete [] data.words;
|
||||
err << "Failed to read SII: " << strerror(errno);
|
||||
|
|
@ -734,7 +734,7 @@ void Master::siiWrite(
|
|||
)
|
||||
{
|
||||
stringstream err;
|
||||
ec_ioctl_sii_t data;
|
||||
ec_ioctl_slave_sii_t data;
|
||||
ifstream file;
|
||||
unsigned int byte_size;
|
||||
const uint16_t *categoryHeader;
|
||||
|
|
@ -814,7 +814,7 @@ void Master::siiWrite(
|
|||
// send data to master
|
||||
open(ReadWrite);
|
||||
data.offset = 0;
|
||||
if (ioctl(fd, EC_IOCTL_SII_WRITE, &data) < 0) {
|
||||
if (ioctl(fd, EC_IOCTL_SLAVE_SII_WRITE, &data) < 0) {
|
||||
stringstream err;
|
||||
err << "Failed to write SII: " << strerror(errno);
|
||||
throw MasterException(err.str());
|
||||
|
|
@ -925,7 +925,7 @@ void Master::writeSlaveAlias(
|
|||
uint16_t alias
|
||||
)
|
||||
{
|
||||
ec_ioctl_sii_t data;
|
||||
ec_ioctl_slave_sii_t data;
|
||||
ec_ioctl_slave_t slave;
|
||||
stringstream err;
|
||||
uint8_t crc;
|
||||
|
|
@ -946,7 +946,7 @@ void Master::writeSlaveAlias(
|
|||
data.words = new uint16_t[data.nwords];
|
||||
|
||||
// read first 8 SII words
|
||||
if (ioctl(fd, EC_IOCTL_SII_READ, &data) < 0) {
|
||||
if (ioctl(fd, EC_IOCTL_SLAVE_SII_READ, &data) < 0) {
|
||||
delete [] data.words;
|
||||
err << "Failed to read SII: " << strerror(errno);
|
||||
throw MasterException(err.str());
|
||||
|
|
@ -962,7 +962,7 @@ void Master::writeSlaveAlias(
|
|||
*(uint8_t *) (data.words + 7) = crc;
|
||||
|
||||
// write first 8 words with new alias and checksum
|
||||
if (ioctl(fd, EC_IOCTL_SII_WRITE, &data) < 0) {
|
||||
if (ioctl(fd, EC_IOCTL_SLAVE_SII_WRITE, &data) < 0) {
|
||||
delete [] data.words;
|
||||
err << "Failed to write SII: " << strerror(errno);
|
||||
throw MasterException(err.str());
|
||||
|
|
@ -1151,7 +1151,7 @@ void Master::listConfigs()
|
|||
void Master::outputDomainData(unsigned int domainIndex)
|
||||
{
|
||||
ec_ioctl_domain_t domain;
|
||||
ec_ioctl_data_t data;
|
||||
ec_ioctl_domain_data_t data;
|
||||
unsigned char *processData;
|
||||
unsigned int i;
|
||||
|
||||
|
|
@ -1182,7 +1182,7 @@ void Master::showDomain(unsigned int domainIndex)
|
|||
{
|
||||
ec_ioctl_domain_t domain;
|
||||
unsigned char *processData;
|
||||
ec_ioctl_data_t data;
|
||||
ec_ioctl_domain_data_t data;
|
||||
unsigned int i, j;
|
||||
ec_ioctl_domain_fmmu_t fmmu;
|
||||
unsigned int dataOffset;
|
||||
|
|
@ -1253,9 +1253,9 @@ void Master::listSlavePdos(
|
|||
)
|
||||
{
|
||||
ec_ioctl_slave_t slave;
|
||||
ec_ioctl_sync_t sync;
|
||||
ec_ioctl_pdo_t pdo;
|
||||
ec_ioctl_pdo_entry_t entry;
|
||||
ec_ioctl_slave_sync_t sync;
|
||||
ec_ioctl_slave_sync_pdo_t pdo;
|
||||
ec_ioctl_slave_sync_pdo_entry_t entry;
|
||||
unsigned int i, j, k;
|
||||
|
||||
getSlave(&slave, slavePosition);
|
||||
|
|
@ -1313,8 +1313,8 @@ void Master::listSlaveSdos(
|
|||
)
|
||||
{
|
||||
ec_ioctl_slave_t slave;
|
||||
ec_ioctl_sdo_t sdo;
|
||||
ec_ioctl_sdo_entry_t entry;
|
||||
ec_ioctl_slave_sdo_t sdo;
|
||||
ec_ioctl_slave_sdo_entry_t entry;
|
||||
unsigned int i, j, k;
|
||||
const CoEDataType *d;
|
||||
|
||||
|
|
@ -1553,10 +1553,10 @@ void Master::showSlave(uint16_t slavePosition)
|
|||
void Master::generateSlaveXml(uint16_t slavePosition)
|
||||
{
|
||||
ec_ioctl_slave_t slave;
|
||||
ec_ioctl_sync_t sync;
|
||||
ec_ioctl_pdo_t pdo;
|
||||
ec_ioctl_slave_sync_t sync;
|
||||
ec_ioctl_slave_sync_pdo_t pdo;
|
||||
string pdoType;
|
||||
ec_ioctl_pdo_entry_t entry;
|
||||
ec_ioctl_slave_sync_pdo_entry_t entry;
|
||||
unsigned int i, j, k;
|
||||
|
||||
getSlave(&slave, slavePosition);
|
||||
|
|
@ -1781,14 +1781,14 @@ void Master::getDomain(ec_ioctl_domain_t *data, unsigned int index)
|
|||
|
||||
/****************************************************************************/
|
||||
|
||||
void Master::getData(ec_ioctl_data_t *data, unsigned int domainIndex,
|
||||
void Master::getData(ec_ioctl_domain_data_t *data, unsigned int domainIndex,
|
||||
unsigned int dataSize, unsigned char *mem)
|
||||
{
|
||||
data->domain_index = domainIndex;
|
||||
data->data_size = dataSize;
|
||||
data->target = mem;
|
||||
|
||||
if (ioctl(fd, EC_IOCTL_DATA, data) < 0) {
|
||||
if (ioctl(fd, EC_IOCTL_DOMAIN_DATA, data) < 0) {
|
||||
stringstream err;
|
||||
err << "Failed to get domain data: " << strerror(errno);
|
||||
throw MasterException(err.str());
|
||||
|
|
@ -1839,7 +1839,7 @@ void Master::getFmmu(
|
|||
/****************************************************************************/
|
||||
|
||||
void Master::getSync(
|
||||
ec_ioctl_sync_t *sync,
|
||||
ec_ioctl_slave_sync_t *sync,
|
||||
uint16_t slaveIndex,
|
||||
uint8_t syncIndex
|
||||
)
|
||||
|
|
@ -1847,7 +1847,7 @@ void Master::getSync(
|
|||
sync->slave_position = slaveIndex;
|
||||
sync->sync_index = syncIndex;
|
||||
|
||||
if (ioctl(fd, EC_IOCTL_SYNC, sync)) {
|
||||
if (ioctl(fd, EC_IOCTL_SLAVE_SYNC, sync)) {
|
||||
stringstream err;
|
||||
err << "Failed to get sync manager: ";
|
||||
if (errno == EINVAL)
|
||||
|
|
@ -1863,7 +1863,7 @@ void Master::getSync(
|
|||
/****************************************************************************/
|
||||
|
||||
void Master::getPdo(
|
||||
ec_ioctl_pdo_t *pdo,
|
||||
ec_ioctl_slave_sync_pdo_t *pdo,
|
||||
uint16_t slaveIndex,
|
||||
uint8_t syncIndex,
|
||||
uint8_t pdoPos
|
||||
|
|
@ -1873,7 +1873,7 @@ void Master::getPdo(
|
|||
pdo->sync_index = syncIndex;
|
||||
pdo->pdo_pos = pdoPos;
|
||||
|
||||
if (ioctl(fd, EC_IOCTL_PDO, pdo)) {
|
||||
if (ioctl(fd, EC_IOCTL_SLAVE_SYNC_PDO, pdo)) {
|
||||
stringstream err;
|
||||
err << "Failed to get Pdo: ";
|
||||
if (errno == EINVAL)
|
||||
|
|
@ -1891,7 +1891,7 @@ void Master::getPdo(
|
|||
/****************************************************************************/
|
||||
|
||||
void Master::getPdoEntry(
|
||||
ec_ioctl_pdo_entry_t *entry,
|
||||
ec_ioctl_slave_sync_pdo_entry_t *entry,
|
||||
uint16_t slaveIndex,
|
||||
uint8_t syncIndex,
|
||||
uint8_t pdoPos,
|
||||
|
|
@ -1903,7 +1903,7 @@ void Master::getPdoEntry(
|
|||
entry->pdo_pos = pdoPos;
|
||||
entry->entry_pos = entryPos;
|
||||
|
||||
if (ioctl(fd, EC_IOCTL_PDO_ENTRY, entry)) {
|
||||
if (ioctl(fd, EC_IOCTL_SLAVE_SYNC_PDO_ENTRY, entry)) {
|
||||
stringstream err;
|
||||
err << "Failed to get Pdo entry: ";
|
||||
if (errno == EINVAL)
|
||||
|
|
@ -1923,7 +1923,7 @@ void Master::getPdoEntry(
|
|||
/****************************************************************************/
|
||||
|
||||
void Master::getSdo(
|
||||
ec_ioctl_sdo_t *sdo,
|
||||
ec_ioctl_slave_sdo_t *sdo,
|
||||
uint16_t slaveIndex,
|
||||
uint16_t sdoPosition
|
||||
)
|
||||
|
|
@ -1931,7 +1931,7 @@ void Master::getSdo(
|
|||
sdo->slave_position = slaveIndex;
|
||||
sdo->sdo_position = sdoPosition;
|
||||
|
||||
if (ioctl(fd, EC_IOCTL_SDO, sdo)) {
|
||||
if (ioctl(fd, EC_IOCTL_SLAVE_SDO, sdo)) {
|
||||
stringstream err;
|
||||
err << "Failed to get Sdo: ";
|
||||
if (errno == EINVAL)
|
||||
|
|
@ -1947,7 +1947,7 @@ void Master::getSdo(
|
|||
/****************************************************************************/
|
||||
|
||||
void Master::getSdoEntry(
|
||||
ec_ioctl_sdo_entry_t *entry,
|
||||
ec_ioctl_slave_sdo_entry_t *entry,
|
||||
uint16_t slaveIndex,
|
||||
int sdoSpec,
|
||||
uint8_t entrySubindex
|
||||
|
|
@ -1957,7 +1957,7 @@ void Master::getSdoEntry(
|
|||
entry->sdo_spec = sdoSpec;
|
||||
entry->sdo_entry_subindex = entrySubindex;
|
||||
|
||||
if (ioctl(fd, EC_IOCTL_SDO_ENTRY, entry)) {
|
||||
if (ioctl(fd, EC_IOCTL_SLAVE_SDO_ENTRY, entry)) {
|
||||
stringstream err;
|
||||
err << "Failed to get Sdo entry: ";
|
||||
err << strerror(errno);
|
||||
|
|
|
|||
|
|
@ -83,15 +83,15 @@ class Master
|
|||
void getConfigSdo(ec_ioctl_config_sdo_t *, unsigned int, unsigned int);
|
||||
void getDomain(ec_ioctl_domain_t *, unsigned int);
|
||||
void getFmmu(ec_ioctl_domain_fmmu_t *, unsigned int, unsigned int);
|
||||
void getData(ec_ioctl_data_t *, unsigned int, unsigned int,
|
||||
void getData(ec_ioctl_domain_data_t *, unsigned int, unsigned int,
|
||||
unsigned char *);
|
||||
void getSlave(ec_ioctl_slave_t *, uint16_t);
|
||||
void getSync(ec_ioctl_sync_t *, uint16_t, uint8_t);
|
||||
void getPdo(ec_ioctl_pdo_t *, uint16_t, uint8_t, uint8_t);
|
||||
void getPdoEntry(ec_ioctl_pdo_entry_t *, uint16_t, uint8_t, uint8_t,
|
||||
uint8_t);
|
||||
void getSdo(ec_ioctl_sdo_t *, uint16_t, uint16_t);
|
||||
void getSdoEntry(ec_ioctl_sdo_entry_t *, uint16_t, int, uint8_t);
|
||||
void getSync(ec_ioctl_slave_sync_t *, uint16_t, uint8_t);
|
||||
void getPdo(ec_ioctl_slave_sync_pdo_t *, uint16_t, uint8_t, uint8_t);
|
||||
void getPdoEntry(ec_ioctl_slave_sync_pdo_entry_t *, uint16_t, uint8_t,
|
||||
uint8_t, uint8_t);
|
||||
void getSdo(ec_ioctl_slave_sdo_t *, uint16_t, uint16_t);
|
||||
void getSdoEntry(ec_ioctl_slave_sdo_entry_t *, uint16_t, int, uint8_t);
|
||||
void requestState(uint16_t, uint8_t);
|
||||
|
||||
static string slaveState(uint8_t);
|
||||
|
|
|
|||
Loading…
Reference in New Issue