master/master.c
changeset 1485 5ddc3a455059
parent 1483 43adf48aa157
child 1489 f77a1182b6f4
equal deleted inserted replaced
1484:1c9151455b65 1485:5ddc3a455059
  1332     EC_FIND_DOMAIN;
  1332     EC_FIND_DOMAIN;
  1333 }
  1333 }
  1334 
  1334 
  1335 /*****************************************************************************/
  1335 /*****************************************************************************/
  1336 
  1336 
       
  1337 /** Get the number of EoE handlers.
       
  1338  *
       
  1339  * \return Number of EoE handlers.
       
  1340  */
       
  1341 uint16_t ec_master_eoe_handler_count(
       
  1342 		const ec_master_t *master /**< EtherCAT master. */
       
  1343 		)
       
  1344 {
       
  1345 	const ec_eoe_t *eoe;
       
  1346 	unsigned int count = 0;
       
  1347 
       
  1348 	list_for_each_entry(eoe, &master->eoe_handlers, list) {
       
  1349 		count++;
       
  1350 	}
       
  1351 
       
  1352 	return count;
       
  1353 }
       
  1354 
       
  1355 /*****************************************************************************/
       
  1356 
       
  1357 /** Get an EoE handler via its position in the list.
       
  1358  *
       
  1359  * Const version.
       
  1360  *
       
  1361  * \return EoE handler pointer, or \a NULL if not found.
       
  1362  */
       
  1363 const ec_eoe_t *ec_master_get_eoe_handler_const(
       
  1364 		const ec_master_t *master, /**< EtherCAT master. */
       
  1365 		uint16_t index /**< EoE handler index. */
       
  1366 		)
       
  1367 {
       
  1368 	const ec_eoe_t *eoe;
       
  1369 
       
  1370 	list_for_each_entry(eoe, &master->eoe_handlers, list) {
       
  1371 		if (index--)
       
  1372 			continue;
       
  1373 		return eoe;
       
  1374 	}
       
  1375 
       
  1376 	return NULL;
       
  1377 }
       
  1378 
       
  1379 /*****************************************************************************/
       
  1380 
  1337 /** Set the debug level.
  1381 /** Set the debug level.
  1338  *
  1382  *
  1339  * \retval       0 Success.
  1383  * \retval       0 Success.
  1340  * \retval -EINVAL Invalid debug level.
  1384  * \retval -EINVAL Invalid debug level.
  1341  */
  1385  */