384 return NULL; |
384 return NULL; |
385 } |
385 } |
386 |
386 |
387 /*****************************************************************************/ |
387 /*****************************************************************************/ |
388 |
388 |
|
389 /** Get the number of IDN configurations. |
|
390 * |
|
391 * \return Number of SDO configurations. |
|
392 */ |
|
393 unsigned int ec_slave_config_idn_count( |
|
394 const ec_slave_config_t *sc /**< Slave configuration. */ |
|
395 ) |
|
396 { |
|
397 const ec_soe_request_t *req; |
|
398 unsigned int count = 0; |
|
399 |
|
400 list_for_each_entry(req, &sc->soe_configs, list) { |
|
401 count++; |
|
402 } |
|
403 |
|
404 return count; |
|
405 } |
|
406 |
|
407 /*****************************************************************************/ |
|
408 |
|
409 /** Finds an IDN configuration via its position in the list. |
|
410 * |
|
411 * Const version. |
|
412 */ |
|
413 const ec_soe_request_t *ec_slave_config_get_idn_by_pos_const( |
|
414 const ec_slave_config_t *sc, /**< Slave configuration. */ |
|
415 unsigned int pos /**< Position in the list. */ |
|
416 ) |
|
417 { |
|
418 const ec_soe_request_t *req; |
|
419 |
|
420 list_for_each_entry(req, &sc->soe_configs, list) { |
|
421 if (pos--) |
|
422 continue; |
|
423 return req; |
|
424 } |
|
425 |
|
426 return NULL; |
|
427 } |
|
428 |
|
429 /*****************************************************************************/ |
|
430 |
389 /** Finds a VoE handler via its position in the list. |
431 /** Finds a VoE handler via its position in the list. |
390 */ |
432 */ |
391 ec_sdo_request_t *ec_slave_config_find_sdo_request( |
433 ec_sdo_request_t *ec_slave_config_find_sdo_request( |
392 ec_slave_config_t *sc, /**< Slave configuration. */ |
434 ec_slave_config_t *sc, /**< Slave configuration. */ |
393 unsigned int pos /**< Position in the list. */ |
435 unsigned int pos /**< Position in the list. */ |
976 EC_CONFIG_DBG(sc, 1, "%s(sc = 0x%p, drive_no = %u, idn = 0x%04X, " |
1018 EC_CONFIG_DBG(sc, 1, "%s(sc = 0x%p, drive_no = %u, idn = 0x%04X, " |
977 "state = %u, data = 0x%p, size = %zu)\n", |
1019 "state = %u, data = 0x%p, size = %zu)\n", |
978 __func__, sc, drive_no, idn, state, data, size); |
1020 __func__, sc, drive_no, idn, state, data, size); |
979 |
1021 |
980 if (drive_no > 7) { |
1022 if (drive_no > 7) { |
981 EC_CONFIG_ERR(sc, "Invalid drive number!\n"); |
1023 EC_CONFIG_ERR(sc, "Invalid drive number %u!\n", |
|
1024 (unsigned int) drive_no); |
982 return -EINVAL; |
1025 return -EINVAL; |
983 } |
1026 } |
984 |
1027 |
985 if (state != EC_AL_STATE_PREOP && state != EC_AL_STATE_SAFEOP) { |
1028 if (state != EC_AL_STATE_PREOP && state != EC_AL_STATE_SAFEOP) { |
986 EC_CONFIG_ERR(sc, "AL state for IDN config" |
1029 EC_CONFIG_ERR(sc, "AL state for IDN config" |