IgH EtherCAT Master  1.5.3
slave_config.h
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * Copyright (C) 2006-2023 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  *
22  * The license mentioned above concerns the source code only. Using the
23  * EtherCAT technology and brand is only permitted in compliance with the
24  * industrial property and similar rights of Beckhoff Automation GmbH.
25  *
26  *****************************************************************************/
27 
33 /*****************************************************************************/
34 
35 #ifndef __EC_SLAVE_CONFIG_H__
36 #define __EC_SLAVE_CONFIG_H__
37 
38 #include <linux/list.h>
39 
40 #include "globals.h"
41 #include "slave.h"
42 #include "sync_config.h"
43 #include "fmmu_config.h"
44 #include "coe_emerg_ring.h"
45 #include "flag.h"
46 
47 /*****************************************************************************/
48 
60 #define EC_CONFIG_INFO(sc, fmt, args...) \
61  printk(KERN_INFO "EtherCAT %u %u:%u: " fmt, sc->master->index, \
62  sc->alias, sc->position, ##args)
63 
74 #define EC_CONFIG_ERR(sc, fmt, args...) \
75  printk(KERN_ERR "EtherCAT ERROR %u %u:%u: " fmt, sc->master->index, \
76  sc->alias, sc->position, ##args)
77 
88 #define EC_CONFIG_WARN(sc, fmt, args...) \
89  printk(KERN_WARNING "EtherCAT WARNING %u %u:%u: " fmt, \
90  sc->master->index, sc->alias, sc->position, ##args)
91 
105 #define EC_CONFIG_DBG(sc, level, fmt, args...) \
106  do { \
107  if (sc->master->debug_level >= level) { \
108  printk(KERN_DEBUG "EtherCAT DEBUG %u %u:%u: " fmt, \
109  sc->master->index, sc->alias, sc->position, ##args); \
110  } \
111  } while (0)
112 
113 /*****************************************************************************/
114 
118  struct list_head list;
121  uint16_t alias;
122  uint16_t position;
124  uint32_t vendor_id;
125  uint32_t product_code;
127  uint16_t watchdog_divider;
138  uint8_t used_fmmus;
142  struct list_head sdo_configs;
143  struct list_head sdo_requests;
144  struct list_head soe_requests;
145  struct list_head voe_handlers;
146  struct list_head reg_requests;
147  struct list_head soe_configs;
148  struct list_head flags;
151 };
152 
153 /*****************************************************************************/
154 
156  uint16_t, uint32_t, uint32_t);
158 
161 
163 
164 unsigned int ec_slave_config_sdo_count(const ec_slave_config_t *);
166  const ec_slave_config_t *, unsigned int);
167 unsigned int ec_slave_config_idn_count(const ec_slave_config_t *);
169  const ec_slave_config_t *, unsigned int);
170 unsigned int ec_slave_config_flag_count(const ec_slave_config_t *);
172  const ec_slave_config_t *, unsigned int);
174  unsigned int);
176  unsigned int);
178  unsigned int);
180  unsigned int);
182 
184  ec_slave_config_t *, uint16_t, uint8_t, size_t);
186  ec_slave_config_t *, uint8_t, uint16_t, size_t);
188  ec_slave_config_t *, size_t);
190  ec_slave_config_t *, size_t);
191 
192 /*****************************************************************************/
193 
194 #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:54
struct list_head sdo_configs
List of SDO configurations.
Definition: slave_config.h:142
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:564
FMMU configuration.
Definition: fmmu_config.h:46
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:498
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:307
unsigned int ec_slave_config_idn_count(const ec_slave_config_t *)
Get the number of IDN configurations.
Definition: slave_config.c:432
CANopen SDO request.
Definition: sdo_request.h:46
EtherCAT slave structure.
Register request.
Definition: reg_request.h:48
unsigned int ec_slave_config_sdo_count(const ec_slave_config_t *)
Get the number of SDO configurations.
Definition: slave_config.c:388
uint8_t used_fmmus
Number of FMMUs used.
Definition: slave_config.h:138
uint32_t product_code
Slave product code.
Definition: slave_config.h:125
uint16_t position
Index after alias.
Definition: slave_config.h:122
struct list_head list
List item.
Definition: slave_config.h:118
ec_master_t * master
Master owning the slave configuration.
Definition: slave_config.h:119
EtherCAT CoE emergency ring buffer structure.
uint16_t alias
Slave alias.
Definition: slave_config.h:121
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:137
ec_sync_signal_t dc_sync[EC_SYNC_SIGNAL_COUNT]
DC sync signals.
Definition: slave_config.h:140
struct list_head flags
List of feature flags.
Definition: slave_config.h:148
EtherCAT slave.
Definition: slave.h:176
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:586
ec_sync_config_t sync_configs[EC_MAX_SYNC_MANAGERS]
Sync manager configurations.
Definition: slave_config.h:135
struct list_head reg_requests
List of register requests.
Definition: slave_config.h:146
Slave configutation feature flag.
Definition: flag.h:38
struct list_head sdo_requests
List of SDO requests.
Definition: slave_config.h:143
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:145
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:410
uint16_t dc_assign_activate
Vendor-specific AssignActivate word.
Definition: slave_config.h:139
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:542
uint16_t watchdog_intervals
Process data watchdog intervals (see spec.
Definition: slave_config.h:129
Vendor specific over EtherCAT handler.
Definition: voe_handler.h:49
struct list_head soe_requests
List of SoE requests.
Definition: slave_config.h:144
EtherCAT sync manager.
EtherCAT FMMU configuration structure.
ec_slave_t * slave
Slave pointer.
Definition: slave_config.h:132
uint16_t watchdog_divider
Watchdog divider as a number of 40ns intervals (see spec.
Definition: slave_config.h:127
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:103
struct list_head soe_configs
List of SoE configurations.
Definition: slave_config.h:147
unsigned int ec_slave_config_flag_count(const ec_slave_config_t *)
Get the number of feature flags.
Definition: slave_config.c:476
int ec_slave_config_attach(ec_slave_config_t *)
Attaches the configuration to the addressed slave object.
Definition: slave_config.c:224
ec_coe_emerg_ring_t emerg_ring
CoE emergency ring buffer.
Definition: slave_config.h:150
Sync manager configuration.
Definition: sync_config.h:46
EtherCAT slave sync signal configuration.
Definition: globals.h:171
uint32_t vendor_id
Slave vendor ID.
Definition: slave_config.h:124
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:520
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:454
void ec_slave_config_detach(ec_slave_config_t *)
Detaches the configuration from a slave object.
Definition: slave_config.c:282
EtherCAT slave configuration.
Definition: slave_config.h:117
EtherCAT master.
Definition: master.h:194
#define EC_MAX_SYNC_MANAGERS
Maximum number of sync managers per slave.
Definition: ecrt.h:226
ec_flag_t * ec_slave_config_find_flag(ec_slave_config_t *, const char *)
Finds a flag.
Definition: slave_config.c:608
#define EC_SYNC_SIGNAL_COUNT
Number of DC sync signals.
Definition: globals.h:98
Sercos-over-EtherCAT request.
Definition: soe_request.h:48