Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();

Added EC_MAX_SYNC_MANAGERS to ecrt.h.
This commit is contained in:
Florian Pose
2008-07-02 14:06:10 +00:00
parent 718e796afa
commit d871e4fd08
15 changed files with 73 additions and 63 deletions
+3 -3
View File
@@ -1000,7 +1000,7 @@ int ec_cdev_ioctl_config(
data.position = sc->position;
data.vendor_id = sc->vendor_id;
data.product_code = sc->product_code;
for (i = 0; i < EC_MAX_SYNCS; i++) {
for (i = 0; i < EC_MAX_SYNC_MANAGERS; i++) {
data.syncs[i].dir = sc->sync_configs[i].dir;
data.syncs[i].pdo_count =
ec_pdo_list_count(&sc->sync_configs[i].pdos);
@@ -1035,7 +1035,7 @@ int ec_cdev_ioctl_config_pdo(
return -EFAULT;
}
if (data.sync_index >= EC_MAX_SYNCS) {
if (data.sync_index >= EC_MAX_SYNC_MANAGERS) {
EC_ERR("Invalid sync manager index %u!\n",
data.sync_index);
return -EINVAL;
@@ -1095,7 +1095,7 @@ int ec_cdev_ioctl_config_pdo_entry(
return -EFAULT;
}
if (data.sync_index >= EC_MAX_SYNCS) {
if (data.sync_index >= EC_MAX_SYNC_MANAGERS) {
EC_ERR("Invalid sync manager index %u!\n",
data.sync_index);
return -EINVAL;
+1 -1
View File
@@ -157,7 +157,7 @@ void ec_fsm_coe_map_action_next_sync(
fsm->sync_index++;
for (; fsm->sync_index < EC_MAX_SYNCS; fsm->sync_index++) {
for (; fsm->sync_index < EC_MAX_SYNC_MANAGERS; fsm->sync_index++) {
if (!(fsm->sync = ec_slave_get_sync(slave, fsm->sync_index)))
continue;
+1 -1
View File
@@ -166,7 +166,7 @@ void ec_fsm_pdo_assign_next_sync(
{
fsm->sync_index++;
for (; fsm->sync_index < EC_MAX_SYNCS; fsm->sync_index++) {
for (; fsm->sync_index < EC_MAX_SYNC_MANAGERS; fsm->sync_index++) {
fsm->pdos = &fsm->slave->config->sync_configs[fsm->sync_index].pdos;
if (!(fsm->sync = ec_slave_get_sync(fsm->slave, fsm->sync_index))) {
+1 -1
View File
@@ -165,7 +165,7 @@ void ec_fsm_pdo_mapping_next_pdo(
const ec_pdo_list_t *pdos;
const ec_pdo_t *pdo, *assigned_pdo;
for (sync_index = 0; sync_index < EC_MAX_SYNCS; sync_index++) {
for (sync_index = 0; sync_index < EC_MAX_SYNC_MANAGERS; sync_index++) {
pdos = &fsm->slave->config->sync_configs[sync_index].pdos;
list_for_each_entry(pdo, &pdos->list, list) {
-3
View File
@@ -93,9 +93,6 @@
/** Maximum number of slave ports. */
#define EC_MAX_PORTS 4
/** Maximum number of sync managers per slave. */
#define EC_MAX_SYNCS 16
/** Size of a sync manager configuration page. */
#define EC_SYNC_PAGE_SIZE 8
+5 -2
View File
@@ -47,6 +47,8 @@
/*****************************************************************************/
/** \cond */
#define EC_IOCTL_TYPE 0xa4
#define EC_IO(nr) _IO(EC_IOCTL_TYPE, nr)
@@ -294,11 +296,10 @@ typedef struct {
struct {
ec_direction_t dir;
uint32_t pdo_count;
} syncs[16];
} syncs[EC_MAX_SYNC_MANAGERS];
uint32_t sdo_count;
uint8_t attached : 1,
operational : 1;
} ec_ioctl_config_t;
/*****************************************************************************/
@@ -347,4 +348,6 @@ typedef struct {
/*****************************************************************************/
/** \endcond */
#endif
+3 -2
View File
@@ -1122,6 +1122,9 @@ unsigned int ec_master_domain_count(
/*****************************************************************************/
/** Common implementation for ec_master_find_domain() and
* ec_master_find_domain_const().
*/
#define EC_FIND_DOMAIN \
do { \
list_for_each_entry(domain, &master->domains, list) { \
@@ -1142,8 +1145,6 @@ ec_domain_t *ec_master_find_domain(
EC_FIND_DOMAIN;
}
/*****************************************************************************/
const ec_domain_t *ec_master_find_domain_const(
const ec_master_t *master, /**< EtherCAT master. */
unsigned int index /**< Domain index. */
+1 -1
View File
@@ -365,7 +365,7 @@ int ec_slave_fetch_sii_syncs(
if (count) {
total_count = count + slave->sii.sync_count;
if (total_count > EC_MAX_SYNCS) {
if (total_count > EC_MAX_SYNC_MANAGERS) {
EC_ERR("Exceeded maximum number of sync managers!\n");
return -1;
}
+13 -13
View File
@@ -70,7 +70,7 @@ void ec_slave_config_init(
sc->product_code = product_code;
sc->slave = NULL;
for (i = 0; i < EC_MAX_SYNCS; i++)
for (i = 0; i < EC_MAX_SYNC_MANAGERS; i++)
ec_sync_config_init(&sc->sync_configs[i]);
INIT_LIST_HEAD(&sc->sdo_configs);
@@ -95,7 +95,7 @@ void ec_slave_config_clear(
ec_slave_config_detach(sc);
// Free sync managers
for (i = 0; i < EC_MAX_SYNCS; i++)
for (i = 0; i < EC_MAX_SYNC_MANAGERS; i++)
ec_sync_config_clear(&sc->sync_configs[i]);
// free all Sdo configurations
@@ -242,7 +242,7 @@ void ec_slave_config_load_default_sync_config(ec_slave_config_t *sc)
if (!sc->slave)
return;
for (sync_index = 0; sync_index < EC_MAX_SYNCS; sync_index++) {
for (sync_index = 0; sync_index < EC_MAX_SYNC_MANAGERS; sync_index++) {
sync_config = &sc->sync_configs[sync_index];
if ((sync = ec_slave_get_sync(sc->slave, sync_index))) {
sync_config->dir = ec_sync_default_direction(sync);
@@ -361,7 +361,7 @@ int ecrt_slave_config_sync_manager(ec_slave_config_t *sc, uint8_t sync_index,
EC_DBG("ecrt_slave_config_sync_manager(sc = 0x%x, sync_index = %u, "
"dir = %u)\n", (u32) sc, sync_index, dir);
if (sync_index >= EC_MAX_SYNCS) {
if (sync_index >= EC_MAX_SYNC_MANAGERS) {
EC_ERR("Invalid sync manager index %u!\n", sync_index);
return -1;
}
@@ -387,7 +387,7 @@ int ecrt_slave_config_pdo_assign_add(ec_slave_config_t *sc,
EC_DBG("ecrt_slave_config_pdo_assign_add(sc = 0x%x, sync_index = %u, "
"pdo_index = 0x%04X)\n", (u32) sc, sync_index, pdo_index);
if (sync_index >= EC_MAX_SYNCS) {
if (sync_index >= EC_MAX_SYNC_MANAGERS) {
EC_ERR("Invalid sync manager index %u!\n", sync_index);
return -1;
}
@@ -416,7 +416,7 @@ void ecrt_slave_config_pdo_assign_clear(ec_slave_config_t *sc,
EC_DBG("ecrt_slave_config_pdo_assign_clear(sc = 0x%x, "
"sync_index = %u)\n", (u32) sc, sync_index);
if (sync_index >= EC_MAX_SYNCS) {
if (sync_index >= EC_MAX_SYNC_MANAGERS) {
EC_ERR("Invalid sync manager index %u!\n", sync_index);
return;
}
@@ -443,7 +443,7 @@ int ecrt_slave_config_pdo_mapping_add(ec_slave_config_t *sc,
(u32) sc, pdo_index, entry_index, entry_subindex,
entry_bit_length);
for (sync_index = 0; sync_index < EC_MAX_SYNCS; sync_index++)
for (sync_index = 0; sync_index < EC_MAX_SYNC_MANAGERS; sync_index++)
if ((pdo = ec_pdo_list_find_pdo(
&sc->sync_configs[sync_index].pdos, pdo_index)))
break;
@@ -473,7 +473,7 @@ void ecrt_slave_config_pdo_mapping_clear(ec_slave_config_t *sc,
EC_DBG("ecrt_slave_config_pdo_mapping_clear(sc = 0x%x, "
"pdo_index = 0x%04X)\n", (u32) sc, pdo_index);
for (sync_index = 0; sync_index < EC_MAX_SYNCS; sync_index++)
for (sync_index = 0; sync_index < EC_MAX_SYNC_MANAGERS; sync_index++)
if ((pdo = ec_pdo_list_find_pdo(
&sc->sync_configs[sync_index].pdos, pdo_index)))
break;
@@ -490,7 +490,7 @@ void ecrt_slave_config_pdo_mapping_clear(ec_slave_config_t *sc,
/*****************************************************************************/
int ecrt_slave_config_sync_managers(ec_slave_config_t *sc,
int ecrt_slave_config_pdos(ec_slave_config_t *sc,
unsigned int n_syncs, const ec_sync_info_t syncs[])
{
unsigned int i, j, k;
@@ -499,7 +499,7 @@ int ecrt_slave_config_sync_managers(ec_slave_config_t *sc,
const ec_pdo_entry_info_t *entry_info;
if (sc->master->debug_level)
EC_DBG("ecrt_slave_config_sync_managers(sc = 0x%x, n_syncs = %u, "
EC_DBG("ecrt_slave_config_pdos(sc = 0x%x, n_syncs = %u, "
"syncs = 0x%x)\n", (u32) sc, n_syncs, (u32) syncs);
if (!syncs)
@@ -511,7 +511,7 @@ int ecrt_slave_config_sync_managers(ec_slave_config_t *sc,
if (sync_info->index == 0xff)
break;
if (sync_info->index >= EC_MAX_SYNCS) {
if (sync_info->index >= EC_MAX_SYNC_MANAGERS) {
EC_ERR("Invalid sync manager index %u!\n", sync_info->index);
return -1;
}
@@ -572,7 +572,7 @@ int ecrt_slave_config_reg_pdo_entry(
"subindex = 0x%02X, domain = 0x%x, bit_position = 0x%x)\n",
(u32) sc, index, subindex, (u32) domain, (u32) bit_position);
for (sync_index = 0; sync_index < EC_MAX_SYNCS; sync_index++) {
for (sync_index = 0; sync_index < EC_MAX_SYNC_MANAGERS; sync_index++) {
sync_config = &sc->sync_configs[sync_index];
bit_offset = 0;
@@ -731,7 +731,7 @@ EXPORT_SYMBOL(ecrt_slave_config_pdo_assign_add);
EXPORT_SYMBOL(ecrt_slave_config_pdo_assign_clear);
EXPORT_SYMBOL(ecrt_slave_config_pdo_mapping_add);
EXPORT_SYMBOL(ecrt_slave_config_pdo_mapping_clear);
EXPORT_SYMBOL(ecrt_slave_config_sync_managers);
EXPORT_SYMBOL(ecrt_slave_config_pdos);
EXPORT_SYMBOL(ecrt_slave_config_reg_pdo_entry);
EXPORT_SYMBOL(ecrt_slave_config_sdo);
EXPORT_SYMBOL(ecrt_slave_config_sdo8);
+1 -1
View File
@@ -67,7 +67,7 @@ struct ec_slave_config {
ec_slave_t *slave; /**< Slave pointer. This is \a NULL, if the slave is
offline. */
ec_sync_config_t sync_configs[EC_MAX_SYNCS]; /**< Sync manager
ec_sync_config_t sync_configs[EC_MAX_SYNC_MANAGERS]; /**< Sync manager
configurations. */
ec_fmmu_config_t fmmu_configs[EC_MAX_FMMUS]; /**< FMMU configurations. */
uint8_t used_fmmus; /**< Number of FMMUs used. */