master/slave.h
changeset 73 9f4ea66d89a3
parent 55 059a9e712aa7
child 74 9bf603942791
--- a/master/slave.h	Wed Feb 22 17:36:28 2006 +0000
+++ b/master/slave.h	Thu Feb 23 09:58:50 2006 +0000
@@ -15,12 +15,68 @@
 
 /*****************************************************************************/
 
-// ec_slave_t ist in EtherCAT_rt.h ...
+/**
+   FMMU-Konfiguration.
+*/
+
+typedef struct
+{
+    const ec_domain_t *domain;
+    const ec_sync_t *sync;
+    uint32_t logical_start_address;
+}
+ec_fmmu_t;
 
 /*****************************************************************************/
 
-// Slave construction and deletion
-void ec_slave_init(ec_slave_t *);
+/**
+   EtherCAT-Slave
+*/
+
+struct ec_slave
+{
+    ec_master_t *master; /**< EtherCAT-Master, zu dem der Slave gehört. */
+
+    // Addresses
+    uint16_t ring_position; /**< Position des Slaves im Bus */
+    uint16_t station_address; /**< Konfigurierte Slave-Adresse */
+
+    // Base data
+    uint8_t base_type; /**< Slave-Typ */
+    uint8_t base_revision; /**< Revision */
+    uint16_t base_build; /**< Build-Nummer */
+    uint16_t base_fmmu_count; /**< Anzahl unterstützter FMMUs */
+    uint16_t base_sync_count; /**< Anzahl unterstützter Sync-Manager */
+
+    // Slave information interface
+    uint32_t sii_vendor_id; /**< Identifikationsnummer des Herstellers */
+    uint32_t sii_product_code; /**< Herstellerspezifischer Produktcode */
+    uint32_t sii_revision_number; /**< Revisionsnummer */
+    uint32_t sii_serial_number; /**< Seriennummer der Klemme */
+
+    const ec_slave_type_t *type; /**< Zeiger auf die Beschreibung
+                                    des Slave-Typs */
+
+    uint8_t registered; /**< Der Slave wurde registriert */
+
+    ec_fmmu_t fmmus[EC_MAX_FMMUS]; /**< FMMU-Konfigurationen */
+    uint8_t fmmu_count; /**< Wieviele FMMUs schon benutzt sind. */
+};
+
+/*****************************************************************************/
+
+// Slave construction/destruction
+void ec_slave_init(ec_slave_t *, ec_master_t *);
+void ec_slave_clear(ec_slave_t *);
+
+// Slave control
+int ec_slave_fetch(ec_slave_t *);
+int ec_slave_sii_read(ec_slave_t *, unsigned short, unsigned int *);
+int ec_slave_state_change(ec_slave_t *, uint8_t);
+int ec_slave_set_fmmu(ec_slave_t *, const ec_domain_t *, const ec_sync_t *);
+
+// Misc
+void ec_slave_print(const ec_slave_t *);
 
 /*****************************************************************************/
 
@@ -28,6 +84,6 @@
 
 /* Emacs-Konfiguration
 ;;; Local Variables: ***
-;;; c-basic-offset:2 ***
+;;; c-basic-offset:4 ***
 ;;; End: ***
 */