diff --git a/include/ecrt.h b/include/ecrt.h index 9367aed2037d08ec741bae51481d742a1e391a0a..568b1e2ef2d3ff1a8a5c7e647ea5832332fa5425 100644 --- a/include/ecrt.h +++ b/include/ecrt.h @@ -44,7 +44,8 @@ * - Added the distributed clocks feature and the respective methods * ecrt_slave_config_dc_assign_activate() and * ecrt_slave_config_dc_sync_cycle_times() to configure a slave for cyclic - * operation, and ecrt_master_sync() for drift compensation. + * operation, and ecrt_master_sync_reference_clock() and + * ecrt_master_sync_slave_clocks() for drift compensation. * - Changed the meaning of the negative return values of * ecrt_slave_config_reg_pdo_entry() and ecrt_slave_config_sdo*(). * - Imlemented the Vendor-specific over EtherCAT mailbox protocol. See @@ -506,16 +507,23 @@ void ecrt_master_state( ec_master_state_t *state /**< Structure to store the information. */ ); -/** Queues the DC drift compensation datagram for sending. +/** Queues the DC reference clock drift compensation datagram for sending. * - * The reference clock will by synchronized to the \a app_time, while the - * other slaves will by synchronized to the reference clock. + * The reference clock will by synchronized to the \a app_time. */ -void ecrt_master_sync( +void ecrt_master_sync_reference_clock( ec_master_t *master, /**< EtherCAT master. */ const struct timeval *app_time /**< Application time. */ ); +/** Queues the DC clock drift compensation datagram for sending. + * + * All slave clocks synchronized to the reference clock. + */ +void ecrt_master_sync_slave_clocks( + ec_master_t *master /**< EtherCAT master. */ + ); + /****************************************************************************** * Slave configuration methods *****************************************************************************/ diff --git a/master/master.c b/master/master.c index 7a641d4f5d8afe29dd7756fe41dcc3253dea4e5c..297d8e7f81c3e48ef141d193448595cb796b29b1 100644 --- a/master/master.c +++ b/master/master.c @@ -1648,19 +1648,20 @@ void ecrt_master_state(const ec_master_t *master, ec_master_state_t *state) /*****************************************************************************/ -void ecrt_master_sync(ec_master_t *master, const struct timeval *app_time) +void ecrt_master_sync_reference_clock(ec_master_t *master, + const struct timeval *app_time) { master->app_time = EC_TIMEVAL2NANO(app_time); - -#if 1 EC_WRITE_U32(master->ref_sync_datagram.data, master->app_time); ec_master_queue_datagram(master, &master->ref_sync_datagram); -#endif +} -#if 1 +/*****************************************************************************/ + +void ecrt_master_sync_slave_clocks(ec_master_t *master) +{ ec_datagram_zero(&master->sync_datagram); ec_master_queue_datagram(master, &master->sync_datagram); -#endif } /*****************************************************************************/ @@ -1674,7 +1675,8 @@ EXPORT_SYMBOL(ecrt_master_receive); EXPORT_SYMBOL(ecrt_master_callbacks); EXPORT_SYMBOL(ecrt_master_slave_config); EXPORT_SYMBOL(ecrt_master_state); -EXPORT_SYMBOL(ecrt_master_sync); +EXPORT_SYMBOL(ecrt_master_sync_reference_clock); +EXPORT_SYMBOL(ecrt_master_sync_slave_clocks); /** \endcond */