include/ecrt.h
changeset 2024 96e2ae6cce95
parent 1995 7d748d9cf9e8
child 2042 8b358effa78b
equal deleted inserted replaced
2023:da133ec36c3a 2024:96e2ae6cce95
    47  *   ecrt_master_sync_slave_clocks() for offset and drift compensation. The
    47  *   ecrt_master_sync_slave_clocks() for offset and drift compensation. The
    48  *   EC_TIMEVAL2NANO() macro can be used for epoch time conversion, while the
    48  *   EC_TIMEVAL2NANO() macro can be used for epoch time conversion, while the
    49  *   ecrt_master_sync_monitor_queue() and ecrt_master_sync_monitor_process()
    49  *   ecrt_master_sync_monitor_queue() and ecrt_master_sync_monitor_process()
    50  *   methods can be used to monitor the synchrony.
    50  *   methods can be used to monitor the synchrony.
    51  * - Improved the callback mechanism. ecrt_master_callbacks() now takes two
    51  * - Improved the callback mechanism. ecrt_master_callbacks() now takes two
    52  *   callback functions for sending and receiving datagrams.
    52  *   callback functions for locking and unlocking the fsm datagram queue.
    53  *   ecrt_master_send_ext() is used to execute the sending of non-application
       
    54  *   datagrams.
       
    55  * - Added watchdog configuration (method ecrt_slave_config_watchdog(),
    53  * - Added watchdog configuration (method ecrt_slave_config_watchdog(),
    56  *   #ec_watchdog_mode_t, \a watchdog_mode parameter in ec_sync_info_t and
    54  *   #ec_watchdog_mode_t, \a watchdog_mode parameter in ec_sync_info_t and
    57  *   ecrt_slave_config_sync_manager()).
    55  *   ecrt_slave_config_sync_manager()).
    58  * - Added ecrt_slave_config_complete_sdo() method to download an SDO during
    56  * - Added ecrt_slave_config_complete_sdo() method to download an SDO during
    59  *   configuration via CompleteAccess.
    57  *   configuration via CompleteAccess.
   510 
   508 
   511 #ifdef __KERNEL__
   509 #ifdef __KERNEL__
   512 
   510 
   513 /** Sets the locking callbacks.
   511 /** Sets the locking callbacks.
   514  *
   512  *
   515  * For concurrent master access, i. e. if other instances than the application
   513  * For concurrent master access, the application has to provide a locking
   516  * want to send and receive datagrams on the bus, the application has to
   514  * mechanism. The method takes two function pointers and a data value as
   517  * provide a callback mechanism. This method takes two function pointers as
   515  * its parameters.
   518  * its parameters. Asynchronous master access (like EoE processing) is only
   516  * The arbitrary \a cb_data value will be passed as argument on every callback.
   519  * possible if the callbacks have been set.
   517  *
   520  *
       
   521  * The task of the send callback (\a send_cb) is to decide, if the bus is
       
   522  * currently accessible and whether or not to call the ecrt_master_send_ext()
       
   523  * method.
       
   524  *
       
   525  * The task of the receive callback (\a receive_cb) is to decide, if a call to
       
   526  * ecrt_master_receive() is allowed and to execute it respectively.
       
   527  */
   518  */
   528 void ecrt_master_callbacks(
   519 void ecrt_master_callbacks(
   529         ec_master_t *master, /**< EtherCAT master */
   520         ec_master_t *master, /**< EtherCAT master */
   530         void (*send_cb)(void *), /**< Datagram sending callback. */
   521         void (*lock_cb)(void *), /**< Lock function. */
   531         void (*receive_cb)(void *), /**< Receive callback. */
   522         void (*unlock_cb)(void *), /**< Unlock function. */
   532         void *cb_data /**< Arbitraty pointer passed to the callback functions.
   523         void *cb_data /**< Arbitrary user data. */
   533                        */
   524         );
   534         );
       
   535 
       
   536 #endif /* __KERNEL__ */
   525 #endif /* __KERNEL__ */
   537 
   526 
   538 /** Creates a new process data domain.
   527 /** Creates a new process data domain.
   539  *
   528  *
   540  * For process data exchange, at least one process data domain is needed.
   529  * For process data exchange, at least one process data domain is needed.
   812  *
   801  *
   813  * Has to be called cyclically by the realtime application after
   802  * Has to be called cyclically by the realtime application after
   814  * ecrt_master_activate() has returned.
   803  * ecrt_master_activate() has returned.
   815  */
   804  */
   816 void ecrt_master_receive(
   805 void ecrt_master_receive(
   817         ec_master_t *master /**< EtherCAT master. */
       
   818         );
       
   819 
       
   820 /** Sends non-application datagrams.
       
   821  *
       
   822  * This method has to be called in the send callback function passed via
       
   823  * ecrt_master_callbacks() to allow the sending of non-application datagrams.
       
   824  */
       
   825 void ecrt_master_send_ext(
       
   826         ec_master_t *master /**< EtherCAT master. */
   806         ec_master_t *master /**< EtherCAT master. */
   827         );
   807         );
   828 
   808 
   829 /** Reads the current master state.
   809 /** Reads the current master state.
   830  *
   810  *