129 typedef struct ec_slave_config ec_slave_config_t; /**< \see ec_slave_config */ |
129 typedef struct ec_slave_config ec_slave_config_t; /**< \see ec_slave_config */ |
130 |
130 |
131 struct ec_domain; |
131 struct ec_domain; |
132 typedef struct ec_domain ec_domain_t; /**< \see ec_domain */ |
132 typedef struct ec_domain ec_domain_t; /**< \see ec_domain */ |
133 |
133 |
|
134 struct ec_sdo_request; |
|
135 typedef struct ec_sdo_request ec_sdo_request_t; /**< \see ec_sdo_request. */ |
|
136 |
134 /*****************************************************************************/ |
137 /*****************************************************************************/ |
135 |
138 |
136 /** Bus state. |
139 /** Bus state. |
137 * |
140 * |
138 * This is used in ec_master_state_t. |
141 * This is used in ec_master_state_t. |
245 uint16_t index; /**< Pdo entry index. */ |
248 uint16_t index; /**< Pdo entry index. */ |
246 uint8_t subindex; /**< Pdo entry subindex. */ |
249 uint8_t subindex; /**< Pdo entry subindex. */ |
247 unsigned int *offset; /**< Pointer to a variable to store the Pdo's |
250 unsigned int *offset; /**< Pointer to a variable to store the Pdo's |
248 offset in the process data. */ |
251 offset in the process data. */ |
249 } ec_pdo_entry_reg_t; |
252 } ec_pdo_entry_reg_t; |
|
253 |
|
254 /*****************************************************************************/ |
|
255 |
|
256 /** Generic request state. |
|
257 */ |
|
258 typedef enum { |
|
259 EC_REQUEST_QUEUED, |
|
260 EC_REQUEST_IN_PROGRESS, |
|
261 EC_REQUEST_COMPLETE, |
|
262 EC_REQUEST_FAILURE |
|
263 } ec_request_state_t; |
|
264 |
|
265 /*****************************************************************************/ |
|
266 |
|
267 /** Sdo request error. |
|
268 * |
|
269 * This is used as return type of ecrt_sdo_request_error(). |
|
270 */ |
|
271 typedef enum { |
|
272 EC_SDO_REQUEST_SUCCESS, /**< There is no error. */ |
|
273 EC_SDO_REQUEST_TIMEOUT, /**< The request timed out. */ |
|
274 } ec_sdo_request_error_t; |
250 |
275 |
251 /****************************************************************************** |
276 /****************************************************************************** |
252 * Global functions |
277 * Global functions |
253 *****************************************************************************/ |
278 *****************************************************************************/ |
254 |
279 |
511 uint16_t sdo_index, /**< Index of the SDO to configure. */ |
536 uint16_t sdo_index, /**< Index of the SDO to configure. */ |
512 uint8_t sdo_subindex, /**< Subindex of the SDO to configure. */ |
537 uint8_t sdo_subindex, /**< Subindex of the SDO to configure. */ |
513 uint32_t value /**< Value to set. */ |
538 uint32_t value /**< Value to set. */ |
514 ); |
539 ); |
515 |
540 |
|
541 /** Create an Sdo request to exchange Sdos during realtime operation. |
|
542 * |
|
543 * The created Sdo request object is freed automatically when the master is |
|
544 * released. |
|
545 */ |
|
546 ec_sdo_request_t *ecrt_slave_config_create_sdo_request( |
|
547 ec_slave_config_t *sc, /**< Slave configuration. */ |
|
548 uint16_t index, /**< Sdo index. */ |
|
549 uint8_t subindex, /**< Sdo subindex. */ |
|
550 size_t size /**< Data size to reserve. */ |
|
551 ); |
|
552 |
516 /** Outputs the state of the slave configuration. |
553 /** Outputs the state of the slave configuration. |
517 * |
554 * |
518 * Stores the state information in the given \a state structure. |
555 * Stores the state information in the given \a state structure. |
519 */ |
556 */ |
520 void ecrt_slave_config_state( |
557 void ecrt_slave_config_state( |
595 */ |
632 */ |
596 void ecrt_domain_state( |
633 void ecrt_domain_state( |
597 const ec_domain_t *domain, /**< Domain. */ |
634 const ec_domain_t *domain, /**< Domain. */ |
598 ec_domain_state_t *state /**< Pointer to a state object to store the |
635 ec_domain_state_t *state /**< Pointer to a state object to store the |
599 information. */ |
636 information. */ |
|
637 ); |
|
638 |
|
639 /***************************************************************************** |
|
640 * Sdo request methods. |
|
641 ****************************************************************************/ |
|
642 |
|
643 /** Set the timeout for an Sdo request. |
|
644 * |
|
645 * If the request cannot be processed in the specified time, if will be marked |
|
646 * as failed. |
|
647 */ |
|
648 void ecrt_sdo_request_timeout( |
|
649 ec_sdo_request_t *req, /**< Sdo request. */ |
|
650 uint32_t timeout /**< Timeout in milliseconds. */ |
|
651 ); |
|
652 |
|
653 /** Access to the Sdo request's data. |
|
654 * |
|
655 * \attention The return value is invalid during (ecrt_sdo_request_state() != |
|
656 * EC_REQUEST_COMPLETE) a read operation, because the internal Sdo data |
|
657 * memory could be re-allocated. |
|
658 * |
|
659 * \return Pointer to the internal Sdo data memory. |
|
660 */ |
|
661 uint8_t *ecrt_sdo_request_data( |
|
662 ec_sdo_request_t *req /**< Sdo request. */ |
|
663 ); |
|
664 |
|
665 /** Get the current state of the Sdo request. |
|
666 * |
|
667 * \return Request state. |
|
668 */ |
|
669 ec_request_state_t ecrt_sdo_request_state( |
|
670 const ec_sdo_request_t *req /**< Sdo request. */ |
|
671 ); |
|
672 |
|
673 /** Get the error code of the Sdo request. |
|
674 */ |
|
675 ec_sdo_request_error_t ecrt_sdo_request_error( |
|
676 const ec_sdo_request_t *req /**< Sdo request. */ |
|
677 ); |
|
678 |
|
679 /** Schedule an Sdo write operation. |
|
680 */ |
|
681 void ecrt_sdo_request_write( |
|
682 ec_sdo_request_t *req /**< Sdo request. */ |
|
683 ); |
|
684 |
|
685 /** Schedule an Sdo read operation . |
|
686 * |
|
687 * \attention After calling this function, the return value of |
|
688 * ecrt_sdo_request_data() will be invalid until ecrt_sdo_request_state() |
|
689 * is EC_REQUEST_COMPLETE. |
|
690 */ |
|
691 void ecrt_sdo_request_read( |
|
692 ec_sdo_request_t *req /**< Sdo request. */ |
600 ); |
693 ); |
601 |
694 |
602 /****************************************************************************** |
695 /****************************************************************************** |
603 * Bitwise read/write macros |
696 * Bitwise read/write macros |
604 *****************************************************************************/ |
697 *****************************************************************************/ |