include/ecrt.h
branchstable-1.5
changeset 2447 e93efb4af231
parent 2445 072d4c0dccd8
child 2449 5db725cc40f9
equal deleted inserted replaced
2446:3425c621ee46 2447:e93efb4af231
    55  * - Added interface for direct EtherCAT register access: Added data type
    55  * - Added interface for direct EtherCAT register access: Added data type
    56  *   ec_reg_request_t and methods ecrt_slave_config_create_reg_request(),
    56  *   ec_reg_request_t and methods ecrt_slave_config_create_reg_request(),
    57  *   ecrt_reg_request_data(), ecrt_reg_request_state(),
    57  *   ecrt_reg_request_data(), ecrt_reg_request_state(),
    58  *   ecrt_reg_request_write(), ecrt_reg_request_read() and the feature flag
    58  *   ecrt_reg_request_write(), ecrt_reg_request_read() and the feature flag
    59  *   EC_HAVE_REG_ACCESS.
    59  *   EC_HAVE_REG_ACCESS.
       
    60  * - Added method to select the reference clock,
       
    61  *   ecrt_master_select_reference_clock() and the feature flag
       
    62  *   EC_HAVE_SELECT_REF_CLOCK to check, if the method is available.
       
    63  * - Added method to get the reference clock time,
       
    64  *   ecrt_master_reference_clock_time() and the feature flag
       
    65  *   EC_HAVE_REF_CLOCK_TIME to have the possibility to synchronize the master
       
    66  *   clock to the reference clock.
    60  *
    67  *
    61  * Changes in version 1.5:
    68  * Changes in version 1.5:
    62  *
    69  *
    63  * - Added the distributed clocks feature and the respective method
    70  * - Added the distributed clocks feature and the respective method
    64  *   ecrt_slave_config_dc() to configure a slave for cyclic operation, and
    71  *   ecrt_slave_config_dc() to configure a slave for cyclic operation, and
   161  * ecrt_reg_request_data(), ecrt_reg_request_state(), ecrt_reg_request_write()
   168  * ecrt_reg_request_data(), ecrt_reg_request_state(), ecrt_reg_request_write()
   162  * and ecrt_reg_request_read() are available.
   169  * and ecrt_reg_request_read() are available.
   163  */
   170  */
   164 #define EC_HAVE_REG_ACCESS
   171 #define EC_HAVE_REG_ACCESS
   165 
   172 
       
   173 /* Defined if the method ecrt_master_select_reference_clock() is available.
       
   174  */
       
   175 #define EC_HAVE_SELECT_REF_CLOCK
       
   176 
       
   177 /* Defined if the method ecrt_master_reference_clock_time() is available.
       
   178  */
       
   179 #define EC_HAVE_REF_CLOCK_TIME
       
   180 
   166 /*****************************************************************************/
   181 /*****************************************************************************/
   167 
   182 
   168 /** End of list marker.
   183 /** End of list marker.
   169  *
   184  *
   170  * This can be used with ecrt_slave_config_pdos().
   185  * This can be used with ecrt_slave_config_pdos().
   662         uint16_t position, /**< Slave position. */
   677         uint16_t position, /**< Slave position. */
   663         uint32_t vendor_id, /**< Expected vendor ID. */
   678         uint32_t vendor_id, /**< Expected vendor ID. */
   664         uint32_t product_code /**< Expected product code. */
   679         uint32_t product_code /**< Expected product code. */
   665         );
   680         );
   666 
   681 
       
   682 /** Selects the reference clock for distributed clocks.
       
   683  *
       
   684  * If this method is not called for a certain master, or if the slave
       
   685  * configuration pointer is NULL, then the first slave with DC functionality
       
   686  * will provide the reference clock.
       
   687  *
       
   688  * \return 0 on success, otherwise negative error code.
       
   689  */
       
   690 int ecrt_master_select_reference_clock(
       
   691         ec_master_t *master, /**< EtherCAT master. */
       
   692         ec_slave_config_t *sc /**< Slave config of the slave to use as the
       
   693                                * reference slave (or NULL). */
       
   694         );
       
   695 
   667 /** Obtains master information.
   696 /** Obtains master information.
   668  *
   697  *
   669  * No memory is allocated on the heap in
   698  * No memory is allocated on the heap in
   670  * this function.
   699  * this function.
   671  *
   700  *
   985  *
  1014  *
   986  * All slave clocks synchronized to the reference clock.
  1015  * All slave clocks synchronized to the reference clock.
   987  */
  1016  */
   988 void ecrt_master_sync_slave_clocks(
  1017 void ecrt_master_sync_slave_clocks(
   989         ec_master_t *master /**< EtherCAT master. */
  1018         ec_master_t *master /**< EtherCAT master. */
       
  1019         );
       
  1020 
       
  1021 /** Get the lower 32 bit of the reference clock system time.
       
  1022  *
       
  1023  * This method can be used to synchronize the master to the reference clock.
       
  1024  *
       
  1025  * The reference clock system time is queried via the
       
  1026  * ecrt_master_sync_slave_clocks() method, that reads the system time of the
       
  1027  * reference clock and writes it to the slave clocks (so be sure to call it
       
  1028  * cyclically to get valid data).
       
  1029  *
       
  1030  * \attention The returned time is the system time of the reference clock
       
  1031  * minus the transmission delay of the reference clock.
       
  1032  *
       
  1033  * \retval 0 success, system time was written into \a time.
       
  1034  * \retval -ENXIO No reference clock found.
       
  1035  * \retval -EIO Slave synchronization datagram was not received.
       
  1036  */
       
  1037 int ecrt_master_reference_clock_time(
       
  1038         ec_master_t *master, /**< EtherCAT master. */
       
  1039         uint32_t *time /**< Pointer to store the queried system time. */
   990         );
  1040         );
   991 
  1041 
   992 /** Queues the DC synchrony monitoring datagram for sending.
  1042 /** Queues the DC synchrony monitoring datagram for sending.
   993  *
  1043  *
   994  * The datagram broadcast-reads all "System time difference" registers (\a
  1044  * The datagram broadcast-reads all "System time difference" registers (\a