include/ecrt.h
changeset 1083 1322dc34cb37
parent 1082 ff06c58e269c
child 1092 69393cf60399
equal deleted inserted replaced
1082:ff06c58e269c 1083:1322dc34cb37
    42  * request a master, to map process data, to communicate with slaves via CoE
    42  * request a master, to map process data, to communicate with slaves via CoE
    43  * and to configure and activate the bus.
    43  * and to configure and activate the bus.
    44  *
    44  *
    45  * Changes in Version 1.4:
    45  * Changes in Version 1.4:
    46  *
    46  *
    47  * - Replaced ec_slave_t with ec_slave_config_t, separating the slave objects
    47  * - Replaced ec_slave_t with ec_slave_config_t, separating the bus
    48  *   from the requested bus configuration. Therefore, renamed
    48  *   configuration from the actual slaves. Therefore, renamed
    49  *   ecrt_master_get_slave() to ecrt_master_slave_config().
    49  *   ecrt_master_get_slave() to ecrt_master_slave_config().
    50  * - Replaced slave address string with alias and position values. See
    50  * - Replaced slave address string with alias and position values. See
    51  *   ecrt_master_slave_config().
    51  *   ecrt_master_slave_config().
    52  * - Removed ecrt_master_get_slave_by_pos(), because it is no longer
    52  * - Removed ecrt_master_get_slave_by_pos(), because it is no longer
    53  *   necessary due to alias/position addressing.
    53  *   necessary due to alias/position addressing.
    71  *   ec_pdo_entry_info_t. Pdo entries, that are mapped with these functions
    71  *   ec_pdo_entry_info_t. Pdo entries, that are mapped with these functions
    72  *   can now immediately be registered, even if the bus is offline.
    72  *   can now immediately be registered, even if the bus is offline.
    73  * - Renamed ec_bus_status_t, ec_master_status_t to ec_bus_state_t and
    73  * - Renamed ec_bus_status_t, ec_master_status_t to ec_bus_state_t and
    74  *   ec_master_state_t, respectively. Renamed ecrt_master_get_status() to
    74  *   ec_master_state_t, respectively. Renamed ecrt_master_get_status() to
    75  *   ecrt_master_state(), for consistency reasons.
    75  *   ecrt_master_state(), for consistency reasons.
    76  * - Added ec_domain_state_t and ec_wc_state_t for a new output parameter
    76  * - Added ec_domain_state_t and #ec_wc_state_t for a new output parameter
    77  *   of ecrt_domain_state(). The domain state object does now contain
    77  *   of ecrt_domain_state(). The domain state object does now contain
    78  *   information, if the process data was exchanged completely.
    78  *   information, if the process data was exchanged completely.
    79  * - Former "Pdo registration" meant Pdo entry registration in fact, therefore
    79  * - Former "Pdo registration" meant Pdo entry registration in fact, therefore
    80  *   renamed ec_pdo_reg_t to ec_pdo_entry_reg_t and ecrt_domain_register_pdo()
    80  *   renamed ec_pdo_reg_t to ec_pdo_entry_reg_t and ecrt_domain_register_pdo()
    81  *   to ecrt_slave_config_reg_pdo_entry().
    81  *   to ecrt_slave_config_reg_pdo_entry().
   270  * This can be use to configure multiple sync managers including the Pdo
   270  * This can be use to configure multiple sync managers including the Pdo
   271  * assignment and Pdo mapping. It is used as an input parameter type in
   271  * assignment and Pdo mapping. It is used as an input parameter type in
   272  * ecrt_slave_config_pdos().
   272  * ecrt_slave_config_pdos().
   273  */
   273  */
   274 typedef struct {
   274 typedef struct {
   275     uint8_t index; /**< Sync manager index. */
   275     uint8_t index; /**< Sync manager index. Must be less
       
   276                      than #EC_MAX_SYNC_MANAGERS for a valid sync manager,
       
   277                      but can also be \a 0xff to mark the end of the list. */
   276     ec_direction_t dir; /**< Sync manager direction. */
   278     ec_direction_t dir; /**< Sync manager direction. */
   277     unsigned int n_pdos; /**< Number of Pdos in \a pdos. */
   279     unsigned int n_pdos; /**< Number of Pdos in \a pdos. */
   278     ec_pdo_info_t *pdos; /**< Array with Pdos to assign. This must contain
   280     ec_pdo_info_t *pdos; /**< Array with Pdos to assign. This must contain
   279                             at least \a n_pdos Pdos. */
   281                             at least \a n_pdos Pdos. */
   280 } ec_sync_info_t;
   282 } ec_sync_info_t;
   456  *
   458  *
   457  * \return zero on success, else non-zero
   459  * \return zero on success, else non-zero
   458  */
   460  */
   459 int ecrt_slave_config_sync_manager(
   461 int ecrt_slave_config_sync_manager(
   460         ec_slave_config_t *sc, /**< Slave configuration. */
   462         ec_slave_config_t *sc, /**< Slave configuration. */
   461         uint8_t sync_index, /**< Sync manager index. Must ba less
   463         uint8_t sync_index, /**< Sync manager index. Must be less
   462                               than #EC_MAX_SYNC_MANAGERS. */
   464                               than #EC_MAX_SYNC_MANAGERS. */
   463         ec_direction_t dir /**< Input/Output. */
   465         ec_direction_t dir /**< Input/Output. */
   464         );
   466         );
   465 
   467 
   466 /** Add a Pdo to a sync manager's Pdo assignment.
   468 /** Add a Pdo to a sync manager's Pdo assignment.
   468  * \see ecrt_slave_config_pdos()
   470  * \see ecrt_slave_config_pdos()
   469  * \return zero on success, else non-zero
   471  * \return zero on success, else non-zero
   470  */
   472  */
   471 int ecrt_slave_config_pdo_assign_add(
   473 int ecrt_slave_config_pdo_assign_add(
   472         ec_slave_config_t *sc, /**< Slave configuration. */
   474         ec_slave_config_t *sc, /**< Slave configuration. */
   473         uint8_t sync_index, /**< Sync manager index. */
   475         uint8_t sync_index, /**< Sync manager index. Must be less
       
   476                               than #EC_MAX_SYNC_MANAGERS. */
   474         uint16_t index /**< Index of the Pdo to assign. */
   477         uint16_t index /**< Index of the Pdo to assign. */
   475         );
   478         );
   476 
   479 
   477 /** Clear a sync manager's Pdo assignment.
   480 /** Clear a sync manager's Pdo assignment.
   478  *
   481  *
   482  * 
   485  * 
   483  * \see ecrt_slave_config_pdos()
   486  * \see ecrt_slave_config_pdos()
   484  */
   487  */
   485 void ecrt_slave_config_pdo_assign_clear(
   488 void ecrt_slave_config_pdo_assign_clear(
   486         ec_slave_config_t *sc, /**< Slave configuration. */
   489         ec_slave_config_t *sc, /**< Slave configuration. */
   487         uint8_t sync_index /**< Sync manager index. */
   490         uint8_t sync_index /**< Sync manager index. Must be less
       
   491                               than #EC_MAX_SYNC_MANAGERS. */
   488         );
   492         );
   489 
   493 
   490 /** Add a Pdo entry to the given Pdo's mapping.
   494 /** Add a Pdo entry to the given Pdo's mapping.
   491  *
   495  *
   492  * \see ecrt_slave_config_pdos()
   496  * \see ecrt_slave_config_pdos()