mirror of
https://gitlab.com/etherlab.org/ethercat.git
synced 2026-02-06 03:41:52 +08:00
Output DC config in 'ethercat config'.
This commit is contained in:
1
TODO
1
TODO
@@ -14,7 +14,6 @@ Version 1.5.0:
|
||||
- Check 32/64 bit operations.
|
||||
- Use vendor correction factors when calculating transmission delays.
|
||||
- Skip setting system time offset when application detached.
|
||||
- Output DC configuration in 'ethercat config'.
|
||||
- How to set the SYNC1 shift time?
|
||||
- Do not output graph, if topology calculation failed.
|
||||
* Fix unloading problem of ec_e100 driver.
|
||||
|
||||
@@ -248,14 +248,14 @@ void ecrt_slave_config_dc(ec_slave_config_t *sc, uint16_t assign_activate,
|
||||
uint32_t sync0_cycle_time, uint32_t sync0_shift_time,
|
||||
uint32_t sync1_cycle_time, uint32_t sync1_shift_time)
|
||||
{
|
||||
ec_ioctl_sc_dc_t data;
|
||||
ec_ioctl_config_t data;
|
||||
|
||||
data.config_index = sc->index;
|
||||
data.assign_activate = assign_activate;
|
||||
data.sync[0].cycle_time = sync0_cycle_time;
|
||||
data.sync[0].shift_time = sync0_shift_time;
|
||||
data.sync[1].cycle_time = sync1_cycle_time;
|
||||
data.sync[1].shift_time = sync1_shift_time;
|
||||
data.dc_assign_activate = assign_activate;
|
||||
data.dc_sync[0].cycle_time = sync0_cycle_time;
|
||||
data.dc_sync[0].shift_time = sync0_shift_time;
|
||||
data.dc_sync[1].cycle_time = sync1_cycle_time;
|
||||
data.dc_sync[1].shift_time = sync1_shift_time;
|
||||
|
||||
if (ioctl(sc->master->fd, EC_IOCTL_SC_DC, &data) == -1) {
|
||||
fprintf(stderr, "Failed to set assign_activate word.\n");
|
||||
|
||||
@@ -1257,6 +1257,10 @@ int ec_cdev_ioctl_config(
|
||||
}
|
||||
data.sdo_count = ec_slave_config_sdo_count(sc);
|
||||
data.slave_position = sc->slave ? sc->slave->ring_position : -1;
|
||||
data.dc_assign_activate = sc->dc_assign_activate;
|
||||
for (i = 0; i < EC_SYNC_SIGNAL_COUNT; i++) {
|
||||
data.dc_sync[i] = sc->dc_sync[i];
|
||||
}
|
||||
|
||||
up(&master->master_sem);
|
||||
|
||||
@@ -1936,7 +1940,7 @@ int ec_cdev_ioctl_sc_dc(
|
||||
ec_cdev_priv_t *priv /**< Private data structure of file handle. */
|
||||
)
|
||||
{
|
||||
ec_ioctl_sc_dc_t data;
|
||||
ec_ioctl_config_t data;
|
||||
ec_slave_config_t *sc;
|
||||
|
||||
if (unlikely(!priv->requested))
|
||||
@@ -1953,11 +1957,11 @@ int ec_cdev_ioctl_sc_dc(
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
ecrt_slave_config_dc(sc, data.assign_activate,
|
||||
data.sync[0].cycle_time,
|
||||
data.sync[0].shift_time,
|
||||
data.sync[1].cycle_time,
|
||||
data.sync[1].shift_time);
|
||||
ecrt_slave_config_dc(sc, data.dc_assign_activate,
|
||||
data.dc_sync[0].cycle_time,
|
||||
data.dc_sync[0].shift_time,
|
||||
data.dc_sync[1].cycle_time,
|
||||
data.dc_sync[1].shift_time);
|
||||
|
||||
up(&master->master_sem);
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
#define EC_IOCTL_SC_ADD_ENTRY EC_IOW(0x25, ec_ioctl_add_pdo_entry_t)
|
||||
#define EC_IOCTL_SC_CLEAR_ENTRIES EC_IOW(0x26, ec_ioctl_config_pdo_t)
|
||||
#define EC_IOCTL_SC_REG_PDO_ENTRY EC_IOWR(0x27, ec_ioctl_reg_pdo_entry_t)
|
||||
#define EC_IOCTL_SC_DC EC_IOW(0x28, ec_ioctl_sc_dc_t)
|
||||
#define EC_IOCTL_SC_DC EC_IOW(0x28, ec_ioctl_config_t)
|
||||
#define EC_IOCTL_SC_SDO EC_IOW(0x29, ec_ioctl_sc_sdo_t)
|
||||
#define EC_IOCTL_SC_SDO_REQUEST EC_IOWR(0x2a, ec_ioctl_sdo_request_t)
|
||||
#define EC_IOCTL_SC_VOE EC_IOWR(0x2b, ec_ioctl_voe_t)
|
||||
@@ -391,17 +391,12 @@ typedef struct {
|
||||
} syncs[EC_MAX_SYNC_MANAGERS];
|
||||
uint32_t sdo_count;
|
||||
int32_t slave_position;
|
||||
uint16_t dc_assign_activate;
|
||||
ec_sync_signal_t dc_sync[EC_SYNC_SIGNAL_COUNT];
|
||||
} ec_ioctl_config_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
// inputs
|
||||
uint64_t app_time;
|
||||
} ec_ioctl_app_time_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
// inputs
|
||||
uint32_t config_index;
|
||||
@@ -470,15 +465,6 @@ typedef struct {
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
// inputs
|
||||
uint32_t config_index;
|
||||
uint16_t assign_activate;
|
||||
ec_sync_signal_t sync[EC_SYNC_SIGNAL_COUNT];
|
||||
} ec_ioctl_sc_dc_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
// inputs
|
||||
uint32_t config_index;
|
||||
@@ -541,6 +527,13 @@ typedef struct {
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
// inputs
|
||||
uint64_t app_time;
|
||||
} ec_ioctl_app_time_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** \endcond */
|
||||
|
||||
#endif
|
||||
|
||||
@@ -218,6 +218,22 @@ void CommandConfig::showDetailedConfigs(
|
||||
cout << " None." << endl;
|
||||
}
|
||||
|
||||
if (configIter->dc_assign_activate) {
|
||||
int i;
|
||||
|
||||
cout << "DC configuration:" << endl
|
||||
<< " AssignActivate: 0x" << hex << setfill('0')
|
||||
<< setw(4) << configIter->dc_assign_activate << endl;
|
||||
|
||||
cout << " Cycle time [ns] Shift time [ns]" << endl;
|
||||
for (i = 0; i < EC_SYNC_SIGNAL_COUNT; i++) {
|
||||
cout << " SYNC" << dec << i << setfill(' ') << right
|
||||
<< setw(11) << configIter->dc_sync[i].cycle_time
|
||||
<< " "
|
||||
<< setw(11) << configIter->dc_sync[i].shift_time
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user