IgH EtherCAT Master  1.6.9
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
26
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;
114
115 uint16_t alias;
116 uint16_t position;
118 uint32_t vendor_id;
119 uint32_t product_code;
120
125
128
132 uint8_t used_fmmus;
135
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;
144
145#ifdef EC_EOE
147#endif
148
150};
151
152/****************************************************************************/
153
155 uint16_t, uint32_t, uint32_t);
157
160
162
163unsigned int ec_slave_config_sdo_count(const ec_slave_config_t *);
165 const ec_slave_config_t *, unsigned int);
166unsigned int ec_slave_config_idn_count(const ec_slave_config_t *);
168 const ec_slave_config_t *, unsigned int);
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
193
194/****************************************************************************/
195
196#endif
EtherCAT CoE emergency ring buffer structure.
EtherCAT Slave Configuration Feature Flag.
EtherCAT FMMU configuration structure.
Global definitions and macros.
ec_slave_state_t
State of an EtherCAT slave.
Definition globals.h:121
#define EC_SYNC_SIGNAL_COUNT
Number of DC sync signals.
Definition globals.h:98
#define EC_MAX_FMMUS
Maximum number of FMMUs per slave.
Definition globals.h:92
struct ec_slave ec_slave_t
Definition globals.h:310
struct ec_soe_request ec_soe_request_t
Definition ecrt.h:312
struct ec_voe_handler ec_voe_handler_t
Definition ecrt.h:315
struct ec_sdo_request ec_sdo_request_t
Definition ecrt.h:309
struct ec_master ec_master_t
Definition ecrt.h:300
struct ec_slave_config ec_slave_config_t
Definition ecrt.h:303
struct ec_reg_request ec_reg_request_t
Definition ecrt.h:318
#define EC_MAX_SYNC_MANAGERS
Maximum number of sync managers per slave.
Definition ecrt.h:267
EtherCAT slave structure.
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.
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.
unsigned int ec_slave_config_flag_count(const ec_slave_config_t *)
Get the number of feature flags.
void ec_slave_config_init(ec_slave_config_t *, ec_master_t *, uint16_t, uint16_t, uint32_t, uint32_t)
Slave configuration constructor.
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.
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.
void ec_slave_config_clear(ec_slave_config_t *)
Slave configuration destructor.
void ec_slave_config_load_default_sync_config(ec_slave_config_t *)
Loads the default PDO assignment from the slave object.
void ec_slave_config_detach(ec_slave_config_t *)
Detaches the configuration from a slave object.
unsigned int ec_slave_config_idn_count(const ec_slave_config_t *)
Get the number of IDN configurations.
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.
int ec_slave_config_attach(ec_slave_config_t *)
Attaches the configuration to the addressed slave object.
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_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.
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.
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.
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_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.
unsigned int ec_slave_config_sdo_count(const ec_slave_config_t *)
Get the number of SDO configurations.
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.
ec_flag_t * ec_slave_config_find_flag(ec_slave_config_t *, const char *)
Finds a flag.
EtherCAT CoE emergency ring buffer.
Ethernet-over-EtherCAT set IP parameter request.
Definition eoe_request.h:41
Slave configutation feature flag.
Definition flag.h:38
FMMU configuration.
Definition fmmu_config.h:38
EtherCAT slave configuration.
uint32_t product_code
Slave product code.
ec_sync_config_t sync_configs[EC_MAX_SYNC_MANAGERS]
Sync manager configurations.
struct list_head flags
List of feature flags.
struct list_head reg_requests
List of register requests.
uint16_t dc_assign_activate
Vendor-specific AssignActivate word.
struct list_head sdo_requests
List of SDO requests.
uint16_t watchdog_intervals
Process data watchdog intervals (see spec.
struct list_head list
List item.
uint16_t alias
Slave alias.
ec_fmmu_config_t fmmu_configs[EC_MAX_FMMUS]
FMMU configurations.
ec_coe_emerg_ring_t emerg_ring
CoE emergency ring buffer.
ec_sync_signal_t dc_sync[EC_SYNC_SIGNAL_COUNT]
DC sync signals.
struct list_head soe_requests
List of SoE requests.
struct list_head soe_configs
List of SoE configurations.
struct list_head sdo_configs
List of SDO configurations.
uint16_t watchdog_divider
Watchdog divider as a number of 40ns intervals (see spec.
uint8_t used_fmmus
Number of FMMUs used.
ec_master_t * master
Master owning the slave configuration.
ec_slave_t * slave
Slave pointer.
struct list_head al_timeouts
List of specific AL state timeouts.
uint32_t vendor_id
Slave vendor ID.
uint16_t position
Index after alias.
ec_eoe_request_t eoe_ip_param_request
EoE IP parameters.
struct list_head voe_handlers
List of VoE handlers.
Sync manager configuration.
Definition sync_config.h:38
EtherCAT slave sync signal configuration.
Definition globals.h:180
EtherCAT sync manager.