fp@39: /****************************************************************************** fp@0: * fp@54: * d e v i c e . h fp@0: * fp@0: * Struktur für ein EtherCAT-Gerät. fp@0: * fp@39: * $Id$ fp@0: * fp@39: *****************************************************************************/ fp@0: fp@0: #ifndef _EC_DEVICE_H_ fp@0: #define _EC_DEVICE_H_ fp@0: fp@25: #include fp@25: fp@78: #include "../include/EtherCAT_rt.h" fp@78: #include "../include/EtherCAT_dev.h" fp@54: #include "globals.h" fp@0: fp@39: /*****************************************************************************/ fp@0: fp@0: /** fp@0: EtherCAT-Gerät. fp@0: fp@0: Ein EtherCAT-Gerät ist eine Netzwerkkarte, die vom fp@0: EtherCAT-Master dazu verwendet wird, um Frames zu senden fp@0: und zu empfangen. fp@0: */ fp@0: fp@54: struct ec_device fp@0: { fp@78: ec_master_t *master; /**< EtherCAT-Master */ fp@73: struct net_device *dev; /**< Zeiger auf das reservierte net_device */ fp@78: uint8_t open; /**< Das net_device ist geoeffnet. */ fp@73: struct sk_buff *tx_skb; /**< Zeiger auf Transmit-Socketbuffer */ fp@73: unsigned long tx_time; /**< Zeit des letzten Sendens */ fp@73: unsigned long rx_time; /**< Zeit des letzten Empfangs */ fp@78: ec_device_state_t state; /**< Zustand des Gerätes */ fp@73: uint8_t rx_data[EC_MAX_FRAME_SIZE]; /**< Speicher für empfangene Rahmen */ fp@78: size_t rx_data_size; /**< Länge des empfangenen Rahmens */ fp@73: irqreturn_t (*isr)(int, void *, struct pt_regs *); /**< Adresse der ISR */ fp@73: struct module *module; /**< Zeiger auf das Modul, das das Gerät zur fp@73: Verfügung stellt. */ fp@78: uint8_t error_reported; /**< Zeigt an, ob ein Fehler im zyklischen Code fp@78: bereits gemeldet wurde. */ fp@54: }; fp@0: fp@39: /*****************************************************************************/ fp@0: fp@78: int ec_device_init(ec_device_t *, ec_master_t *); fp@54: void ec_device_clear(ec_device_t *); fp@78: fp@54: int ec_device_open(ec_device_t *); fp@54: int ec_device_close(ec_device_t *); fp@78: fp@54: void ec_device_call_isr(ec_device_t *); fp@73: uint8_t *ec_device_prepare(ec_device_t *); fp@78: void ec_device_send(ec_device_t *, size_t); fp@73: unsigned int ec_device_received(const ec_device_t *); fp@73: uint8_t *ec_device_data(ec_device_t *); fp@0: fp@78: void ec_device_debug(const ec_device_t *); fp@78: void ec_data_print(const uint8_t *, size_t); fp@78: void ec_data_print_diff(const uint8_t *, const uint8_t *, size_t); fp@78: fp@39: /*****************************************************************************/ fp@0: fp@0: #endif fp@73: fp@73: /* Emacs-Konfiguration fp@73: ;;; Local Variables: *** fp@73: ;;; c-basic-offset:4 *** fp@73: ;;; End: *** fp@73: */