1274 |
1274 |
1275 master->configs_attached = !errors; |
1275 master->configs_attached = !errors; |
1276 return errors ? -1 : 0; |
1276 return errors ? -1 : 0; |
1277 } |
1277 } |
1278 |
1278 |
|
1279 /*****************************************************************************/ |
|
1280 |
|
1281 /** Finds a slave in the bus, given the alias and position. |
|
1282 */ |
|
1283 ec_slave_t *ec_master_find_slave( |
|
1284 ec_master_t *master, /**< EtherCAT master. */ |
|
1285 uint16_t alias, /**< Slave alias. */ |
|
1286 uint16_t position /**< Slave position. */ |
|
1287 ) |
|
1288 { |
|
1289 ec_slave_t *slave; |
|
1290 unsigned int alias_found = 0, relative_position = 0; |
|
1291 |
|
1292 list_for_each_entry(slave, &master->slaves, list) { |
|
1293 if (!alias_found) { |
|
1294 if (alias && slave->sii.alias != alias) |
|
1295 continue; |
|
1296 alias_found = 1; |
|
1297 relative_position = 0; |
|
1298 } |
|
1299 if (relative_position == position) { |
|
1300 return slave; |
|
1301 } |
|
1302 relative_position++; |
|
1303 } |
|
1304 |
|
1305 return NULL; |
|
1306 } |
|
1307 |
1279 /****************************************************************************** |
1308 /****************************************************************************** |
1280 * Realtime interface |
1309 * Realtime interface |
1281 *****************************************************************************/ |
1310 *****************************************************************************/ |
1282 |
1311 |
1283 ec_domain_t *ecrt_master_create_domain(ec_master_t *master /**< master */) |
1312 ec_domain_t *ecrt_master_create_domain(ec_master_t *master /**< master */) |