drivers/ec_master.h
changeset 17 1b5aea4d5147
parent 14 28b57b073f58
child 19 a51289e6cb2d
equal deleted inserted replaced
16:f04e93b8af0f 17:1b5aea4d5147
    29 {
    29 {
    30   EtherCAT_slave_t *slaves; /**< Zeiger auf statischen Speicher
    30   EtherCAT_slave_t *slaves; /**< Zeiger auf statischen Speicher
    31                                mit Slave-Informationen */
    31                                mit Slave-Informationen */
    32   unsigned int slave_count; /**< Anzahl der Slaves in slaves */
    32   unsigned int slave_count; /**< Anzahl der Slaves in slaves */
    33 
    33 
    34 #if 0
       
    35   EtherCAT_command_t *first_command; /**< Zeiger auf das erste
       
    36                                         Kommando in der Liste */
       
    37 #endif
       
    38   EtherCAT_command_t process_data_command; /**< Kommando zum Senden und
    34   EtherCAT_command_t process_data_command; /**< Kommando zum Senden und
    39                                               Empfangen der Prozessdaten */
    35                                               Empfangen der Prozessdaten */
    40 
    36 
    41   EtherCAT_device_t *dev; /**< Zeiger auf das zugewiesene EtherCAT-Gerät */
    37   EtherCAT_device_t *dev; /**< Zeiger auf das zugewiesene EtherCAT-Gerät */
    42 
    38 
    50                                                     im EtherCAT-Gerät */
    46                                                     im EtherCAT-Gerät */
    51 
    47 
    52   unsigned char *process_data; /**< Zeiger auf Speicher mit Prozessdaten */
    48   unsigned char *process_data; /**< Zeiger auf Speicher mit Prozessdaten */
    53   unsigned int process_data_length; /**< Länge der Prozessdaten */
    49   unsigned int process_data_length; /**< Länge der Prozessdaten */
    54 
    50 
    55 #if 0
       
    56   EtherCAT_command_t cmd_ring[ECAT_COMMAND_RING_SIZE]; /**< Statischer Kommandoring */
       
    57   int cmd_reserved[ECAT_COMMAND_RING_SIZE]; /**< Reservierungsflags für die Kommandos */
       
    58   unsigned int cmd_ring_index; /**< Index des nächsten Kommandos im Ring */
       
    59 #endif
       
    60 
       
    61   int debug_level; /**< Debug-Level im Master-Code */
    51   int debug_level; /**< Debug-Level im Master-Code */
    62 }
    52 }
    63 EtherCAT_master_t;
    53 EtherCAT_master_t;
    64 
    54 
    65 /***************************************************************/
    55 /***************************************************************/
    66 
    56 
    67 // Master creation and deletion
    57 // Master creation and deletion
    68 int EtherCAT_master_init(EtherCAT_master_t *, EtherCAT_device_t *);
    58 int EtherCAT_master_init(EtherCAT_master_t *, EtherCAT_device_t *);
    69 void EtherCAT_master_clear(EtherCAT_master_t *);
    59 void EtherCAT_master_clear(EtherCAT_master_t *);
    70 
    60 
       
    61 // Sending and receiving
       
    62 int EtherCAT_simple_send_receive(EtherCAT_master_t *, EtherCAT_command_t *);
       
    63 int EtherCAT_simple_send(EtherCAT_master_t *, EtherCAT_command_t *);
       
    64 int EtherCAT_simple_receive(EtherCAT_master_t *, EtherCAT_command_t *);
       
    65 
    71 // Slave management
    66 // Slave management
    72 int EtherCAT_check_slaves(EtherCAT_master_t *, EtherCAT_slave_t *, unsigned int);
    67 int EtherCAT_check_slaves(EtherCAT_master_t *, EtherCAT_slave_t *, unsigned int);
    73 void EtherCAT_clear_slaves(EtherCAT_master_t *);
    68 void EtherCAT_clear_slaves(EtherCAT_master_t *);
       
    69 int EtherCAT_read_slave_information(EtherCAT_master_t *,
       
    70                                     unsigned short int,
       
    71                                     unsigned short int,
       
    72                                     unsigned int *);
    74 int EtherCAT_activate_slave(EtherCAT_master_t *, EtherCAT_slave_t *);
    73 int EtherCAT_activate_slave(EtherCAT_master_t *, EtherCAT_slave_t *);
    75 int EtherCAT_deactivate_slave(EtherCAT_master_t *, EtherCAT_slave_t *);
    74 int EtherCAT_deactivate_slave(EtherCAT_master_t *, EtherCAT_slave_t *);
    76 int EtherCAT_activate_all_slaves(EtherCAT_master_t *);
    75 int EtherCAT_activate_all_slaves(EtherCAT_master_t *);
    77 int EtherCAT_deactivate_all_slaves(EtherCAT_master_t *);
    76 int EtherCAT_deactivate_all_slaves(EtherCAT_master_t *);
       
    77 int EtherCAT_state_change(EtherCAT_master_t *, EtherCAT_slave_t *, unsigned char);
    78 
    78 
    79 // Sending and receiving
    79 // Process data
    80 #if 0
       
    81 int EtherCAT_async_send_receive(EtherCAT_master_t *);
       
    82 int EtherCAT_send(EtherCAT_master_t *);
       
    83 int EtherCAT_receive(EtherCAT_master_t *);
       
    84 #endif
       
    85 int EtherCAT_simple_send_receive(EtherCAT_master_t *, EtherCAT_command_t *);
       
    86 int EtherCAT_simple_send(EtherCAT_master_t *, EtherCAT_command_t *);
       
    87 int EtherCAT_simple_receive(EtherCAT_master_t *, EtherCAT_command_t *);
       
    88 
       
    89 int EtherCAT_write_process_data(EtherCAT_master_t *);
    80 int EtherCAT_write_process_data(EtherCAT_master_t *);
    90 int EtherCAT_read_process_data(EtherCAT_master_t *);
    81 int EtherCAT_read_process_data(EtherCAT_master_t *);
    91 void EtherCAT_clear_process_data(EtherCAT_master_t *);
    82 void EtherCAT_clear_process_data(EtherCAT_master_t *);
    92 
    83 
    93 /***************************************************************/
       
    94 
       
    95 // Slave information interface
       
    96 int EtherCAT_read_slave_information(EtherCAT_master_t *,
       
    97                                     unsigned short int,
       
    98                                     unsigned short int,
       
    99                                     unsigned int *);
       
   100 
       
   101 // EtherCAT commands
       
   102 #if 0
       
   103 EtherCAT_command_t *EtherCAT_read(EtherCAT_master_t *,
       
   104                                   unsigned short,
       
   105                                   unsigned short,
       
   106                                   unsigned int);
       
   107 EtherCAT_command_t *EtherCAT_write(EtherCAT_master_t *,
       
   108                                    unsigned short,
       
   109                                    unsigned short,
       
   110                                    unsigned int,
       
   111                                    const unsigned char *);
       
   112 EtherCAT_command_t *EtherCAT_position_read(EtherCAT_master_t *,
       
   113                                            short,
       
   114                                            unsigned short,
       
   115                                            unsigned int);
       
   116 EtherCAT_command_t *EtherCAT_position_write(EtherCAT_master_t *,
       
   117                                             short,
       
   118                                             unsigned short,
       
   119                                             unsigned int,
       
   120                                             const unsigned char *);
       
   121 EtherCAT_command_t *EtherCAT_broadcast_read(EtherCAT_master_t *,
       
   122                                             unsigned short,
       
   123                                             unsigned int);
       
   124 EtherCAT_command_t *EtherCAT_broadcast_write(EtherCAT_master_t *,
       
   125                                              unsigned short,
       
   126                                              unsigned int,
       
   127                                              const unsigned char *);
       
   128 EtherCAT_command_t *EtherCAT_logical_read_write(EtherCAT_master_t *,
       
   129                                                 unsigned int,
       
   130                                                 unsigned int,
       
   131                                                 unsigned char *);
       
   132 
       
   133 void EtherCAT_remove_command(EtherCAT_master_t *, EtherCAT_command_t *);
       
   134 #endif
       
   135 
       
   136 // Slave states
       
   137 int EtherCAT_state_change(EtherCAT_master_t *, EtherCAT_slave_t *, unsigned char);
       
   138 
       
   139 /***************************************************************/
       
   140 
       
   141 // Private functions
    84 // Private functions
   142 #if 0
       
   143 EtherCAT_command_t *alloc_cmd(EtherCAT_master_t *);
       
   144 int add_command(EtherCAT_master_t *, EtherCAT_command_t *);
       
   145 #endif
       
   146 void set_byte(unsigned char *, unsigned int, unsigned char);
    85 void set_byte(unsigned char *, unsigned int, unsigned char);
   147 void set_word(unsigned char *, unsigned int, unsigned int);
    86 void set_word(unsigned char *, unsigned int, unsigned int);
   148 void output_debug_data(unsigned char *, unsigned int);
    87 void output_debug_data(unsigned char *, unsigned int);
   149 
    88 
   150 /***************************************************************/
    89 /***************************************************************/