author | Florian Pose <fp@igh-essen.com> |
Tue, 10 Jan 2012 10:43:36 +0100 | |
branch | redundancy |
changeset 2341 | 80c03df98a49 |
parent 2267 | 2d36f36a433c |
child 2374 | e898451c054a |
permissions | -rw-r--r-- |
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/****************************************************************************** |
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
* |
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
* $Id$ |
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
* |
1326
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
5 |
* Copyright (C) 2006-2008 Florian Pose, Ingenieurgemeinschaft IgH |
197
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
196
diff
changeset
|
6 |
* |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
196
diff
changeset
|
7 |
* This file is part of the IgH EtherCAT Master. |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
196
diff
changeset
|
8 |
* |
1326
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
9 |
* The IgH EtherCAT Master is free software; you can redistribute it and/or |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
10 |
* modify it under the terms of the GNU General Public License version 2, as |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
11 |
* published by the Free Software Foundation. |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
12 |
* |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
13 |
* The IgH EtherCAT Master is distributed in the hope that it will be useful, |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
16 |
* Public License for more details. |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
17 |
* |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
18 |
* You should have received a copy of the GNU General Public License along |
ef907b0b5125
merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents:
1313
diff
changeset
|
19 |
* with the IgH EtherCAT Master; if not, write to the Free Software |
197
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
196
diff
changeset
|
20 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
* |
1363
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
22 |
* --- |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
23 |
* |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
24 |
* The license mentioned above concerns the source code only. Using the |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
25 |
* EtherCAT technology and brand is only permitted in compliance with the |
11c0b2caa253
Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents:
1337
diff
changeset
|
26 |
* industrial property and similar rights of Beckhoff Automation GmbH. |
246
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
201
diff
changeset
|
27 |
* |
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
34
diff
changeset
|
28 |
*****************************************************************************/ |
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
30 |
/** \file |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
31 |
* EtherCAT master driver module. |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
32 |
*/ |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
33 |
|
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
34 |
/*****************************************************************************/ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
35 |
|
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
#include <linux/module.h> |
1014
d39d430cfdc4
Replaced include sysfs->device.
Florian Pose <fp@igh-essen.com>
parents:
1013
diff
changeset
|
37 |
#include <linux/device.h> |
1239
b50b93faaf3e
Used ERR_PTR() macro for return value of ecrt_request_master().
Florian Pose <fp@igh-essen.com>
parents:
1209
diff
changeset
|
38 |
#include <linux/err.h> |
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
|
184
2fc86cec12df
Macro for SysFS attribute definition
Florian Pose <fp@igh-essen.com>
parents:
178
diff
changeset
|
40 |
#include "globals.h" |
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
41 |
#include "master.h" |
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
42 |
#include "device.h" |
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
43 |
|
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
44 |
/*****************************************************************************/ |
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
45 |
|
1814
23fcca9ef1fb
Increased default number of masters to 32.
Florian Pose <fp@igh-essen.com>
parents:
1586
diff
changeset
|
46 |
#define MAX_MASTERS 32 /**< Maximum number of masters. */ |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
47 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
48 |
/*****************************************************************************/ |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
49 |
|
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
50 |
int __init ec_init_module(void); |
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
51 |
void __exit ec_cleanup_module(void); |
52 | 52 |
|
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
53 |
static int ec_mac_parse(uint8_t *, const char *, int); |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
54 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
55 |
/*****************************************************************************/ |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
56 |
|
806
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
57 |
static char *main_devices[MAX_MASTERS]; /**< Main devices parameter. */ |
1399
f79d4bb5b23a
Added debug_level module parameter. debug_level is now unsigned int.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
58 |
static unsigned int master_count; /**< Number of masters. */ |
806
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
59 |
static char *backup_devices[MAX_MASTERS]; /**< Backup devices parameter. */ |
1399
f79d4bb5b23a
Added debug_level module parameter. debug_level is now unsigned int.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
60 |
static unsigned int backup_count; /**< Number of backup devices. */ |
f79d4bb5b23a
Added debug_level module parameter. debug_level is now unsigned int.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
61 |
static unsigned int debug_level; /**< Debug level parameter. */ |
806
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
62 |
|
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
63 |
static ec_master_t *masters; /**< Array of masters. */ |
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
64 |
static struct semaphore master_sem; /**< Master semaphore. */ |
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
65 |
|
954
4e7be3b24622
Removed static from device.
Florian Pose <fp@igh-essen.com>
parents:
922
diff
changeset
|
66 |
dev_t device_number; /**< Device number for master cdevs. */ |
1012
89f87a901ce5
Create device class. Preparation for device numbers in sysfs.
Florian Pose <fp@igh-essen.com>
parents:
1011
diff
changeset
|
67 |
struct class *class; /**< Device class. */ |
922
fede1d8f5b71
Added the new ethercat comman-line tool with lsec functionality.
Florian Pose <fp@igh-essen.com>
parents:
919
diff
changeset
|
68 |
|
806
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
69 |
static uint8_t macs[MAX_MASTERS][2][ETH_ALEN]; /**< MAC addresses. */ |
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
70 |
|
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
71 |
char *ec_master_version_str = EC_MASTER_VERSION; /**< Version string. */ |
444
31223539fc00
Compiler flag -DSVNREV only for module.c to avoid unnecessary recompiling.
Florian Pose <fp@igh-essen.com>
parents:
430
diff
changeset
|
72 |
|
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
34
diff
changeset
|
73 |
/*****************************************************************************/ |
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
34
diff
changeset
|
74 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
75 |
/** \cond */ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
76 |
|
251
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
77 |
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>"); |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
78 |
MODULE_DESCRIPTION("EtherCAT master driver module"); |
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
79 |
MODULE_LICENSE("GPL"); |
382
72500991bcc3
Altered master version string.
Florian Pose <fp@igh-essen.com>
parents:
381
diff
changeset
|
80 |
MODULE_VERSION(EC_MASTER_VERSION); |
573
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
81 |
|
806
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
82 |
module_param_array(main_devices, charp, &master_count, S_IRUGO); |
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
83 |
MODULE_PARM_DESC(main_devices, "MAC addresses of main devices"); |
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
84 |
module_param_array(backup_devices, charp, &backup_count, S_IRUGO); |
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
85 |
MODULE_PARM_DESC(backup_devices, "MAC addresses of backup devices"); |
1399
f79d4bb5b23a
Added debug_level module parameter. debug_level is now unsigned int.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
86 |
module_param_named(debug_level, debug_level, uint, S_IRUGO); |
f79d4bb5b23a
Added debug_level module parameter. debug_level is now unsigned int.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
87 |
MODULE_PARM_DESC(debug_level, "Debug level"); |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
88 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
89 |
/** \endcond */ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
90 |
|
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
91 |
/*****************************************************************************/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
92 |
|
806
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
93 |
/** Module initialization. |
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
94 |
* |
922
fede1d8f5b71
Added the new ethercat comman-line tool with lsec functionality.
Florian Pose <fp@igh-essen.com>
parents:
919
diff
changeset
|
95 |
* Initializes \a master_count masters. |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
96 |
* \return 0 on success, else < 0 |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
97 |
*/ |
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
98 |
int __init ec_init_module(void) |
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
99 |
{ |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
100 |
int i, ret = 0; |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
64
diff
changeset
|
101 |
|
382
72500991bcc3
Altered master version string.
Florian Pose <fp@igh-essen.com>
parents:
381
diff
changeset
|
102 |
EC_INFO("Master driver %s\n", EC_MASTER_VERSION); |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
64
diff
changeset
|
103 |
|
1579
326d47aa986c
applied komax patch to version r1822
Martin Troxler <martin.troxler@komaxgroup.com>
parents:
1469
diff
changeset
|
104 |
sema_init(&master_sem, 1); |
653
33aa0e7e5a68
Fixed missing semaphore initialization.
Florian Pose <fp@igh-essen.com>
parents:
648
diff
changeset
|
105 |
|
997
652180478e95
Removed kobject from master and module. Sysfs is gone!
Florian Pose <fp@igh-essen.com>
parents:
954
diff
changeset
|
106 |
if (master_count) { |
1921 | 107 |
if (alloc_chrdev_region(&device_number, |
108 |
0, master_count, "EtherCAT")) { |
|
997
652180478e95
Removed kobject from master and module. Sysfs is gone!
Florian Pose <fp@igh-essen.com>
parents:
954
diff
changeset
|
109 |
EC_ERR("Failed to obtain device number(s)!\n"); |
652180478e95
Removed kobject from master and module. Sysfs is gone!
Florian Pose <fp@igh-essen.com>
parents:
954
diff
changeset
|
110 |
ret = -EBUSY; |
652180478e95
Removed kobject from master and module. Sysfs is gone!
Florian Pose <fp@igh-essen.com>
parents:
954
diff
changeset
|
111 |
goto out_return; |
652180478e95
Removed kobject from master and module. Sysfs is gone!
Florian Pose <fp@igh-essen.com>
parents:
954
diff
changeset
|
112 |
} |
922
fede1d8f5b71
Added the new ethercat comman-line tool with lsec functionality.
Florian Pose <fp@igh-essen.com>
parents:
919
diff
changeset
|
113 |
} |
fede1d8f5b71
Added the new ethercat comman-line tool with lsec functionality.
Florian Pose <fp@igh-essen.com>
parents:
919
diff
changeset
|
114 |
|
1012
89f87a901ce5
Create device class. Preparation for device numbers in sysfs.
Florian Pose <fp@igh-essen.com>
parents:
1011
diff
changeset
|
115 |
class = class_create(THIS_MODULE, "EtherCAT"); |
89f87a901ce5
Create device class. Preparation for device numbers in sysfs.
Florian Pose <fp@igh-essen.com>
parents:
1011
diff
changeset
|
116 |
if (IS_ERR(class)) { |
89f87a901ce5
Create device class. Preparation for device numbers in sysfs.
Florian Pose <fp@igh-essen.com>
parents:
1011
diff
changeset
|
117 |
EC_ERR("Failed to create device class.\n"); |
1313
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
118 |
ret = PTR_ERR(class); |
1012
89f87a901ce5
Create device class. Preparation for device numbers in sysfs.
Florian Pose <fp@igh-essen.com>
parents:
1011
diff
changeset
|
119 |
goto out_cdev; |
89f87a901ce5
Create device class. Preparation for device numbers in sysfs.
Florian Pose <fp@igh-essen.com>
parents:
1011
diff
changeset
|
120 |
} |
89f87a901ce5
Create device class. Preparation for device numbers in sysfs.
Florian Pose <fp@igh-essen.com>
parents:
1011
diff
changeset
|
121 |
|
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
122 |
// zero MAC addresses |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
123 |
memset(macs, 0x00, sizeof(uint8_t) * MAX_MASTERS * 2 * ETH_ALEN); |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
124 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
125 |
// process MAC parameters |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
126 |
for (i = 0; i < master_count; i++) { |
1313
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
127 |
ret = ec_mac_parse(macs[i][0], main_devices[i], 0); |
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
128 |
if (ret) |
1012
89f87a901ce5
Create device class. Preparation for device numbers in sysfs.
Florian Pose <fp@igh-essen.com>
parents:
1011
diff
changeset
|
129 |
goto out_class; |
573
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
130 |
|
1313
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
131 |
if (i < backup_count) { |
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
132 |
ret = ec_mac_parse(macs[i][1], backup_devices[i], 1); |
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
133 |
if (ret) |
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
134 |
goto out_class; |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
135 |
} |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
136 |
} |
1279
6911450535b7
merge -c1522 branches/stable-1.4: Fixed jace in jiffies timeout calculation.
Florian Pose <fp@igh-essen.com>
parents:
1239
diff
changeset
|
137 |
|
6911450535b7
merge -c1522 branches/stable-1.4: Fixed jace in jiffies timeout calculation.
Florian Pose <fp@igh-essen.com>
parents:
1239
diff
changeset
|
138 |
// initialize static master variables |
6911450535b7
merge -c1522 branches/stable-1.4: Fixed jace in jiffies timeout calculation.
Florian Pose <fp@igh-essen.com>
parents:
1239
diff
changeset
|
139 |
ec_master_init_static(); |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
140 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
141 |
if (master_count) { |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
142 |
if (!(masters = kmalloc(sizeof(ec_master_t) * master_count, |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
143 |
GFP_KERNEL))) { |
1921 | 144 |
EC_ERR("Failed to allocate memory" |
145 |
" for EtherCAT masters.\n"); |
|
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
146 |
ret = -ENOMEM; |
1012
89f87a901ce5
Create device class. Preparation for device numbers in sysfs.
Florian Pose <fp@igh-essen.com>
parents:
1011
diff
changeset
|
147 |
goto out_class; |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
148 |
} |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
149 |
} |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
150 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
151 |
for (i = 0; i < master_count; i++) { |
1313
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
152 |
ret = ec_master_init(&masters[i], i, macs[i][0], macs[i][1], |
1399
f79d4bb5b23a
Added debug_level module parameter. debug_level is now unsigned int.
Florian Pose <fp@igh-essen.com>
parents:
1363
diff
changeset
|
153 |
device_number, class, debug_level); |
1313
ed15eef57d5c
Improved error case return codes of many functions.
Florian Pose <fp@igh-essen.com>
parents:
1312
diff
changeset
|
154 |
if (ret) |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
155 |
goto out_free_masters; |
573
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
156 |
} |
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
157 |
|
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
158 |
EC_INFO("%u master%s waiting for devices.\n", |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
159 |
master_count, (master_count == 1 ? "" : "s")); |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
160 |
return ret; |
127
e67c80a76de4
Code aufger?umt und kleines Speicherleck entdeckt.
Florian Pose <fp@igh-essen.com>
parents:
111
diff
changeset
|
161 |
|
573
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
162 |
out_free_masters: |
997
652180478e95
Removed kobject from master and module. Sysfs is gone!
Florian Pose <fp@igh-essen.com>
parents:
954
diff
changeset
|
163 |
for (i--; i >= 0; i--) |
652180478e95
Removed kobject from master and module. Sysfs is gone!
Florian Pose <fp@igh-essen.com>
parents:
954
diff
changeset
|
164 |
ec_master_clear(&masters[i]); |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
165 |
kfree(masters); |
1012
89f87a901ce5
Create device class. Preparation for device numbers in sysfs.
Florian Pose <fp@igh-essen.com>
parents:
1011
diff
changeset
|
166 |
out_class: |
89f87a901ce5
Create device class. Preparation for device numbers in sysfs.
Florian Pose <fp@igh-essen.com>
parents:
1011
diff
changeset
|
167 |
class_destroy(class); |
922
fede1d8f5b71
Added the new ethercat comman-line tool with lsec functionality.
Florian Pose <fp@igh-essen.com>
parents:
919
diff
changeset
|
168 |
out_cdev: |
1012
89f87a901ce5
Create device class. Preparation for device numbers in sysfs.
Florian Pose <fp@igh-essen.com>
parents:
1011
diff
changeset
|
169 |
if (master_count) |
89f87a901ce5
Create device class. Preparation for device numbers in sysfs.
Florian Pose <fp@igh-essen.com>
parents:
1011
diff
changeset
|
170 |
unregister_chrdev_region(device_number, master_count); |
997
652180478e95
Removed kobject from master and module. Sysfs is gone!
Florian Pose <fp@igh-essen.com>
parents:
954
diff
changeset
|
171 |
out_return: |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
172 |
return ret; |
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
173 |
} |
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
174 |
|
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
34
diff
changeset
|
175 |
/*****************************************************************************/ |
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
176 |
|
806
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
177 |
/** Module cleanup. |
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
178 |
* |
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
179 |
* Clears all master instances. |
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
180 |
*/ |
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
181 |
void __exit ec_cleanup_module(void) |
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
182 |
{ |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
183 |
unsigned int i; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
184 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
185 |
for (i = 0; i < master_count; i++) { |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
186 |
ec_master_clear(&masters[i]); |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
187 |
} |
1012
89f87a901ce5
Create device class. Preparation for device numbers in sysfs.
Florian Pose <fp@igh-essen.com>
parents:
1011
diff
changeset
|
188 |
|
89f87a901ce5
Create device class. Preparation for device numbers in sysfs.
Florian Pose <fp@igh-essen.com>
parents:
1011
diff
changeset
|
189 |
if (master_count) |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
190 |
kfree(masters); |
1012
89f87a901ce5
Create device class. Preparation for device numbers in sysfs.
Florian Pose <fp@igh-essen.com>
parents:
1011
diff
changeset
|
191 |
|
89f87a901ce5
Create device class. Preparation for device numbers in sysfs.
Florian Pose <fp@igh-essen.com>
parents:
1011
diff
changeset
|
192 |
class_destroy(class); |
89f87a901ce5
Create device class. Preparation for device numbers in sysfs.
Florian Pose <fp@igh-essen.com>
parents:
1011
diff
changeset
|
193 |
|
89f87a901ce5
Create device class. Preparation for device numbers in sysfs.
Florian Pose <fp@igh-essen.com>
parents:
1011
diff
changeset
|
194 |
if (master_count) |
997
652180478e95
Removed kobject from master and module. Sysfs is gone!
Florian Pose <fp@igh-essen.com>
parents:
954
diff
changeset
|
195 |
unregister_chrdev_region(device_number, master_count); |
652180478e95
Removed kobject from master and module. Sysfs is gone!
Florian Pose <fp@igh-essen.com>
parents:
954
diff
changeset
|
196 |
|
575
9a2121b500b1
Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
573
diff
changeset
|
197 |
EC_INFO("Master module cleaned up.\n"); |
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
198 |
} |
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
199 |
|
1826
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
1814
diff
changeset
|
200 |
/*****************************************************************************/ |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
1814
diff
changeset
|
201 |
|
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
1814
diff
changeset
|
202 |
/** Get the number of masters. |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
1814
diff
changeset
|
203 |
*/ |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
1814
diff
changeset
|
204 |
unsigned int ec_master_count(void) |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
1814
diff
changeset
|
205 |
{ |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
1814
diff
changeset
|
206 |
return master_count; |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
1814
diff
changeset
|
207 |
} |
ec6223c3b7ec
Multi-master support for command-line tool. The --master option supports
Florian Pose <fp@igh-essen.com>
parents:
1814
diff
changeset
|
208 |
|
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
209 |
/***************************************************************************** |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
210 |
* MAC address functions |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
211 |
****************************************************************************/ |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
212 |
|
758
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
700
diff
changeset
|
213 |
/** |
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
700
diff
changeset
|
214 |
* \return true, if two MAC addresses are equal. |
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
700
diff
changeset
|
215 |
*/ |
840 | 216 |
int ec_mac_equal( |
217 |
const uint8_t *mac1, /**< First MAC address. */ |
|
218 |
const uint8_t *mac2 /**< Second MAC address. */ |
|
219 |
) |
|
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
220 |
{ |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
221 |
unsigned int i; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
222 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
223 |
for (i = 0; i < ETH_ALEN; i++) |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
224 |
if (mac1[i] != mac2[i]) |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
225 |
return 0; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
226 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
227 |
return 1; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
228 |
} |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
229 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
230 |
/*****************************************************************************/ |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
231 |
|
2267
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
232 |
/** Maximum MAC string size. |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
233 |
*/ |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
234 |
#define EC_MAX_MAC_STRING_SIZE (3 * ETH_ALEN) |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
235 |
|
806
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
236 |
/** Print a MAC address to a buffer. |
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
237 |
* |
2267
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
238 |
* The buffer size must be at least EC_MAX_MAC_STRING_SIZE. |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
239 |
* |
758
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
700
diff
changeset
|
240 |
* \return number of bytes written. |
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
700
diff
changeset
|
241 |
*/ |
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
700
diff
changeset
|
242 |
ssize_t ec_mac_print( |
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
700
diff
changeset
|
243 |
const uint8_t *mac, /**< MAC address */ |
2267
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
244 |
char *buffer /**< Target buffer. */ |
758
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
700
diff
changeset
|
245 |
) |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
246 |
{ |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
247 |
off_t off = 0; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
248 |
unsigned int i; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
249 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
250 |
for (i = 0; i < ETH_ALEN; i++) { |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
251 |
off += sprintf(buffer + off, "%02X", mac[i]); |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
252 |
if (i < ETH_ALEN - 1) off += sprintf(buffer + off, ":"); |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
253 |
} |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
254 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
255 |
return off; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
256 |
} |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
257 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
258 |
/*****************************************************************************/ |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
259 |
|
758
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
700
diff
changeset
|
260 |
/** |
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
700
diff
changeset
|
261 |
* \return true, if the MAC address is all-zero. |
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
700
diff
changeset
|
262 |
*/ |
840 | 263 |
int ec_mac_is_zero( |
264 |
const uint8_t *mac /**< MAC address. */ |
|
265 |
) |
|
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
266 |
{ |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
267 |
unsigned int i; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
268 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
269 |
for (i = 0; i < ETH_ALEN; i++) |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
270 |
if (mac[i]) |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
271 |
return 0; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
272 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
273 |
return 1; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
274 |
} |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
275 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
276 |
/*****************************************************************************/ |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
277 |
|
758
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
700
diff
changeset
|
278 |
/** |
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
700
diff
changeset
|
279 |
* \return true, if the given MAC address is the broadcast address. |
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
700
diff
changeset
|
280 |
*/ |
840 | 281 |
int ec_mac_is_broadcast( |
282 |
const uint8_t *mac /**< MAC address. */ |
|
283 |
) |
|
700
a6b61f1a062d
Broadcast MAC address accepts first device.
Florian Pose <fp@igh-essen.com>
parents:
653
diff
changeset
|
284 |
{ |
a6b61f1a062d
Broadcast MAC address accepts first device.
Florian Pose <fp@igh-essen.com>
parents:
653
diff
changeset
|
285 |
unsigned int i; |
a6b61f1a062d
Broadcast MAC address accepts first device.
Florian Pose <fp@igh-essen.com>
parents:
653
diff
changeset
|
286 |
|
a6b61f1a062d
Broadcast MAC address accepts first device.
Florian Pose <fp@igh-essen.com>
parents:
653
diff
changeset
|
287 |
for (i = 0; i < ETH_ALEN; i++) |
a6b61f1a062d
Broadcast MAC address accepts first device.
Florian Pose <fp@igh-essen.com>
parents:
653
diff
changeset
|
288 |
if (mac[i] != 0xff) |
a6b61f1a062d
Broadcast MAC address accepts first device.
Florian Pose <fp@igh-essen.com>
parents:
653
diff
changeset
|
289 |
return 0; |
a6b61f1a062d
Broadcast MAC address accepts first device.
Florian Pose <fp@igh-essen.com>
parents:
653
diff
changeset
|
290 |
|
a6b61f1a062d
Broadcast MAC address accepts first device.
Florian Pose <fp@igh-essen.com>
parents:
653
diff
changeset
|
291 |
return 1; |
a6b61f1a062d
Broadcast MAC address accepts first device.
Florian Pose <fp@igh-essen.com>
parents:
653
diff
changeset
|
292 |
} |
a6b61f1a062d
Broadcast MAC address accepts first device.
Florian Pose <fp@igh-essen.com>
parents:
653
diff
changeset
|
293 |
|
a6b61f1a062d
Broadcast MAC address accepts first device.
Florian Pose <fp@igh-essen.com>
parents:
653
diff
changeset
|
294 |
/*****************************************************************************/ |
a6b61f1a062d
Broadcast MAC address accepts first device.
Florian Pose <fp@igh-essen.com>
parents:
653
diff
changeset
|
295 |
|
806
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
296 |
/** Parse a MAC address from a string. |
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
297 |
* |
2129 | 298 |
* The MAC address must match the regular expression |
758
8fa6f825eb7d
Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents:
700
diff
changeset
|
299 |
* "([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}". |
806
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
300 |
* |
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
301 |
* \return 0 on success, else < 0 |
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
302 |
*/ |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
303 |
static int ec_mac_parse(uint8_t *mac, const char *src, int allow_empty) |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
304 |
{ |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
305 |
unsigned int i, value; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
306 |
const char *orig = src; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
307 |
char *rem; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
308 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
309 |
if (!strlen(src)) { |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
310 |
if (allow_empty){ |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
311 |
return 0; |
2129 | 312 |
} else { |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
313 |
EC_ERR("MAC address may not be empty.\n"); |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
314 |
return -EINVAL; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
315 |
} |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
316 |
} |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
317 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
318 |
for (i = 0; i < ETH_ALEN; i++) { |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
319 |
value = simple_strtoul(src, &rem, 16); |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
320 |
if (rem != src + 2 |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
321 |
|| value > 0xFF |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
322 |
|| (i < ETH_ALEN - 1 && *rem != ':')) { |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
323 |
EC_ERR("Invalid MAC address \"%s\".\n", orig); |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
324 |
return -EINVAL; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
325 |
} |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
326 |
mac[i] = value; |
2129 | 327 |
if (i < ETH_ALEN - 1) { |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
328 |
src = rem + 1; // skip colon |
2129 | 329 |
} |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
330 |
} |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
331 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
332 |
return 0; |
178
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
161
diff
changeset
|
333 |
} |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
161
diff
changeset
|
334 |
|
196
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
335 |
/*****************************************************************************/ |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
336 |
|
806
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
337 |
/** Outputs frame contents for debugging purposes. |
1584
cd9a68fd5b89
ec_print_data: show only the first 128 and the last 128 bytes of a data block
Martin Troxler <martin.troxler@komaxgroup.com>
parents:
1583
diff
changeset
|
338 |
* If the data block is larger than 256 bytes, only the first 128 |
cd9a68fd5b89
ec_print_data: show only the first 128 and the last 128 bytes of a data block
Martin Troxler <martin.troxler@komaxgroup.com>
parents:
1583
diff
changeset
|
339 |
* and the last 128 bytes will be shown |
806
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
340 |
*/ |
196
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
341 |
void ec_print_data(const uint8_t *data, /**< pointer to data */ |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
342 |
size_t size /**< number of bytes to output */ |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
343 |
) |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
344 |
{ |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
345 |
unsigned int i; |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
346 |
|
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
347 |
EC_DBG(""); |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
348 |
for (i = 0; i < size; i++) { |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
349 |
printk("%02X ", data[i]); |
1930
59a50053ccc6
Made send_interval variable an unsigned int; fixed format specifiers for
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
350 |
|
1469
873e4ee3d5ec
Improved newlines in debug data output.
Florian Pose <fp@igh-essen.com>
parents:
1399
diff
changeset
|
351 |
if ((i + 1) % 16 == 0 && i < size - 1) { |
196
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
352 |
printk("\n"); |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
353 |
EC_DBG(""); |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
354 |
} |
1930
59a50053ccc6
Made send_interval variable an unsigned int; fixed format specifiers for
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
355 |
|
59a50053ccc6
Made send_interval variable an unsigned int; fixed format specifiers for
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
356 |
if (i + 1 == 128 && size > 256) { |
59a50053ccc6
Made send_interval variable an unsigned int; fixed format specifiers for
Florian Pose <fp@igh-essen.com>
parents:
1921
diff
changeset
|
357 |
printk("dropped %zu bytes\n", size - 128 - i); |
1583
017fa8fd9ac1
Each slave got its own SDO state machine (faster handling of external SDO requests)
Martin Troxler <martin.troxler@komaxgroup.com>
parents:
1579
diff
changeset
|
358 |
i = size - 128; |
1584
cd9a68fd5b89
ec_print_data: show only the first 128 and the last 128 bytes of a data block
Martin Troxler <martin.troxler@komaxgroup.com>
parents:
1583
diff
changeset
|
359 |
EC_DBG(""); |
1583
017fa8fd9ac1
Each slave got its own SDO state machine (faster handling of external SDO requests)
Martin Troxler <martin.troxler@komaxgroup.com>
parents:
1579
diff
changeset
|
360 |
} |
196
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
361 |
} |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
362 |
printk("\n"); |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
363 |
} |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
364 |
|
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
365 |
/*****************************************************************************/ |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
366 |
|
806
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
367 |
/** Outputs frame contents and differences for debugging purposes. |
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
368 |
*/ |
196
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
369 |
void ec_print_data_diff(const uint8_t *d1, /**< first data */ |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
370 |
const uint8_t *d2, /**< second data */ |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
371 |
size_t size /** number of bytes to output */ |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
372 |
) |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
373 |
{ |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
374 |
unsigned int i; |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
375 |
|
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
376 |
EC_DBG(""); |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
377 |
for (i = 0; i < size; i++) { |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
378 |
if (d1[i] == d2[i]) printk(".. "); |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
379 |
else printk("%02X ", d2[i]); |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
380 |
if ((i + 1) % 16 == 0) { |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
381 |
printk("\n"); |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
382 |
EC_DBG(""); |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
383 |
} |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
384 |
} |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
385 |
printk("\n"); |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
386 |
} |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
387 |
|
251
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
388 |
/*****************************************************************************/ |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
389 |
|
806
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
390 |
/** Prints slave states in clear text. |
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
391 |
*/ |
325
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
321
diff
changeset
|
392 |
size_t ec_state_string(uint8_t states, /**< slave states */ |
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
393 |
char *buffer, /**< target buffer |
403
7bb931deccd9
Added EC_SLAVE_STATE_ACK_ERR to ec_state_string(); added EC_STATE_STRING_SIZE
Florian Pose <fp@igh-essen.com>
parents:
383
diff
changeset
|
394 |
(min. EC_STATE_STRING_SIZE bytes) */ |
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
395 |
uint8_t multi /**< Show multi-state mask. */ |
325
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
321
diff
changeset
|
396 |
) |
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
321
diff
changeset
|
397 |
{ |
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
321
diff
changeset
|
398 |
off_t off = 0; |
251
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
399 |
unsigned int first = 1; |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
400 |
|
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
401 |
if (!states) { |
325
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
321
diff
changeset
|
402 |
off += sprintf(buffer + off, "(unknown)"); |
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
321
diff
changeset
|
403 |
return off; |
251
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
404 |
} |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
405 |
|
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
406 |
if (multi) { // multiple slaves |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
407 |
if (states & EC_SLAVE_STATE_INIT) { |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
408 |
off += sprintf(buffer + off, "INIT"); |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
409 |
first = 0; |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
410 |
} |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
411 |
if (states & EC_SLAVE_STATE_PREOP) { |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
412 |
if (!first) off += sprintf(buffer + off, ", "); |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
413 |
off += sprintf(buffer + off, "PREOP"); |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
414 |
first = 0; |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
415 |
} |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
416 |
if (states & EC_SLAVE_STATE_SAFEOP) { |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
417 |
if (!first) off += sprintf(buffer + off, ", "); |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
418 |
off += sprintf(buffer + off, "SAFEOP"); |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
419 |
first = 0; |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
420 |
} |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
421 |
if (states & EC_SLAVE_STATE_OP) { |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
422 |
if (!first) off += sprintf(buffer + off, ", "); |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
423 |
off += sprintf(buffer + off, "OP"); |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
424 |
} |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
425 |
} else { // single slave |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
426 |
if ((states & EC_SLAVE_STATE_MASK) == EC_SLAVE_STATE_INIT) { |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
427 |
off += sprintf(buffer + off, "INIT"); |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
428 |
} else if ((states & EC_SLAVE_STATE_MASK) == EC_SLAVE_STATE_PREOP) { |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
429 |
off += sprintf(buffer + off, "PREOP"); |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
430 |
} else if ((states & EC_SLAVE_STATE_MASK) == EC_SLAVE_STATE_BOOT) { |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
431 |
off += sprintf(buffer + off, "BOOT"); |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
432 |
} else if ((states & EC_SLAVE_STATE_MASK) == EC_SLAVE_STATE_SAFEOP) { |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
433 |
off += sprintf(buffer + off, "SAFEOP"); |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
434 |
} else if ((states & EC_SLAVE_STATE_MASK) == EC_SLAVE_STATE_OP) { |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
435 |
off += sprintf(buffer + off, "OP"); |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
436 |
} else { |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
437 |
off += sprintf(buffer + off, "(invalid)"); |
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
438 |
} |
251
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
439 |
first = 0; |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
440 |
} |
1337
0253c74d0940
merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents:
1332
diff
changeset
|
441 |
|
403
7bb931deccd9
Added EC_SLAVE_STATE_ACK_ERR to ec_state_string(); added EC_STATE_STRING_SIZE
Florian Pose <fp@igh-essen.com>
parents:
383
diff
changeset
|
442 |
if (states & EC_SLAVE_STATE_ACK_ERR) { |
453
2ecaa53c6291
Changed output of ec_state_string() for error flag to "+ ERROR".
Florian Pose <fp@igh-essen.com>
parents:
448
diff
changeset
|
443 |
if (!first) off += sprintf(buffer + off, " + "); |
2ecaa53c6291
Changed output of ec_state_string() for error flag to "+ ERROR".
Florian Pose <fp@igh-essen.com>
parents:
448
diff
changeset
|
444 |
off += sprintf(buffer + off, "ERROR"); |
403
7bb931deccd9
Added EC_SLAVE_STATE_ACK_ERR to ec_state_string(); added EC_STATE_STRING_SIZE
Florian Pose <fp@igh-essen.com>
parents:
383
diff
changeset
|
445 |
} |
325
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
321
diff
changeset
|
446 |
|
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
321
diff
changeset
|
447 |
return off; |
251
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
448 |
} |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
449 |
|
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
450 |
/****************************************************************************** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
451 |
* Device interface |
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
452 |
*****************************************************************************/ |
33
f4171b8aadf8
Master-Reservierung und Use-Count f?r NIC-Treiber.
Florian Pose <fp@igh-essen.com>
parents:
27
diff
changeset
|
453 |
|
2267
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
454 |
/** Device names. |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
455 |
*/ |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
456 |
static const char *ec_device_names[EC_NUM_DEVICES] = { |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
457 |
"main", |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
458 |
"backup" |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
459 |
}; |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
460 |
|
806
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
461 |
/** Offers an EtherCAT device to a certain master. |
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
462 |
* |
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
463 |
* The master decides, if it wants to use the device for EtherCAT operation, |
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
464 |
* or not. It is important, that the offered net_device is not used by the |
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
465 |
* kernel IP stack. If the master, accepted the offer, the address of the |
1011 | 466 |
* newly created EtherCAT device is returned, else \a NULL is returned. |
467 |
* |
|
468 |
* \return Pointer to device, if accepted, or NULL if declined. |
|
806
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
469 |
* \ingroup DeviceInterface |
ab8daaabbe48
Renamed master module parameters, re-formatted code documentation.
Florian Pose <fp@igh-essen.com>
parents:
794
diff
changeset
|
470 |
*/ |
1011 | 471 |
ec_device_t *ecdev_offer( |
472 |
struct net_device *net_dev, /**< net_device to offer */ |
|
573
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
473 |
ec_pollfunc_t poll, /**< device poll function */ |
1011 | 474 |
struct module *module /**< pointer to the module */ |
573
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
475 |
) |
91
0120d6214948
Code-Dokumentation angepasst.
Florian Pose <fp@igh-essen.com>
parents:
88
diff
changeset
|
476 |
{ |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
64
diff
changeset
|
477 |
ec_master_t *master; |
2267
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
478 |
char str[EC_MAX_MAC_STRING_SIZE]; |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
479 |
unsigned int i, j; |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
480 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
481 |
for (i = 0; i < master_count; i++) { |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
482 |
master = &masters[i]; |
2156
71425e6120d8
Master accepting two devices.
Florian Pose <fp@igh-essen.com>
parents:
2129
diff
changeset
|
483 |
ec_mac_print(net_dev->dev_addr, str); |
700
a6b61f1a062d
Broadcast MAC address accepts first device.
Florian Pose <fp@igh-essen.com>
parents:
653
diff
changeset
|
484 |
|
a6b61f1a062d
Broadcast MAC address accepts first device.
Florian Pose <fp@igh-essen.com>
parents:
653
diff
changeset
|
485 |
down(&master->device_sem); |
2156
71425e6120d8
Master accepting two devices.
Florian Pose <fp@igh-essen.com>
parents:
2129
diff
changeset
|
486 |
|
2267
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
487 |
for (j = 0; j < EC_NUM_DEVICES; j++) { |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
488 |
if (!master->devices[j].dev |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
489 |
&& (ec_mac_equal(master->macs[j], net_dev->dev_addr) |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
490 |
|| ec_mac_is_broadcast(master->macs[j]))) { |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
491 |
|
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
492 |
EC_INFO("Accepting %s as %s device for master %u.\n", |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
493 |
str, ec_device_names[j], master->index); |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
494 |
|
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
495 |
ec_device_attach(&master->devices[j], net_dev, poll, module); |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
496 |
up(&master->device_sem); |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
497 |
|
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
498 |
snprintf(net_dev->name, IFNAMSIZ, "ec%c%u", |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
499 |
ec_device_names[j][0], master->index); |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
500 |
|
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
501 |
return &master->devices[j]; // offer accepted |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
502 |
} |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
503 |
} |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
504 |
|
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
505 |
up(&master->device_sem); |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
506 |
|
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
507 |
EC_MASTER_DBG(master, 1, "Master declined device %s.\n", str); |
573
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
508 |
} |
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
509 |
|
1011 | 510 |
return NULL; // offer declined |
497
04552130dd54
Re-introduced ecdev_open() and ecdev_close(), to avoid a race condition regarding the link state.
Florian Pose <fp@igh-essen.com>
parents:
495
diff
changeset
|
511 |
} |
04552130dd54
Re-introduced ecdev_open() and ecdev_close(), to avoid a race condition regarding the link state.
Florian Pose <fp@igh-essen.com>
parents:
495
diff
changeset
|
512 |
|
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
513 |
/****************************************************************************** |
2129 | 514 |
* Application interface |
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
515 |
*****************************************************************************/ |
33
f4171b8aadf8
Master-Reservierung und Use-Count f?r NIC-Treiber.
Florian Pose <fp@igh-essen.com>
parents:
27
diff
changeset
|
516 |
|
1312
74853e018898
Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents:
1279
diff
changeset
|
517 |
/** Request a master. |
74853e018898
Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents:
1279
diff
changeset
|
518 |
* |
74853e018898
Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents:
1279
diff
changeset
|
519 |
* Same as ecrt_request_master(), but with ERR_PTR() return value. |
74853e018898
Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents:
1279
diff
changeset
|
520 |
*/ |
1332
d62633fea8ed
merge -c1610 branches/stable-1.4: Added missing doxygen docs.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
521 |
ec_master_t *ecrt_request_master_err( |
d62633fea8ed
merge -c1610 branches/stable-1.4: Added missing doxygen docs.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
522 |
unsigned int master_index /**< Master index. */ |
d62633fea8ed
merge -c1610 branches/stable-1.4: Added missing doxygen docs.
Florian Pose <fp@igh-essen.com>
parents:
1326
diff
changeset
|
523 |
) |
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
524 |
{ |
1239
b50b93faaf3e
Used ERR_PTR() macro for return value of ecrt_request_master().
Florian Pose <fp@igh-essen.com>
parents:
1209
diff
changeset
|
525 |
ec_master_t *master, *errptr = NULL; |
2267
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
526 |
unsigned int i, got_modules = 0; |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
64
diff
changeset
|
527 |
|
647
dc556a8c8fed
Replaced master variable 'atomic_t available' by integer and used
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
528 |
EC_INFO("Requesting master %u...\n", master_index); |
178
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
161
diff
changeset
|
529 |
|
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
530 |
if (master_index >= master_count) { |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
531 |
EC_ERR("Invalid master index %u.\n", master_index); |
1239
b50b93faaf3e
Used ERR_PTR() macro for return value of ecrt_request_master().
Florian Pose <fp@igh-essen.com>
parents:
1209
diff
changeset
|
532 |
errptr = ERR_PTR(-EINVAL); |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
533 |
goto out_return; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
534 |
} |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
535 |
master = &masters[master_index]; |
178
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
161
diff
changeset
|
536 |
|
1239
b50b93faaf3e
Used ERR_PTR() macro for return value of ecrt_request_master().
Florian Pose <fp@igh-essen.com>
parents:
1209
diff
changeset
|
537 |
if (down_interruptible(&master_sem)) { |
b50b93faaf3e
Used ERR_PTR() macro for return value of ecrt_request_master().
Florian Pose <fp@igh-essen.com>
parents:
1209
diff
changeset
|
538 |
errptr = ERR_PTR(-EINTR); |
1189
acc6430bfb32
Use down_interruptible() wherever possible.
Florian Pose <fp@igh-essen.com>
parents:
1029
diff
changeset
|
539 |
goto out_return; |
1239
b50b93faaf3e
Used ERR_PTR() macro for return value of ecrt_request_master().
Florian Pose <fp@igh-essen.com>
parents:
1209
diff
changeset
|
540 |
} |
1189
acc6430bfb32
Use down_interruptible() wherever possible.
Florian Pose <fp@igh-essen.com>
parents:
1029
diff
changeset
|
541 |
|
647
dc556a8c8fed
Replaced master variable 'atomic_t available' by integer and used
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
542 |
if (master->reserved) { |
dc556a8c8fed
Replaced master variable 'atomic_t available' by integer and used
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
543 |
up(&master_sem); |
1921 | 544 |
EC_MASTER_ERR(master, "Master already in use!\n"); |
1239
b50b93faaf3e
Used ERR_PTR() macro for return value of ecrt_request_master().
Florian Pose <fp@igh-essen.com>
parents:
1209
diff
changeset
|
545 |
errptr = ERR_PTR(-EBUSY); |
191 | 546 |
goto out_return; |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
64
diff
changeset
|
547 |
} |
647
dc556a8c8fed
Replaced master variable 'atomic_t available' by integer and used
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
548 |
master->reserved = 1; |
dc556a8c8fed
Replaced master variable 'atomic_t available' by integer and used
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
549 |
up(&master_sem); |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
64
diff
changeset
|
550 |
|
1239
b50b93faaf3e
Used ERR_PTR() macro for return value of ecrt_request_master().
Florian Pose <fp@igh-essen.com>
parents:
1209
diff
changeset
|
551 |
if (down_interruptible(&master->device_sem)) { |
b50b93faaf3e
Used ERR_PTR() macro for return value of ecrt_request_master().
Florian Pose <fp@igh-essen.com>
parents:
1209
diff
changeset
|
552 |
errptr = ERR_PTR(-EINTR); |
1189
acc6430bfb32
Use down_interruptible() wherever possible.
Florian Pose <fp@igh-essen.com>
parents:
1029
diff
changeset
|
553 |
goto out_release; |
1239
b50b93faaf3e
Used ERR_PTR() macro for return value of ecrt_request_master().
Florian Pose <fp@igh-essen.com>
parents:
1209
diff
changeset
|
554 |
} |
648
0a6d38ec463f
Made waiting for device semaphore uninterruptible.
Florian Pose <fp@igh-essen.com>
parents:
647
diff
changeset
|
555 |
|
1029
61ffe5f22306
Renamed master 'mode' to 'phase'.
Florian Pose <fp@igh-essen.com>
parents:
1014
diff
changeset
|
556 |
if (master->phase != EC_IDLE) { |
381
006d3653701d
Fixed race on duplicate device registering or device unregistering while requesting master.
Florian Pose <fp@igh-essen.com>
parents:
378
diff
changeset
|
557 |
up(&master->device_sem); |
1921 | 558 |
EC_MASTER_ERR(master, "Master still waiting for devices!\n"); |
1239
b50b93faaf3e
Used ERR_PTR() macro for return value of ecrt_request_master().
Florian Pose <fp@igh-essen.com>
parents:
1209
diff
changeset
|
559 |
errptr = ERR_PTR(-ENODEV); |
191 | 560 |
goto out_release; |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
64
diff
changeset
|
561 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
64
diff
changeset
|
562 |
|
2267
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
563 |
for (i = 0; i < EC_NUM_DEVICES; i++) { |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
564 |
ec_device_t *device = &master->devices[i]; |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
565 |
if (device->dev) { |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
566 |
if (!try_module_get(device->module)) { |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
567 |
up(&master->device_sem); |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
568 |
EC_MASTER_ERR(master, "Device module is unloading!\n"); |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
569 |
errptr = ERR_PTR(-ENODEV); |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
570 |
goto out_module_put; |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
571 |
} |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
572 |
} |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
573 |
got_modules++; |
191 | 574 |
} |
575 |
||
381
006d3653701d
Fixed race on duplicate device registering or device unregistering while requesting master.
Florian Pose <fp@igh-essen.com>
parents:
378
diff
changeset
|
576 |
up(&master->device_sem); |
006d3653701d
Fixed race on duplicate device registering or device unregistering while requesting master.
Florian Pose <fp@igh-essen.com>
parents:
378
diff
changeset
|
577 |
|
1029
61ffe5f22306
Renamed master 'mode' to 'phase'.
Florian Pose <fp@igh-essen.com>
parents:
1014
diff
changeset
|
578 |
if (ec_master_enter_operation_phase(master)) { |
1921 | 579 |
EC_MASTER_ERR(master, "Failed to enter OPERATION phase!\n"); |
1239
b50b93faaf3e
Used ERR_PTR() macro for return value of ecrt_request_master().
Florian Pose <fp@igh-essen.com>
parents:
1209
diff
changeset
|
580 |
errptr = ERR_PTR(-EIO); |
446 | 581 |
goto out_module_put; |
377
ecac8252f114
Changes in ecrt_request_master(); minor output changes.
Florian Pose <fp@igh-essen.com>
parents:
361
diff
changeset
|
582 |
} |
ecac8252f114
Changes in ecrt_request_master(); minor output changes.
Florian Pose <fp@igh-essen.com>
parents:
361
diff
changeset
|
583 |
|
647
dc556a8c8fed
Replaced master variable 'atomic_t available' by integer and used
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
584 |
EC_INFO("Successfully requested master %u.\n", master_index); |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
64
diff
changeset
|
585 |
return master; |
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
586 |
|
191 | 587 |
out_module_put: |
2267
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
588 |
for (; got_modules > 0; got_modules--) { |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
589 |
ec_device_t *device = &master->devices[i - 1]; |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
590 |
if (device->dev) { |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
591 |
module_put(device->module); |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
592 |
} |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
593 |
} |
191 | 594 |
out_release: |
647
dc556a8c8fed
Replaced master variable 'atomic_t available' by integer and used
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
595 |
master->reserved = 0; |
191 | 596 |
out_return: |
1239
b50b93faaf3e
Used ERR_PTR() macro for return value of ecrt_request_master().
Florian Pose <fp@igh-essen.com>
parents:
1209
diff
changeset
|
597 |
return errptr; |
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
598 |
} |
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
599 |
|
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
34
diff
changeset
|
600 |
/*****************************************************************************/ |
33
f4171b8aadf8
Master-Reservierung und Use-Count f?r NIC-Treiber.
Florian Pose <fp@igh-essen.com>
parents:
27
diff
changeset
|
601 |
|
1312
74853e018898
Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents:
1279
diff
changeset
|
602 |
ec_master_t *ecrt_request_master(unsigned int master_index) |
74853e018898
Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents:
1279
diff
changeset
|
603 |
{ |
74853e018898
Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents:
1279
diff
changeset
|
604 |
ec_master_t *master = ecrt_request_master_err(master_index); |
74853e018898
Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents:
1279
diff
changeset
|
605 |
return IS_ERR(master) ? NULL : master; |
74853e018898
Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents:
1279
diff
changeset
|
606 |
} |
74853e018898
Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents:
1279
diff
changeset
|
607 |
|
74853e018898
Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents:
1279
diff
changeset
|
608 |
/*****************************************************************************/ |
74853e018898
Created backend versions of all API functions returing a pointer; using
Florian Pose <fp@igh-essen.com>
parents:
1279
diff
changeset
|
609 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
610 |
void ecrt_release_master(ec_master_t *master) |
33
f4171b8aadf8
Master-Reservierung und Use-Count f?r NIC-Treiber.
Florian Pose <fp@igh-essen.com>
parents:
27
diff
changeset
|
611 |
{ |
2267
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
612 |
unsigned int i; |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
613 |
|
1921 | 614 |
EC_MASTER_INFO(master, "Releasing master...\n"); |
531
8d9339e7453f
Warn on duplicate master releasing.
Florian Pose <fp@igh-essen.com>
parents:
525
diff
changeset
|
615 |
|
997
652180478e95
Removed kobject from master and module. Sysfs is gone!
Florian Pose <fp@igh-essen.com>
parents:
954
diff
changeset
|
616 |
if (!master->reserved) { |
1921 | 617 |
EC_MASTER_WARN(master, "%s(): Master was was not requested!\n", |
618 |
__func__); |
|
531
8d9339e7453f
Warn on duplicate master releasing.
Florian Pose <fp@igh-essen.com>
parents:
525
diff
changeset
|
619 |
return; |
8d9339e7453f
Warn on duplicate master releasing.
Florian Pose <fp@igh-essen.com>
parents:
525
diff
changeset
|
620 |
} |
8d9339e7453f
Warn on duplicate master releasing.
Florian Pose <fp@igh-essen.com>
parents:
525
diff
changeset
|
621 |
|
1029
61ffe5f22306
Renamed master 'mode' to 'phase'.
Florian Pose <fp@igh-essen.com>
parents:
1014
diff
changeset
|
622 |
ec_master_leave_operation_phase(master); |
151
1961b674466c
Plugfest: master_open()/close() ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
127
diff
changeset
|
623 |
|
2267
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
624 |
for (i = 0; i < EC_NUM_DEVICES; i++) { |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
625 |
if (master->devices[i].dev) { |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
626 |
module_put(master->devices[i].module); |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
627 |
} |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
628 |
} |
2d36f36a433c
Devices as array; lock all device modules with module_get().
Florian Pose <fp@igh-essen.com>
parents:
2159
diff
changeset
|
629 |
|
647
dc556a8c8fed
Replaced master variable 'atomic_t available' by integer and used
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
630 |
master->reserved = 0; |
dc556a8c8fed
Replaced master variable 'atomic_t available' by integer and used
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
631 |
|
1921 | 632 |
EC_MASTER_INFO(master, "Released.\n"); |
33
f4171b8aadf8
Master-Reservierung und Use-Count f?r NIC-Treiber.
Florian Pose <fp@igh-essen.com>
parents:
27
diff
changeset
|
633 |
} |
f4171b8aadf8
Master-Reservierung und Use-Count f?r NIC-Treiber.
Florian Pose <fp@igh-essen.com>
parents:
27
diff
changeset
|
634 |
|
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
34
diff
changeset
|
635 |
/*****************************************************************************/ |
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
636 |
|
792
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
637 |
unsigned int ecrt_version_magic(void) |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
638 |
{ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
639 |
return ECRT_VERSION_MAGIC; |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
640 |
} |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
641 |
|
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
642 |
/*****************************************************************************/ |
3778920f61e4
Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents:
758
diff
changeset
|
643 |
|
1209 | 644 |
/** Global request state type translation table. |
645 |
* |
|
646 |
* Translates an internal request state to an external one. |
|
647 |
*/ |
|
648 |
const ec_request_state_t ec_request_state_translation_table[] = { |
|
649 |
EC_REQUEST_UNUSED, // EC_INT_REQUEST_INIT, |
|
650 |
EC_REQUEST_BUSY, // EC_INT_REQUEST_QUEUED, |
|
651 |
EC_REQUEST_BUSY, // EC_INT_REQUEST_BUSY, |
|
652 |
EC_REQUEST_SUCCESS, // EC_INT_REQUEST_SUCCESS, |
|
653 |
EC_REQUEST_ERROR // EC_INT_REQUEST_FAILURE |
|
654 |
}; |
|
655 |
||
656 |
/*****************************************************************************/ |
|
657 |
||
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
658 |
/** \cond */ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
659 |
|
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
660 |
module_init(ec_init_module); |
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
661 |
module_exit(ec_cleanup_module); |
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
662 |
|
573
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
663 |
EXPORT_SYMBOL(ecdev_offer); |
997
652180478e95
Removed kobject from master and module. Sysfs is gone!
Florian Pose <fp@igh-essen.com>
parents:
954
diff
changeset
|
664 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
665 |
EXPORT_SYMBOL(ecrt_request_master); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
666 |
EXPORT_SYMBOL(ecrt_release_master); |
545
6c4322e118d6
Added EXPORT macro for ecrt_version_magic().
Florian Pose <fp@igh-essen.com>
parents:
541
diff
changeset
|
667 |
EXPORT_SYMBOL(ecrt_version_magic); |
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
668 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
669 |
/** \endcond */ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
670 |
|
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
671 |
/*****************************************************************************/ |