# HG changeset patch # User Florian Pose # Date 1212757436 0 # Node ID 93807963b906bdc53490212b6cb46af4e5698d62 # Parent f1a7ea8a550a70a44b6c1a0e980e212e1c5052d9 Added ec_slave_get_sdo_const(). diff -r f1a7ea8a550a -r 93807963b906 master/slave.c --- a/master/slave.c Fri Jun 06 09:34:20 2008 +0000 +++ b/master/slave.c Fri Jun 06 13:03:56 2008 +0000 @@ -1200,7 +1200,34 @@ ec_sdo_t *sdo; list_for_each_entry(sdo, &slave->sdo_dictionary, list) { - if (sdo->index != index) continue; + if (sdo->index != index) + continue; + return sdo; + } + + return NULL; +} + +/*****************************************************************************/ + +/** + * Get an Sdo from the dictionary. + * + * const version. + * + * \returns The desired Sdo, or NULL. + */ + +const ec_sdo_t *ec_slave_get_sdo_const( + const ec_slave_t *slave, /**< EtherCAT slave */ + uint16_t index /**< Sdo index */ + ) +{ + const ec_sdo_t *sdo; + + list_for_each_entry(sdo, &slave->sdo_dictionary, list) { + if (sdo->index != index) + continue; return sdo; } diff -r f1a7ea8a550a -r 93807963b906 master/slave.h --- a/master/slave.h Fri Jun 06 09:34:20 2008 +0000 +++ b/master/slave.h Fri Jun 06 13:03:56 2008 +0000 @@ -223,6 +223,7 @@ void ec_slave_sdo_dict_info(const ec_slave_t *, unsigned int *, unsigned int *); ec_sdo_t *ec_slave_get_sdo(ec_slave_t *, uint16_t); +const ec_sdo_t *ec_slave_get_sdo_const(const ec_slave_t *, uint16_t); const ec_sdo_t *ec_slave_get_sdo_by_pos_const(const ec_slave_t *, uint16_t); uint16_t ec_slave_sdo_count(const ec_slave_t *); const ec_pdo_t *ec_slave_find_pdo(const ec_slave_t *, uint16_t);