fp@39: /****************************************************************************** fp@0: * fp@54: * m a s t e r . h fp@0: * fp@0: * Struktur für einen EtherCAT-Master. fp@0: * fp@39: * $Id$ fp@0: * fp@39: *****************************************************************************/ fp@0: fp@0: #ifndef _EC_MASTER_H_ fp@0: #define _EC_MASTER_H_ fp@0: fp@95: #include fp@95: fp@54: #include "device.h" fp@54: #include "slave.h" fp@54: #include "domain.h" fp@0: fp@39: /*****************************************************************************/ fp@0: fp@0: /** fp@98: EtherCAT-Rahmen-Statistiken. fp@98: */ fp@98: fp@98: typedef struct fp@98: { fp@98: unsigned int timeouts; /**< Kommando-Timeouts */ fp@98: unsigned int delayed; /**< Verzögerte Kommandos */ fp@98: unsigned int corrupted; /**< Verfälschte Rahmen */ fp@98: unsigned int unmatched; /**< Unpassende Kommandos */ fp@98: cycles_t t_last; /**< Timestamp-Counter bei der letzten Ausgabe */ fp@98: } fp@98: ec_stats_t; fp@98: fp@98: /*****************************************************************************/ fp@98: fp@98: /** fp@0: EtherCAT-Master fp@0: fp@0: Verwaltet die EtherCAT-Slaves und kommuniziert mit fp@0: dem zugewiesenen EtherCAT-Gerät. fp@0: */ fp@0: fp@55: struct ec_master fp@0: { fp@73: ec_slave_t *slaves; /**< Array von Slaves auf dem Bus */ fp@73: unsigned int slave_count; /**< Anzahl Slaves auf dem Bus */ fp@98: ec_device_t *device; /**< EtherCAT-Gerät */ fp@98: struct list_head commands; /**< Kommando-Liste */ fp@73: uint8_t command_index; /**< Aktueller Kommando-Index */ fp@95: struct list_head domains; /**< Liste der Prozessdatendomänen */ fp@130: ec_command_t watch_command; /**< Kommando zum Überwachen der Slaves */ fp@130: unsigned int slaves_responding; /**< Anzahl antwortender Slaves */ fp@130: ec_slave_state_t slave_states; /**< Zustände der antwortenden Slaves */ fp@73: int debug_level; /**< Debug-Level im Master-Code */ fp@98: ec_stats_t stats; /**< Rahmen-Statistiken */ fp@106: unsigned int timeout; /**< Timeout für synchronen Datenaustausch */ fp@55: }; fp@0: fp@39: /*****************************************************************************/ fp@0: fp@0: // Master creation and deletion fp@54: void ec_master_init(ec_master_t *); fp@54: void ec_master_clear(ec_master_t *); fp@56: void ec_master_reset(ec_master_t *); fp@98: fp@98: // IO fp@98: void ec_master_receive(ec_master_t *, const uint8_t *, size_t); fp@98: void ec_master_queue_command(ec_master_t *, ec_command_t *); fp@98: int ec_master_simple_io(ec_master_t *, ec_command_t *); fp@0: fp@27: // Registration of devices fp@54: int ec_master_open(ec_master_t *); fp@54: void ec_master_close(ec_master_t *); fp@17: fp@0: // Slave management fp@98: int ec_master_bus_scan(ec_master_t *); fp@0: fp@73: // Misc fp@98: void ec_master_debug(const ec_master_t *); fp@98: void ec_master_output_stats(ec_master_t *); fp@64: fp@39: /*****************************************************************************/ fp@0: fp@0: #endif fp@42: fp@42: /* Emacs-Konfiguration fp@42: ;;; Local Variables: *** fp@73: ;;; c-basic-offset:4 *** fp@42: ;;; End: *** fp@42: */