include/ecrt.h
changeset 1544 cfcaf46c5b3f
parent 1536 171ddba165d2
child 1580 1baac79a40cf
equal deleted inserted replaced
1543:373cd456dc26 1544:cfcaf46c5b3f
    43  *
    43  *
    44  * - Added the distributed clocks feature and the respective method
    44  * - Added the distributed clocks feature and the respective method
    45  *   ecrt_slave_config_dc() to configure a slave for cyclic operation, and
    45  *   ecrt_slave_config_dc() to configure a slave for cyclic operation, and
    46  *   ecrt_master_application_time(), ecrt_master_sync_reference_clock() and
    46  *   ecrt_master_application_time(), ecrt_master_sync_reference_clock() and
    47  *   ecrt_master_sync_slave_clocks() for offset and drift compensation. The
    47  *   ecrt_master_sync_slave_clocks() for offset and drift compensation. The
    48  *   EC_TIMEVAL2NANO() macro can be used for epoch time conversion.
    48  *   EC_TIMEVAL2NANO() macro can be used for epoch time conversion, while the
       
    49  *   ecrt_master_sync_monitor_queue() and ecrt_master_sync_monitor_process()
       
    50  *   methods can be used to monitor the synchrony. 
    49  * - Improved the callback mechanism. ecrt_master_callbacks() now takes two
    51  * - Improved the callback mechanism. ecrt_master_callbacks() now takes two
    50  *   callback functions for sending and receiving datagrams.
    52  *   callback functions for sending and receiving datagrams.
    51  *   ecrt_master_send_ext() is used to execute the sending of non-application
    53  *   ecrt_master_send_ext() is used to execute the sending of non-application
    52  *   datagrams.
    54  *   datagrams.
    53  * - Added watchdog configuration (method ecrt_slave_config_watchdog(),
    55  * - Added watchdog configuration (method ecrt_slave_config_watchdog(),
    54  *   #ec_watchdog_mode_t, \a watchdog_mode parameter in ec_sync_info_t and
    56  *   #ec_watchdog_mode_t, \a watchdog_mode parameter in ec_sync_info_t and
    55  *   ecrt_slave_config_sync_manager()).
    57  *   ecrt_slave_config_sync_manager()).
    56  * - Added ecrt_slave_config_complete_sdo() method to download an SDO during
    58  * - Added ecrt_slave_config_complete_sdo() method to download an SDO during
    57  *   configuration via CompleteAccess.
    59  *   configuration via CompleteAccess.
       
    60  * - Added ecrt_master_deactivate() to remove the bus configuration.
    58  * - Added ecrt_open_master() and ecrt_master_reserve() separation for
    61  * - Added ecrt_open_master() and ecrt_master_reserve() separation for
    59  *   userspace.
    62  *   userspace.
    60  * - Added bus information interface (methods ecrt_master(),
    63  * - Added bus information interface (methods ecrt_master(),
    61  *   ecrt_master_get_slave(), ecrt_master_get_sync_manager(),
    64  *   ecrt_master_get_slave(), ecrt_master_get_sync_manager(),
    62  *   ecrt_master_get_pdo() and ecrt_master_get_pdo_entry()) to get information
    65  *   ecrt_master_get_pdo() and ecrt_master_get_pdo_entry()) to get information
   680  */
   683  */
   681 int ecrt_master_activate(
   684 int ecrt_master_activate(
   682         ec_master_t *master /**< EtherCAT master. */
   685         ec_master_t *master /**< EtherCAT master. */
   683         );
   686         );
   684 
   687 
       
   688 /** Deactivates the master.
       
   689  *
       
   690  * Removes the bus configuration. All objects created by
       
   691  * ecrt_master_create_domain(), ecrt_master_slave_config(), ecrt_domain_data()
       
   692  * ecrt_slave_config_create_sdo_request() and
       
   693  * ecrt_slave_config_create_voe_handler() are freed, so pointers to them
       
   694  * become invalid.
       
   695  */
       
   696 void ecrt_master_deactivate(
       
   697         ec_master_t *master /**< EtherCAT master. */
       
   698         );
       
   699 
   685 /** Sends all datagrams in the queue.
   700 /** Sends all datagrams in the queue.
   686  *
   701  *
   687  * This method takes all datagrams, that have been queued for transmission,
   702  * This method takes all datagrams, that have been queued for transmission,
   688  * puts them into frames, and passes them to the Ethernet device for sending.
   703  * puts them into frames, and passes them to the Ethernet device for sending.
   689  *
   704  *
   760  */
   775  */
   761 void ecrt_master_sync_slave_clocks(
   776 void ecrt_master_sync_slave_clocks(
   762         ec_master_t *master /**< EtherCAT master. */
   777         ec_master_t *master /**< EtherCAT master. */
   763         );
   778         );
   764 
   779 
       
   780 /** Queues the DC synchonity monitoring datagram for sending.
       
   781  *
       
   782  * The datagram broadcast-reads all "System time difference" registers (\a
       
   783  * 0x092c) to get an upper estiomation of the DC synchony. The result can be
       
   784  * checked with the ecrt_master_sync_monitor_process() method.
       
   785  */
       
   786 void ecrt_master_sync_monitor_queue(
       
   787         ec_master_t *master /**< EtherCAT master. */
       
   788         );
       
   789 
       
   790 /** Processes the DC synchonity monitoring datagram.
       
   791  *
       
   792  * If the sync monitoring datagram was sent before with
       
   793  * ecrt_master_sync_monitor_queue(), the result can be queried with this
       
   794  * method.
       
   795  *
       
   796  * \return Upper estination of the maximum time difference in ns.
       
   797  */
       
   798 uint32_t ecrt_master_sync_monitor_process(
       
   799         ec_master_t *master /**< EtherCAT master. */
       
   800         );
       
   801 
   765 /******************************************************************************
   802 /******************************************************************************
   766  * Slave configuration methods
   803  * Slave configuration methods
   767  *****************************************************************************/
   804  *****************************************************************************/
   768 
   805 
   769 /** Configure a sync manager.
   806 /** Configure a sync manager.
   780         ec_direction_t direction, /**< Input/Output. */
   817         ec_direction_t direction, /**< Input/Output. */
   781         ec_watchdog_mode_t watchdog_mode /** Watchdog mode. */
   818         ec_watchdog_mode_t watchdog_mode /** Watchdog mode. */
   782         );
   819         );
   783 
   820 
   784 /** Configure a slave's watchdog times.
   821 /** Configure a slave's watchdog times.
   785 */	 
   822  */
   786 void ecrt_slave_config_watchdog(
   823 void ecrt_slave_config_watchdog(
   787         ec_slave_config_t *sc, /**< Slave configuration. */
   824         ec_slave_config_t *sc, /**< Slave configuration. */
   788         uint16_t watchdog_divider, /**< Number of 40 ns intervals. Used as a
   825         uint16_t watchdog_divider, /**< Number of 40 ns intervals. Used as a
   789                                     base unit for all slave watchdogs. */
   826                                      base unit for all slave watchdogs. If set
       
   827                                      to zero, the value is not written, so the
       
   828                                      default ist used. */
   790         uint16_t watchdog_intervals /**< Number of base intervals for process
   829         uint16_t watchdog_intervals /**< Number of base intervals for process
   791                                       data watchdog. */
   830                                       data watchdog. If set to zero, the value
       
   831                                       is not written, so the default is used.
       
   832                                      */
   792         );
   833         );
   793 
   834 
   794 /** Add a PDO to a sync manager's PDO assignment.
   835 /** Add a PDO to a sync manager's PDO assignment.
   795  *
   836  *
   796  * \see ecrt_slave_config_pdos()
   837  * \see ecrt_slave_config_pdos()