equal
deleted
inserted
replaced
1119 return count; |
1119 return count; |
1120 } |
1120 } |
1121 |
1121 |
1122 /*****************************************************************************/ |
1122 /*****************************************************************************/ |
1123 |
1123 |
|
1124 /** Common implementation for ec_master_get_config() |
|
1125 * and ec_master_get_config_const(). |
|
1126 */ |
|
1127 #define EC_FIND_CONFIG \ |
|
1128 do { \ |
|
1129 list_for_each_entry(sc, &master->configs, list) { \ |
|
1130 if (pos--) \ |
|
1131 continue; \ |
|
1132 return sc; \ |
|
1133 } \ |
|
1134 return NULL; \ |
|
1135 } while (0) |
|
1136 |
|
1137 /** Get a slave configuration via its position in the list. |
|
1138 * |
|
1139 * \return Slave configuration or \a NULL. |
|
1140 */ |
|
1141 ec_slave_config_t *ec_master_get_config( |
|
1142 const ec_master_t *master, /**< EtherCAT master. */ |
|
1143 unsigned int pos /**< List position. */ |
|
1144 ) |
|
1145 { |
|
1146 ec_slave_config_t *sc; |
|
1147 EC_FIND_CONFIG; |
|
1148 } |
|
1149 |
1124 /** Get a slave configuration via its position in the list. |
1150 /** Get a slave configuration via its position in the list. |
1125 * |
1151 * |
1126 * Const version. |
1152 * Const version. |
1127 * |
1153 * |
1128 * \return Slave configuration or \a NULL. |
1154 * \return Slave configuration or \a NULL. |
1131 const ec_master_t *master, /**< EtherCAT master. */ |
1157 const ec_master_t *master, /**< EtherCAT master. */ |
1132 unsigned int pos /**< List position. */ |
1158 unsigned int pos /**< List position. */ |
1133 ) |
1159 ) |
1134 { |
1160 { |
1135 const ec_slave_config_t *sc; |
1161 const ec_slave_config_t *sc; |
1136 |
1162 EC_FIND_CONFIG; |
1137 list_for_each_entry(sc, &master->configs, list) { |
|
1138 if (pos--) |
|
1139 continue; |
|
1140 return sc; |
|
1141 } |
|
1142 |
|
1143 return NULL; |
|
1144 } |
1163 } |
1145 |
1164 |
1146 /*****************************************************************************/ |
1165 /*****************************************************************************/ |
1147 |
1166 |
1148 /** Get the number of domains. |
1167 /** Get the number of domains. |