EC_TIMEVAL2NANO() takes no pointer argument any more.
authorFlorian Pose <fp@igh-essen.com>
Fri, 15 May 2009 09:06:28 +0000
changeset 1466 362147819ca1
parent 1465 3099d78343ea
child 1467 013a4e42a9fb
EC_TIMEVAL2NANO() takes no pointer argument any more.
examples/dc_rtai/dc_rtai_sample.c
examples/dc_user/main.c
include/ecrt.h
--- a/examples/dc_rtai/dc_rtai_sample.c	Fri May 15 09:05:27 2009 +0000
+++ b/examples/dc_rtai/dc_rtai_sample.c	Fri May 15 09:06:28 2009 +0000
@@ -220,7 +220,7 @@
             tv.tv_usec -= 1000000;
             tv.tv_sec++;
         }
-        ecrt_master_application_time(master, EC_TIMEVAL2NANO(&tv));
+        ecrt_master_application_time(master, EC_TIMEVAL2NANO(tv));
             
         if (sync_ref_counter) {
             sync_ref_counter--;
--- a/examples/dc_user/main.c	Fri May 15 09:05:27 2009 +0000
+++ b/examples/dc_user/main.c	Fri May 15 09:06:28 2009 +0000
@@ -164,7 +164,7 @@
         app_time.tv_usec -= 1000000;
         app_time.tv_sec++;
     }
-    ecrt_master_application_time(master, EC_TIMEVAL2NANO(&app_time));
+    ecrt_master_application_time(master, EC_TIMEVAL2NANO(app_time));
 
     if (sync_ref_counter) {
         sync_ref_counter--;
--- a/include/ecrt.h	Fri May 15 09:05:27 2009 +0000
+++ b/include/ecrt.h	Fri May 15 09:06:28 2009 +0000
@@ -120,12 +120,12 @@
  *
  * This macro converts a unix epoch time to EtherCAT DC time.
  *
- * \see ecrt_master_sync_reference_clock()
- *
- * \param TV Pointer to struct timeval.
+ * \see void ecrt_master_application_time()
+ *
+ * \param TV struct timeval containing epoch time.
  */
 #define EC_TIMEVAL2NANO(TV) \
-    (((TV)->tv_sec - 946684800ULL) * 1000000000ULL + (TV)->tv_usec * 1000ULL)
+    (((TV).tv_sec - 946684800ULL) * 1000000000ULL + (TV).tv_usec * 1000ULL)
 
 /******************************************************************************
  * Data types 
@@ -205,7 +205,7 @@
     uint32_t revision_number; /**< Revision-Number stored on the slave. */
     uint32_t serial_number; /**< Serial-Number stored on the slave. */
     uint16_t alias; /**< The slaves alias if not equal to 0. */
-    int16_t current_on_ebus;
+    int16_t current_on_ebus; /**< Used current in mA. */
     uint8_t al_state; /**< Current state of the slave. */
     uint8_t error_flag; /**< Error flag for that slave. */
     uint8_t sync_count; /**< Number of sync managers. */
@@ -527,9 +527,14 @@
 
 /** Sets the application time.
  *
- * The master has to know the application time when operation slaves with
- * distributed clocks. The time is not incremented by the master, so this
- * method has to be called cyclically.
+ * The master has to know the application's time when operating slaves with
+ * distributed clocks. The time is not incremented by the master itself, so
+ * this method has to be called cyclically.
+ * 
+ * The time is used when setting the slaves' <tt>System Time Offset</tt> and
+ * <tt>Cyclic Operation Start Time</tt> registers and when synchronizing the
+ * DC reference clock to the application time via
+ * ecrt_master_sync_reference_clock().
  * 
  * The time is defined as nanoseconds from 2000-01-01 00:00. Converting an
  * epoch time can be done with the EC_TIMEVAL2NANO() macro.