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@54: #include "device.h" fp@54: #include "slave.h" fp@73: #include "frame.h" fp@54: #include "domain.h" fp@0: fp@39: /*****************************************************************************/ fp@0: fp@0: /** 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@73: ec_device_t device; /**< EtherCAT-Gerät */ fp@73: unsigned int device_registered; /**< Ein Geraet hat sich registriert. */ fp@73: uint8_t command_index; /**< Aktueller Kommando-Index */ fp@73: ec_domain_t *domains[EC_MASTER_MAX_DOMAINS]; /** Prozessdatendomänen */ fp@73: unsigned int domain_count; fp@73: int debug_level; /**< Debug-Level im Master-Code */ fp@73: unsigned int bus_time; /**< Letzte Bus-Zeit in Mikrosekunden */ fp@73: unsigned int frames_lost; /**< Anzahl verlorene Frames */ fp@73: unsigned long t_lost_output; /*<< Timer-Ticks bei der letzten Ausgabe von fp@73: verlorenen Frames */ 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@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@54: int ec_scan_for_slaves(ec_master_t *); fp@68: ec_slave_t *ec_address(const ec_master_t *, const char *); fp@0: fp@73: // Misc fp@73: void ec_output_debug_data(const ec_master_t *); fp@73: void ec_output_lost_frames(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: */