include/ecrt.h
changeset 1466 362147819ca1
parent 1448 d7ba0c408a07
child 1494 6c632c8f45cc
equal deleted inserted replaced
1465:3099d78343ea 1466:362147819ca1
   118 
   118 
   119 /** Timeval to nanoseconds conversion.
   119 /** Timeval to nanoseconds conversion.
   120  *
   120  *
   121  * This macro converts a unix epoch time to EtherCAT DC time.
   121  * This macro converts a unix epoch time to EtherCAT DC time.
   122  *
   122  *
   123  * \see ecrt_master_sync_reference_clock()
   123  * \see void ecrt_master_application_time()
   124  *
   124  *
   125  * \param TV Pointer to struct timeval.
   125  * \param TV struct timeval containing epoch time.
   126  */
   126  */
   127 #define EC_TIMEVAL2NANO(TV) \
   127 #define EC_TIMEVAL2NANO(TV) \
   128     (((TV)->tv_sec - 946684800ULL) * 1000000000ULL + (TV)->tv_usec * 1000ULL)
   128     (((TV).tv_sec - 946684800ULL) * 1000000000ULL + (TV).tv_usec * 1000ULL)
   129 
   129 
   130 /******************************************************************************
   130 /******************************************************************************
   131  * Data types 
   131  * Data types 
   132  *****************************************************************************/
   132  *****************************************************************************/
   133 
   133 
   203     uint32_t vendor_id; /**< Vendor-ID stored on the slave. */
   203     uint32_t vendor_id; /**< Vendor-ID stored on the slave. */
   204     uint32_t product_code; /**< Product-Code stored on the slave. */
   204     uint32_t product_code; /**< Product-Code stored on the slave. */
   205     uint32_t revision_number; /**< Revision-Number stored on the slave. */
   205     uint32_t revision_number; /**< Revision-Number stored on the slave. */
   206     uint32_t serial_number; /**< Serial-Number stored on the slave. */
   206     uint32_t serial_number; /**< Serial-Number stored on the slave. */
   207     uint16_t alias; /**< The slaves alias if not equal to 0. */
   207     uint16_t alias; /**< The slaves alias if not equal to 0. */
   208     int16_t current_on_ebus;
   208     int16_t current_on_ebus; /**< Used current in mA. */
   209     uint8_t al_state; /**< Current state of the slave. */
   209     uint8_t al_state; /**< Current state of the slave. */
   210     uint8_t error_flag; /**< Error flag for that slave. */
   210     uint8_t error_flag; /**< Error flag for that slave. */
   211     uint8_t sync_count; /**< Number of sync managers. */
   211     uint8_t sync_count; /**< Number of sync managers. */
   212     uint16_t sdo_count; /**< Number of SDO's. */
   212     uint16_t sdo_count; /**< Number of SDO's. */
   213     char name[EC_MAX_STRING_LENGTH]; /**< Name of the slave. */
   213     char name[EC_MAX_STRING_LENGTH]; /**< Name of the slave. */
   525         ec_master_state_t *state /**< Structure to store the information. */
   525         ec_master_state_t *state /**< Structure to store the information. */
   526         );
   526         );
   527 
   527 
   528 /** Sets the application time.
   528 /** Sets the application time.
   529  *
   529  *
   530  * The master has to know the application time when operation slaves with
   530  * The master has to know the application's time when operating slaves with
   531  * distributed clocks. The time is not incremented by the master, so this
   531  * distributed clocks. The time is not incremented by the master itself, so
   532  * method has to be called cyclically.
   532  * this method has to be called cyclically.
       
   533  * 
       
   534  * The time is used when setting the slaves' <tt>System Time Offset</tt> and
       
   535  * <tt>Cyclic Operation Start Time</tt> registers and when synchronizing the
       
   536  * DC reference clock to the application time via
       
   537  * ecrt_master_sync_reference_clock().
   533  * 
   538  * 
   534  * The time is defined as nanoseconds from 2000-01-01 00:00. Converting an
   539  * The time is defined as nanoseconds from 2000-01-01 00:00. Converting an
   535  * epoch time can be done with the EC_TIMEVAL2NANO() macro.
   540  * epoch time can be done with the EC_TIMEVAL2NANO() macro.
   536  */
   541  */
   537 void ecrt_master_application_time(
   542 void ecrt_master_application_time(