master/master.h
changeset 73 9f4ea66d89a3
parent 68 a452700db994
child 74 9bf603942791
equal deleted inserted replaced
72:7c986b717411 73:9f4ea66d89a3
    11 #ifndef _EC_MASTER_H_
    11 #ifndef _EC_MASTER_H_
    12 #define _EC_MASTER_H_
    12 #define _EC_MASTER_H_
    13 
    13 
    14 #include "device.h"
    14 #include "device.h"
    15 #include "slave.h"
    15 #include "slave.h"
    16 #include "command.h"
    16 #include "frame.h"
    17 #include "domain.h"
    17 #include "domain.h"
    18 
    18 
    19 /*****************************************************************************/
    19 /*****************************************************************************/
    20 
    20 
    21 /**
    21 /**
    25    dem zugewiesenen EtherCAT-Gerät.
    25    dem zugewiesenen EtherCAT-Gerät.
    26 */
    26 */
    27 
    27 
    28 struct ec_master
    28 struct ec_master
    29 {
    29 {
    30   ec_slave_t *bus_slaves; /**< Array von Slaves auf dem Bus */
    30     ec_slave_t *slaves; /**< Array von Slaves auf dem Bus */
    31   unsigned int bus_slaves_count; /**< Anzahl Slaves auf dem Bus */
    31     unsigned int slave_count; /**< Anzahl Slaves auf dem Bus */
    32   ec_device_t device; /**< EtherCAT-Gerät */
    32     ec_device_t device; /**< EtherCAT-Gerät */
    33   unsigned int device_registered; /**< Ein Geraet hat sich registriert. */
    33     unsigned int device_registered; /**< Ein Geraet hat sich registriert. */
    34   unsigned char command_index; /**< Aktueller Kommando-Index */
    34     uint8_t command_index; /**< Aktueller Kommando-Index */
    35   unsigned char tx_data[EC_FRAME_SIZE]; /**< Statischer Speicher
    35     ec_domain_t *domains[EC_MASTER_MAX_DOMAINS]; /** Prozessdatendomänen */
    36                                            für zu sendende Daten */
    36     unsigned int domain_count;
    37   unsigned int tx_data_length; /**< Länge der Daten im Sendespeicher */
    37     int debug_level; /**< Debug-Level im Master-Code */
    38   unsigned char rx_data[EC_FRAME_SIZE]; /**< Statische Speicher für
    38     unsigned int bus_time; /**< Letzte Bus-Zeit in Mikrosekunden */
    39                                            eine Kopie des Rx-Buffers
    39     unsigned int frames_lost; /**< Anzahl verlorene Frames */
    40                                            im EtherCAT-Gerät */
    40     unsigned long t_lost_output; /*<< Timer-Ticks bei der letzten Ausgabe von
    41   unsigned int rx_data_length; /**< Länge der Daten im Empfangsspeicher */
    41                                    verlorenen Frames */
    42   ec_domain_t domains[EC_MAX_DOMAINS]; /** Prozessdatendomänen */
       
    43   unsigned int domain_count;
       
    44   int debug_level; /**< Debug-Level im Master-Code */
       
    45   unsigned int bus_time; /**< Letzte Bus-Zeit in Mikrosekunden */
       
    46   unsigned int frames_lost; /**< Anzahl verlorene Frames */
       
    47   unsigned long t_lost_output; /*<< Timer-Ticks bei der letzten Ausgabe von
       
    48                                  verlorenen Frames */
       
    49 };
    42 };
    50 
    43 
    51 /*****************************************************************************/
    44 /*****************************************************************************/
    52 
    45 
    53 // Master creation and deletion
    46 // Master creation and deletion
    61 
    54 
    62 // Slave management
    55 // Slave management
    63 int ec_scan_for_slaves(ec_master_t *);
    56 int ec_scan_for_slaves(ec_master_t *);
    64 ec_slave_t *ec_address(const ec_master_t *, const char *);
    57 ec_slave_t *ec_address(const ec_master_t *, const char *);
    65 
    58 
    66 // Data
    59 // Misc
    67 int ec_simple_send_receive(ec_master_t *, ec_command_t *);
    60 void ec_output_debug_data(const ec_master_t *);
       
    61 void ec_output_lost_frames(ec_master_t *);
    68 
    62 
    69 /*****************************************************************************/
    63 /*****************************************************************************/
    70 
    64 
    71 #endif
    65 #endif
    72 
    66 
    73 /* Emacs-Konfiguration
    67 /* Emacs-Konfiguration
    74 ;;; Local Variables: ***
    68 ;;; Local Variables: ***
    75 ;;; c-basic-offset:2 ***
    69 ;;; c-basic-offset:4 ***
    76 ;;; End: ***
    70 ;;; End: ***
    77 */
    71 */