IgH EtherCAT Master  1.6.2
slave_config.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * Copyright (C) 2006-2024 Florian Pose, Ingenieurgemeinschaft IgH
4  *
5  * This file is part of the IgH EtherCAT Master.
6  *
7  * The IgH EtherCAT Master is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License version 2, as
9  * published by the Free Software Foundation.
10  *
11  * The IgH EtherCAT Master is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
14  * Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with the IgH EtherCAT Master; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  *
20  ****************************************************************************/
21 
27 /****************************************************************************/
28 
29 #ifndef __EC_SLAVE_CONFIG_H__
30 #define __EC_SLAVE_CONFIG_H__
31 
32 #include <linux/list.h>
33 
34 #include "globals.h"
35 #include "slave.h"
36 #include "sync_config.h"
37 #include "fmmu_config.h"
38 #include "coe_emerg_ring.h"
39 #include "flag.h"
40 
41 /****************************************************************************/
42 
54 #define EC_CONFIG_INFO(sc, fmt, args...) \
55  printk(KERN_INFO "EtherCAT %u %u:%u: " fmt, sc->master->index, \
56  sc->alias, sc->position, ##args)
57 
68 #define EC_CONFIG_ERR(sc, fmt, args...) \
69  printk(KERN_ERR "EtherCAT ERROR %u %u:%u: " fmt, sc->master->index, \
70  sc->alias, sc->position, ##args)
71 
82 #define EC_CONFIG_WARN(sc, fmt, args...) \
83  printk(KERN_WARNING "EtherCAT WARNING %u %u:%u: " fmt, \
84  sc->master->index, sc->alias, sc->position, ##args)
85 
99 #define EC_CONFIG_DBG(sc, level, fmt, args...) \
100  do { \
101  if (sc->master->debug_level >= level) { \
102  printk(KERN_DEBUG "EtherCAT DEBUG %u %u:%u: " fmt, \
103  sc->master->index, sc->alias, sc->position, ##args); \
104  } \
105  } while (0)
106 
107 /****************************************************************************/
108 
112  struct list_head list;
115  uint16_t alias;
116  uint16_t position;
118  uint32_t vendor_id;
119  uint32_t product_code;
121  uint16_t watchdog_divider;
132  uint8_t used_fmmus;
136  struct list_head sdo_configs;
137  struct list_head sdo_requests;
138  struct list_head soe_requests;
139  struct list_head voe_handlers;
140  struct list_head reg_requests;
141  struct list_head soe_configs;
142  struct list_head flags;
143  struct list_head al_timeouts;
145 #ifdef EC_EOE
147 #endif
148 
150 };
151 
152 /****************************************************************************/
153 
155  uint16_t, uint32_t, uint32_t);
157 
160 
162 
163 unsigned int ec_slave_config_sdo_count(const ec_slave_config_t *);
165  const ec_slave_config_t *, unsigned int);
166 unsigned int ec_slave_config_idn_count(const ec_slave_config_t *);
168  const ec_slave_config_t *, unsigned int);
169 unsigned int ec_slave_config_flag_count(const ec_slave_config_t *);
171  const ec_slave_config_t *, unsigned int);
173  unsigned int);
175  unsigned int);
177  unsigned int);
179  unsigned int);
181 
183  ec_slave_config_t *, uint16_t, uint8_t, size_t);
185  ec_slave_config_t *, uint8_t, uint16_t, size_t);
187  ec_slave_config_t *, size_t);
189  ec_slave_config_t *, size_t);
190 
191 unsigned int ec_slave_config_al_timeout(const ec_slave_config_t *,
193 
194 /****************************************************************************/
195 
196 #endif
void ec_slave_config_init(ec_slave_config_t *, ec_master_t *, uint16_t, uint16_t, uint32_t, uint32_t)
Slave configuration constructor.
Definition: slave_config.c:72
struct list_head sdo_configs
List of SDO configurations.
Definition: slave_config.h:136
ec_soe_request_t * ecrt_slave_config_create_soe_request_err(ec_slave_config_t *, uint8_t, uint16_t, size_t)
Same as ecrt_slave_config_create_soe_request(), but with ERR_PTR() return value.
ec_reg_request_t * ec_slave_config_find_reg_request(ec_slave_config_t *, unsigned int)
Finds a register handler via its position in the list.
Definition: slave_config.c:594
FMMU configuration.
Definition: fmmu_config.h:38
const ec_flag_t * ec_slave_config_get_flag_by_pos_const(const ec_slave_config_t *, unsigned int)
Finds a flag via its position in the list.
Definition: slave_config.c:528
void ec_slave_config_load_default_sync_config(ec_slave_config_t *)
Loads the default PDO assignment from the slave object.
Definition: slave_config.c:337
unsigned int ec_slave_config_idn_count(const ec_slave_config_t *)
Get the number of IDN configurations.
Definition: slave_config.c:462
CANopen SDO request.
Definition: sdo_request.h:40
EtherCAT slave structure.
Register request.
Definition: reg_request.h:40
unsigned int ec_slave_config_sdo_count(const ec_slave_config_t *)
Get the number of SDO configurations.
Definition: slave_config.c:418
uint8_t used_fmmus
Number of FMMUs used.
Definition: slave_config.h:132
uint32_t product_code
Slave product code.
Definition: slave_config.h:119
uint16_t position
Index after alias.
Definition: slave_config.h:116
struct list_head list
List item.
Definition: slave_config.h:112
ec_master_t * master
Master owning the slave configuration.
Definition: slave_config.h:113
EtherCAT CoE emergency ring buffer structure.
uint16_t alias
Slave alias.
Definition: slave_config.h:115
ec_eoe_request_t eoe_ip_param_request
EoE IP parameters.
Definition: slave_config.h:146
EtherCAT CoE emergency ring buffer.
#define EC_MAX_FMMUS
Maximum number of FMMUs per slave.
Definition: globals.h:92
Global definitions and macros.
ec_fmmu_config_t fmmu_configs[EC_MAX_FMMUS]
FMMU configurations.
Definition: slave_config.h:131
ec_sync_signal_t dc_sync[EC_SYNC_SIGNAL_COUNT]
DC sync signals.
Definition: slave_config.h:134
struct list_head al_timeouts
List of specific AL state timeouts.
Definition: slave_config.h:143
struct list_head flags
List of feature flags.
Definition: slave_config.h:142
EtherCAT slave.
Definition: slave.h:168
ec_voe_handler_t * ec_slave_config_find_voe_handler(ec_slave_config_t *, unsigned int)
Finds a VoE handler via its position in the list.
Definition: slave_config.c:616
ec_sync_config_t sync_configs[EC_MAX_SYNC_MANAGERS]
Sync manager configurations.
Definition: slave_config.h:129
struct list_head reg_requests
List of register requests.
Definition: slave_config.h:140
Slave configutation feature flag.
Definition: flag.h:38
struct list_head sdo_requests
List of SDO requests.
Definition: slave_config.h:137
ec_sdo_request_t * ecrt_slave_config_create_sdo_request_err(ec_slave_config_t *, uint16_t, uint8_t, size_t)
Same as ecrt_slave_config_create_sdo_request(), but with ERR_PTR() return value.
EtherCAT Slave Configuration Feature Flag.
struct list_head voe_handlers
List of VoE handlers.
Definition: slave_config.h:139
const ec_sdo_request_t * ec_slave_config_get_sdo_by_pos_const(const ec_slave_config_t *, unsigned int)
Finds an SDO configuration via its position in the list.
Definition: slave_config.c:440
uint16_t dc_assign_activate
Vendor-specific AssignActivate word.
Definition: slave_config.h:133
ec_soe_request_t * ec_slave_config_find_soe_request(ec_slave_config_t *, unsigned int)
Finds a SoE request via its position in the list.
Definition: slave_config.c:572
uint16_t watchdog_intervals
Process data watchdog intervals (see spec.
Definition: slave_config.h:123
Vendor specific over EtherCAT handler.
Definition: voe_handler.h:41
struct list_head soe_requests
List of SoE requests.
Definition: slave_config.h:138
EtherCAT sync manager.
ec_slave_state_t
State of an EtherCAT slave.
Definition: globals.h:121
EtherCAT FMMU configuration structure.
ec_slave_t * slave
Slave pointer.
Definition: slave_config.h:126
uint16_t watchdog_divider
Watchdog divider as a number of 40ns intervals (see spec.
Definition: slave_config.h:121
ec_voe_handler_t * ecrt_slave_config_create_voe_handler_err(ec_slave_config_t *, size_t)
Same as ecrt_slave_config_create_voe_handler(), but with ERR_PTR() return value.
ec_reg_request_t * ecrt_slave_config_create_reg_request_err(ec_slave_config_t *, size_t)
Same as ecrt_slave_config_create_reg_request(), but with ERR_PTR() return value.
void ec_slave_config_clear(ec_slave_config_t *)
Slave configuration destructor.
Definition: slave_config.c:126
struct list_head soe_configs
List of SoE configurations.
Definition: slave_config.h:141
Ethernet-over-EtherCAT set IP parameter request.
Definition: eoe_request.h:41
unsigned int ec_slave_config_flag_count(const ec_slave_config_t *)
Get the number of feature flags.
Definition: slave_config.c:506
int ec_slave_config_attach(ec_slave_config_t *)
Attaches the configuration to the addressed slave object.
Definition: slave_config.c:254
ec_coe_emerg_ring_t emerg_ring
CoE emergency ring buffer.
Definition: slave_config.h:149
Sync manager configuration.
Definition: sync_config.h:38
EtherCAT slave sync signal configuration.
Definition: globals.h:180
uint32_t vendor_id
Slave vendor ID.
Definition: slave_config.h:118
ec_sdo_request_t * ec_slave_config_find_sdo_request(ec_slave_config_t *, unsigned int)
Finds a CoE SDO request via its position in the list.
Definition: slave_config.c:550
const ec_soe_request_t * ec_slave_config_get_idn_by_pos_const(const ec_slave_config_t *, unsigned int)
Finds an IDN configuration via its position in the list.
Definition: slave_config.c:484
void ec_slave_config_detach(ec_slave_config_t *)
Detaches the configuration from a slave object.
Definition: slave_config.c:312
EtherCAT slave configuration.
Definition: slave_config.h:111
EtherCAT master.
Definition: master.h:187
#define EC_MAX_SYNC_MANAGERS
Maximum number of sync managers per slave.
Definition: ecrt.h:267
ec_flag_t * ec_slave_config_find_flag(ec_slave_config_t *, const char *)
Finds a flag.
Definition: slave_config.c:638
#define EC_SYNC_SIGNAL_COUNT
Number of DC sync signals.
Definition: globals.h:98
Sercos-over-EtherCAT request.
Definition: soe_request.h:40
unsigned int ec_slave_config_al_timeout(const ec_slave_config_t *, ec_slave_state_t, ec_slave_state_t)
Return an AL state timeout.
Definition: slave_config.c:661