include/ecrt.h
changeset 864 5b6992df2931
parent 861 6e3de145421a
child 868 aaf175ef0171
equal deleted inserted replaced
863:1f85dbb2f76e 864:5b6992df2931
    31  *
    31  *
    32  *****************************************************************************/
    32  *****************************************************************************/
    33 
    33 
    34 /** \file
    34 /** \file
    35  *
    35  *
    36  * EtherCAT Real-Time Interface.
    36  * EtherCAT Realtime Interface.
    37  *
    37  *
    38  * \defgroup RealtimeInterface EtherCAT Real-Time Interface
    38  * \defgroup RealtimeInterface EtherCAT Realtime Interface
    39  *
    39  *
    40  * EtherCAT interface for realtime modules. This interface is designed for
    40  * EtherCAT interface for realtime modules. This interface is designed for
    41  * realtime modules that want to use EtherCAT. There are functions to request
    41  * realtime modules that want to use EtherCAT. There are functions to request
    42  * a master, to map process data, to communicate with slaves via CoE and to
    42  * a master, to map process data, to communicate with slaves via CoE and to
    43  * configure and activate the bus.
    43  * configure and activate the bus.
    79  *   renamed ec_pdo_reg_t to ec_pdo_entry_reg_t and ecrt_domain_register_pdo()
    79  *   renamed ec_pdo_reg_t to ec_pdo_entry_reg_t and ecrt_domain_register_pdo()
    80  *   to ecrt_slave_config_reg_pdo_entry().
    80  *   to ecrt_slave_config_reg_pdo_entry().
    81  * - Removed ecrt_domain_register_pdo_range(), because it's functionality can
    81  * - Removed ecrt_domain_register_pdo_range(), because it's functionality can
    82  *   be reached by specifying an explicit Pdo mapping and registering those
    82  *   be reached by specifying an explicit Pdo mapping and registering those
    83  *   Pdo entries.
    83  *   Pdo entries.
       
    84  * - Added an Sdo access interface, working with Sdo requests. These can be
       
    85  *   scheduled for reading and writing during realtime operation.
    84  *
    86  *
    85  * @{
    87  * @{
    86  */
    88  */
    87 
    89 
    88 /*****************************************************************************/
    90 /*****************************************************************************/
   100 
   102 
   101 /******************************************************************************
   103 /******************************************************************************
   102  * Global definitions
   104  * Global definitions
   103  *****************************************************************************/
   105  *****************************************************************************/
   104 
   106 
   105 /** EtherCAT real-time interface major version number.
   107 /** EtherCAT realtime interface major version number.
   106  */
   108  */
   107 #define ECRT_VER_MAJOR 1
   109 #define ECRT_VER_MAJOR 1
   108 
   110 
   109 /** EtherCAT real-time interface minor version number.
   111 /** EtherCAT realtime interface minor version number.
   110  */
   112  */
   111 #define ECRT_VER_MINOR 4
   113 #define ECRT_VER_MINOR 4
   112 
   114 
   113 /** EtherCAT real-time interface version word generator.
   115 /** EtherCAT realtime interface version word generator.
   114  */
   116  */
   115 #define ECRT_VERSION(a, b) (((a) << 8) + (b))
   117 #define ECRT_VERSION(a, b) (((a) << 8) + (b))
   116 
   118 
   117 /** EtherCAT real-time interface version word.
   119 /** EtherCAT realtime interface version word.
   118  */
   120  */
   119 #define ECRT_VERSION_MAGIC ECRT_VERSION(ECRT_VER_MAJOR, ECRT_VER_MINOR)
   121 #define ECRT_VERSION_MAGIC ECRT_VERSION(ECRT_VER_MAJOR, ECRT_VER_MINOR)
   120 
   122 
   121 /******************************************************************************
   123 /******************************************************************************
   122  * Data types 
   124  * Data types 
   633 
   635 
   634 /** Set the timeout for an Sdo request.
   636 /** Set the timeout for an Sdo request.
   635  *
   637  *
   636  * If the request cannot be processed in the specified time, if will be marked
   638  * If the request cannot be processed in the specified time, if will be marked
   637  * as failed.
   639  * as failed.
       
   640  *
       
   641  * \todo The timeout functionality is not yet implemented.
   638  */
   642  */
   639 void ecrt_sdo_request_timeout(
   643 void ecrt_sdo_request_timeout(
   640         ec_sdo_request_t *req, /**< Sdo request. */
   644         ec_sdo_request_t *req, /**< Sdo request. */
   641         uint32_t timeout /**< Timeout in milliseconds. */
   645         uint32_t timeout /**< Timeout in milliseconds. */
   642         );
   646         );
   643 
   647 
   644 /** Access to the Sdo request's data.
   648 /** Access to the Sdo request's data.
   645  *
   649  *
   646  * \attention The return value is invalid during a read operation, because the
   650  * \attention The return value can be invalid during a read operation, because
   647  * internal Sdo data memory could be re-allocated.
   651  * the internal Sdo data memory could be re-allocated if the read Sdo data do
       
   652  * not fit inside.
   648  *
   653  *
   649  * \return Pointer to the internal Sdo data memory.
   654  * \return Pointer to the internal Sdo data memory.
   650  */
   655  */
   651 uint8_t *ecrt_sdo_request_data(
   656 uint8_t *ecrt_sdo_request_data(
   652         ec_sdo_request_t *req /**< Sdo request. */
   657         ec_sdo_request_t *req /**< Sdo request. */
   659 ec_sdo_request_state_t ecrt_sdo_request_state(
   664 ec_sdo_request_state_t ecrt_sdo_request_state(
   660     const ec_sdo_request_t *req /**< Sdo request. */
   665     const ec_sdo_request_t *req /**< Sdo request. */
   661     );
   666     );
   662 
   667 
   663 /** Schedule an Sdo write operation.
   668 /** Schedule an Sdo write operation.
       
   669  *
       
   670  * \attention This method may not be called while ecrt_sdo_request_state()
       
   671  * returns EC_SDO_REQUEST_BUSY.
   664  */
   672  */
   665 void ecrt_sdo_request_write(
   673 void ecrt_sdo_request_write(
   666         ec_sdo_request_t *req /**< Sdo request. */
   674         ec_sdo_request_t *req /**< Sdo request. */
   667         );
   675         );
   668 
   676 
   669 /** Schedule an Sdo read operation .
   677 /** Schedule an Sdo read operation.
       
   678  *
       
   679  * \attention This method may not be called while ecrt_sdo_request_state()
       
   680  * returns EC_SDO_REQUEST_BUSY.
   670  *
   681  *
   671  * \attention After calling this function, the return value of
   682  * \attention After calling this function, the return value of
   672  * ecrt_sdo_request_data() will be invalid while ecrt_sdo_request_state()
   683  * ecrt_sdo_request_data() must be considered as invalid while
   673  * returns EC_SDO_REQUEST_BUSY.
   684  * ecrt_sdo_request_state() returns EC_SDO_REQUEST_BUSY.
   674  */
   685  */
   675 void ecrt_sdo_request_read(
   686 void ecrt_sdo_request_read(
   676         ec_sdo_request_t *req /**< Sdo request. */
   687         ec_sdo_request_t *req /**< Sdo request. */
   677         );
   688         );
   678 
   689