drivers/ec_slave.h
changeset 0 05c992bf5847
child 5 6f2508af550c
equal deleted inserted replaced
-1:000000000000 0:05c992bf5847
       
     1 /****************************************************************
       
     2  *
       
     3  *  e c _ s l a v e . h
       
     4  *
       
     5  *  Struktur für einen EtherCAT-Slave.
       
     6  *
       
     7  *  $Date$
       
     8  *  $Author$
       
     9  *
       
    10  ***************************************************************/
       
    11 
       
    12 #ifndef _EC_SLAVE_H_
       
    13 #define _EC_SLAVE_H_
       
    14 
       
    15 #include "ec_types.h"
       
    16 
       
    17 /***************************************************************/
       
    18 
       
    19 /**
       
    20    EtherCAT-Slave
       
    21 */
       
    22 
       
    23 typedef struct
       
    24 {
       
    25   // Base data
       
    26   unsigned char type; /**< Slave-Typ */
       
    27   unsigned char revision; /**< Revision */
       
    28   unsigned short build; /**< Build-Nummer */
       
    29 
       
    30   // Addresses
       
    31   short ring_position; /**< (Negative) Position des Slaves im Bus */
       
    32   unsigned short station_address; /**< Konfigurierte Slave-Adresse */
       
    33 
       
    34   // Slave information interface
       
    35   unsigned int vendor_id; /**< Identifikationsnummer des Herstellers */
       
    36   unsigned int product_code; /**< Herstellerspezifischer Produktcode */
       
    37   unsigned int revision_number; /**< Revisionsnummer */
       
    38 
       
    39   const EtherCAT_slave_desc_t *desc; /**< Zeiger auf die Beschreibung
       
    40                                         des Slave-Typs */
       
    41 
       
    42   unsigned int logical_address0; /**< Konfigurierte, logische adresse */
       
    43 
       
    44   EtherCAT_state_t current_state; /**< Aktueller Zustand */
       
    45   EtherCAT_state_t requested_state; /**< Angeforderter Zustand */
       
    46 
       
    47   unsigned char *process_data; /**< Zeiger auf den Speicherbereich
       
    48                                   im Prozessdatenspeicher des Masters */
       
    49 }
       
    50 EtherCAT_slave_t;
       
    51 
       
    52 #define ECAT_INIT_SLAVE(TYPE) {0, 0, 0, 0, 0, 0, 0, 0, \
       
    53                                TYPE, 0, ECAT_STATE_UNKNOWN, \
       
    54                                ECAT_STATE_UNKNOWN, NULL}
       
    55 
       
    56 /***************************************************************/
       
    57 
       
    58 // Slave construction and deletion
       
    59 void EtherCAT_slave_init(EtherCAT_slave_t *);
       
    60 void EtherCAT_slave_clear(EtherCAT_slave_t *);
       
    61 
       
    62 int EtherCAT_read_value(EtherCAT_slave_t *, unsigned int);
       
    63 void EtherCAT_write_value(EtherCAT_slave_t *, unsigned int, int);
       
    64 
       
    65 /***************************************************************/
       
    66 
       
    67 #endif