equal
deleted
inserted
replaced
501 * Realtime interface |
501 * Realtime interface |
502 *****************************************************************************/ |
502 *****************************************************************************/ |
503 |
503 |
504 /** |
504 /** |
505 Registers a PDO in a domain. |
505 Registers a PDO in a domain. |
506 - If \a data_ptr is NULL, the slave is only validated. |
|
507 \return pointer to the slave on success, else NULL |
506 \return pointer to the slave on success, else NULL |
508 \ingroup RealtimeInterface |
507 \ingroup RealtimeInterface |
509 */ |
508 */ |
510 |
509 |
511 ec_slave_t *ecrt_domain_register_pdo(ec_domain_t *domain, |
510 ec_slave_t *ecrt_domain_register_pdo(ec_domain_t *domain, |
535 |
534 |
536 // translate address and validate slave |
535 // translate address and validate slave |
537 if (!(slave = ecrt_master_get_slave(master, address))) return NULL; |
536 if (!(slave = ecrt_master_get_slave(master, address))) return NULL; |
538 if (ec_slave_validate(slave, vendor_id, product_code)) return NULL; |
537 if (ec_slave_validate(slave, vendor_id, product_code)) return NULL; |
539 |
538 |
540 if (!data_ptr) return slave; |
|
541 |
|
542 list_for_each_entry(pdo, &slave->sii_pdos, list) { |
539 list_for_each_entry(pdo, &slave->sii_pdos, list) { |
543 list_for_each_entry(entry, &pdo->entries, list) { |
540 list_for_each_entry(entry, &pdo->entries, list) { |
544 if (entry->index != pdo_index |
541 if (entry->index != pdo_index |
545 || entry->subindex != pdo_subindex) continue; |
542 || entry->subindex != pdo_subindex) continue; |
546 |
543 |
559 |
556 |
560 /*****************************************************************************/ |
557 /*****************************************************************************/ |
561 |
558 |
562 /** |
559 /** |
563 Registeres a bunch of data fields. |
560 Registeres a bunch of data fields. |
564 Caution! The list has to be terminated with a NULL structure ({})! |
561 \attention The list has to be terminated with a NULL structure ({})! |
565 \return 0 in case of success, else < 0 |
562 \return 0 in case of success, else < 0 |
566 \ingroup RealtimeInterface |
563 \ingroup RealtimeInterface |
567 */ |
564 */ |
568 |
565 |
569 int ecrt_domain_register_pdo_list(ec_domain_t *domain, |
566 int ecrt_domain_register_pdo_list(ec_domain_t *domain, |
588 |
585 |
589 /*****************************************************************************/ |
586 /*****************************************************************************/ |
590 |
587 |
591 /** |
588 /** |
592 Registers a PDO range in a domain. |
589 Registers a PDO range in a domain. |
593 - If \a data_ptr is NULL, the slave is only validated. |
|
594 \return pointer to the slave on success, else NULL |
590 \return pointer to the slave on success, else NULL |
595 \ingroup RealtimeInterface |
591 \ingroup RealtimeInterface |
596 */ |
592 */ |
597 |
593 |
598 ec_slave_t *ecrt_domain_register_pdo_range(ec_domain_t *domain, |
594 ec_slave_t *ecrt_domain_register_pdo_range(ec_domain_t *domain, |
622 |
618 |
623 // translate address and validate slave |
619 // translate address and validate slave |
624 if (!(slave = ecrt_master_get_slave(master, address))) return NULL; |
620 if (!(slave = ecrt_master_get_slave(master, address))) return NULL; |
625 if (ec_slave_validate(slave, vendor_id, product_code)) return NULL; |
621 if (ec_slave_validate(slave, vendor_id, product_code)) return NULL; |
626 |
622 |
627 if (!data_ptr) return slave; |
|
628 |
|
629 if (ec_domain_reg_pdo_range(domain, slave, |
623 if (ec_domain_reg_pdo_range(domain, slave, |
630 direction, offset, length, data_ptr)) { |
624 direction, offset, length, data_ptr)) { |
631 return NULL; |
625 return NULL; |
632 } |
626 } |
633 |
627 |