167 for (dir = EC_DIR_OUTPUT; dir <= EC_DIR_INPUT; dir++) { |
168 for (dir = EC_DIR_OUTPUT; dir <= EC_DIR_INPUT; dir++) { |
168 pdos = &fsm->slave->config->pdos[dir]; |
169 pdos = &fsm->slave->config->pdos[dir]; |
169 |
170 |
170 list_for_each_entry(pdo, &pdos->list, list) { |
171 list_for_each_entry(pdo, &pdos->list, list) { |
171 if (fsm->pdo) { // there was a Pdo mapping changed in the last run |
172 if (fsm->pdo) { // there was a Pdo mapping changed in the last run |
172 if (pdo == fsm->pdo) // this is the last Pdo |
173 if (pdo == fsm->pdo) // this is the previously configured Pdo |
173 fsm->pdo = NULL; // take the next one |
174 fsm->pdo = NULL; // take the next one |
174 } else { |
175 } else { |
175 if ((assigned_pdo = ec_slave_find_pdo(fsm->slave, pdo->index))) |
176 if ((assigned_pdo = ec_slave_find_pdo(fsm->slave, pdo->index))) |
176 if (ec_pdo_equal_entries(pdo, assigned_pdo)) |
177 if (ec_pdo_equal_entries(pdo, assigned_pdo)) |
177 continue; // Pdo entries mapped correctly |
178 continue; // Pdo entries mapped correctly |
178 |
179 |
179 fsm->pdo = pdo; |
180 fsm->pdo = pdo; |
|
181 fsm->num_configured_pdos++; |
180 break; |
182 break; |
181 } |
183 } |
182 } |
184 } |
183 } |
185 } |
184 |
186 |
185 if (!fsm->pdo) { |
187 if (!fsm->pdo) { |
186 if (fsm->slave->master->debug_level) |
188 if (fsm->slave->master->debug_level && !fsm->num_configured_pdos) |
187 EC_DBG("Pdo mapping finished for slave %u.\n", |
189 EC_DBG("Pdo mappings of slave %u are already configured" |
188 fsm->slave->ring_position); |
190 " correctly.\n", fsm->slave->ring_position); |
189 fsm->state = ec_fsm_pdo_mapping_state_end; |
191 fsm->state = ec_fsm_pdo_mapping_state_end; |
190 return; |
192 return; |
191 } |
193 } |
192 |
194 |
193 // Pdo mapping has to be changed. Does the slave support this? |
195 // Pdo mapping has to be changed. Does the slave support this? |