From 488f1840b9b21837625bdc9ea17c2b52878b58cc Mon Sep 17 00:00:00 2001 From: Florian Pose <fp@igh-essen.com> Date: Mon, 7 Apr 2008 15:47:22 +0000 Subject: [PATCH] Debug messaged on configuring assignment and mapping. --- master/fsm_pdo_assign.c | 13 ++++++++----- master/fsm_pdo_assign.h | 3 ++- master/fsm_pdo_mapping.c | 10 ++++++---- master/fsm_pdo_mapping.h | 1 + 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/master/fsm_pdo_assign.c b/master/fsm_pdo_assign.c index eacad10d..2f36d962 100644 --- a/master/fsm_pdo_assign.c +++ b/master/fsm_pdo_assign.c @@ -152,6 +152,7 @@ void ec_fsm_pdo_assign_state_start( } fsm->dir = (ec_direction_t) -1; // next is EC_DIR_OUTPUT + fsm->num_configured_dirs = 0; ec_fsm_pdo_assign_next_dir(fsm); } @@ -191,6 +192,8 @@ void ec_fsm_pdo_assign_next_dir( return; } + fsm->num_configured_dirs++; + if (fsm->slave->master->debug_level) { EC_DBG("Changing Pdo assignment for SM%u of slave %u.\n", fsm->sync->index, fsm->slave->ring_position); @@ -215,9 +218,9 @@ void ec_fsm_pdo_assign_next_dir( return; } - if (fsm->slave->master->debug_level) - EC_DBG("Pdo assignment finished for slave %u.\n", - fsm->slave->ring_position); + if (fsm->slave->master->debug_level && !fsm->num_configured_dirs) + EC_DBG("Pdo assignments of slave %u are already configured" + " correctly.\n", fsm->slave->ring_position); fsm->state = ec_fsm_pdo_assign_state_end; } @@ -348,8 +351,8 @@ void ec_fsm_pdo_assign_state_pdo_count( } if (fsm->slave->master->debug_level) - EC_DBG("Successfully set Pdo assignment for SM%u of slave %u.\n", - fsm->sync->index, fsm->slave->ring_position); + EC_DBG("Successfully configured Pdo assignment for SM%u of" + " slave %u.\n", fsm->sync->index, fsm->slave->ring_position); // assignment for this direction finished ec_fsm_pdo_assign_next_dir(fsm); diff --git a/master/fsm_pdo_assign.h b/master/fsm_pdo_assign.h index 436e1f70..7e88d7a9 100644 --- a/master/fsm_pdo_assign.h +++ b/master/fsm_pdo_assign.h @@ -63,8 +63,9 @@ struct ec_fsm_pdo_assign ec_slave_t *slave; /**< Slave the FSM runs on. */ ec_direction_t dir; /**< Current direction. */ - const ec_sync_t *sync; /**< Current sync manager. */ const ec_pdo_list_t *pdos; /**< Target Pdo assignment. */ + const ec_sync_t *sync; /**< Current sync manager. */ + unsigned int num_configured_dirs; /**< Number of configured directions. */ const ec_pdo_t *pdo; /**< Current Pdo. */ ec_sdo_request_t request; /**< Sdo request. */ diff --git a/master/fsm_pdo_mapping.c b/master/fsm_pdo_mapping.c index 0d984cbe..ebcf1c5a 100644 --- a/master/fsm_pdo_mapping.c +++ b/master/fsm_pdo_mapping.c @@ -149,6 +149,7 @@ void ec_fsm_pdo_mapping_state_start( } fsm->pdo = NULL; + fsm->num_configured_pdos = 0; ec_fsm_pdo_mapping_next_pdo(fsm); } @@ -169,7 +170,7 @@ void ec_fsm_pdo_mapping_next_pdo( list_for_each_entry(pdo, &pdos->list, list) { if (fsm->pdo) { // there was a Pdo mapping changed in the last run - if (pdo == fsm->pdo) // this is the last Pdo + if (pdo == fsm->pdo) // this is the previously configured Pdo fsm->pdo = NULL; // take the next one } else { if ((assigned_pdo = ec_slave_find_pdo(fsm->slave, pdo->index))) @@ -177,15 +178,16 @@ void ec_fsm_pdo_mapping_next_pdo( continue; // Pdo entries mapped correctly fsm->pdo = pdo; + fsm->num_configured_pdos++; break; } } } if (!fsm->pdo) { - if (fsm->slave->master->debug_level) - EC_DBG("Pdo mapping finished for slave %u.\n", - fsm->slave->ring_position); + if (fsm->slave->master->debug_level && !fsm->num_configured_pdos) + EC_DBG("Pdo mappings of slave %u are already configured" + " correctly.\n", fsm->slave->ring_position); fsm->state = ec_fsm_pdo_mapping_state_end; return; } diff --git a/master/fsm_pdo_mapping.h b/master/fsm_pdo_mapping.h index 753f0836..e0e3f21e 100644 --- a/master/fsm_pdo_mapping.h +++ b/master/fsm_pdo_mapping.h @@ -61,6 +61,7 @@ struct ec_fsm_pdo_mapping ec_slave_t *slave; /**< Slave the FSM runs on. */ const ec_pdo_t *pdo; /**< Current Pdo to configure. */ + unsigned int num_configured_pdos; /**< Number of configured Pdos. */ const ec_pdo_entry_t *entry; /**< Current entry. */ ec_sdo_request_t request; /**< Sdo request. */ -- GitLab