IgH EtherCAT Master  1.5.2
module.c
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * $Id$
4  *
5  * Copyright (C) 2006-2008 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 
34 /*****************************************************************************/
35 
36 #include <linux/module.h>
37 #include <linux/device.h>
38 #include <linux/err.h>
39 
40 #include "globals.h"
41 #include "master.h"
42 #include "device.h"
43 
44 /*****************************************************************************/
45 
46 #define MAX_MASTERS 32
48 /*****************************************************************************/
49 
50 int __init ec_init_module(void);
51 void __exit ec_cleanup_module(void);
52 
53 static int ec_mac_parse(uint8_t *, const char *, int);
54 
55 /*****************************************************************************/
56 
57 static char *main_devices[MAX_MASTERS];
58 static unsigned int master_count;
59 static char *backup_devices[MAX_MASTERS];
60 static unsigned int backup_count;
61 #ifdef EC_EOE
63 unsigned int eoe_count;
64 bool eoe_autocreate = 1;
65 #endif
66 static unsigned int debug_level;
67 unsigned long pcap_size;
70 static ec_lock_t master_sem;
73 struct class *class;
75 static uint8_t macs[MAX_MASTERS][2][ETH_ALEN];
77 char *ec_master_version_str = EC_MASTER_VERSION;
79 /*****************************************************************************/
80 
83 MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
84 MODULE_DESCRIPTION("EtherCAT master driver module");
85 MODULE_LICENSE("GPL");
86 MODULE_VERSION(EC_MASTER_VERSION);
87 
88 module_param_array(main_devices, charp, &master_count, S_IRUGO);
89 MODULE_PARM_DESC(main_devices, "MAC addresses of main devices");
90 module_param_array(backup_devices, charp, &backup_count, S_IRUGO);
91 MODULE_PARM_DESC(backup_devices, "MAC addresses of backup devices");
92 #ifdef EC_EOE
93 module_param_array(eoe_interfaces, charp, &eoe_count, S_IRUGO);
94 MODULE_PARM_DESC(eoe_interfaces, "EOE interfaces");
95 module_param_named(eoe_autocreate, eoe_autocreate, bool, S_IRUGO);
96 MODULE_PARM_DESC(eoe_autocreate, "EOE atuo create mode");
97 #endif
98 module_param_named(debug_level, debug_level, uint, S_IRUGO);
99 MODULE_PARM_DESC(debug_level, "Debug level");
100 module_param_named(pcap_size, pcap_size, ulong, S_IRUGO);
101 MODULE_PARM_DESC(pcap_size, "Pcap buffer size");
102 
105 /*****************************************************************************/
106 
112 int __init ec_init_module(void)
113 {
114  int i, ret = 0;
115 
116  EC_INFO("Master driver %s\n", EC_MASTER_VERSION);
117 
118  ec_lock_init(&master_sem);
119 
120  if (master_count) {
121  if (alloc_chrdev_region(&device_number,
122  0, master_count, "EtherCAT")) {
123  EC_ERR("Failed to obtain device number(s)!\n");
124  ret = -EBUSY;
125  goto out_return;
126  }
127  }
128 
129  class = class_create(THIS_MODULE, "EtherCAT");
130  if (IS_ERR(class)) {
131  EC_ERR("Failed to create device class.\n");
132  ret = PTR_ERR(class);
133  goto out_cdev;
134  }
135 
136  // zero MAC addresses
137  memset(macs, 0x00, sizeof(uint8_t) * MAX_MASTERS * 2 * ETH_ALEN);
138 
139  // process MAC parameters
140  for (i = 0; i < master_count; i++) {
141  ret = ec_mac_parse(macs[i][0], main_devices[i], 0);
142  if (ret)
143  goto out_class;
144 
145  if (i < backup_count) {
146  ret = ec_mac_parse(macs[i][1], backup_devices[i], 1);
147  if (ret)
148  goto out_class;
149  }
150  }
151 
152  // initialize static master variables
154 
155  if (master_count) {
156  if (!(masters = kmalloc(sizeof(ec_master_t) * master_count,
157  GFP_KERNEL))) {
158  EC_ERR("Failed to allocate memory"
159  " for EtherCAT masters.\n");
160  ret = -ENOMEM;
161  goto out_class;
162  }
163  }
164 
165  for (i = 0; i < master_count; i++) {
166  ret = ec_master_init(&masters[i], i, macs[i][0], macs[i][1],
167  device_number, class, debug_level);
168  if (ret)
169  goto out_free_masters;
170  }
171 
172  EC_INFO("%u master%s waiting for devices.\n",
173  master_count, (master_count == 1 ? "" : "s"));
174  return ret;
175 
176 out_free_masters:
177  for (i--; i >= 0; i--)
178  ec_master_clear(&masters[i]);
179  kfree(masters);
180 out_class:
181  class_destroy(class);
182 out_cdev:
183  if (master_count)
184  unregister_chrdev_region(device_number, master_count);
185 out_return:
186  return ret;
187 }
188 
189 /*****************************************************************************/
190 
195 void __exit ec_cleanup_module(void)
196 {
197  unsigned int i;
198 
199  for (i = 0; i < master_count; i++) {
200  ec_master_clear(&masters[i]);
201  }
202 
203  if (master_count)
204  kfree(masters);
205 
206  class_destroy(class);
207 
208  if (master_count)
209  unregister_chrdev_region(device_number, master_count);
210 
211  EC_INFO("Master module cleaned up.\n");
212 }
213 
214 /*****************************************************************************/
215 
218 unsigned int ec_master_count(void)
219 {
220  return master_count;
221 }
222 
223 /*****************************************************************************
224  * MAC address functions
225  ****************************************************************************/
226 
231  const uint8_t *mac1,
232  const uint8_t *mac2
233  )
234 {
235  unsigned int i;
236 
237  for (i = 0; i < ETH_ALEN; i++)
238  if (mac1[i] != mac2[i])
239  return 0;
240 
241  return 1;
242 }
243 
244 /*****************************************************************************/
245 
248 #define EC_MAX_MAC_STRING_SIZE (3 * ETH_ALEN)
249 
257  const uint8_t *mac,
258  char *buffer
259  )
260 {
261  size_t off = 0;
262  unsigned int i;
263 
264  for (i = 0; i < ETH_ALEN; i++) {
265  off += sprintf(buffer + off, "%02X", mac[i]);
266  if (i < ETH_ALEN - 1) off += sprintf(buffer + off, ":");
267  }
268 
269  return off;
270 }
271 
272 /*****************************************************************************/
273 
278  const uint8_t *mac
279  )
280 {
281  unsigned int i;
282 
283  for (i = 0; i < ETH_ALEN; i++)
284  if (mac[i])
285  return 0;
286 
287  return 1;
288 }
289 
290 /*****************************************************************************/
291 
296  const uint8_t *mac
297  )
298 {
299  unsigned int i;
300 
301  for (i = 0; i < ETH_ALEN; i++)
302  if (mac[i] != 0xff)
303  return 0;
304 
305  return 1;
306 }
307 
308 /*****************************************************************************/
309 
317 static int ec_mac_parse(uint8_t *mac, const char *src, int allow_empty)
318 {
319  unsigned int i, value;
320  const char *orig = src;
321  char *rem;
322 
323  if (!strlen(src)) {
324  if (allow_empty){
325  return 0;
326  } else {
327  EC_ERR("MAC address may not be empty.\n");
328  return -EINVAL;
329  }
330  }
331 
332  for (i = 0; i < ETH_ALEN; i++) {
333  value = simple_strtoul(src, &rem, 16);
334  if (rem != src + 2
335  || value > 0xFF
336  || (i < ETH_ALEN - 1 && *rem != ':')) {
337  EC_ERR("Invalid MAC address \"%s\".\n", orig);
338  return -EINVAL;
339  }
340  mac[i] = value;
341  if (i < ETH_ALEN - 1) {
342  src = rem + 1; // skip colon
343  }
344  }
345 
346  return 0;
347 }
348 
349 /*****************************************************************************/
350 
355 void ec_print_data(const uint8_t *data,
356  size_t size
357  )
358 {
359  unsigned int i;
360 
361  EC_DBG("");
362  for (i = 0; i < size; i++) {
363  printk(KERN_CONT "%02X ", data[i]);
364 
365  if ((i + 1) % 16 == 0 && i < size - 1) {
366  printk(KERN_CONT "\n");
367  EC_DBG("");
368  }
369 
370  if (i + 1 == 128 && size > 256) {
371  printk(KERN_CONT "dropped %zu bytes\n", size - 128 - i);
372  i = size - 128;
373  EC_DBG("");
374  }
375  }
376  printk(KERN_CONT "\n");
377 }
378 
379 /*****************************************************************************/
380 
383 void ec_print_data_diff(const uint8_t *d1,
384  const uint8_t *d2,
385  size_t size
386  )
387 {
388  unsigned int i;
389 
390  EC_DBG("");
391  for (i = 0; i < size; i++) {
392  if (d1[i] == d2[i]) printk(KERN_CONT ".. ");
393  else printk(KERN_CONT "%02X ", d2[i]);
394  if ((i + 1) % 16 == 0) {
395  printk(KERN_CONT "\n");
396  EC_DBG("");
397  }
398  }
399  printk(KERN_CONT "\n");
400 }
401 
402 /*****************************************************************************/
403 
408 size_t ec_state_string(uint8_t states,
409  char *buffer,
411  uint8_t multi
412  )
413 {
414  off_t off = 0;
415  unsigned int first = 1;
416 
417  if (!states) {
418  off += sprintf(buffer + off, "(unknown)");
419  return off;
420  }
421 
422  if (multi) { // multiple slaves
423  if (states & EC_SLAVE_STATE_INIT) {
424  off += sprintf(buffer + off, "INIT");
425  first = 0;
426  }
427  if (states & EC_SLAVE_STATE_PREOP) {
428  if (!first) off += sprintf(buffer + off, ", ");
429  off += sprintf(buffer + off, "PREOP");
430  first = 0;
431  }
432  if (states & EC_SLAVE_STATE_SAFEOP) {
433  if (!first) off += sprintf(buffer + off, ", ");
434  off += sprintf(buffer + off, "SAFEOP");
435  first = 0;
436  }
437  if (states & EC_SLAVE_STATE_OP) {
438  if (!first) off += sprintf(buffer + off, ", ");
439  off += sprintf(buffer + off, "OP");
440  }
441  } else { // single slave
442  if ((states & EC_SLAVE_STATE_MASK) == EC_SLAVE_STATE_INIT) {
443  off += sprintf(buffer + off, "INIT");
444  } else if ((states & EC_SLAVE_STATE_MASK) == EC_SLAVE_STATE_PREOP) {
445  off += sprintf(buffer + off, "PREOP");
446  } else if ((states & EC_SLAVE_STATE_MASK) == EC_SLAVE_STATE_BOOT) {
447  off += sprintf(buffer + off, "BOOT");
448  } else if ((states & EC_SLAVE_STATE_MASK) == EC_SLAVE_STATE_SAFEOP) {
449  off += sprintf(buffer + off, "SAFEOP");
450  } else if ((states & EC_SLAVE_STATE_MASK) == EC_SLAVE_STATE_OP) {
451  off += sprintf(buffer + off, "OP");
452  } else {
453  off += sprintf(buffer + off, "(invalid)");
454  }
455  first = 0;
456  }
457 
458  if (states & EC_SLAVE_STATE_ACK_ERR) {
459  if (!first) off += sprintf(buffer + off, " + ");
460  off += sprintf(buffer + off, "ERROR");
461  }
462 
463  return off;
464 }
465 
466 /******************************************************************************
467  * Device interface
468  *****************************************************************************/
469 
472 const char *ec_device_names[2] = {
473  "main",
474  "backup"
475 };
476 
488  struct net_device *net_dev,
489  ec_pollfunc_t poll,
490  struct module *module
491  )
492 {
493  ec_master_t *master;
494  char str[EC_MAX_MAC_STRING_SIZE];
495  unsigned int i, dev_idx;
496 
497  for (i = 0; i < master_count; i++) {
498  master = &masters[i];
499  ec_mac_print(net_dev->dev_addr, str);
500 
501  if (ec_lock_down_interruptible(&master->device_sem)) {
502  EC_MASTER_WARN(master, "%s() interrupted!\n", __func__);
503  return NULL;
504  }
505 
506  for (dev_idx = EC_DEVICE_MAIN;
507  dev_idx < ec_master_num_devices(master); dev_idx++) {
508  if (!master->devices[dev_idx].dev
509  && (ec_mac_equal(master->macs[dev_idx], net_dev->dev_addr)
510  || ec_mac_is_broadcast(master->macs[dev_idx]))) {
511 
512  EC_INFO("Accepting %s as %s device for master %u.\n",
513  str, ec_device_names[dev_idx != 0], master->index);
514 
515  ec_device_attach(&master->devices[dev_idx],
516  net_dev, poll, module);
517  ec_lock_up(&master->device_sem);
518 
519  snprintf(net_dev->name, IFNAMSIZ, "ec%c%u",
520  ec_device_names[dev_idx != 0][0], master->index);
521 
522  return &master->devices[dev_idx]; // offer accepted
523  }
524  }
525 
526  ec_lock_up(&master->device_sem);
527 
528  EC_MASTER_DBG(master, 1, "Master declined device %s.\n", str);
529  }
530 
531  return NULL; // offer declined
532 }
533 
534 /******************************************************************************
535  * Application interface
536  *****************************************************************************/
537 
545  unsigned int master_index
546  )
547 {
548  ec_master_t *master, *errptr = NULL;
549  unsigned int dev_idx = EC_DEVICE_MAIN;
550 
551  EC_INFO("Requesting master %u...\n", master_index);
552 
553  if (master_index >= master_count) {
554  EC_ERR("Invalid master index %u.\n", master_index);
555  errptr = ERR_PTR(-EINVAL);
556  goto out_return;
557  }
558  master = &masters[master_index];
559 
560  if (ec_lock_down_interruptible(&master_sem)) {
561  errptr = ERR_PTR(-EINTR);
562  goto out_return;
563  }
564 
565  if (master->reserved) {
566  ec_lock_up(&master_sem);
567  EC_MASTER_ERR(master, "Master already in use!\n");
568  errptr = ERR_PTR(-EBUSY);
569  goto out_return;
570  }
571  master->reserved = 1;
572  ec_lock_up(&master_sem);
573 
574  if (ec_lock_down_interruptible(&master->device_sem)) {
575  errptr = ERR_PTR(-EINTR);
576  goto out_release;
577  }
578 
579  if (master->phase != EC_IDLE) {
580  ec_lock_up(&master->device_sem);
581  EC_MASTER_ERR(master, "Master still waiting for devices!\n");
582  errptr = ERR_PTR(-ENODEV);
583  goto out_release;
584  }
585 
586  for (; dev_idx < ec_master_num_devices(master); dev_idx++) {
587  ec_device_t *device = &master->devices[dev_idx];
588  if (!try_module_get(device->module)) {
589  ec_lock_up(&master->device_sem);
590  EC_MASTER_ERR(master, "Device module is unloading!\n");
591  errptr = ERR_PTR(-ENODEV);
592  goto out_module_put;
593  }
594  }
595 
596  ec_lock_up(&master->device_sem);
597 
598  if (ec_master_enter_operation_phase(master)) {
599  EC_MASTER_ERR(master, "Failed to enter OPERATION phase!\n");
600  errptr = ERR_PTR(-EIO);
601  goto out_module_put;
602  }
603 
604  EC_INFO("Successfully requested master %u.\n", master_index);
605  return master;
606 
607  out_module_put:
608  for (; dev_idx > 0; dev_idx--) {
609  ec_device_t *device = &master->devices[dev_idx - 1];
610  module_put(device->module);
611  }
612  out_release:
613  master->reserved = 0;
614  out_return:
615  return errptr;
616 }
617 
618 /*****************************************************************************/
619 
620 ec_master_t *ecrt_request_master(unsigned int master_index)
621 {
622  ec_master_t *master = ecrt_request_master_err(master_index);
623  return IS_ERR(master) ? NULL : master;
624 }
625 
626 /*****************************************************************************/
627 
629 {
630  unsigned int dev_idx;
631 
632  EC_MASTER_INFO(master, "Releasing master...\n");
633 
634  if (!master->reserved) {
635  EC_MASTER_WARN(master, "%s(): Master was was not requested!\n",
636  __func__);
637  return;
638  }
639 
641 
642  for (dev_idx = EC_DEVICE_MAIN; dev_idx < ec_master_num_devices(master);
643  dev_idx++) {
644  module_put(master->devices[dev_idx].module);
645  }
646 
647  master->reserved = 0;
648 
649  EC_MASTER_INFO(master, "Released.\n");
650 }
651 
652 /*****************************************************************************/
653 
654 unsigned int ecrt_version_magic(void)
655 {
656  return ECRT_VERSION_MAGIC;
657 }
658 
659 /*****************************************************************************/
660 
666  EC_REQUEST_UNUSED, // EC_INT_REQUEST_INIT,
667  EC_REQUEST_BUSY, // EC_INT_REQUEST_QUEUED,
668  EC_REQUEST_BUSY, // EC_INT_REQUEST_BUSY,
669  EC_REQUEST_SUCCESS, // EC_INT_REQUEST_SUCCESS,
670  EC_REQUEST_ERROR // EC_INT_REQUEST_FAILURE
671 };
672 
673 /*****************************************************************************/
674 
677 module_init(ec_init_module);
678 module_exit(ec_cleanup_module);
679 
680 EXPORT_SYMBOL(ecdev_offer);
681 
682 EXPORT_SYMBOL(ecrt_request_master);
683 EXPORT_SYMBOL(ecrt_release_master);
684 EXPORT_SYMBOL(ecrt_version_magic);
685 
688 /*****************************************************************************/
unsigned int reserved
True, if the master is in use.
Definition: master.h:204
void ec_print_data(const uint8_t *data, size_t size)
Outputs frame contents for debugging purposes.
Definition: module.c:355
#define EC_SLAVE_STATE_MASK
Slave state mask.
Definition: globals.h:155
static char * backup_devices[MAX_MASTERS]
Backup devices parameter.
Definition: module.c:59
size_t ec_state_string(uint8_t states, char *buffer, uint8_t multi)
Prints slave states in clear text.
Definition: module.c:408
int ec_mac_is_broadcast(const uint8_t *mac)
Definition: module.c:295
void ecrt_release_master(ec_master_t *master)
Releases a requested EtherCAT master.
Definition: module.c:628
#define MAX_EOE
Maximum number of EOE interfaces that can be defined at startup.
Definition: master.h:435
void ec_master_clear(ec_master_t *master)
Destructor.
Definition: master.c:422
OP (mailbox communication and input/output update)
Definition: globals.h:170
void ec_master_leave_operation_phase(ec_master_t *master)
Transition function from OPERATION to IDLE phase.
Definition: master.c:916
static ec_lock_t master_sem
Master semaphore.
Definition: module.c:70
#define ec_master_num_devices(MASTER)
Number of Ethernet devices.
Definition: master.h:359
#define EC_MAX_MAC_STRING_SIZE
Maximum MAC string size.
Definition: module.c:248
struct module * module
pointer to the device&#39;s owning module
Definition: device.h:95
dev_t device_number
Device number for master cdevs.
Definition: module.c:72
Bootstrap state (mailbox communication, firmware update)
Definition: globals.h:166
int ec_mac_is_zero(const uint8_t *mac)
Definition: module.c:277
#define MAX_MASTERS
Maximum number of masters.
Definition: module.c:46
static ec_master_t * masters
Array of masters.
Definition: module.c:69
char * ec_master_version_str
Version string.
Definition: module.c:77
Acknowledge/Error bit (no actual state)
Definition: globals.h:172
static unsigned int debug_level
Debug level parameter.
Definition: module.c:66
const uint8_t * macs[EC_MAX_NUM_DEVICES]
Device MAC addresses.
Definition: master.h:220
void ec_print_data_diff(const uint8_t *d1, const uint8_t *d2, size_t size)
Outputs frame contents and differences for debugging purposes.
Definition: module.c:383
ec_master_t * ecrt_request_master_err(unsigned int master_index)
Request a master.
Definition: module.c:544
Global definitions and macros.
EtherCAT master structure.
void __exit ec_cleanup_module(void)
Module cleanup.
Definition: module.c:195
SAFEOP (mailbox communication and input update)
Definition: globals.h:168
Not requested.
Definition: ecrt.h:538
#define EC_MASTER_DBG(master, level, fmt, args...)
Convenience macro for printing master-specific debug messages to syslog.
Definition: master.h:106
ec_lock_t device_sem
Device semaphore.
Definition: master.h:226
unsigned int eoe_count
Number of EOE interfaces.
Definition: module.c:63
ec_master_t * ecrt_request_master(unsigned int master_index)
Requests an EtherCAT master for realtime operation.
Definition: module.c:620
Request is being processed.
Definition: ecrt.h:539
static uint8_t macs[MAX_MASTERS][2][ETH_ALEN]
MAC addresses.
Definition: module.c:75
ec_master_phase_t phase
Master phase.
Definition: master.h:231
static unsigned int master_count
Number of masters.
Definition: module.c:58
void(* ec_pollfunc_t)(struct net_device *)
Device poll function type.
Definition: ecdev.h:57
EtherCAT device.
Definition: device.h:90
int __init ec_init_module(void)
Module initialization.
Definition: module.c:112
Main device.
Definition: globals.h:237
unsigned int ecrt_version_magic(void)
Returns the version magic of the realtime interface.
Definition: module.c:654
int ec_master_init(ec_master_t *master, unsigned int index, const uint8_t *main_mac, const uint8_t *backup_mac, dev_t device_number, struct class *class, unsigned int debug_level)
Master constructor.
Definition: master.c:145
#define EC_MASTER_WARN(master, fmt, args...)
Convenience macro for printing master-specific warnings to syslog.
Definition: master.h:92
int ec_master_enter_operation_phase(ec_master_t *master)
Transition function from IDLE to OPERATION phase.
Definition: master.c:845
struct class * class
Device class.
Definition: module.c:73
#define EC_MASTER_ERR(master, fmt, args...)
Convenience macro for printing master-specific errors to syslog.
Definition: master.h:80
int ec_mac_equal(const uint8_t *mac1, const uint8_t *mac2)
Definition: module.c:230
char * eoe_interfaces[MAX_EOE]
EOE interfaces parameter.
Definition: module.c:62
INIT state (no mailbox communication, no IO)
Definition: globals.h:162
Idle phase.
Definition: master.h:141
#define EC_DBG(fmt, args...)
Convenience macro for printing EtherCAT debug messages to syslog.
Definition: globals.h:282
#define EC_INFO(fmt, args...)
Convenience macro for printing EtherCAT-specific information to syslog.
Definition: globals.h:252
#define EC_ERR(fmt, args...)
Convenience macro for printing EtherCAT-specific errors to syslog.
Definition: globals.h:262
ec_device_t * ecdev_offer(struct net_device *net_dev, ec_pollfunc_t poll, struct module *module)
Offers an EtherCAT device to a certain master.
Definition: module.c:487
unsigned int ec_master_count(void)
Get the number of masters.
Definition: module.c:218
const ec_request_state_t ec_request_state_translation_table[]
Global request state type translation table.
Definition: module.c:665
void ec_device_attach(ec_device_t *device, struct net_device *net_dev, ec_pollfunc_t poll, struct module *module)
Associate with net_device.
Definition: device.c:183
EtherCAT device structure.
static int ec_mac_parse(uint8_t *, const char *, int)
Parse a MAC address from a string.
Definition: module.c:317
struct net_device * dev
pointer to the assigned net_device
Definition: device.h:93
Request was processed successfully.
Definition: ecrt.h:540
static unsigned int backup_count
Number of backup devices.
Definition: module.c:60
ec_request_state_t
Request state.
Definition: ecrt.h:537
unsigned int index
Index.
Definition: master.h:203
bool eoe_autocreate
Auto-create EOE interfaces.
Definition: module.c:64
PREOP state (mailbox communication, no IO)
Definition: globals.h:164
#define EC_MASTER_INFO(master, fmt, args...)
Convenience macro for printing master-specific information to syslog.
Definition: master.h:68
static char * main_devices[MAX_MASTERS]
Main devices parameter.
Definition: module.c:57
EtherCAT master.
Definition: master.h:202
Request processing failed.
Definition: ecrt.h:541
ec_device_t devices[EC_MAX_NUM_DEVICES]
EtherCAT devices.
Definition: master.h:219
unsigned long pcap_size
Pcap buffer size in bytes.
Definition: module.c:67
size_t ec_mac_print(const uint8_t *mac, char *buffer)
Print a MAC address to a buffer.
Definition: module.c:256
void ec_master_init_static(void)
Static variables initializer.
Definition: master.c:124
#define ECRT_VERSION_MAGIC
EtherCAT realtime interface version word.
Definition: ecrt.h:155
const char * ec_device_names[2]
Device names.
Definition: module.c:472