include/ecrt.h
changeset 916 db73994fbdac
parent 900 f8b5c6d21705
child 923 a6b51990e7e6
--- a/include/ecrt.h	Wed May 28 07:19:33 2008 +0000
+++ b/include/ecrt.h	Wed May 28 07:26:28 2008 +0000
@@ -58,11 +58,13 @@
  *   added the domain methods ecrt_domain_size() and
  *   ecrt_domain_external_memory().
  * - Replaced the process data pointers in the Pdo entry registration
- *   functions with a process data offset, that is now returned by
- *   ecrt_slave_config_reg_pdo_entry(). This was necessary for the external
- *   domain memory. An additional advantage is, that the returned offset value
- *   is directly usable. If the domain's process data is allocated internally,
- *   the start address can be retrieved with ecrt_domain_data().
+ *   functions with a process data offset, that is now returned either byte-
+ *   or bitwise by ecrt_slave_config_reg_pdo_entry() or
+ *   ecrt_slave_config_reg_pdo_entry_bitwise(), respectively. This was
+ *   necessary for the external domain memory. An additional advantage is,
+ *   that the returned offset is immediately valid. If the domain's
+ *   process data is allocated internally, the start address can be retrieved
+ *   with ecrt_domain_data().
  * - Replaced ecrt_slave_pdo_mapping/add/clear() with
  *   ecrt_slave_config_pdo_assign_add() to add a Pdo to a sync manager's Pdo
  *   assignment and ecrt_slave_config_pdo_mapping_add() to add a Pdo entry to a
@@ -238,7 +240,8 @@
 /** List record type for Pdo entry mass-registration.
  *
  * This type is used for the array parameter of the
- * ecrt_domain_reg_pdo_entry_list() convenience function.
+ * ecrt_domain_reg_pdo_entry_list() and
+ * ecrt_domain_reg_pdo_entry_list_bitwise() convenience functions.
  */
 typedef struct {
     uint16_t alias; /**< Slave alias address. */
@@ -248,7 +251,10 @@
     uint16_t index; /**< Pdo entry index. */
     uint8_t subindex; /**< Pdo entry subindex. */
     unsigned int *offset; /**< Pointer to a variable to store the Pdo's
-                       offset in the process data. */
+                       offset in the process data. This can either be byte-
+                       or bitwise, depending on whether
+                       ecrt_domain_reg_pdo_entry_list() or
+                       ecrt_domain_reg_pdo_entry_list_bitwise() was called. */
 } ec_pdo_entry_reg_t;
 
 /*****************************************************************************/
@@ -518,6 +524,7 @@
  * \retval >=0 Success: Offset of the Pdo entry's process data.
  * \retval -1  Error: Pdo entry not found.
  * \retval -2  Error: Failed to register Pdo entry.
+ * \retval -3  Error: Pdo entry is not byte-aligned.
  */
 int ecrt_slave_config_reg_pdo_entry(
         ec_slave_config_t *sc, /**< Slave configuration. */
@@ -526,6 +533,23 @@
         ec_domain_t *domain /**< Domain. */
         );
 
+/** Registers a Pdo entry for process data exchange in a domain.
+ *
+ * Bitwise registration function.
+ *
+ * \see ecrt_slave_config_reg_pdo_entry().
+ *
+ * \retval >=0 Success: Bit offset of the Pdo entry's process data.
+ * \retval -1  Error: Pdo entry not found.
+ * \retval -2  Error: Failed to register Pdo entry.
+ */
+int ecrt_slave_config_reg_pdo_entry_bitwise(
+        ec_slave_config_t *sc, /**< Slave configuration. */
+        uint16_t entry_index, /**< Index of the Pdo entry to register. */
+        uint8_t entry_subindex, /**< Subindex of the Pdo entry to register. */
+        ec_domain_t *domain /**< Domain. */
+        );
+
 /** Add an Sdo configuration.
  *
  * An Sdo configuration is stored in the slave configuration object and is
@@ -623,6 +647,22 @@
                                                    registrations. */
         );
 
+/** Registers a bunch of Pdo entries for a domain.
+ *
+ * Bitwise registration.
+ *
+ * \see ecrt_domain_reg_pdo_entry_list()
+ *
+ * \attention The registration array has to be terminated with an empty
+ *            structure, or one with the \a index field set to zero!
+ * \return 0 on success, else non-zero.
+ */
+int ecrt_domain_reg_pdo_entry_list_bitwise(
+        ec_domain_t *domain, /**< Domain. */
+        const ec_pdo_entry_reg_t *pdo_entry_regs /**< Array of Pdo
+                                                   registrations. */
+        );
+
 /** Returns the current size of the domain's process data.
  *
  * \return Size of the process data image.