IgH EtherCAT Master  1.5.2
slave_config.h
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * $Id$
4 *
5 * Copyright (C) 2006-2012 Florian Pose, Ingenieurgemeinschaft IgH
6 *
7 * This file is part of the IgH EtherCAT Master.
8 *
9 * The IgH EtherCAT Master is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License version 2, as
11 * published by the Free Software Foundation.
12 *
13 * The IgH EtherCAT Master is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16 * Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with the IgH EtherCAT Master; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 *
22 * ---
23 *
24 * The license mentioned above concerns the source code only. Using the
25 * EtherCAT technology and brand is only permitted in compliance with the
26 * industrial property and similar rights of Beckhoff Automation GmbH.
27 *
28 *****************************************************************************/
29
35/*****************************************************************************/
36
37#ifndef __EC_SLAVE_CONFIG_H__
38#define __EC_SLAVE_CONFIG_H__
39
40#include <linux/list.h>
41
42#include "globals.h"
43#include "slave.h"
44#include "sync_config.h"
45#include "fmmu_config.h"
46#include "coe_emerg_ring.h"
47#include "flag.h"
48
49/*****************************************************************************/
50
62#define EC_CONFIG_INFO(sc, fmt, args...) \
63 printk(KERN_INFO "EtherCAT %u %u:%u: " fmt, sc->master->index, \
64 sc->alias, sc->position, ##args)
65
76#define EC_CONFIG_ERR(sc, fmt, args...) \
77 printk(KERN_ERR "EtherCAT ERROR %u %u:%u: " fmt, sc->master->index, \
78 sc->alias, sc->position, ##args)
79
90#define EC_CONFIG_WARN(sc, fmt, args...) \
91 printk(KERN_WARNING "EtherCAT WARNING %u %u:%u: " fmt, \
92 sc->master->index, sc->alias, sc->position, ##args)
93
107#define EC_CONFIG_DBG(sc, level, fmt, args...) \
108 do { \
109 if (sc->master->debug_level >= level) { \
110 printk(KERN_DEBUG "EtherCAT DEBUG %u %u:%u: " fmt, \
111 sc->master->index, sc->alias, sc->position, ##args); \
112 } \
113 } while (0)
114
115/*****************************************************************************/
116
120 struct list_head list;
123 uint16_t alias;
124 uint16_t position;
126 uint32_t vendor_id;
127 uint32_t product_code;
140 uint8_t used_fmmus;
144 struct list_head sdo_configs;
145 struct list_head sdo_requests;
146 struct list_head voe_handlers;
147 struct list_head reg_requests;
148 struct list_head soe_configs;
149 struct list_head flags;
152};
153
154/*****************************************************************************/
155
157 uint16_t, uint32_t, uint32_t);
159
162
164
165unsigned int ec_slave_config_sdo_count(const ec_slave_config_t *);
167 const ec_slave_config_t *, unsigned int);
168unsigned int ec_slave_config_idn_count(const ec_slave_config_t *);
170 const ec_slave_config_t *, unsigned int);
173 const ec_slave_config_t *, 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 *, size_t);
187 ec_slave_config_t *, size_t);
188
189/*****************************************************************************/
190
191#endif
EtherCAT CoE emergency ring buffer structure.
EtherCAT Slave Configuration Feature Flag.
EtherCAT FMMU configuration structure.
Global definitions and macros.
#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
#define EC_MAX_SYNC_MANAGERS
Maximum number of sync managers per slave.
Definition: ecrt.h:213
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.
Definition: slave_config.c:448
unsigned int ec_slave_config_flag_count(const ec_slave_config_t *)
Get the number of feature flags.
Definition: slave_config.c:470
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:56
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:492
void ec_slave_config_clear(ec_slave_config_t *)
Slave configuration destructor.
Definition: slave_config.c:104
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:301
void ec_slave_config_detach(ec_slave_config_t *)
Detaches the configuration from a slave object.
Definition: slave_config.c:276
unsigned int ec_slave_config_idn_count(const ec_slave_config_t *)
Get the number of IDN configurations.
Definition: slave_config.c:426
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.
Definition: slave_config.c:218
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 handler via its position in the list.
Definition: slave_config.c:514
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:404
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:558
unsigned int ec_slave_config_sdo_count(const ec_slave_config_t *)
Get the number of SDO configurations.
Definition: slave_config.c:382
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:536
ec_flag_t * ec_slave_config_find_flag(ec_slave_config_t *, const char *)
Finds a flag.
Definition: slave_config.c:580
EtherCAT CoE emergency ring buffer.
Slave configutation feature flag.
Definition: flag.h:38
FMMU configuration.
Definition: fmmu_config.h:46
EtherCAT master.
Definition: master.h:194
Register request.
Definition: reg_request.h:48
CANopen SDO request.
Definition: sdo_request.h:48
EtherCAT slave configuration.
Definition: slave_config.h:119
uint32_t product_code
Slave product code.
Definition: slave_config.h:127
ec_sync_config_t sync_configs[EC_MAX_SYNC_MANAGERS]
Sync manager configurations.
Definition: slave_config.h:137
struct list_head flags
List of feature flags.
Definition: slave_config.h:149
struct list_head reg_requests
List of register requests.
Definition: slave_config.h:147
uint16_t dc_assign_activate
Vendor-specific AssignActivate word.
Definition: slave_config.h:141
struct list_head sdo_requests
List of SDO requests.
Definition: slave_config.h:145
uint16_t watchdog_intervals
Process data watchdog intervals (see spec.
Definition: slave_config.h:131
struct list_head list
List item.
Definition: slave_config.h:120
uint16_t alias
Slave alias.
Definition: slave_config.h:123
ec_fmmu_config_t fmmu_configs[EC_MAX_FMMUS]
FMMU configurations.
Definition: slave_config.h:139
ec_coe_emerg_ring_t emerg_ring
CoE emergency ring buffer.
Definition: slave_config.h:151
ec_sync_signal_t dc_sync[EC_SYNC_SIGNAL_COUNT]
DC sync signals.
Definition: slave_config.h:142
struct list_head soe_configs
List of SoE configurations.
Definition: slave_config.h:148
struct list_head sdo_configs
List of SDO configurations.
Definition: slave_config.h:144
uint16_t watchdog_divider
Watchdog divider as a number of 40ns intervals (see spec.
Definition: slave_config.h:129
uint8_t used_fmmus
Number of FMMUs used.
Definition: slave_config.h:140
ec_master_t * master
Master owning the slave configuration.
Definition: slave_config.h:121
ec_slave_t * slave
Slave pointer.
Definition: slave_config.h:134
uint32_t vendor_id
Slave vendor ID.
Definition: slave_config.h:126
uint16_t position
Index after alias.
Definition: slave_config.h:124
struct list_head voe_handlers
List of VoE handlers.
Definition: slave_config.h:146
EtherCAT slave.
Definition: slave.h:177
Sercos-over-EtherCAT request.
Definition: soe_request.h:48
Sync manager configuration.
Definition: sync_config.h:46
EtherCAT slave sync signal configuration.
Definition: globals.h:171
Vendor specific over EtherCAT handler.
Definition: voe_handler.h:49
EtherCAT sync manager.