author | Florian Pose <fp@igh-essen.com> |
Tue, 07 Aug 2007 07:54:51 +0000 | |
changeset 679 | 62fc387ec928 |
parent 653 | 33aa0e7e5a68 |
child 700 | a6b61f1a062d |
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 |
* |
197
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
196
diff
changeset
|
5 |
* Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH |
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 |
* |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
196
diff
changeset
|
9 |
* The IgH EtherCAT Master is free software; you can redistribute it |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
196
diff
changeset
|
10 |
* and/or modify it under the terms of the GNU General Public License |
246
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
201
diff
changeset
|
11 |
* as published by the Free Software Foundation; either version 2 of the |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
201
diff
changeset
|
12 |
* License, or (at your option) any later version. |
197
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
196
diff
changeset
|
13 |
* |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
196
diff
changeset
|
14 |
* The IgH EtherCAT Master is distributed in the hope that it will be |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
196
diff
changeset
|
15 |
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
196
diff
changeset
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
196
diff
changeset
|
17 |
* GNU General Public License for more details. |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
196
diff
changeset
|
18 |
* |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
196
diff
changeset
|
19 |
* You should have received a copy of the GNU General Public License |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
196
diff
changeset
|
20 |
* along with the IgH EtherCAT Master; if not, write to the Free Software |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
196
diff
changeset
|
21 |
* 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
|
22 |
* |
246
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
201
diff
changeset
|
23 |
* The right to use EtherCAT Technology is granted and comes free of |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
201
diff
changeset
|
24 |
* charge under condition of compatibility of product made by |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
201
diff
changeset
|
25 |
* Licensee. People intending to distribute/sell products based on the |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
201
diff
changeset
|
26 |
* code, have to sign an agreement to guarantee that products using |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
201
diff
changeset
|
27 |
* software based on IgH EtherCAT master stay compatible with the actual |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
201
diff
changeset
|
28 |
* EtherCAT specification (which are released themselves as an open |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
201
diff
changeset
|
29 |
* standard) as the (only) precondition to have the right to use EtherCAT |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
201
diff
changeset
|
30 |
* Technology, IP and trade marks. |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
201
diff
changeset
|
31 |
* |
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
34
diff
changeset
|
32 |
*****************************************************************************/ |
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
|
199
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 |
\file |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
36 |
EtherCAT master driver module. |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
37 |
*/ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
38 |
|
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
39 |
/*****************************************************************************/ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
40 |
|
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
#include <linux/module.h> |
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
#include <linux/kernel.h> |
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
43 |
#include <linux/init.h> |
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
44 |
|
184
2fc86cec12df
Macro for SysFS attribute definition
Florian Pose <fp@igh-essen.com>
parents:
178
diff
changeset
|
45 |
#include "globals.h" |
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
46 |
#include "master.h" |
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
47 |
#include "device.h" |
571
deb7fcb92dd7
Removed XML device from master structure.
Florian Pose <fp@igh-essen.com>
parents:
545
diff
changeset
|
48 |
#include "xmldev.h" |
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
49 |
|
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
50 |
/*****************************************************************************/ |
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
51 |
|
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
52 |
#define MAX_MASTERS 5 /**< maximum number of masters */ |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
53 |
|
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 |
|
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
56 |
int __init ec_init_module(void); |
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
57 |
void __exit ec_cleanup_module(void); |
52 | 58 |
|
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
59 |
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
|
60 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
61 |
/*****************************************************************************/ |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
62 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
63 |
struct kobject kobj; /**< kobject for master module */ |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
64 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
65 |
static char *main[MAX_MASTERS]; /**< main devices parameter */ |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
66 |
static char *backup[MAX_MASTERS]; /**< backup devices parameter */ |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
67 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
68 |
static ec_master_t *masters; /**< master array */ |
647
dc556a8c8fed
Replaced master variable 'atomic_t available' by integer and used
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
69 |
static struct semaphore master_sem; /**< master semaphore */ |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
70 |
static unsigned int master_count; /**< number of masters */ |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
71 |
static unsigned int backup_count; /**< number of backup devices */ |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
72 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
73 |
static uint8_t macs[MAX_MASTERS][2][ETH_ALEN]; /**< MAC addresses */ |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
74 |
|
571
deb7fcb92dd7
Removed XML device from master structure.
Florian Pose <fp@igh-essen.com>
parents:
545
diff
changeset
|
75 |
static dev_t device_number; /**< XML character device number */ |
deb7fcb92dd7
Removed XML device from master structure.
Florian Pose <fp@igh-essen.com>
parents:
545
diff
changeset
|
76 |
ec_xmldev_t xmldev; /**< XML character device */ |
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
77 |
|
444
31223539fc00
Compiler flag -DSVNREV only for module.c to avoid unnecessary recompiling.
Florian Pose <fp@igh-essen.com>
parents:
430
diff
changeset
|
78 |
char *ec_master_version_str = EC_MASTER_VERSION; |
31223539fc00
Compiler flag -DSVNREV only for module.c to avoid unnecessary recompiling.
Florian Pose <fp@igh-essen.com>
parents:
430
diff
changeset
|
79 |
|
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
34
diff
changeset
|
80 |
/*****************************************************************************/ |
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
34
diff
changeset
|
81 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
82 |
/** \cond */ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
83 |
|
251
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
84 |
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
|
85 |
MODULE_DESCRIPTION("EtherCAT master driver module"); |
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
86 |
MODULE_LICENSE("GPL"); |
382
72500991bcc3
Altered master version string.
Florian Pose <fp@igh-essen.com>
parents:
381
diff
changeset
|
87 |
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
|
88 |
|
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
89 |
module_param_array(main, charp, &master_count, S_IRUGO); |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
90 |
MODULE_PARM_DESC(main, "MAC addresses of main devices"); |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
91 |
module_param_array(backup, charp, &backup_count, S_IRUGO); |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
92 |
MODULE_PARM_DESC(backup, "MAC addresses of backup devices"); |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
93 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
94 |
/** \endcond */ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
95 |
|
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
96 |
/*****************************************************************************/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
97 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
98 |
/** |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
99 |
* Module initialization. |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
100 |
* Initializes \a ec_master_count masters. |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
101 |
* \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
|
102 |
*/ |
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
103 |
|
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
104 |
int __init ec_init_module(void) |
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
105 |
{ |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
106 |
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
|
107 |
|
382
72500991bcc3
Altered master version string.
Florian Pose <fp@igh-essen.com>
parents:
381
diff
changeset
|
108 |
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
|
109 |
|
653
33aa0e7e5a68
Fixed missing semaphore initialization.
Florian Pose <fp@igh-essen.com>
parents:
648
diff
changeset
|
110 |
init_MUTEX(&master_sem); |
33aa0e7e5a68
Fixed missing semaphore initialization.
Florian Pose <fp@igh-essen.com>
parents:
648
diff
changeset
|
111 |
|
576
158c5a3d0a2a
New module file /sys/ethercat, masters moved to /sys/ethercat/masterX.
Florian Pose <fp@igh-essen.com>
parents:
575
diff
changeset
|
112 |
// init kobject and add it to the hierarchy |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
113 |
memset(&kobj, 0x00, sizeof(struct kobject)); |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
114 |
kobject_init(&kobj); // no ktype |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
115 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
116 |
if (kobject_set_name(&kobj, "ethercat")) { |
576
158c5a3d0a2a
New module file /sys/ethercat, masters moved to /sys/ethercat/masterX.
Florian Pose <fp@igh-essen.com>
parents:
575
diff
changeset
|
117 |
EC_ERR("Failed to set module kobject name.\n"); |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
118 |
ret = -ENOMEM; |
576
158c5a3d0a2a
New module file /sys/ethercat, masters moved to /sys/ethercat/masterX.
Florian Pose <fp@igh-essen.com>
parents:
575
diff
changeset
|
119 |
goto out_put; |
158c5a3d0a2a
New module file /sys/ethercat, masters moved to /sys/ethercat/masterX.
Florian Pose <fp@igh-essen.com>
parents:
575
diff
changeset
|
120 |
} |
158c5a3d0a2a
New module file /sys/ethercat, masters moved to /sys/ethercat/masterX.
Florian Pose <fp@igh-essen.com>
parents:
575
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 |
if (kobject_add(&kobj)) { |
576
158c5a3d0a2a
New module file /sys/ethercat, masters moved to /sys/ethercat/masterX.
Florian Pose <fp@igh-essen.com>
parents:
575
diff
changeset
|
123 |
EC_ERR("Failed to add module kobject.\n"); |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
124 |
ret = -EEXIST; |
576
158c5a3d0a2a
New module file /sys/ethercat, masters moved to /sys/ethercat/masterX.
Florian Pose <fp@igh-essen.com>
parents:
575
diff
changeset
|
125 |
goto out_put; |
158c5a3d0a2a
New module file /sys/ethercat, masters moved to /sys/ethercat/masterX.
Florian Pose <fp@igh-essen.com>
parents:
575
diff
changeset
|
126 |
} |
158c5a3d0a2a
New module file /sys/ethercat, masters moved to /sys/ethercat/masterX.
Florian Pose <fp@igh-essen.com>
parents:
575
diff
changeset
|
127 |
|
573
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
128 |
if (alloc_chrdev_region(&device_number, 0, 1, "EtherCAT")) { |
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
129 |
EC_ERR("Failed to obtain device number!\n"); |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
130 |
ret = -EBUSY; |
576
158c5a3d0a2a
New module file /sys/ethercat, masters moved to /sys/ethercat/masterX.
Florian Pose <fp@igh-essen.com>
parents:
575
diff
changeset
|
131 |
goto out_del; |
361
29af81543ce1
Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
356
diff
changeset
|
132 |
} |
29af81543ce1
Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
356
diff
changeset
|
133 |
|
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
134 |
// 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
|
135 |
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
|
136 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
137 |
// 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
|
138 |
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
|
139 |
if (ec_mac_parse(macs[i][0], main[i], 0)) { |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
140 |
ret = -EINVAL; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
141 |
goto out_cdev; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
142 |
} |
573
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
143 |
|
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
144 |
if (i < backup_count && ec_mac_parse(macs[i][1], backup[i], 1)) { |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
145 |
ret = -EINVAL; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
146 |
goto out_cdev; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
147 |
} |
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 |
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
|
151 |
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
|
152 |
GFP_KERNEL))) { |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
153 |
EC_ERR("Failed to allocate memory for EtherCAT masters.\n"); |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
154 |
ret = -ENOMEM; |
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_cdev; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
156 |
} |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
157 |
} |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
158 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
159 |
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
|
160 |
if (ec_master_init(&masters[i], &kobj, i, macs[i][0], macs[i][1])) { |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
161 |
ret = -EIO; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
162 |
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
|
163 |
} |
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
164 |
} |
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
165 |
|
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
166 |
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
|
167 |
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
|
168 |
return ret; |
127
e67c80a76de4
Code aufger?umt und kleines Speicherleck entdeckt.
Florian Pose <fp@igh-essen.com>
parents:
111
diff
changeset
|
169 |
|
573
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
170 |
out_free_masters: |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
171 |
for (i--; i >= 0; i--) 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
|
172 |
kfree(masters); |
575
9a2121b500b1
Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
573
diff
changeset
|
173 |
out_cdev: |
573
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
174 |
unregister_chrdev_region(device_number, 1); |
576
158c5a3d0a2a
New module file /sys/ethercat, masters moved to /sys/ethercat/masterX.
Florian Pose <fp@igh-essen.com>
parents:
575
diff
changeset
|
175 |
out_del: |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
176 |
kobject_del(&kobj); |
576
158c5a3d0a2a
New module file /sys/ethercat, masters moved to /sys/ethercat/masterX.
Florian Pose <fp@igh-essen.com>
parents:
575
diff
changeset
|
177 |
out_put: |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
178 |
kobject_put(&kobj); |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
179 |
return ret; |
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
180 |
} |
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
181 |
|
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
34
diff
changeset
|
182 |
/*****************************************************************************/ |
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
183 |
|
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
184 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
185 |
Module cleanup. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
186 |
Clears all master instances. |
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
187 |
*/ |
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
188 |
|
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
189 |
void __exit ec_cleanup_module(void) |
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
190 |
{ |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
191 |
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
|
192 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
193 |
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
|
194 |
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
|
195 |
} |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
196 |
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
|
197 |
kfree(masters); |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
198 |
|
573
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
199 |
unregister_chrdev_region(device_number, 1); |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
200 |
kobject_del(&kobj); |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
201 |
kobject_put(&kobj); |
361
29af81543ce1
Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
356
diff
changeset
|
202 |
|
575
9a2121b500b1
Layed out device ID functionality in own files.
Florian Pose <fp@igh-essen.com>
parents:
573
diff
changeset
|
203 |
EC_INFO("Master module cleaned up.\n"); |
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
204 |
} |
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
205 |
|
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
206 |
/***************************************************************************** |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
207 |
* 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
|
208 |
****************************************************************************/ |
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 |
int ec_mac_equal(const uint8_t *mac1, const uint8_t *mac2) |
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 |
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
|
213 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
214 |
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
|
215 |
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
|
216 |
return 0; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
217 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
218 |
return 1; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
219 |
} |
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 |
/*****************************************************************************/ |
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 |
ssize_t ec_mac_print(const uint8_t *mac, char *buffer) |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
224 |
{ |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
225 |
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
|
226 |
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
|
227 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
228 |
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
|
229 |
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
|
230 |
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
|
231 |
} |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
232 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
233 |
return off; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
234 |
} |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
235 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
236 |
/*****************************************************************************/ |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
237 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
238 |
int ec_mac_is_zero(const uint8_t *mac) |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
239 |
{ |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
240 |
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
|
241 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
242 |
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
|
243 |
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
|
244 |
return 0; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
245 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
246 |
return 1; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
247 |
} |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
248 |
|
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 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
251 |
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
|
252 |
{ |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
253 |
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
|
254 |
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
|
255 |
char *rem; |
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 |
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
|
258 |
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
|
259 |
return 0; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
260 |
} |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
261 |
else { |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
262 |
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
|
263 |
return -EINVAL; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
264 |
} |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
265 |
} |
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 |
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
|
268 |
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
|
269 |
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
|
270 |
|| value > 0xFF |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
271 |
|| (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
|
272 |
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
|
273 |
return -EINVAL; |
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 |
mac[i] = value; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
276 |
if (i < ETH_ALEN - 1) |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
277 |
src = rem + 1; // skip colon |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
278 |
} |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
279 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
280 |
return 0; |
178
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
161
diff
changeset
|
281 |
} |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
161
diff
changeset
|
282 |
|
196
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
283 |
/*****************************************************************************/ |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
284 |
|
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
285 |
/** |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
286 |
Outputs frame contents for debugging purposes. |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
287 |
*/ |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
288 |
|
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
289 |
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
|
290 |
size_t size /**< number of bytes to output */ |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
291 |
) |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
292 |
{ |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
293 |
unsigned int i; |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
294 |
|
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
295 |
EC_DBG(""); |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
296 |
for (i = 0; i < size; i++) { |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
297 |
printk("%02X ", data[i]); |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
298 |
if ((i + 1) % 16 == 0) { |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
299 |
printk("\n"); |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
300 |
EC_DBG(""); |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
301 |
} |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
302 |
} |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
303 |
printk("\n"); |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
304 |
} |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
305 |
|
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
306 |
/*****************************************************************************/ |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
307 |
|
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
308 |
/** |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
309 |
Outputs frame contents and differences for debugging purposes. |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
310 |
*/ |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
311 |
|
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
312 |
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
|
313 |
const uint8_t *d2, /**< second data */ |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
314 |
size_t size /** number of bytes to output */ |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
315 |
) |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
316 |
{ |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
317 |
unsigned int i; |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
318 |
|
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
319 |
EC_DBG(""); |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
320 |
for (i = 0; i < size; i++) { |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
321 |
if (d1[i] == d2[i]) printk(".. "); |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
322 |
else printk("%02X ", d2[i]); |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
323 |
if ((i + 1) % 16 == 0) { |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
324 |
printk("\n"); |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
325 |
EC_DBG(""); |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
326 |
} |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
327 |
} |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
328 |
printk("\n"); |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
329 |
} |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
330 |
|
251
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
331 |
/*****************************************************************************/ |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
332 |
|
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
333 |
/** |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
334 |
Prints slave states in clear text. |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
335 |
*/ |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
336 |
|
325
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
321
diff
changeset
|
337 |
size_t ec_state_string(uint8_t states, /**< slave states */ |
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
|
338 |
char *buffer /**< target buffer |
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
|
339 |
(min. EC_STATE_STRING_SIZE bytes) */ |
325
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
321
diff
changeset
|
340 |
) |
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
321
diff
changeset
|
341 |
{ |
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
321
diff
changeset
|
342 |
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
|
343 |
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
|
344 |
|
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
345 |
if (!states) { |
325
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
321
diff
changeset
|
346 |
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
|
347 |
return off; |
251
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
348 |
} |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
349 |
|
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
350 |
if (states & EC_SLAVE_STATE_INIT) { |
325
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
321
diff
changeset
|
351 |
off += sprintf(buffer + off, "INIT"); |
251
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
352 |
first = 0; |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
353 |
} |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
354 |
if (states & EC_SLAVE_STATE_PREOP) { |
325
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
321
diff
changeset
|
355 |
if (!first) off += sprintf(buffer + off, ", "); |
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
321
diff
changeset
|
356 |
off += sprintf(buffer + off, "PREOP"); |
251
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
357 |
first = 0; |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
358 |
} |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
359 |
if (states & EC_SLAVE_STATE_SAVEOP) { |
325
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
321
diff
changeset
|
360 |
if (!first) off += sprintf(buffer + off, ", "); |
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
321
diff
changeset
|
361 |
off += sprintf(buffer + off, "SAVEOP"); |
251
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
362 |
first = 0; |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
363 |
} |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
364 |
if (states & EC_SLAVE_STATE_OP) { |
325
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
321
diff
changeset
|
365 |
if (!first) off += sprintf(buffer + off, ", "); |
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
321
diff
changeset
|
366 |
off += sprintf(buffer + off, "OP"); |
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
321
diff
changeset
|
367 |
} |
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
|
368 |
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
|
369 |
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
|
370 |
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
|
371 |
} |
325
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
321
diff
changeset
|
372 |
|
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
321
diff
changeset
|
373 |
return off; |
251
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
374 |
} |
c1d0b63a9302
EoE in Free-Run mode; Finished slave configuration state machine.
Florian Pose <fp@igh-essen.com>
parents:
249
diff
changeset
|
375 |
|
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
376 |
/****************************************************************************** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
377 |
* Device interface |
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
378 |
*****************************************************************************/ |
33
f4171b8aadf8
Master-Reservierung und Use-Count f?r NIC-Treiber.
Florian Pose <fp@igh-essen.com>
parents:
27
diff
changeset
|
379 |
|
f4171b8aadf8
Master-Reservierung und Use-Count f?r NIC-Treiber.
Florian Pose <fp@igh-essen.com>
parents:
27
diff
changeset
|
380 |
/** |
573
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
381 |
Offers an EtherCAT device to a certain master. |
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
382 |
The master decides, if it wants to use the device for EtherCAT operation, |
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
383 |
or not. It is important, that the offered net_device is not used by |
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
384 |
the kernel IP stack. If the master, accepted the offer, the address of |
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
385 |
the newly created EtherCAT device is written to the ecdev pointer, else |
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
386 |
the pointer is written to zero. |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
387 |
\return 0 on success, else < 0 |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
388 |
\ingroup DeviceInterface |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
389 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
390 |
|
573
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
391 |
int ecdev_offer(struct net_device *net_dev, /**< net_device to offer */ |
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
392 |
ec_pollfunc_t poll, /**< device poll function */ |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
393 |
struct module *module, /**< pointer to the module */ |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
394 |
ec_device_t **ecdev /**< pointer to store a device on success */ |
573
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
395 |
) |
91
0120d6214948
Code-Dokumentation angepasst.
Florian Pose <fp@igh-essen.com>
parents:
88
diff
changeset
|
396 |
{ |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
64
diff
changeset
|
397 |
ec_master_t *master; |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
398 |
char str[20]; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
399 |
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
|
400 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
401 |
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
|
402 |
master = &masters[i]; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
403 |
if (ec_mac_equal(master->main_mac, net_dev->dev_addr)) { |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
404 |
ec_mac_print(master->main_mac, str); |
578
f402b4bd2f4d
Removed ktype for module kobject; added backup device for master; device
Florian Pose <fp@igh-essen.com>
parents:
576
diff
changeset
|
405 |
EC_INFO("Accepting device %s for master %u.\n", |
f402b4bd2f4d
Removed ktype for module kobject; added backup device for master; device
Florian Pose <fp@igh-essen.com>
parents:
576
diff
changeset
|
406 |
str, master->index); |
573
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
407 |
|
648
0a6d38ec463f
Made waiting for device semaphore uninterruptible.
Florian Pose <fp@igh-essen.com>
parents:
647
diff
changeset
|
408 |
down(&master->device_sem); |
579
17c6fd3b076e
Made master devices persistent; added ec_device_attach() and ec_device_detach().
Florian Pose <fp@igh-essen.com>
parents:
578
diff
changeset
|
409 |
if (master->main_device.dev) { |
17c6fd3b076e
Made master devices persistent; added ec_device_attach() and ec_device_detach().
Florian Pose <fp@igh-essen.com>
parents:
578
diff
changeset
|
410 |
EC_ERR("Master %u already has a device attached.\n", |
17c6fd3b076e
Made master devices persistent; added ec_device_attach() and ec_device_detach().
Florian Pose <fp@igh-essen.com>
parents:
578
diff
changeset
|
411 |
master->index); |
17c6fd3b076e
Made master devices persistent; added ec_device_attach() and ec_device_detach().
Florian Pose <fp@igh-essen.com>
parents:
578
diff
changeset
|
412 |
up(&master->device_sem); |
17c6fd3b076e
Made master devices persistent; added ec_device_attach() and ec_device_detach().
Florian Pose <fp@igh-essen.com>
parents:
578
diff
changeset
|
413 |
return -1; |
573
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
414 |
} |
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
415 |
|
579
17c6fd3b076e
Made master devices persistent; added ec_device_attach() and ec_device_detach().
Florian Pose <fp@igh-essen.com>
parents:
578
diff
changeset
|
416 |
ec_device_attach(&master->main_device, net_dev, poll, module); |
573
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
417 |
up(&master->device_sem); |
579
17c6fd3b076e
Made master devices persistent; added ec_device_attach() and ec_device_detach().
Florian Pose <fp@igh-essen.com>
parents:
578
diff
changeset
|
418 |
|
573
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
419 |
sprintf(net_dev->name, "ec%u", master->index); |
579
17c6fd3b076e
Made master devices persistent; added ec_device_attach() and ec_device_detach().
Florian Pose <fp@igh-essen.com>
parents:
578
diff
changeset
|
420 |
*ecdev = &master->main_device; // offer accepted |
573
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
421 |
return 0; // no error |
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
422 |
} |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
423 |
else if (master->debug_level) { |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
424 |
ec_mac_print(master->main_mac, str); |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
425 |
EC_DBG("Master %u declined device %s.\n", master->index, str); |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
426 |
} |
573
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
427 |
} |
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
428 |
|
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
429 |
*ecdev = NULL; // offer declined |
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
430 |
return 0; // no error |
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
431 |
} |
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
432 |
|
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
433 |
/*****************************************************************************/ |
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
434 |
|
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
435 |
/** |
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
436 |
Withdraws an EtherCAT device from the master. |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
437 |
The device is disconnected from the master and all device ressources |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
438 |
are freed. |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
439 |
\attention Before calling this function, the ecdev_stop() function has |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
440 |
to be called, to be sure that the master does not use the device any more. |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
441 |
\ingroup DeviceInterface |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
442 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
443 |
|
573
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
444 |
void ecdev_withdraw(ec_device_t *device /**< EtherCAT device */) |
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
445 |
{ |
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
446 |
ec_master_t *master = device->master; |
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
447 |
char str[20]; |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
448 |
|
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
449 |
ec_mac_print(master->main_mac, str); |
578
f402b4bd2f4d
Removed ktype for module kobject; added backup device for master; device
Florian Pose <fp@igh-essen.com>
parents:
576
diff
changeset
|
450 |
|
f402b4bd2f4d
Removed ktype for module kobject; added backup device for master; device
Florian Pose <fp@igh-essen.com>
parents:
576
diff
changeset
|
451 |
EC_INFO("Master %u releasing main device %s.\n", master->index, str); |
f402b4bd2f4d
Removed ktype for module kobject; added backup device for master; device
Florian Pose <fp@igh-essen.com>
parents:
576
diff
changeset
|
452 |
|
381
006d3653701d
Fixed race on duplicate device registering or device unregistering while requesting master.
Florian Pose <fp@igh-essen.com>
parents:
378
diff
changeset
|
453 |
down(&master->device_sem); |
579
17c6fd3b076e
Made master devices persistent; added ec_device_attach() and ec_device_detach().
Florian Pose <fp@igh-essen.com>
parents:
578
diff
changeset
|
454 |
ec_device_detach(device); |
381
006d3653701d
Fixed race on duplicate device registering or device unregistering while requesting master.
Florian Pose <fp@igh-essen.com>
parents:
378
diff
changeset
|
455 |
up(&master->device_sem); |
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
456 |
} |
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
457 |
|
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
|
458 |
/*****************************************************************************/ |
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
|
459 |
|
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
|
460 |
/** |
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
|
461 |
Opens the network device and makes the master enter IDLE mode. |
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
|
462 |
\return 0 on success, else < 0 |
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
|
463 |
\ingroup DeviceInterface |
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
|
464 |
*/ |
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
|
465 |
|
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
|
466 |
int ecdev_open(ec_device_t *device /**< EtherCAT device */) |
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
|
467 |
{ |
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
|
468 |
if (ec_device_open(device)) { |
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
|
469 |
EC_ERR("Failed to open device!\n"); |
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
|
470 |
return -1; |
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
|
471 |
} |
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
|
472 |
|
525
8b20781bd1e0
Master workqueue replaced with kernel thread.
Florian Pose <fp@igh-essen.com>
parents:
497
diff
changeset
|
473 |
if (ec_master_enter_idle_mode(device->master)) { |
8b20781bd1e0
Master workqueue replaced with kernel thread.
Florian Pose <fp@igh-essen.com>
parents:
497
diff
changeset
|
474 |
EC_ERR("Failed to enter idle mode!\n"); |
8b20781bd1e0
Master workqueue replaced with kernel thread.
Florian Pose <fp@igh-essen.com>
parents:
497
diff
changeset
|
475 |
return -1; |
8b20781bd1e0
Master workqueue replaced with kernel thread.
Florian Pose <fp@igh-essen.com>
parents:
497
diff
changeset
|
476 |
} |
8b20781bd1e0
Master workqueue replaced with kernel thread.
Florian Pose <fp@igh-essen.com>
parents:
497
diff
changeset
|
477 |
|
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
|
478 |
return 0; |
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
|
479 |
} |
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
|
480 |
|
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
|
481 |
/*****************************************************************************/ |
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
|
482 |
|
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
|
483 |
/** |
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
|
484 |
Makes the master leave IDLE mode and closes the network device. |
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
|
485 |
\return 0 on success, else < 0 |
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
|
486 |
\ingroup DeviceInterface |
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
|
487 |
*/ |
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
|
488 |
|
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
|
489 |
void ecdev_close(ec_device_t *device /**< EtherCAT device */) |
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
|
490 |
{ |
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
|
491 |
ec_master_leave_idle_mode(device->master); |
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
|
492 |
|
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
|
493 |
if (ec_device_close(device)) |
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
|
494 |
EC_WARN("Failed to close device!\n"); |
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
|
495 |
} |
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
|
496 |
|
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
497 |
/****************************************************************************** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
498 |
* Realtime interface |
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
499 |
*****************************************************************************/ |
33
f4171b8aadf8
Master-Reservierung und Use-Count f?r NIC-Treiber.
Florian Pose <fp@igh-essen.com>
parents:
27
diff
changeset
|
500 |
|
f4171b8aadf8
Master-Reservierung und Use-Count f?r NIC-Treiber.
Florian Pose <fp@igh-essen.com>
parents:
27
diff
changeset
|
501 |
/** |
541
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
533
diff
changeset
|
502 |
* Returns the version magic of the realtime interface. |
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
533
diff
changeset
|
503 |
* \return ECRT version magic. |
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
533
diff
changeset
|
504 |
* \ingroup RealtimeInterface |
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
533
diff
changeset
|
505 |
*/ |
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
533
diff
changeset
|
506 |
|
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
533
diff
changeset
|
507 |
unsigned int ecrt_version_magic(void) |
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
533
diff
changeset
|
508 |
{ |
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
533
diff
changeset
|
509 |
return ECRT_VERSION_MAGIC; |
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
533
diff
changeset
|
510 |
} |
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
533
diff
changeset
|
511 |
|
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
533
diff
changeset
|
512 |
/*****************************************************************************/ |
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
533
diff
changeset
|
513 |
|
5a2b1658b67f
Introduced ECRT version magic.
Florian Pose <fp@igh-essen.com>
parents:
533
diff
changeset
|
514 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
515 |
Reserves an EtherCAT master for realtime operation. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
516 |
\return pointer to reserved master, or NULL on error |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
517 |
\ingroup RealtimeInterface |
91
0120d6214948
Code-Dokumentation angepasst.
Florian Pose <fp@igh-essen.com>
parents:
88
diff
changeset
|
518 |
*/ |
0120d6214948
Code-Dokumentation angepasst.
Florian Pose <fp@igh-essen.com>
parents:
88
diff
changeset
|
519 |
|
178
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
161
diff
changeset
|
520 |
ec_master_t *ecrt_request_master(unsigned int master_index |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
521 |
/**< master index */ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
522 |
) |
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
523 |
{ |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
64
diff
changeset
|
524 |
ec_master_t *master; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
64
diff
changeset
|
525 |
|
647
dc556a8c8fed
Replaced master variable 'atomic_t available' by integer and used
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
526 |
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
|
527 |
|
639
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
528 |
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
|
529 |
EC_ERR("Invalid master index %u.\n", master_index); |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
530 |
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
|
531 |
} |
aa23c48dca2d
Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents:
579
diff
changeset
|
532 |
master = &masters[master_index]; |
178
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
161
diff
changeset
|
533 |
|
647
dc556a8c8fed
Replaced master variable 'atomic_t available' by integer and used
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
534 |
down(&master_sem); |
dc556a8c8fed
Replaced master variable 'atomic_t available' by integer and used
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
535 |
if (master->reserved) { |
dc556a8c8fed
Replaced master variable 'atomic_t available' by integer and used
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
536 |
up(&master_sem); |
dc556a8c8fed
Replaced master variable 'atomic_t available' by integer and used
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
537 |
EC_ERR("Master %u is already in use!\n", master_index); |
191 | 538 |
goto out_return; |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
64
diff
changeset
|
539 |
} |
647
dc556a8c8fed
Replaced master variable 'atomic_t available' by integer and used
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
540 |
master->reserved = 1; |
dc556a8c8fed
Replaced master variable 'atomic_t available' by integer and used
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
541 |
up(&master_sem); |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
64
diff
changeset
|
542 |
|
648
0a6d38ec463f
Made waiting for device semaphore uninterruptible.
Florian Pose <fp@igh-essen.com>
parents:
647
diff
changeset
|
543 |
down(&master->device_sem); |
0a6d38ec463f
Made waiting for device semaphore uninterruptible.
Florian Pose <fp@igh-essen.com>
parents:
647
diff
changeset
|
544 |
|
579
17c6fd3b076e
Made master devices persistent; added ec_device_attach() and ec_device_detach().
Florian Pose <fp@igh-essen.com>
parents:
578
diff
changeset
|
545 |
if (master->mode != EC_MASTER_MODE_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
|
546 |
up(&master->device_sem); |
647
dc556a8c8fed
Replaced master variable 'atomic_t available' by integer and used
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
547 |
EC_ERR("Master %u still waiting for devices!\n", master_index); |
191 | 548 |
goto out_release; |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
64
diff
changeset
|
549 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
64
diff
changeset
|
550 |
|
579
17c6fd3b076e
Made master devices persistent; added ec_device_attach() and ec_device_detach().
Florian Pose <fp@igh-essen.com>
parents:
578
diff
changeset
|
551 |
if (!try_module_get(master->main_device.module)) { |
381
006d3653701d
Fixed race on duplicate device registering or device unregistering while requesting master.
Florian Pose <fp@igh-essen.com>
parents:
378
diff
changeset
|
552 |
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
|
553 |
EC_ERR("Device module is unloading!\n"); |
191 | 554 |
goto out_release; |
555 |
} |
|
556 |
||
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); |
006d3653701d
Fixed race on duplicate device registering or device unregistering while requesting master.
Florian Pose <fp@igh-essen.com>
parents:
378
diff
changeset
|
558 |
|
579
17c6fd3b076e
Made master devices persistent; added ec_device_attach() and ec_device_detach().
Florian Pose <fp@igh-essen.com>
parents:
578
diff
changeset
|
559 |
if (!master->main_device.link_state) { |
377
ecac8252f114
Changes in ecrt_request_master(); minor output changes.
Florian Pose <fp@igh-essen.com>
parents:
361
diff
changeset
|
560 |
EC_ERR("Link is DOWN.\n"); |
ecac8252f114
Changes in ecrt_request_master(); minor output changes.
Florian Pose <fp@igh-essen.com>
parents:
361
diff
changeset
|
561 |
goto out_module_put; |
ecac8252f114
Changes in ecrt_request_master(); minor output changes.
Florian Pose <fp@igh-essen.com>
parents:
361
diff
changeset
|
562 |
} |
ecac8252f114
Changes in ecrt_request_master(); minor output changes.
Florian Pose <fp@igh-essen.com>
parents:
361
diff
changeset
|
563 |
|
446 | 564 |
if (ec_master_enter_operation_mode(master)) { |
565 |
EC_ERR("Failed to enter OPERATION mode!\n"); |
|
566 |
goto out_module_put; |
|
377
ecac8252f114
Changes in ecrt_request_master(); minor output changes.
Florian Pose <fp@igh-essen.com>
parents:
361
diff
changeset
|
567 |
} |
ecac8252f114
Changes in ecrt_request_master(); minor output changes.
Florian Pose <fp@igh-essen.com>
parents:
361
diff
changeset
|
568 |
|
647
dc556a8c8fed
Replaced master variable 'atomic_t available' by integer and used
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
569 |
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
|
570 |
return master; |
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
571 |
|
191 | 572 |
out_module_put: |
579
17c6fd3b076e
Made master devices persistent; added ec_device_attach() and ec_device_detach().
Florian Pose <fp@igh-essen.com>
parents:
578
diff
changeset
|
573 |
module_put(master->main_device.module); |
191 | 574 |
out_release: |
647
dc556a8c8fed
Replaced master variable 'atomic_t available' by integer and used
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
575 |
master->reserved = 0; |
191 | 576 |
out_return: |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
64
diff
changeset
|
577 |
return NULL; |
27
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
578 |
} |
d75ef6b46e33
EtherCAT-Master in eigenes Modul ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
579 |
|
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
34
diff
changeset
|
580 |
/*****************************************************************************/ |
33
f4171b8aadf8
Master-Reservierung und Use-Count f?r NIC-Treiber.
Florian Pose <fp@igh-essen.com>
parents:
27
diff
changeset
|
581 |
|
f4171b8aadf8
Master-Reservierung und Use-Count f?r NIC-Treiber.
Florian Pose <fp@igh-essen.com>
parents:
27
diff
changeset
|
582 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
583 |
Releases a reserved EtherCAT master. |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
584 |
\ingroup RealtimeInterface |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
585 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
586 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
191
diff
changeset
|
587 |
void ecrt_release_master(ec_master_t *master /**< EtherCAT master */) |
33
f4171b8aadf8
Master-Reservierung und Use-Count f?r NIC-Treiber.
Florian Pose <fp@igh-essen.com>
parents:
27
diff
changeset
|
588 |
{ |
647
dc556a8c8fed
Replaced master variable 'atomic_t available' by integer and used
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
589 |
EC_INFO("Releasing master %u...\n", master->index); |
531
8d9339e7453f
Warn on duplicate master releasing.
Florian Pose <fp@igh-essen.com>
parents:
525
diff
changeset
|
590 |
|
8d9339e7453f
Warn on duplicate master releasing.
Florian Pose <fp@igh-essen.com>
parents:
525
diff
changeset
|
591 |
if (master->mode != EC_MASTER_MODE_OPERATION) { |
647
dc556a8c8fed
Replaced master variable 'atomic_t available' by integer and used
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
592 |
EC_WARN("Master %u was was not requested!\n", master->index); |
531
8d9339e7453f
Warn on duplicate master releasing.
Florian Pose <fp@igh-essen.com>
parents:
525
diff
changeset
|
593 |
return; |
8d9339e7453f
Warn on duplicate master releasing.
Florian Pose <fp@igh-essen.com>
parents:
525
diff
changeset
|
594 |
} |
8d9339e7453f
Warn on duplicate master releasing.
Florian Pose <fp@igh-essen.com>
parents:
525
diff
changeset
|
595 |
|
446 | 596 |
ec_master_leave_operation_mode(master); |
151
1961b674466c
Plugfest: master_open()/close() ausgelagert.
Florian Pose <fp@igh-essen.com>
parents:
127
diff
changeset
|
597 |
|
579
17c6fd3b076e
Made master devices persistent; added ec_device_attach() and ec_device_detach().
Florian Pose <fp@igh-essen.com>
parents:
578
diff
changeset
|
598 |
module_put(master->main_device.module); |
647
dc556a8c8fed
Replaced master variable 'atomic_t available' by integer and used
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
599 |
master->reserved = 0; |
dc556a8c8fed
Replaced master variable 'atomic_t available' by integer and used
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
600 |
|
dc556a8c8fed
Replaced master variable 'atomic_t available' by integer and used
Florian Pose <fp@igh-essen.com>
parents:
639
diff
changeset
|
601 |
EC_INFO("Released master %u.\n", master->index); |
33
f4171b8aadf8
Master-Reservierung und Use-Count f?r NIC-Treiber.
Florian Pose <fp@igh-essen.com>
parents:
27
diff
changeset
|
602 |
} |
f4171b8aadf8
Master-Reservierung und Use-Count f?r NIC-Treiber.
Florian Pose <fp@igh-essen.com>
parents:
27
diff
changeset
|
603 |
|
39
6965c23a6826
likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents:
34
diff
changeset
|
604 |
/*****************************************************************************/ |
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
605 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
606 |
/** \cond */ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
607 |
|
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
608 |
module_init(ec_init_module); |
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
609 |
module_exit(ec_cleanup_module); |
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
610 |
|
573
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
611 |
EXPORT_SYMBOL(ecdev_offer); |
cdee4ea90ce9
Introduced device IDs; removed comment lines from 8139too; removed
Florian Pose <fp@igh-essen.com>
parents:
572
diff
changeset
|
612 |
EXPORT_SYMBOL(ecdev_withdraw); |
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
|
613 |
EXPORT_SYMBOL(ecdev_open); |
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
|
614 |
EXPORT_SYMBOL(ecdev_close); |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
615 |
EXPORT_SYMBOL(ecrt_request_master); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
616 |
EXPORT_SYMBOL(ecrt_release_master); |
545
6c4322e118d6
Added EXPORT macro for ecrt_version_magic().
Florian Pose <fp@igh-essen.com>
parents:
541
diff
changeset
|
617 |
EXPORT_SYMBOL(ecrt_version_magic); |
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
618 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
619 |
/** \endcond */ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
620 |
|
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
621 |
/*****************************************************************************/ |