include/ecrt.h
changeset 1995 7d748d9cf9e8
parent 1982 7421bca39b6d
parent 1952 7d9fb723fc4b
child 2024 96e2ae6cce95
equal deleted inserted replaced
1994:b369f3f92eb8 1995:7d748d9cf9e8
   414     EC_REQUEST_BUSY, /**< Request is being processed. */
   414     EC_REQUEST_BUSY, /**< Request is being processed. */
   415     EC_REQUEST_SUCCESS, /**< Request was processed successfully. */
   415     EC_REQUEST_SUCCESS, /**< Request was processed successfully. */
   416     EC_REQUEST_ERROR, /**< Request processing failed. */
   416     EC_REQUEST_ERROR, /**< Request processing failed. */
   417 } ec_request_state_t;
   417 } ec_request_state_t;
   418 
   418 
       
   419 /*****************************************************************************/
       
   420 
       
   421 /** Application-layer state.
       
   422  */
       
   423 typedef enum {
       
   424     EC_AL_STATE_INIT = 1, /**< Init. */
       
   425     EC_AL_STATE_PREOP = 2, /**< Pre-operational. */
       
   426     EC_AL_STATE_SAFEOP = 4, /**< Safe-operational. */
       
   427     EC_AL_STATE_OP = 8, /**< Operational. */
       
   428 } ec_al_state_t;
       
   429 
   419 /******************************************************************************
   430 /******************************************************************************
   420  * Global functions
   431  * Global functions
   421  *****************************************************************************/
   432  *****************************************************************************/
   422 
   433 
   423 #ifdef __cplusplus
   434 #ifdef __cplusplus
   695         size_t target_size, /**< Size of the target buffer. */
   706         size_t target_size, /**< Size of the target buffer. */
   696         size_t *result_size, /**< Uploaded data size. */
   707         size_t *result_size, /**< Uploaded data size. */
   697         uint32_t *abort_code /**< Abort code of the SDO upload. */
   708         uint32_t *abort_code /**< Abort code of the SDO upload. */
   698         );
   709         );
   699 
   710 
       
   711 #endif /* #ifndef __KERNEL__ */
       
   712 
   700 /** Executes an SoE write request.
   713 /** Executes an SoE write request.
   701  *
   714  *
   702  * Starts writing an IDN and blocks until the request was processed, or an
   715  * Starts writing an IDN and blocks until the request was processed, or an
   703  * error occurred.
   716  * error occurred.
   704  *
   717  *
   706  * \retval -1 An error occured.
   719  * \retval -1 An error occured.
   707  */
   720  */
   708 int ecrt_master_write_idn(
   721 int ecrt_master_write_idn(
   709         ec_master_t *master, /**< EtherCAT master. */
   722         ec_master_t *master, /**< EtherCAT master. */
   710         uint16_t slave_position, /**< Slave position. */
   723         uint16_t slave_position, /**< Slave position. */
       
   724         uint8_t drive_no, /**< Drive number. */
   711         uint16_t idn, /**< SoE IDN (see ecrt_slave_config_idn()). */
   725         uint16_t idn, /**< SoE IDN (see ecrt_slave_config_idn()). */
   712         uint8_t *data, /**< Pointer to data to write. */
   726         uint8_t *data, /**< Pointer to data to write. */
   713         size_t data_size, /**< Size of data to write. */
   727         size_t data_size, /**< Size of data to write. */
   714         uint32_t *error_code /**< Pointer to variable, where an SoE error code
   728         uint16_t *error_code /**< Pointer to variable, where an SoE error code
   715                                can be stored. */
   729                                can be stored. */
   716         );
   730         );
   717 
   731 
   718 /** Executes an SoE read request.
   732 /** Executes an SoE read request.
   719  *
   733  *
   724  * \retval -1 An error occured.
   738  * \retval -1 An error occured.
   725  */
   739  */
   726 int ecrt_master_read_idn(
   740 int ecrt_master_read_idn(
   727         ec_master_t *master, /**< EtherCAT master. */
   741         ec_master_t *master, /**< EtherCAT master. */
   728         uint16_t slave_position, /**< Slave position. */
   742         uint16_t slave_position, /**< Slave position. */
       
   743         uint8_t drive_no, /**< Drive number. */
   729         uint16_t idn, /**< SoE IDN (see ecrt_slave_config_idn()). */
   744         uint16_t idn, /**< SoE IDN (see ecrt_slave_config_idn()). */
   730         uint8_t *target, /**< Pointer to memory where the read data can be
   745         uint8_t *target, /**< Pointer to memory where the read data can be
   731                            stored. */
   746                            stored. */
   732         size_t target_size, /**< Size of the memory \a target points to. */
   747         size_t target_size, /**< Size of the memory \a target points to. */
   733         size_t *result_size, /**< Actual size of the received data. */
   748         size_t *result_size, /**< Actual size of the received data. */
   734         uint32_t *error_code /**< Pointer to variable, where an SoE error code
   749         uint16_t *error_code /**< Pointer to variable, where an SoE error code
   735                                can be stored. */
   750                                can be stored. */
   736         );
   751         );
   737 
       
   738 #endif /* #ifndef __KERNEL__ */
       
   739 
   752 
   740 /** Finishes the configuration phase and prepares for cyclic operation.
   753 /** Finishes the configuration phase and prepares for cyclic operation.
   741  *
   754  *
   742  * This function tells the master that the configuration phase is finished and
   755  * This function tells the master that the configuration phase is finished and
   743  * the realtime operation will begin. The function allocates internal memory
   756  * the realtime operation will begin. The function allocates internal memory
  1256  * \retval  0 Success.
  1269  * \retval  0 Success.
  1257  * \retval <0 Error code.
  1270  * \retval <0 Error code.
  1258  */
  1271  */
  1259 int ecrt_slave_config_idn(
  1272 int ecrt_slave_config_idn(
  1260         ec_slave_config_t *sc, /**< Slave configuration. */
  1273         ec_slave_config_t *sc, /**< Slave configuration. */
       
  1274         uint8_t drive_no, /**< Drive number. */
  1261         uint16_t idn, /**< SoE IDN. */
  1275         uint16_t idn, /**< SoE IDN. */
       
  1276         ec_al_state_t state, /**< AL state in which to write the IDN (PREOP or
       
  1277                                SAFEOP). */
  1262         const uint8_t *data, /**< Pointer to the data. */
  1278         const uint8_t *data, /**< Pointer to the data. */
  1263         size_t size /**< Size of the \a data. */
  1279         size_t size /**< Size of the \a data. */
  1264         );
  1280         );
  1265 
  1281 
  1266 /******************************************************************************
  1282 /******************************************************************************