include/ecrt.h
changeset 1396 9d04cc08f40f
parent 1394 e77728ddf0f9
child 1410 fb6719008bf5
equal deleted inserted replaced
1395:e9fe40c458cc 1396:9d04cc08f40f
    65 #define __ECRT_H__
    65 #define __ECRT_H__
    66 
    66 
    67 #ifdef __KERNEL__
    67 #ifdef __KERNEL__
    68 #include <asm/byteorder.h>
    68 #include <asm/byteorder.h>
    69 #include <linux/types.h>
    69 #include <linux/types.h>
       
    70 #include <linux/time.h>
    70 #else
    71 #else
    71 #include <stdlib.h> // for size_t
    72 #include <stdlib.h> // for size_t
    72 #include <stdint.h>
    73 #include <stdint.h>
       
    74 #include <sys/time.h> // for struct timeval
    73 #endif
    75 #endif
    74 
    76 
    75 /******************************************************************************
    77 /******************************************************************************
    76  * Global definitions
    78  * Global definitions
    77  *****************************************************************************/
    79  *****************************************************************************/
   503         const ec_master_t *master, /**< EtherCAT master. */
   505         const ec_master_t *master, /**< EtherCAT master. */
   504         ec_master_state_t *state /**< Structure to store the information. */
   506         ec_master_state_t *state /**< Structure to store the information. */
   505         );
   507         );
   506 
   508 
   507 /** Queues the DC drift compensation datagram for sending.
   509 /** Queues the DC drift compensation datagram for sending.
       
   510  *
       
   511  * The reference clock will by synchronized to the \a app_time, while the
       
   512  * other slaves will by synchronized to the reference clock.
   508  */
   513  */
   509 void ecrt_master_sync(
   514 void ecrt_master_sync(
   510         ec_master_t *master /**< EtherCAT master. */
   515         ec_master_t *master, /**< EtherCAT master. */
       
   516         const struct timeval *app_time /**< Application time. */
   511         );
   517         );
   512 
   518 
   513 /******************************************************************************
   519 /******************************************************************************
   514  * Slave configuration methods
   520  * Slave configuration methods
   515  *****************************************************************************/
   521  *****************************************************************************/
   683 
   689 
   684 /** Sets the AssignActivate word necessary for DC operation.
   690 /** Sets the AssignActivate word necessary for DC operation.
   685  *
   691  *
   686  * The AssignActivate word is vendor-specific and can be taken from the XML
   692  * The AssignActivate word is vendor-specific and can be taken from the XML
   687  * device description file (Device -> Dc -> AssignActivate). Set this to zero,
   693  * device description file (Device -> Dc -> AssignActivate). Set this to zero,
   688  * if the slave shall be not operated without distributed clocks (default).
   694  * if the slave shall be operated without distributed clocks (default).
   689  */
   695  */
   690 void ecrt_slave_config_dc_assign_activate(
   696 void ecrt_slave_config_dc_assign_activate(
   691 		ec_slave_config_t *sc, /**< Slave configuration. */
   697 		ec_slave_config_t *sc, /**< Slave configuration. */
   692         uint16_t assign_activate /**< AssignActivate word. */
   698         uint16_t assign_activate /**< AssignActivate word. */
   693 		);
   699 		);
   694 
   700 
   695 /** Sets the cylce times for the SYNC0 and SYNC1 signals.
   701 /** Sets the cycle times for the SYNC0 and SYNC1 signals.
   696  */
   702  */
   697 void ecrt_slave_config_dc_sync_cycle_times(
   703 void ecrt_slave_config_dc_sync_cycle_times(
   698 		ec_slave_config_t *sc, /**< Slave configuration. */
   704 		ec_slave_config_t *sc, /**< Slave configuration. */
   699         uint32_t sync0_cycle_time, /**< SYNC0 cycle time [ns]. */
   705         uint32_t sync0_cycle_time, /**< SYNC0 cycle time [ns]. */
   700 		uint32_t sync1_cycle_time /**< SYNC1 cycle time [ns]. */
   706 		uint32_t sync1_cycle_time /**< SYNC1 cycle time [ns]. */