include/ecrt.h
changeset 916 db73994fbdac
parent 900 f8b5c6d21705
child 923 a6b51990e7e6
equal deleted inserted replaced
915:57907232b901 916:db73994fbdac
    56  * - Process data memory for a domain can now be allocated externally. This
    56  * - Process data memory for a domain can now be allocated externally. This
    57  *   offers the possibility to use a shared-memory region. Therefore,
    57  *   offers the possibility to use a shared-memory region. Therefore,
    58  *   added the domain methods ecrt_domain_size() and
    58  *   added the domain methods ecrt_domain_size() and
    59  *   ecrt_domain_external_memory().
    59  *   ecrt_domain_external_memory().
    60  * - Replaced the process data pointers in the Pdo entry registration
    60  * - Replaced the process data pointers in the Pdo entry registration
    61  *   functions with a process data offset, that is now returned by
    61  *   functions with a process data offset, that is now returned either byte-
    62  *   ecrt_slave_config_reg_pdo_entry(). This was necessary for the external
    62  *   or bitwise by ecrt_slave_config_reg_pdo_entry() or
    63  *   domain memory. An additional advantage is, that the returned offset value
    63  *   ecrt_slave_config_reg_pdo_entry_bitwise(), respectively. This was
    64  *   is directly usable. If the domain's process data is allocated internally,
    64  *   necessary for the external domain memory. An additional advantage is,
    65  *   the start address can be retrieved with ecrt_domain_data().
    65  *   that the returned offset is immediately valid. If the domain's
       
    66  *   process data is allocated internally, the start address can be retrieved
       
    67  *   with ecrt_domain_data().
    66  * - Replaced ecrt_slave_pdo_mapping/add/clear() with
    68  * - Replaced ecrt_slave_pdo_mapping/add/clear() with
    67  *   ecrt_slave_config_pdo_assign_add() to add a Pdo to a sync manager's Pdo
    69  *   ecrt_slave_config_pdo_assign_add() to add a Pdo to a sync manager's Pdo
    68  *   assignment and ecrt_slave_config_pdo_mapping_add() to add a Pdo entry to a
    70  *   assignment and ecrt_slave_config_pdo_mapping_add() to add a Pdo entry to a
    69  *   Pdo's mapping. ecrt_slave_config_pdos() is a convenience function
    71  *   Pdo's mapping. ecrt_slave_config_pdos() is a convenience function
    70  *   for both, that uses the new data types ec_pdo_info_t and
    72  *   for both, that uses the new data types ec_pdo_info_t and
   236 /*****************************************************************************/
   238 /*****************************************************************************/
   237 
   239 
   238 /** List record type for Pdo entry mass-registration.
   240 /** List record type for Pdo entry mass-registration.
   239  *
   241  *
   240  * This type is used for the array parameter of the
   242  * This type is used for the array parameter of the
   241  * ecrt_domain_reg_pdo_entry_list() convenience function.
   243  * ecrt_domain_reg_pdo_entry_list() and
       
   244  * ecrt_domain_reg_pdo_entry_list_bitwise() convenience functions.
   242  */
   245  */
   243 typedef struct {
   246 typedef struct {
   244     uint16_t alias; /**< Slave alias address. */
   247     uint16_t alias; /**< Slave alias address. */
   245     uint16_t position; /**< Slave position. */
   248     uint16_t position; /**< Slave position. */
   246     uint32_t vendor_id; /**< Slave vendor ID. */
   249     uint32_t vendor_id; /**< Slave vendor ID. */
   247     uint32_t product_code; /**< Slave product code. */
   250     uint32_t product_code; /**< Slave product code. */
   248     uint16_t index; /**< Pdo entry index. */
   251     uint16_t index; /**< Pdo entry index. */
   249     uint8_t subindex; /**< Pdo entry subindex. */
   252     uint8_t subindex; /**< Pdo entry subindex. */
   250     unsigned int *offset; /**< Pointer to a variable to store the Pdo's
   253     unsigned int *offset; /**< Pointer to a variable to store the Pdo's
   251                        offset in the process data. */
   254                        offset in the process data. This can either be byte-
       
   255                        or bitwise, depending on whether
       
   256                        ecrt_domain_reg_pdo_entry_list() or
       
   257                        ecrt_domain_reg_pdo_entry_list_bitwise() was called. */
   252 } ec_pdo_entry_reg_t;
   258 } ec_pdo_entry_reg_t;
   253 
   259 
   254 /*****************************************************************************/
   260 /*****************************************************************************/
   255 
   261 
   256 /** Sdo request state.
   262 /** Sdo request state.
   516  * entry's data inside the domain's process data is returned.
   522  * entry's data inside the domain's process data is returned.
   517  *
   523  *
   518  * \retval >=0 Success: Offset of the Pdo entry's process data.
   524  * \retval >=0 Success: Offset of the Pdo entry's process data.
   519  * \retval -1  Error: Pdo entry not found.
   525  * \retval -1  Error: Pdo entry not found.
   520  * \retval -2  Error: Failed to register Pdo entry.
   526  * \retval -2  Error: Failed to register Pdo entry.
       
   527  * \retval -3  Error: Pdo entry is not byte-aligned.
   521  */
   528  */
   522 int ecrt_slave_config_reg_pdo_entry(
   529 int ecrt_slave_config_reg_pdo_entry(
       
   530         ec_slave_config_t *sc, /**< Slave configuration. */
       
   531         uint16_t entry_index, /**< Index of the Pdo entry to register. */
       
   532         uint8_t entry_subindex, /**< Subindex of the Pdo entry to register. */
       
   533         ec_domain_t *domain /**< Domain. */
       
   534         );
       
   535 
       
   536 /** Registers a Pdo entry for process data exchange in a domain.
       
   537  *
       
   538  * Bitwise registration function.
       
   539  *
       
   540  * \see ecrt_slave_config_reg_pdo_entry().
       
   541  *
       
   542  * \retval >=0 Success: Bit offset of the Pdo entry's process data.
       
   543  * \retval -1  Error: Pdo entry not found.
       
   544  * \retval -2  Error: Failed to register Pdo entry.
       
   545  */
       
   546 int ecrt_slave_config_reg_pdo_entry_bitwise(
   523         ec_slave_config_t *sc, /**< Slave configuration. */
   547         ec_slave_config_t *sc, /**< Slave configuration. */
   524         uint16_t entry_index, /**< Index of the Pdo entry to register. */
   548         uint16_t entry_index, /**< Index of the Pdo entry to register. */
   525         uint8_t entry_subindex, /**< Subindex of the Pdo entry to register. */
   549         uint8_t entry_subindex, /**< Subindex of the Pdo entry to register. */
   526         ec_domain_t *domain /**< Domain. */
   550         ec_domain_t *domain /**< Domain. */
   527         );
   551         );
   616  * \attention The registration array has to be terminated with an empty
   640  * \attention The registration array has to be terminated with an empty
   617  *            structure, or one with the \a index field set to zero!
   641  *            structure, or one with the \a index field set to zero!
   618  * \return 0 on success, else non-zero.
   642  * \return 0 on success, else non-zero.
   619  */
   643  */
   620 int ecrt_domain_reg_pdo_entry_list(
   644 int ecrt_domain_reg_pdo_entry_list(
       
   645         ec_domain_t *domain, /**< Domain. */
       
   646         const ec_pdo_entry_reg_t *pdo_entry_regs /**< Array of Pdo
       
   647                                                    registrations. */
       
   648         );
       
   649 
       
   650 /** Registers a bunch of Pdo entries for a domain.
       
   651  *
       
   652  * Bitwise registration.
       
   653  *
       
   654  * \see ecrt_domain_reg_pdo_entry_list()
       
   655  *
       
   656  * \attention The registration array has to be terminated with an empty
       
   657  *            structure, or one with the \a index field set to zero!
       
   658  * \return 0 on success, else non-zero.
       
   659  */
       
   660 int ecrt_domain_reg_pdo_entry_list_bitwise(
   621         ec_domain_t *domain, /**< Domain. */
   661         ec_domain_t *domain, /**< Domain. */
   622         const ec_pdo_entry_reg_t *pdo_entry_regs /**< Array of Pdo
   662         const ec_pdo_entry_reg_t *pdo_entry_regs /**< Array of Pdo
   623                                                    registrations. */
   663                                                    registrations. */
   624         );
   664         );
   625 
   665