53 * - Added watchdog configuration (method ecrt_slave_config_watchdog(), |
53 * - Added watchdog configuration (method ecrt_slave_config_watchdog(), |
54 * #ec_watchdog_mode_t, \a watchdog_mode parameter in ec_sync_info_t and |
54 * #ec_watchdog_mode_t, \a watchdog_mode parameter in ec_sync_info_t and |
55 * ecrt_slave_config_sync_manager()). |
55 * ecrt_slave_config_sync_manager()). |
56 * - Added ecrt_open_master() and ecrt_master_reserve() separation for |
56 * - Added ecrt_open_master() and ecrt_master_reserve() separation for |
57 * userspace. |
57 * userspace. |
58 * - Added ecrt_master() userspace interface, to get information about a |
58 * - Added bus information interface (methods ecrt_master(), |
59 * master. |
59 * ecrt_master_get_slave(), ecrt_master_get_sync_manager(), |
60 * - Added ecrt_master_slave() to get information about a certain slave. |
60 * ecrt_master_get_pdo() and ecrt_master_get_pdo_entry()) to get information |
61 * - Added ecrt_slave_sdo_upload() and ecrt_slave_sdo_download() methods to |
61 * about the currently connected slaves and the PDO entries provided. |
62 * let an application transfer SDOs before activating the master. |
62 * - Added ecrt_master_sdo_download() and ecrt_master_sdo_upload() |
|
63 * methods to let an application transfer SDOs before activating the master. |
63 * - Changed the meaning of the negative return values of |
64 * - Changed the meaning of the negative return values of |
64 * ecrt_slave_config_reg_pdo_entry() and ecrt_slave_config_sdo*(). |
65 * ecrt_slave_config_reg_pdo_entry() and ecrt_slave_config_sdo*(). |
65 * - Imlemented the Vendor-specific over EtherCAT mailbox protocol. See |
66 * - Imlemented the Vendor-specific over EtherCAT mailbox protocol. See |
66 * ecrt_slave_config_create_voe_handler(). |
67 * ecrt_slave_config_create_voe_handler(). |
67 * - Renamed ec_sdo_request_state_t to #ec_request_state_t, because it is also |
68 * - Renamed ec_sdo_request_state_t to #ec_request_state_t, because it is also |
555 * |
556 * |
556 * \attention The pointer to this structure must point to a valid variable. |
557 * \attention The pointer to this structure must point to a valid variable. |
557 * |
558 * |
558 * \return 0 in case of success, else < 0 |
559 * \return 0 in case of success, else < 0 |
559 */ |
560 */ |
560 int ecrt_master_slave( |
561 int ecrt_master_get_slave( |
561 ec_master_t *master, /**< EtherCAT master */ |
562 ec_master_t *master, /**< EtherCAT master */ |
562 uint16_t position, /**< Slave position. */ |
563 uint16_t slave_position, /**< Slave position. */ |
563 ec_slave_info_t *slave_info /**< Structure that will output the |
564 ec_slave_info_t *slave_info /**< Structure that will output the |
564 information */ |
565 information */ |
|
566 ); |
|
567 |
|
568 /** Returns the proposed configuration of a slave's sync manager. |
|
569 * |
|
570 * Fills a given ec_sync_info_t structure with the attributes of a sync |
|
571 * manager. The \a pdos field of the return value is left empty. Use |
|
572 * ecrt_master_get_pdo() to get the PDO information. |
|
573 * |
|
574 * \return zero on success, else non-zero |
|
575 */ |
|
576 int ecrt_master_get_sync_manager( |
|
577 ec_master_t *master, /**< EtherCAT master. */ |
|
578 uint16_t slave_position, /**< Slave position. */ |
|
579 uint8_t sync_index, /**< Sync manager index. Must be less |
|
580 than #EC_MAX_SYNC_MANAGERS. */ |
|
581 ec_sync_info_t *sync /**< Pointer to output structure. */ |
|
582 ); |
|
583 |
|
584 /** Returns information about a currently assigned PDO. |
|
585 * |
|
586 * Fills a given ec_pdo_info_t structure with the attributes of a currently |
|
587 * assigned PDO of the given sync manager. The \a entries field of the return |
|
588 * value is left empty. Use ecrt_master_get_pdo_entry() to get the PDO |
|
589 * entry information. |
|
590 * |
|
591 * \retval zero on success, else non-zero |
|
592 */ |
|
593 int ecrt_master_get_pdo( |
|
594 ec_master_t *master, /**< EtherCAT master. */ |
|
595 uint16_t slave_position, /**< Slave position. */ |
|
596 uint8_t sync_index, /**< Sync manager index. Must be less |
|
597 than #EC_MAX_SYNC_MANAGERS. */ |
|
598 uint16_t pos, /**< Zero-based PDO position. */ |
|
599 ec_pdo_info_t *pdo /**< Pointer to output structure. */ |
|
600 ); |
|
601 |
|
602 /** Returns information about a currently mapped PDO entry. |
|
603 * |
|
604 * Fills a given ec_pdo_entry_info_t structure with the attributes of a |
|
605 * currently mapped PDO entry of the given PDO. |
|
606 * |
|
607 * \retval zero on success, else non-zero |
|
608 */ |
|
609 int ecrt_master_get_pdo_entry( |
|
610 ec_master_t *master, /**< EtherCAT master. */ |
|
611 uint16_t slave_position, /**< Slave position. */ |
|
612 uint8_t sync_index, /**< Sync manager index. Must be less |
|
613 than #EC_MAX_SYNC_MANAGERS. */ |
|
614 uint16_t pdo_pos, /**< Zero-based PDO position. */ |
|
615 uint16_t entry_pos, /**< Zero-based PDO entry position. */ |
|
616 ec_pdo_entry_info_t *entry /**< Pointer to output structure. */ |
|
617 ); |
|
618 |
|
619 /** Executes an SDO write request to download data. |
|
620 * |
|
621 * This function operates aside of the normal way to request SDOs. Before the |
|
622 * activation of the master, these requests are processed by the master state |
|
623 * machine itself. After activation the user has to ensure cyclic processing. |
|
624 * |
|
625 * \retval 0 Success. |
|
626 * \retval -1 An error occured. |
|
627 */ |
|
628 int ecrt_master_sdo_download( |
|
629 ec_master_t *master, /**< EtherCAT master. */ |
|
630 uint16_t slave_position, /**< Slave position. */ |
|
631 uint16_t index, /**< Index of the SDO. */ |
|
632 uint8_t subindex, /**< Subindex of the SDO. */ |
|
633 uint8_t *data, /**< Data buffer to download. */ |
|
634 size_t data_size, /**< Size of the data buffer. */ |
|
635 uint32_t *abort_code /**< Abort code of the SDO download. */ |
|
636 ); |
|
637 |
|
638 /** Executes a SDO read request to upload data. |
|
639 * |
|
640 * This function operates aside of the normal way to request SDOs. Before the |
|
641 * activation of the master, these requests are processed by the master state |
|
642 * machine itself. After activation the user have to ensure cyclic |
|
643 * processing. |
|
644 * |
|
645 * \retval 0 Success. |
|
646 * \retval -1 Error occured. |
|
647 */ |
|
648 int ecrt_master_sdo_upload( |
|
649 ec_master_t *master, /**< EtherCAT master. */ |
|
650 uint16_t slave_position, /**< Slave position. */ |
|
651 uint16_t index, /**< Index of the SDO. */ |
|
652 uint8_t subindex, /**< Subindex of the SDO. */ |
|
653 uint8_t *target, /**< Target buffer for the upload. */ |
|
654 size_t target_size, /**< Size of the target buffer. */ |
|
655 size_t *result_size, /**< Uploaded data size. */ |
|
656 uint32_t *abort_code /**< Abort code of the SDO upload. */ |
565 ); |
657 ); |
566 |
658 |
567 #endif /* #ifndef __KERNEL__ */ |
659 #endif /* #ifndef __KERNEL__ */ |
568 |
660 |
569 /** Finishes the configuration phase and prepares for cyclic operation. |
661 /** Finishes the configuration phase and prepares for cyclic operation. |
663 * All slave clocks synchronized to the reference clock. |
755 * All slave clocks synchronized to the reference clock. |
664 */ |
756 */ |
665 void ecrt_master_sync_slave_clocks( |
757 void ecrt_master_sync_slave_clocks( |
666 ec_master_t *master /**< EtherCAT master. */ |
758 ec_master_t *master /**< EtherCAT master. */ |
667 ); |
759 ); |
668 |
|
669 #ifndef __KERNEL__ |
|
670 |
|
671 /** Executes an SDO write request to download data. |
|
672 * |
|
673 * This function operates aside of the normal way to request SDOs. Before the |
|
674 * activation of the master, these requests are processed by the master state |
|
675 * machine itself. After activation the user has to ensure cyclic processing. |
|
676 * |
|
677 * \retval 0 Success. |
|
678 * \retval -1 An error occured. |
|
679 */ |
|
680 int ecrt_slave_sdo_download( |
|
681 ec_master_t* master, /**< EtherCAT master. */ |
|
682 uint16_t slave_position, /**< Slave position. */ |
|
683 uint16_t index, /**< Index of the SDO. */ |
|
684 uint8_t subindex, /**< Subindex of the SDO. */ |
|
685 uint8_t *data, /**< Data buffer to download. */ |
|
686 size_t data_size, /**< Size of the data buffer. */ |
|
687 uint32_t *abort_code /**< Abort code of the SDO download. */ |
|
688 ); |
|
689 |
|
690 /** Executes a SDO read request to upload data. |
|
691 * |
|
692 * This function operates aside of the normal way to request SDOs. Before the |
|
693 * activation of the master, these requests are processed by the master state |
|
694 * machine itself. After activation the user have to ensure cyclic |
|
695 * processing. |
|
696 * |
|
697 * \retval 0 Success. |
|
698 * \retval -1 Error occured. |
|
699 */ |
|
700 int ecrt_slave_sdo_upload( |
|
701 ec_master_t* master, /**< EtherCAT master. */ |
|
702 uint16_t slave_position, /**< Slave position. */ |
|
703 uint16_t index, /**< Index of the SDO. */ |
|
704 uint8_t subindex, /**< Subindex of the SDO. */ |
|
705 uint8_t *target, /**< Target buffer for the upload. */ |
|
706 size_t target_size, /**< Size of the target buffer. */ |
|
707 size_t *result_size, /**< Uploaded data size. */ |
|
708 uint32_t *abort_code /**< Abort code of the SDO upload. */ |
|
709 ); |
|
710 |
|
711 #endif /* #ifndef __KERNEL__ */ |
|
712 |
760 |
713 /****************************************************************************** |
761 /****************************************************************************** |
714 * Slave configuration methods |
762 * Slave configuration methods |
715 *****************************************************************************/ |
763 *****************************************************************************/ |
716 |
764 |