# HG changeset patch # User Florian Pose # Date 1217581115 0 # Node ID 846907b8cc4be670371d870553492c4d8317095c # Parent c0e6adec1aee3d17162c5f79f5ec592e70aba933 Configure Pdos before configuring the Pdo sync managers, to earlier detect problems with non-existing SM information. diff -r c0e6adec1aee -r 846907b8cc4b TODO --- a/TODO Fri Aug 01 08:11:23 2008 +0000 +++ b/TODO Fri Aug 01 08:58:35 2008 +0000 @@ -14,7 +14,6 @@ * Remove ec_sync_t::assign_source? * Repair rcethercat status. * Debug output for all configuration functions of the application interface. -* Output warning, if there is no sync manager for a configuration. * Abort code messages in userspace. Future issues: diff -r c0e6adec1aee -r 846907b8cc4b documentation/graphs/fsm_slave_conf.dot --- a/documentation/graphs/fsm_slave_conf.dot Fri Aug 01 08:11:23 2008 +0000 +++ b/documentation/graphs/fsm_slave_conf.dot Fri Aug 01 08:58:35 2008 +0000 @@ -10,78 +10,61 @@ start -> init [weight=10] init [fontname="Helvetica"] - //init -> init - //init -> error - init -> enter_mbox_sync [fontname="Helvetica",label ="No FMMUs"] + init -> enter_mbox_sync [fontname="Helvetica", label="No FMMUs"] init -> clear_fmmus [weight=10] clear_fmmus [fontname="Helvetica"] - //clear_fmmus -> clear_fmmus - //clear_fmmus -> error clear_fmmus -> enter_mbox_sync [weight=10] - enter_mbox_sync [shape=point,label=""] - enter_mbox_sync -> end [fontname="Helvetica",label="INIT\nrequested"] - enter_mbox_sync -> preop [fontname="Helvetica",label="No mailboxes"] + enter_mbox_sync [shape=point, label=""] + enter_mbox_sync -> end [fontname="Helvetica", label="INIT\nrequested"] + enter_mbox_sync -> preop [fontname="Helvetica", label="No mailboxes"] enter_mbox_sync -> mbox_sync [weight=10] mbox_sync [fontname="Helvetica"] - //mbox_sync -> mbox_sync - //mbox_sync -> error mbox_sync -> preop [weight=10] preop [fontname="Helvetica"] - //preop -> preop - //preop -> error - preop -> end [fontname="Helvetica",label="PREOP\nrequested"] - preop -> enter_safeop [fontname="Helvetica",label="No slave\nconfig attached"] + preop -> end [fontname="Helvetica", label="PREOP\nrequested"] + preop -> enter_safeop [fontname="Helvetica", label="No slave\nconfig attached"] preop -> enter_sdo_conf [weight=10] - enter_sdo_conf [shape=point,label=""] - enter_sdo_conf -> enter_pdo_sync [fontname="Helvetica",label="No Sdo\nconfigurations"] + enter_sdo_conf [shape=point, label=""] + enter_sdo_conf -> enter_pdo_conf [fontname="Helvetica", label="No Sdos\nconfigured"] enter_sdo_conf -> sdo_conf [weight=10] sdo_conf [fontname="Helvetica"] - //sdo_conf -> sdo_conf - //sdo_conf -> error - sdo_conf -> enter_pdo_sync [weight=10] + sdo_conf -> enter_pdo_conf [weight=10] - enter_pdo_sync [shape=point,label=""] - enter_pdo_sync -> enter_safeop [fontname="Helvetica",label="No Pdos"] + enter_pdo_conf [shape=point, label=""] + enter_pdo_conf -> pdo_conf [weight=10] + + pdo_conf [fontname="Helvetica"] + pdo_conf -> enter_pdo_sync [weight=10] + + enter_pdo_sync [shape=point, label=""] + enter_pdo_sync -> enter_fmmu [fontname="Helvetica", label="No Pdo SMs"] enter_pdo_sync -> pdo_sync [weight=10] pdo_sync [fontname="Helvetica"] - //pdo_sync -> pdo_sync - //pdo_sync -> error - pdo_sync -> pdo_conf [weight=10] - - pdo_conf [fontname="Helvetica"] - //pdo_conf -> pdo_conf - //pdo_conf -> error - pdo_conf -> enter_fmmu [weight=10] + pdo_sync -> enter_fmmu [weight=10] enter_fmmu [shape=point,label=""] - enter_fmmu -> enter_safeop [fontname="Helvetica",label="No FMMUs\nto configure"] + enter_fmmu -> enter_safeop [fontname="Helvetica", label="No FMMUs\nconfigured"] enter_fmmu -> fmmu [weight=10] fmmu [fontname="Helvetica"] - //fmmu -> fmmu - //fmmu -> error fmmu -> enter_safeop [weight=10] enter_safeop [shape=point,label=""] enter_safeop -> safeop [weight=10] safeop [fontname="Helvetica"] - //safeop -> safeop - //safeop -> error - safeop -> end [fontname="Helvetica",label="SAFEOP\nrequested"] + safeop -> end [fontname="Helvetica", label="SAFEOP\nrequested"] safeop -> op [weight=10] op [fontname="Helvetica"] - //op -> op - //op -> error - op -> end [weight=10] + op -> end// [weight=10] end [fontname="Helvetica"] } diff -r c0e6adec1aee -r 846907b8cc4b master/fsm_pdo.c --- a/master/fsm_pdo.c Fri Aug 01 08:11:23 2008 +0000 +++ b/master/fsm_pdo.c Fri Aug 01 08:58:35 2008 +0000 @@ -413,7 +413,7 @@ if (!(fsm->sync = ec_slave_get_sync(fsm->slave, fsm->sync_index))) { if (!list_empty(&fsm->pdos.list)) EC_WARN("Pdos configured for SM%u, but slave %u does not " - "provide a sync manager configuration!\n", + "provide the sync manager information!\n", fsm->sync_index, fsm->slave->ring_position); continue; } diff -r c0e6adec1aee -r 846907b8cc4b master/fsm_slave_config.c --- a/master/fsm_slave_config.c Fri Aug 01 08:11:23 2008 +0000 +++ b/master/fsm_slave_config.c Fri Aug 01 08:58:35 2008 +0000 @@ -61,6 +61,7 @@ void ec_fsm_slave_config_enter_mbox_sync(ec_fsm_slave_config_t *); void ec_fsm_slave_config_enter_preop(ec_fsm_slave_config_t *); void ec_fsm_slave_config_enter_sdo_conf(ec_fsm_slave_config_t *); +void ec_fsm_slave_config_enter_pdo_conf(ec_fsm_slave_config_t *); void ec_fsm_slave_config_enter_pdo_sync(ec_fsm_slave_config_t *); void ec_fsm_slave_config_enter_fmmu(ec_fsm_slave_config_t *); void ec_fsm_slave_config_enter_safeop(ec_fsm_slave_config_t *); @@ -440,7 +441,7 @@ // No CoE configuration to be applied? if (list_empty(&slave->config->sdo_configs)) { // skip Sdo configuration - ec_fsm_slave_config_enter_pdo_sync(fsm); + ec_fsm_slave_config_enter_pdo_conf(fsm); return; } @@ -482,6 +483,39 @@ } // All Sdos are now configured. + ec_fsm_slave_config_enter_pdo_conf(fsm); +} + +/*****************************************************************************/ + +/** PDO_CONF entry function. + */ +void ec_fsm_slave_config_enter_pdo_conf( + ec_fsm_slave_config_t *fsm /**< slave state machine */ + ) +{ + // Start configuring Pdos + ec_fsm_pdo_start_configuration(fsm->fsm_pdo, fsm->slave); + fsm->state = ec_fsm_slave_config_state_pdo_conf; + fsm->state(fsm); // execute immediately +} + +/*****************************************************************************/ + +/** Slave configuration state: PDO_CONF. + */ +void ec_fsm_slave_config_state_pdo_conf( + ec_fsm_slave_config_t *fsm /**< slave state machine */ + ) +{ + if (ec_fsm_pdo_exec(fsm->fsm_pdo)) + return; + + if (!ec_fsm_pdo_success(fsm->fsm_pdo)) { + EC_WARN("Pdo configuration failed on slave %u.\n", + fsm->slave->ring_position); + } + ec_fsm_slave_config_enter_pdo_sync(fsm); } @@ -509,7 +543,7 @@ if (slave->sii.sync_count <= offset) { // no Pdo sync managers to configure - ec_fsm_slave_config_enter_safeop(fsm); + ec_fsm_slave_config_enter_fmmu(fsm); return; } @@ -565,28 +599,6 @@ return; } - // Start configuring Pdos - ec_fsm_pdo_start_configuration(fsm->fsm_pdo, fsm->slave); - fsm->state = ec_fsm_slave_config_state_pdo_conf; - fsm->state(fsm); // execute immediately -} - -/*****************************************************************************/ - -/** Slave configuration state: PDO_CONF. - */ -void ec_fsm_slave_config_state_pdo_conf( - ec_fsm_slave_config_t *fsm /**< slave state machine */ - ) -{ - if (ec_fsm_pdo_exec(fsm->fsm_pdo)) - return; - - if (!ec_fsm_pdo_success(fsm->fsm_pdo)) { - EC_WARN("Pdo configuration failed on slave %u.\n", - fsm->slave->ring_position); - } - ec_fsm_slave_config_enter_fmmu(fsm); }