author | Florian Pose <fp@igh-essen.com> |
Thu, 13 Jul 2006 13:10:57 +0000 | |
branch | stable-1.1 |
changeset 1714 | f149465f4c63 |
parent 294 | feea8d850c65 |
child 315 | 119f967aead8 |
child 1715 | e675450f2174 |
permissions | -rw-r--r-- |
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/****************************************************************************** |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
* |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
* $Id$ |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
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:
195
diff
changeset
|
5 |
* Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
6 |
* |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
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:
195
diff
changeset
|
8 |
* |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
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:
195
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:
199
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:
199
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:
195
diff
changeset
|
13 |
* |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
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:
195
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:
195
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:
195
diff
changeset
|
17 |
* GNU General Public License for more details. |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
18 |
* |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
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:
195
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:
195
diff
changeset
|
21 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
22 |
* |
246
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
199
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:
199
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:
199
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:
199
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:
199
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:
199
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:
199
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:
199
diff
changeset
|
30 |
* Technology, IP and trade marks. |
0bf7c769de06
Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents:
199
diff
changeset
|
31 |
* |
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
*****************************************************************************/ |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
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 domain methods. |
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 |
|
294
feea8d850c65
Applied include patch by M. Schwerin.
Florian Pose <fp@igh-essen.com>
parents:
293
diff
changeset
|
41 |
#include <linux/module.h> |
feea8d850c65
Applied include patch by M. Schwerin.
Florian Pose <fp@igh-essen.com>
parents:
293
diff
changeset
|
42 |
|
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
43 |
#include "globals.h" |
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
44 |
#include "domain.h" |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
45 |
#include "master.h" |
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
46 |
|
178
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
47 |
/*****************************************************************************/ |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
48 |
|
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
49 |
void ec_domain_clear_field_regs(ec_domain_t *); |
179
fb4c9dd11ca0
Sourced SysFS attribute show method prototypes out of headers.
Florian Pose <fp@igh-essen.com>
parents:
178
diff
changeset
|
50 |
ssize_t ec_show_domain_attribute(struct kobject *, struct attribute *, char *); |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
51 |
|
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
52 |
/*****************************************************************************/ |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
53 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
54 |
/** \cond */ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
55 |
|
184
2fc86cec12df
Macro for SysFS attribute definition
Florian Pose <fp@igh-essen.com>
parents:
182
diff
changeset
|
56 |
EC_SYSFS_READ_ATTR(data_size); |
178
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
57 |
|
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
58 |
static struct attribute *def_attrs[] = { |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
59 |
&attr_data_size, |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
60 |
NULL, |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
61 |
}; |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
62 |
|
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
63 |
static struct sysfs_ops sysfs_ops = { |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
64 |
.show = &ec_show_domain_attribute, |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
65 |
.store = NULL |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
66 |
}; |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
67 |
|
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
68 |
static struct kobj_type ktype_ec_domain = { |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
69 |
.release = ec_domain_clear, |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
70 |
.sysfs_ops = &sysfs_ops, |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
71 |
.default_attrs = def_attrs |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
72 |
}; |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
73 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
74 |
/** \endcond */ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
75 |
|
178
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
76 |
/*****************************************************************************/ |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
77 |
|
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
78 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
79 |
Domain constructor. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
80 |
\return 0 in case of success, else < 0 |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
81 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
82 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
83 |
int ec_domain_init(ec_domain_t *domain, /**< EtherCAT domain */ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
84 |
ec_master_t *master, /**< owning master */ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
85 |
unsigned int index /**< domain index */ |
178
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
86 |
) |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
87 |
{ |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
88 |
domain->master = master; |
178
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
89 |
domain->index = index; |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
90 |
domain->data_size = 0; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
91 |
domain->base_address = 0; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
92 |
domain->response_count = 0xFFFFFFFF; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
93 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
94 |
INIT_LIST_HEAD(&domain->field_regs); |
293
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
95 |
INIT_LIST_HEAD(&domain->datagrams); |
178
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
96 |
|
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
97 |
// init kobject and add it to the hierarchy |
178
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
98 |
memset(&domain->kobj, 0x00, sizeof(struct kobject)); |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
99 |
kobject_init(&domain->kobj); |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
100 |
domain->kobj.ktype = &ktype_ec_domain; |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
101 |
domain->kobj.parent = &master->kobj; |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
102 |
if (kobject_set_name(&domain->kobj, "domain%i", index)) { |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
103 |
EC_ERR("Failed to set kobj name.\n"); |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
104 |
return -1; |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
105 |
} |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
106 |
|
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
107 |
return 0; |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
108 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
109 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
110 |
/*****************************************************************************/ |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
111 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
112 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
113 |
Domain destructor. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
114 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
115 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
116 |
void ec_domain_clear(struct kobject *kobj /**< kobject of the domain */) |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
117 |
{ |
293
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
118 |
ec_datagram_t *datagram, *next; |
178
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
119 |
ec_domain_t *domain; |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
120 |
|
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
121 |
domain = container_of(kobj, ec_domain_t, kobj); |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
122 |
|
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
123 |
EC_INFO("Clearing domain %i.\n", domain->index); |
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
124 |
|
293
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
125 |
list_for_each_entry_safe(datagram, next, &domain->datagrams, list) { |
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
126 |
ec_datagram_clear(datagram); |
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
127 |
kfree(datagram); |
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
128 |
} |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
129 |
|
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
130 |
ec_domain_clear_field_regs(domain); |
178
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
131 |
|
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
132 |
kfree(domain); |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
133 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
134 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
135 |
/*****************************************************************************/ |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
136 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
137 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
138 |
Registeres a data field in a domain. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
139 |
\return 0 in case of success, else < 0 |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
140 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
141 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
142 |
int ec_domain_reg_field(ec_domain_t *domain, /**< EtherCAT domain */ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
143 |
ec_slave_t *slave, /**< slave */ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
144 |
const ec_sync_t *sync, /**< sync manager */ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
145 |
uint32_t field_offset, /**< data field offset */ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
146 |
void **data_ptr /**< pointer to the process data |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
147 |
pointer */ |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
148 |
) |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
149 |
{ |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
150 |
ec_field_reg_t *field_reg; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
151 |
|
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
152 |
if (!(field_reg = |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
153 |
(ec_field_reg_t *) kmalloc(sizeof(ec_field_reg_t), GFP_KERNEL))) { |
84
b4ae98855cea
printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents:
76
diff
changeset
|
154 |
EC_ERR("Failed to allocate field registration.\n"); |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
155 |
return -1; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
156 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
157 |
|
160
7ddf8367196a
Renamed slave_set_fmmu() to slave_prepare_fmmu().
Florian Pose <fp@igh-essen.com>
parents:
150
diff
changeset
|
158 |
if (ec_slave_prepare_fmmu(slave, domain, sync)) { |
84
b4ae98855cea
printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents:
76
diff
changeset
|
159 |
EC_ERR("FMMU configuration failed.\n"); |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
160 |
kfree(field_reg); |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
161 |
return -1; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
162 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
163 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
164 |
field_reg->slave = slave; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
165 |
field_reg->sync = sync; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
166 |
field_reg->field_offset = field_offset; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
167 |
field_reg->data_ptr = data_ptr; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
168 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
169 |
list_add_tail(&field_reg->list, &domain->field_regs); |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
170 |
return 0; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
171 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
172 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
173 |
/*****************************************************************************/ |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
174 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
175 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
176 |
Clears the list of the registered data fields. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
177 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
178 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
179 |
void ec_domain_clear_field_regs(ec_domain_t *domain /**< EtherCAT domain */) |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
180 |
{ |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
181 |
ec_field_reg_t *field_reg, *next; |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
182 |
|
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
183 |
list_for_each_entry_safe(field_reg, next, &domain->field_regs, list) { |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
184 |
list_del(&field_reg->list); |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
185 |
kfree(field_reg); |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
186 |
} |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
187 |
} |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
188 |
|
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
189 |
/*****************************************************************************/ |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
190 |
|
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
191 |
/** |
293
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
192 |
Allocates a process data datagram and appends it to the list. |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
193 |
\return 0 in case of success, else < 0 |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
194 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
195 |
|
293
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
196 |
int ec_domain_add_datagram(ec_domain_t *domain, /**< EtherCAT domain */ |
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
197 |
uint32_t offset, /**< logical offset */ |
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
198 |
size_t data_size /**< size of the datagram data */ |
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
199 |
) |
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
200 |
{ |
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
201 |
ec_datagram_t *datagram; |
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
202 |
|
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
203 |
if (!(datagram = kmalloc(sizeof(ec_datagram_t), GFP_KERNEL))) { |
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
204 |
EC_ERR("Failed to allocate domain datagram!\n"); |
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
205 |
return -1; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
206 |
} |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
207 |
|
293
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
208 |
ec_datagram_init(datagram); |
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
209 |
|
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
210 |
if (ec_datagram_lrw(datagram, offset, data_size)) { |
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
211 |
kfree(datagram); |
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
212 |
return -1; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
213 |
} |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
214 |
|
293
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
215 |
list_add_tail(&datagram->list, &domain->datagrams); |
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
216 |
return 0; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
217 |
} |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
218 |
|
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
219 |
/*****************************************************************************/ |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
220 |
|
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
221 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
222 |
Creates a domain. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
223 |
Reserves domain memory, calculates the logical addresses of the |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
224 |
corresponding FMMUs and sets the process data pointer of the registered |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
225 |
data fields. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
226 |
\return 0 in case of success, else < 0 |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
227 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
228 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
229 |
int ec_domain_alloc(ec_domain_t *domain, /**< EtherCAT domain */ |
275
ba51285d4ef6
Variable-sized data fields, BK1120.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
230 |
uint32_t base_address /**< logical base address */ |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
231 |
) |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
232 |
{ |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
233 |
ec_field_reg_t *field_reg; |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
234 |
ec_slave_t *slave; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
235 |
ec_fmmu_t *fmmu; |
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
236 |
unsigned int i, j, cmd_count; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
237 |
uint32_t field_off, field_off_cmd; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
238 |
uint32_t cmd_offset; |
275
ba51285d4ef6
Variable-sized data fields, BK1120.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
239 |
size_t cmd_data_size, sync_size; |
293
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
240 |
ec_datagram_t *datagram; |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
241 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
242 |
domain->base_address = base_address; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
243 |
|
275
ba51285d4ef6
Variable-sized data fields, BK1120.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
244 |
// calculate size of process data and allocate memory |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
245 |
domain->data_size = 0; |
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
246 |
cmd_offset = base_address; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
247 |
cmd_data_size = 0; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
248 |
cmd_count = 0; |
182
8c0bc99229a9
Slaves stored in list, slaves in SysFS
Florian Pose <fp@igh-essen.com>
parents:
179
diff
changeset
|
249 |
list_for_each_entry(slave, &domain->master->slaves, list) { |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
250 |
for (j = 0; j < slave->fmmu_count; j++) { |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
251 |
fmmu = &slave->fmmus[j]; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
252 |
if (fmmu->domain == domain) { |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
253 |
fmmu->logical_start_address = base_address + domain->data_size; |
275
ba51285d4ef6
Variable-sized data fields, BK1120.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
254 |
sync_size = ec_slave_calc_sync_size(slave, fmmu->sync); |
ba51285d4ef6
Variable-sized data fields, BK1120.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
255 |
domain->data_size += sync_size; |
ba51285d4ef6
Variable-sized data fields, BK1120.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
256 |
if (cmd_data_size + sync_size > EC_MAX_DATA_SIZE) { |
293
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
257 |
if (ec_domain_add_datagram(domain, cmd_offset, |
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
258 |
cmd_data_size)) return -1; |
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
259 |
cmd_offset += cmd_data_size; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
260 |
cmd_data_size = 0; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
261 |
cmd_count++; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
262 |
} |
275
ba51285d4ef6
Variable-sized data fields, BK1120.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
263 |
cmd_data_size += sync_size; |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
264 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
265 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
266 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
267 |
|
293
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
268 |
// allocate last datagram |
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
269 |
if (cmd_data_size) { |
293
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
270 |
if (ec_domain_add_datagram(domain, cmd_offset, cmd_data_size)) |
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
271 |
return -1; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
272 |
cmd_count++; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
273 |
} |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
274 |
|
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
275 |
if (!cmd_count) { |
178
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
276 |
EC_WARN("Domain %i contains no data!\n", domain->index); |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
277 |
ec_domain_clear_field_regs(domain); |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
278 |
return 0; |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
279 |
} |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
280 |
|
275
ba51285d4ef6
Variable-sized data fields, BK1120.
Florian Pose <fp@igh-essen.com>
parents:
246
diff
changeset
|
281 |
// set all process data pointers |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
282 |
list_for_each_entry(field_reg, &domain->field_regs, list) { |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
283 |
for (i = 0; i < field_reg->slave->fmmu_count; i++) { |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
284 |
fmmu = &field_reg->slave->fmmus[i]; |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
285 |
if (fmmu->domain == domain && fmmu->sync == field_reg->sync) { |
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
286 |
field_off = fmmu->logical_start_address + |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
287 |
field_reg->field_offset; |
293
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
288 |
// search datagram |
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
289 |
list_for_each_entry(datagram, &domain->datagrams, list) { |
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
290 |
field_off_cmd = field_off - datagram->address.logical; |
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
291 |
if (field_off >= datagram->address.logical && |
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
292 |
field_off_cmd < datagram->mem_size) { |
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
293 |
*field_reg->data_ptr = datagram->data + field_off_cmd; |
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
294 |
} |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
295 |
} |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
296 |
if (!field_reg->data_ptr) { |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
297 |
EC_ERR("Failed to assign data pointer!\n"); |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
298 |
return -1; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
299 |
} |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
300 |
break; |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
301 |
} |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
302 |
} |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
303 |
} |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
304 |
|
293
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
305 |
EC_INFO("Domain %i - Allocated %i bytes in %i datagram%s\n", |
178
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
306 |
domain->index, domain->data_size, cmd_count, |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
307 |
cmd_count == 1 ? "" : "s"); |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
308 |
|
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
309 |
ec_domain_clear_field_regs(domain); |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
310 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
311 |
return 0; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
312 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
313 |
|
97
e6264685dd7b
Link-Down-Verhalten verbessert.
Florian Pose <fp@igh-essen.com>
parents:
96
diff
changeset
|
314 |
/*****************************************************************************/ |
e6264685dd7b
Link-Down-Verhalten verbessert.
Florian Pose <fp@igh-essen.com>
parents:
96
diff
changeset
|
315 |
|
e6264685dd7b
Link-Down-Verhalten verbessert.
Florian Pose <fp@igh-essen.com>
parents:
96
diff
changeset
|
316 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
317 |
Sets the number of responding slaves and outputs it on demand. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
318 |
This number isn't really the number of responding slaves, but the sum of |
293
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
319 |
the working counters of all domain datagrams. Some slaves increase the |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
320 |
working counter by 2, some by 1. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
321 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
322 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
323 |
void ec_domain_response_count(ec_domain_t *domain, /**< EtherCAT domain */ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
324 |
unsigned int count /**< new WC sum */ |
97
e6264685dd7b
Link-Down-Verhalten verbessert.
Florian Pose <fp@igh-essen.com>
parents:
96
diff
changeset
|
325 |
) |
e6264685dd7b
Link-Down-Verhalten verbessert.
Florian Pose <fp@igh-essen.com>
parents:
96
diff
changeset
|
326 |
{ |
e6264685dd7b
Link-Down-Verhalten verbessert.
Florian Pose <fp@igh-essen.com>
parents:
96
diff
changeset
|
327 |
if (count != domain->response_count) { |
e6264685dd7b
Link-Down-Verhalten verbessert.
Florian Pose <fp@igh-essen.com>
parents:
96
diff
changeset
|
328 |
domain->response_count = count; |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
329 |
EC_INFO("Domain %i working counter change: %i\n", domain->index, |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
330 |
count); |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
331 |
} |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
332 |
} |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
333 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
334 |
/*****************************************************************************/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
335 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
336 |
/** |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
337 |
Formats attribute data for SysFS reading. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
338 |
\return number of bytes to read |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
339 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
340 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
341 |
ssize_t ec_show_domain_attribute(struct kobject *kobj, /**< kobject */ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
342 |
struct attribute *attr, /**< attribute */ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
343 |
char *buffer /**< memory to store data in */ |
178
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
344 |
) |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
345 |
{ |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
346 |
ec_domain_t *domain = container_of(kobj, ec_domain_t, kobj); |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
347 |
|
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
348 |
if (attr == &attr_data_size) { |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
349 |
return sprintf(buffer, "%i\n", domain->data_size); |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
350 |
} |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
351 |
|
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
352 |
return 0; |
97
e6264685dd7b
Link-Down-Verhalten verbessert.
Florian Pose <fp@igh-essen.com>
parents:
96
diff
changeset
|
353 |
} |
e6264685dd7b
Link-Down-Verhalten verbessert.
Florian Pose <fp@igh-essen.com>
parents:
96
diff
changeset
|
354 |
|
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
355 |
/****************************************************************************** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
356 |
* Realtime interface |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
357 |
*****************************************************************************/ |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
358 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
359 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
360 |
Registers a data field in a domain. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
361 |
- If \a data_ptr is NULL, the slave is only checked against its type. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
362 |
- If \a field_count is 0, it is assumed that one data field is to be |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
363 |
registered. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
364 |
- If \a field_count is greater then 1, it is assumed that \a data_ptr |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
365 |
is an array of the respective size. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
366 |
\return pointer to the slave on success, else NULL |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
367 |
\ingroup RealtimeInterface |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
368 |
*/ |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
369 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
370 |
ec_slave_t *ecrt_domain_register_field(ec_domain_t *domain, |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
371 |
/**< EtherCAT domain */ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
372 |
const char *address, |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
373 |
/**< ASCII address of the slave, |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
374 |
see ecrt_master_get_slave() */ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
375 |
const char *vendor_name, |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
376 |
/**< vendor name */ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
377 |
const char *product_name, |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
378 |
/**< product name */ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
379 |
void **data_ptr, |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
380 |
/**< address of the process data |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
381 |
pointer */ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
382 |
const char *field_name, |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
383 |
/**< data field name */ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
384 |
unsigned int field_index, |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
385 |
/**< offset of data fields with |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
386 |
\a field_type */ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
387 |
unsigned int field_count |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
388 |
/**< number of data fields (with |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
389 |
the same type) to register */ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
390 |
) |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
391 |
{ |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
392 |
ec_slave_t *slave; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
393 |
const ec_slave_type_t *type; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
394 |
ec_master_t *master; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
395 |
const ec_sync_t *sync; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
396 |
const ec_field_t *field; |
108
dc3d56151d07
Bugfix: Registrieren von mehreren Feldern gleichzeitig geht jetzt.
Florian Pose <fp@igh-essen.com>
parents:
105
diff
changeset
|
397 |
unsigned int field_counter, i, j, orig_field_index, orig_field_count; |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
398 |
uint32_t field_offset; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
399 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
400 |
master = domain->master; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
401 |
|
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
402 |
// translate address |
138
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
112
diff
changeset
|
403 |
if (!(slave = ecrt_master_get_slave(master, address))) return NULL; |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
404 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
405 |
if (!(type = slave->type)) { |
84
b4ae98855cea
printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents:
76
diff
changeset
|
406 |
EC_ERR("Slave \"%s\" (position %i) has unknown type!\n", address, |
b4ae98855cea
printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents:
76
diff
changeset
|
407 |
slave->ring_position); |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
408 |
return NULL; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
409 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
410 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
411 |
if (strcmp(vendor_name, type->vendor_name) || |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
412 |
strcmp(product_name, type->product_name)) { |
84
b4ae98855cea
printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents:
76
diff
changeset
|
413 |
EC_ERR("Invalid slave type at position %i - Requested: \"%s %s\"," |
b4ae98855cea
printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents:
76
diff
changeset
|
414 |
" found: \"%s %s\".\n", slave->ring_position, vendor_name, |
b4ae98855cea
printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents:
76
diff
changeset
|
415 |
product_name, type->vendor_name, type->product_name); |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
416 |
return NULL; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
417 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
418 |
|
112
eec7639c7be9
Feldregistrierung: NULL als data_ptr m?glich, field_count 0 = 1.
Florian Pose <fp@igh-essen.com>
parents:
108
diff
changeset
|
419 |
if (!data_ptr) { |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
420 |
// data_ptr is NULL => mark slave as "registered" (do not warn) |
112
eec7639c7be9
Feldregistrierung: NULL als data_ptr m?glich, field_count 0 = 1.
Florian Pose <fp@igh-essen.com>
parents:
108
diff
changeset
|
421 |
slave->registered = 1; |
eec7639c7be9
Feldregistrierung: NULL als data_ptr m?glich, field_count 0 = 1.
Florian Pose <fp@igh-essen.com>
parents:
108
diff
changeset
|
422 |
} |
eec7639c7be9
Feldregistrierung: NULL als data_ptr m?glich, field_count 0 = 1.
Florian Pose <fp@igh-essen.com>
parents:
108
diff
changeset
|
423 |
|
eec7639c7be9
Feldregistrierung: NULL als data_ptr m?glich, field_count 0 = 1.
Florian Pose <fp@igh-essen.com>
parents:
108
diff
changeset
|
424 |
if (!field_count) field_count = 1; |
108
dc3d56151d07
Bugfix: Registrieren von mehreren Feldern gleichzeitig geht jetzt.
Florian Pose <fp@igh-essen.com>
parents:
105
diff
changeset
|
425 |
orig_field_index = field_index; |
dc3d56151d07
Bugfix: Registrieren von mehreren Feldern gleichzeitig geht jetzt.
Florian Pose <fp@igh-essen.com>
parents:
105
diff
changeset
|
426 |
orig_field_count = field_count; |
dc3d56151d07
Bugfix: Registrieren von mehreren Feldern gleichzeitig geht jetzt.
Florian Pose <fp@igh-essen.com>
parents:
105
diff
changeset
|
427 |
|
dc3d56151d07
Bugfix: Registrieren von mehreren Feldern gleichzeitig geht jetzt.
Florian Pose <fp@igh-essen.com>
parents:
105
diff
changeset
|
428 |
field_counter = 0; |
76 | 429 |
for (i = 0; type->sync_managers[i]; i++) { |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
430 |
sync = type->sync_managers[i]; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
431 |
field_offset = 0; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
432 |
for (j = 0; sync->fields[j]; j++) { |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
433 |
field = sync->fields[j]; |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
434 |
if (!strcmp(field->name, field_name)) { |
108
dc3d56151d07
Bugfix: Registrieren von mehreren Feldern gleichzeitig geht jetzt.
Florian Pose <fp@igh-essen.com>
parents:
105
diff
changeset
|
435 |
if (field_counter++ == field_index) { |
112
eec7639c7be9
Feldregistrierung: NULL als data_ptr m?glich, field_count 0 = 1.
Florian Pose <fp@igh-essen.com>
parents:
108
diff
changeset
|
436 |
if (data_ptr) |
eec7639c7be9
Feldregistrierung: NULL als data_ptr m?glich, field_count 0 = 1.
Florian Pose <fp@igh-essen.com>
parents:
108
diff
changeset
|
437 |
ec_domain_reg_field(domain, slave, sync, field_offset, |
eec7639c7be9
Feldregistrierung: NULL als data_ptr m?glich, field_count 0 = 1.
Florian Pose <fp@igh-essen.com>
parents:
108
diff
changeset
|
438 |
data_ptr++); |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
439 |
if (!(--field_count)) return slave; |
108
dc3d56151d07
Bugfix: Registrieren von mehreren Feldern gleichzeitig geht jetzt.
Florian Pose <fp@igh-essen.com>
parents:
105
diff
changeset
|
440 |
field_index++; |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
441 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
442 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
443 |
field_offset += field->size; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
444 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
445 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
446 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
447 |
EC_ERR("Slave %i (\"%s %s\") registration mismatch: Field \"%s\"," |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
448 |
" index %i, count %i.\n", slave->ring_position, vendor_name, |
108
dc3d56151d07
Bugfix: Registrieren von mehreren Feldern gleichzeitig geht jetzt.
Florian Pose <fp@igh-essen.com>
parents:
105
diff
changeset
|
449 |
product_name, field_name, orig_field_index, orig_field_count); |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
450 |
return NULL; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
451 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
452 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
453 |
/*****************************************************************************/ |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
454 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
455 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
456 |
Registeres a bunch of data fields. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
457 |
Caution! The list has to be terminated with a NULL structure ({})! |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
458 |
\return 0 in case of success, else < 0 |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
459 |
\ingroup RealtimeInterface |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
460 |
*/ |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
461 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
462 |
int ecrt_domain_register_field_list(ec_domain_t *domain, |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
463 |
/**< EtherCAT domain */ |
150
36530399236b
Plugfest: domain_process mit const-Zeiger.
Florian Pose <fp@igh-essen.com>
parents:
144
diff
changeset
|
464 |
const ec_field_init_t *fields |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
465 |
/**< array of data field registrations */ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
466 |
) |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
467 |
{ |
150
36530399236b
Plugfest: domain_process mit const-Zeiger.
Florian Pose <fp@igh-essen.com>
parents:
144
diff
changeset
|
468 |
const ec_field_init_t *field; |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
469 |
|
112
eec7639c7be9
Feldregistrierung: NULL als data_ptr m?glich, field_count 0 = 1.
Florian Pose <fp@igh-essen.com>
parents:
108
diff
changeset
|
470 |
for (field = fields; field->slave_address; field++) |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
471 |
if (!ecrt_domain_register_field(domain, field->slave_address, |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
472 |
field->vendor_name, |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
473 |
field->product_name, field->data_ptr, |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
474 |
field->field_name, field->field_index, |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
475 |
field->field_count)) |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
476 |
return -1; |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
477 |
|
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
478 |
return 0; |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
479 |
} |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
480 |
|
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
481 |
/*****************************************************************************/ |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
482 |
|
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
483 |
/** |
293
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
484 |
Places all process data datagrams in the masters datagram queue. |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
485 |
\ingroup RealtimeInterface |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
486 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
487 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
488 |
void ecrt_domain_queue(ec_domain_t *domain /**< EtherCAT domain */) |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
489 |
{ |
293
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
490 |
ec_datagram_t *datagram; |
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
491 |
|
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
492 |
list_for_each_entry(datagram, &domain->datagrams, list) { |
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
493 |
ec_master_queue_datagram(domain->master, datagram); |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
494 |
} |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
495 |
} |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
496 |
|
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
497 |
/*****************************************************************************/ |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
498 |
|
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
499 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
500 |
Processes received process data. |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
501 |
\ingroup RealtimeInterface |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
502 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
503 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
504 |
void ecrt_domain_process(ec_domain_t *domain /**< EtherCAT domain */) |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
505 |
{ |
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
506 |
unsigned int working_counter_sum; |
293
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
507 |
ec_datagram_t *datagram; |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
508 |
|
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
509 |
working_counter_sum = 0; |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
510 |
|
293
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
511 |
list_for_each_entry(datagram, &domain->datagrams, list) { |
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
512 |
if (datagram->state == EC_CMD_RECEIVED) { |
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
513 |
working_counter_sum += datagram->working_counter; |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
514 |
} |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
515 |
} |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
516 |
|
97
e6264685dd7b
Link-Down-Verhalten verbessert.
Florian Pose <fp@igh-essen.com>
parents:
96
diff
changeset
|
517 |
ec_domain_response_count(domain, working_counter_sum); |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
518 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
519 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
520 |
/*****************************************************************************/ |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
521 |
|
105
fad6709a526f
Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
522 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
523 |
Returns the state of a domain. |
293
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
524 |
\return 0 if all datagrams were received, else -1. |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
525 |
\ingroup RealtimeInterface |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
526 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
527 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
528 |
int ecrt_domain_state(ec_domain_t *domain /**< EtherCAT domain */) |
105
fad6709a526f
Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
529 |
{ |
293
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
530 |
ec_datagram_t *datagram; |
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
531 |
|
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
532 |
list_for_each_entry(datagram, &domain->datagrams, list) { |
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
275
diff
changeset
|
533 |
if (datagram->state != EC_CMD_RECEIVED) return -1; |
105
fad6709a526f
Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
534 |
} |
fad6709a526f
Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
535 |
|
fad6709a526f
Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
536 |
return 0; |
fad6709a526f
Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
537 |
} |
fad6709a526f
Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
538 |
|
fad6709a526f
Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
539 |
/*****************************************************************************/ |
fad6709a526f
Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
540 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
541 |
/** \cond */ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
542 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
543 |
EXPORT_SYMBOL(ecrt_domain_register_field); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
544 |
EXPORT_SYMBOL(ecrt_domain_register_field_list); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
545 |
EXPORT_SYMBOL(ecrt_domain_queue); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
546 |
EXPORT_SYMBOL(ecrt_domain_process); |
105
fad6709a526f
Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
547 |
EXPORT_SYMBOL(ecrt_domain_state); |
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
548 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
549 |
/** \endcond */ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
550 |
|
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
551 |
/*****************************************************************************/ |