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 
48 /*****************************************************************************/
49 
61 #define EC_CONFIG_INFO(sc, fmt, args...) \
62  printk(KERN_INFO "EtherCAT %u %u:%u: " fmt, sc->master->index, \
63  sc->alias, sc->position, ##args)
64 
75 #define EC_CONFIG_ERR(sc, fmt, args...) \
76  printk(KERN_ERR "EtherCAT ERROR %u %u:%u: " fmt, sc->master->index, \
77  sc->alias, sc->position, ##args)
78 
89 #define EC_CONFIG_WARN(sc, fmt, args...) \
90  printk(KERN_WARNING "EtherCAT WARNING %u %u:%u: " fmt, \
91  sc->master->index, sc->alias, sc->position, ##args)
92 
106 #define EC_CONFIG_DBG(sc, level, fmt, args...) \
107  do { \
108  if (sc->master->debug_level >= level) { \
109  printk(KERN_DEBUG "EtherCAT DEBUG %u %u:%u: " fmt, \
110  sc->master->index, sc->alias, sc->position, ##args); \
111  } \
112  } while (0)
113 
114 /*****************************************************************************/
115 
119  struct list_head list;
122  uint16_t alias;
123  uint16_t position;
125  uint32_t vendor_id;
126  uint32_t product_code;
128  uint16_t watchdog_divider;
141  uint8_t used_fmmus;
145  struct list_head sdo_configs;
146  struct list_head sdo_requests;
147  struct list_head foe_requests;
148  struct list_head voe_handlers;
149  struct list_head reg_requests;
150  struct list_head soe_configs;
153 };
154 
155 /*****************************************************************************/
156 
158  uint16_t, uint32_t, uint32_t);
160 
163 
165 
166 unsigned int ec_slave_config_sdo_count(const ec_slave_config_t *);
168  const ec_slave_config_t *, unsigned int);
169 unsigned int ec_slave_config_idn_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, uint8_t, size_t);
185  ec_slave_config_t *, size_t);
187  ec_slave_config_t *, size_t);
189  ec_slave_config_t *, size_t);
190 
191 /*****************************************************************************/
192 
193 #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:55
struct list_head sdo_configs
List of SDO configurations.
Definition: slave_config.h:145
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:562
FMMU configuration.
Definition: fmmu_config.h:46
struct list_head foe_requests
List of FoE requests.
Definition: slave_config.h:147
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:344
unsigned int ec_slave_config_idn_count(const ec_slave_config_t *)
Get the number of IDN configurations.
Definition: slave_config.c:474
CANopen SDO request.
Definition: sdo_request.h:48
void ec_slave_config_expire_disconnected_requests(ec_slave_config_t *)
Expires any requests that have been started on a detached slave.
Definition: slave_config.c:604
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:430
uint8_t used_fmmus
Number of FMMUs used.
Definition: slave_config.h:141
uint32_t product_code
Slave product code.
Definition: slave_config.h:126
uint16_t position
Index after alias.
Definition: slave_config.h:123
struct list_head list
List item.
Definition: slave_config.h:119
ec_master_t * master
Master owning the slave configuration.
Definition: slave_config.h:120
EtherCAT CoE emergency ring buffer structure.
uint16_t alias
Slave alias.
Definition: slave_config.h:122
EtherCAT CoE emergency ring buffer.
#define EC_MAX_FMMUS
Maximum number of FMMUs per slave.
Definition: globals.h:130
Global definitions and macros.
ec_fmmu_config_t fmmu_configs[EC_MAX_FMMUS]
FMMU configurations.
Definition: slave_config.h:140
ec_sync_signal_t dc_sync[EC_SYNC_SIGNAL_COUNT]
DC sync signals.
Definition: slave_config.h:143
EtherCAT slave.
Definition: slave.h:214
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:584
ec_foe_request_t * ec_slave_config_find_foe_request(ec_slave_config_t *, unsigned int)
Finds an FoE handler via its position in the list.
Definition: slave_config.c:540
ec_sync_config_t sync_configs[EC_MAX_SYNC_MANAGERS]
Sync manager configurations.
Definition: slave_config.h:138
struct list_head reg_requests
List of register requests.
Definition: slave_config.h:149
struct list_head sdo_requests
List of SDO requests.
Definition: slave_config.h:146
struct list_head voe_handlers
List of VoE handlers.
Definition: slave_config.h:148
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:452
uint16_t dc_assign_activate
Vendor-specific AssignActivate word.
Definition: slave_config.h:142
uint16_t watchdog_intervals
Process data watchdog intervals (see spec.
Definition: slave_config.h:130
Vendor specific over EtherCAT handler.
Definition: voe_handler.h:49
ec_foe_request_t * ecrt_slave_config_create_foe_request_err(ec_slave_config_t *, size_t)
Same as ecrt_slave_config_create_foe_request(), but with ERR_PTR() return value.
EtherCAT sync manager.
EtherCAT FMMU configuration structure.
ec_slave_t * slave
Slave pointer.
Definition: slave_config.h:135
uint16_t watchdog_divider
Watchdog divider as a number of 40ns intervals (see spec.
Definition: slave_config.h:128
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:104
struct list_head soe_configs
List of SoE configurations.
Definition: slave_config.h:150
uint8_t allow_overlapping_pdos
Allow input PDOs use the same frame space as output PDOs.
Definition: slave_config.h:133
int ec_slave_config_attach(ec_slave_config_t *)
Attaches the configuration to the addressed slave object.
Definition: slave_config.c:249
ec_coe_emerg_ring_t emerg_ring
CoE emergency ring buffer.
Definition: slave_config.h:152
ec_sdo_request_t * ecrt_slave_config_create_sdo_request_err(ec_slave_config_t *, uint16_t, uint8_t, uint8_t, size_t)
Same as ecrt_slave_config_create_sdo_request(), but with ERR_PTR() return value.
Sync manager configuration.
Definition: sync_config.h:46
EtherCAT slave sync signal configuration.
Definition: globals.h:218
uint32_t vendor_id
Slave vendor ID.
Definition: slave_config.h:125
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:518
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:496
void ec_slave_config_detach(ec_slave_config_t *)
Detaches the configuration from a slave object.
Definition: slave_config.c:315
EtherCAT slave configuration.
Definition: slave_config.h:118
FoE request.
Definition: foe_request.h:50
EtherCAT master.
Definition: master.h:202
#define EC_MAX_SYNC_MANAGERS
Maximum number of sync managers per slave.
Definition: ecrt.h:208
#define EC_SYNC_SIGNAL_COUNT
Number of DC sync signals.
Definition: globals.h:136
Sercos-over-EtherCAT request.
Definition: soe_request.h:48