author | Florian Pose <fp@igh-essen.com> |
Tue, 25 Apr 2006 11:37:05 +0000 | |
changeset 202 | d5141123a5af |
parent 199 | 04ecf40fc2e9 |
child 246 | 0bf7c769de06 |
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 |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
11 |
* as published by the Free Software Foundation; version 2 of the License. |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
12 |
* |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
13 |
* 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
|
14 |
* 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
|
15 |
* 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
|
16 |
* GNU General Public License for more details. |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
17 |
* |
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
18 |
* 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
|
19 |
* 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
|
20 |
* 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
|
21 |
* |
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
22 |
*****************************************************************************/ |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
23 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
24 |
/** |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
25 |
\file |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
26 |
EtherCAT domain methods. |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
27 |
*/ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
28 |
|
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
29 |
/*****************************************************************************/ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
30 |
|
54
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
31 |
#include "globals.h" |
7506e67dd122
Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents:
52
diff
changeset
|
32 |
#include "domain.h" |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
33 |
#include "master.h" |
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
|
178
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
35 |
/*****************************************************************************/ |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
36 |
|
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
37 |
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
|
38 |
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
|
39 |
|
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
/*****************************************************************************/ |
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
42 |
/** \cond */ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
43 |
|
184
2fc86cec12df
Macro for SysFS attribute definition
Florian Pose <fp@igh-essen.com>
parents:
182
diff
changeset
|
44 |
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
|
45 |
|
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
46 |
static struct attribute *def_attrs[] = { |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
47 |
&attr_data_size, |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
48 |
NULL, |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
49 |
}; |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
50 |
|
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
51 |
static struct sysfs_ops sysfs_ops = { |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
52 |
.show = &ec_show_domain_attribute, |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
53 |
.store = NULL |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
54 |
}; |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
55 |
|
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
56 |
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
|
57 |
.release = ec_domain_clear, |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
58 |
.sysfs_ops = &sysfs_ops, |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
59 |
.default_attrs = def_attrs |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
60 |
}; |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
61 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
62 |
/** \endcond */ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
63 |
|
178
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
64 |
/*****************************************************************************/ |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
65 |
|
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
66 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
67 |
Domain constructor. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
68 |
\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
|
69 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
70 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
71 |
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
|
72 |
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
|
73 |
unsigned int index /**< domain index */ |
178
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
74 |
) |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
75 |
{ |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
76 |
domain->master = master; |
178
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
77 |
domain->index = index; |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
78 |
domain->data_size = 0; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
79 |
domain->base_address = 0; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
80 |
domain->response_count = 0xFFFFFFFF; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
81 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
82 |
INIT_LIST_HEAD(&domain->field_regs); |
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
83 |
INIT_LIST_HEAD(&domain->commands); |
178
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
84 |
|
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
85 |
// 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
|
86 |
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
|
87 |
kobject_init(&domain->kobj); |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
88 |
domain->kobj.ktype = &ktype_ec_domain; |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
89 |
domain->kobj.parent = &master->kobj; |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
90 |
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
|
91 |
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
|
92 |
return -1; |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
93 |
} |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
94 |
|
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
95 |
return 0; |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
96 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
97 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
98 |
/*****************************************************************************/ |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
99 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
100 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
101 |
Domain destructor. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
102 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
103 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
104 |
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
|
105 |
{ |
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
106 |
ec_command_t *command, *next; |
178
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
107 |
ec_domain_t *domain; |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
108 |
|
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
109 |
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
|
110 |
|
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
111 |
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
|
112 |
|
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
113 |
list_for_each_entry_safe(command, next, &domain->commands, list) { |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
114 |
ec_command_clear(command); |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
115 |
kfree(command); |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
116 |
} |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
117 |
|
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
118 |
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
|
119 |
|
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
120 |
kfree(domain); |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
121 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
122 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
123 |
/*****************************************************************************/ |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
124 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
125 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
126 |
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
|
127 |
\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
|
128 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
129 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
130 |
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
|
131 |
ec_slave_t *slave, /**< slave */ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
132 |
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
|
133 |
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
|
134 |
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
|
135 |
pointer */ |
73
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 |
{ |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
138 |
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
|
139 |
|
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
140 |
if (!(field_reg = |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
141 |
(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
|
142 |
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
|
143 |
return -1; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
144 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
145 |
|
160
7ddf8367196a
Renamed slave_set_fmmu() to slave_prepare_fmmu().
Florian Pose <fp@igh-essen.com>
parents:
150
diff
changeset
|
146 |
if (ec_slave_prepare_fmmu(slave, domain, sync)) { |
84
b4ae98855cea
printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents:
76
diff
changeset
|
147 |
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
|
148 |
kfree(field_reg); |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
149 |
return -1; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
150 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
151 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
152 |
field_reg->slave = slave; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
153 |
field_reg->sync = sync; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
154 |
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
|
155 |
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
|
156 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
157 |
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
|
158 |
return 0; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
159 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
160 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
161 |
/*****************************************************************************/ |
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 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
164 |
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
|
165 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
166 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
167 |
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
|
168 |
{ |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
169 |
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
|
170 |
|
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
171 |
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
|
172 |
list_del(&field_reg->list); |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
173 |
kfree(field_reg); |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
174 |
} |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
175 |
} |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
176 |
|
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
177 |
/*****************************************************************************/ |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
178 |
|
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
179 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
180 |
Allocates a process data command and appends it to the list. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
181 |
\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
|
182 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
183 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
184 |
int ec_domain_add_command(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
|
185 |
uint32_t offset, /**< logical offset */ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
186 |
size_t data_size /**< size of the command data */ |
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
187 |
) |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
188 |
{ |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
189 |
ec_command_t *command; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
190 |
|
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
191 |
if (!(command = kmalloc(sizeof(ec_command_t), GFP_KERNEL))) { |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
192 |
EC_ERR("Failed to allocate domain command!\n"); |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
193 |
return -1; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
194 |
} |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
195 |
|
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
196 |
ec_command_init(command); |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
197 |
|
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
198 |
if (ec_command_lrw(command, offset, data_size)) { |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
199 |
kfree(command); |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
200 |
return -1; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
201 |
} |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
202 |
|
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
203 |
list_add_tail(&command->list, &domain->commands); |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
204 |
return 0; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
205 |
} |
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 |
/*****************************************************************************/ |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
208 |
|
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
209 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
210 |
Creates a domain. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
211 |
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
|
212 |
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
|
213 |
data fields. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
214 |
\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
|
215 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
216 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
217 |
int ec_domain_alloc(ec_domain_t *domain, /**< EtherCAT domain */ |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
218 |
uint32_t base_address /**< Logische Basisadresse */ |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
219 |
) |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
220 |
{ |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
221 |
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
|
222 |
ec_slave_t *slave; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
223 |
ec_fmmu_t *fmmu; |
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
224 |
unsigned int i, j, cmd_count; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
225 |
uint32_t field_off, field_off_cmd; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
226 |
uint32_t cmd_offset; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
227 |
size_t cmd_data_size; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
228 |
ec_command_t *command; |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
229 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
230 |
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
|
231 |
|
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
232 |
// Größe der Prozessdaten berechnen und Kommandos allozieren |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
233 |
domain->data_size = 0; |
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
234 |
cmd_offset = base_address; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
235 |
cmd_data_size = 0; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
236 |
cmd_count = 0; |
182
8c0bc99229a9
Slaves stored in list, slaves in SysFS
Florian Pose <fp@igh-essen.com>
parents:
179
diff
changeset
|
237 |
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
|
238 |
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
|
239 |
fmmu = &slave->fmmus[j]; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
240 |
if (fmmu->domain == domain) { |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
241 |
fmmu->logical_start_address = base_address + domain->data_size; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
242 |
domain->data_size += fmmu->sync->size; |
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
243 |
if (cmd_data_size + fmmu->sync->size > EC_MAX_DATA_SIZE) { |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
244 |
if (ec_domain_add_command(domain, cmd_offset, |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
245 |
cmd_data_size)) return -1; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
246 |
cmd_offset += cmd_data_size; |
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++; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
249 |
} |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
250 |
cmd_data_size += fmmu->sync->size; |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
251 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
252 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
253 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
254 |
|
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
255 |
// Letztes Kommando allozieren |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
256 |
if (cmd_data_size) { |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
257 |
if (ec_domain_add_command(domain, cmd_offset, cmd_data_size)) |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
258 |
return -1; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
259 |
cmd_count++; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
260 |
} |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
261 |
|
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
262 |
if (!cmd_count) { |
178
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
263 |
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
|
264 |
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
|
265 |
return 0; |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
266 |
} |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
267 |
|
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
268 |
// Alle Prozessdatenzeiger setzen |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
269 |
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
|
270 |
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
|
271 |
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
|
272 |
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
|
273 |
field_off = fmmu->logical_start_address + |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
274 |
field_reg->field_offset; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
275 |
// Kommando suchen |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
276 |
list_for_each_entry(command, &domain->commands, list) { |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
277 |
field_off_cmd = field_off - command->address.logical; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
278 |
if (field_off >= command->address.logical && |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
279 |
field_off_cmd < command->mem_size) { |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
280 |
*field_reg->data_ptr = command->data + field_off_cmd; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
281 |
} |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
282 |
} |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
283 |
if (!field_reg->data_ptr) { |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
284 |
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
|
285 |
return -1; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
286 |
} |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
287 |
break; |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
288 |
} |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
289 |
} |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
290 |
} |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
291 |
|
178
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
292 |
EC_INFO("Domain %i - Allocated %i bytes in %i command%s\n", |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
293 |
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
|
294 |
cmd_count == 1 ? "" : "s"); |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
295 |
|
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
296 |
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
|
297 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
298 |
return 0; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
299 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
300 |
|
97
e6264685dd7b
Link-Down-Verhalten verbessert.
Florian Pose <fp@igh-essen.com>
parents:
96
diff
changeset
|
301 |
/*****************************************************************************/ |
e6264685dd7b
Link-Down-Verhalten verbessert.
Florian Pose <fp@igh-essen.com>
parents:
96
diff
changeset
|
302 |
|
e6264685dd7b
Link-Down-Verhalten verbessert.
Florian Pose <fp@igh-essen.com>
parents:
96
diff
changeset
|
303 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
304 |
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
|
305 |
This number isn't really the number of responding slaves, but the sum of |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
306 |
the working counters of all domain commands. Some slaves increase the |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
307 |
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
|
308 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
309 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
310 |
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
|
311 |
unsigned int count /**< new WC sum */ |
97
e6264685dd7b
Link-Down-Verhalten verbessert.
Florian Pose <fp@igh-essen.com>
parents:
96
diff
changeset
|
312 |
) |
e6264685dd7b
Link-Down-Verhalten verbessert.
Florian Pose <fp@igh-essen.com>
parents:
96
diff
changeset
|
313 |
{ |
e6264685dd7b
Link-Down-Verhalten verbessert.
Florian Pose <fp@igh-essen.com>
parents:
96
diff
changeset
|
314 |
if (count != domain->response_count) { |
e6264685dd7b
Link-Down-Verhalten verbessert.
Florian Pose <fp@igh-essen.com>
parents:
96
diff
changeset
|
315 |
domain->response_count = count; |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
316 |
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
|
317 |
count); |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
318 |
} |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
319 |
} |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
320 |
|
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 |
/** |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
324 |
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
|
325 |
\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
|
326 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
327 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
328 |
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
|
329 |
struct attribute *attr, /**< attribute */ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
330 |
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
|
331 |
) |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
332 |
{ |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
333 |
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
|
334 |
|
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
335 |
if (attr == &attr_data_size) { |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
336 |
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
|
337 |
} |
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
338 |
|
b84f69db8566
MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents:
166
diff
changeset
|
339 |
return 0; |
97
e6264685dd7b
Link-Down-Verhalten verbessert.
Florian Pose <fp@igh-essen.com>
parents:
96
diff
changeset
|
340 |
} |
e6264685dd7b
Link-Down-Verhalten verbessert.
Florian Pose <fp@igh-essen.com>
parents:
96
diff
changeset
|
341 |
|
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
342 |
/****************************************************************************** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
343 |
* Realtime interface |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
344 |
*****************************************************************************/ |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
345 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
346 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
347 |
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
|
348 |
- 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
|
349 |
- 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
|
350 |
registered. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
351 |
- 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
|
352 |
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
|
353 |
\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
|
354 |
\ingroup RealtimeInterface |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
355 |
*/ |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
356 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
357 |
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
|
358 |
/**< EtherCAT domain */ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
359 |
const char *address, |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
360 |
/**< ASCII address of the slave, |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
361 |
see ecrt_master_get_slave() */ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
362 |
const char *vendor_name, |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
363 |
/**< vendor name */ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
364 |
const char *product_name, |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
365 |
/**< product name */ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
366 |
void **data_ptr, |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
367 |
/**< address of the process data |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
368 |
pointer */ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
369 |
const char *field_name, |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
370 |
/**< data field name */ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
371 |
unsigned int field_index, |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
372 |
/**< offset of data fields with |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
373 |
\a field_type */ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
374 |
unsigned int field_count |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
375 |
/**< number of data fields (with |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
376 |
the same type) to register */ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
377 |
) |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
378 |
{ |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
379 |
ec_slave_t *slave; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
380 |
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
|
381 |
ec_master_t *master; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
382 |
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
|
383 |
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
|
384 |
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
|
385 |
uint32_t field_offset; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
386 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
387 |
master = domain->master; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
388 |
|
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
389 |
// translate address |
138
7e743a61a991
SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents:
112
diff
changeset
|
390 |
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
|
391 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
392 |
if (!(type = slave->type)) { |
84
b4ae98855cea
printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents:
76
diff
changeset
|
393 |
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
|
394 |
slave->ring_position); |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
395 |
return NULL; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
396 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
397 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
398 |
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
|
399 |
strcmp(product_name, type->product_name)) { |
84
b4ae98855cea
printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents:
76
diff
changeset
|
400 |
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
|
401 |
" found: \"%s %s\".\n", slave->ring_position, vendor_name, |
b4ae98855cea
printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents:
76
diff
changeset
|
402 |
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
|
403 |
return NULL; |
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 |
|
112
eec7639c7be9
Feldregistrierung: NULL als data_ptr m?glich, field_count 0 = 1.
Florian Pose <fp@igh-essen.com>
parents:
108
diff
changeset
|
406 |
if (!data_ptr) { |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
407 |
// 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
|
408 |
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
|
409 |
} |
eec7639c7be9
Feldregistrierung: NULL als data_ptr m?glich, field_count 0 = 1.
Florian Pose <fp@igh-essen.com>
parents:
108
diff
changeset
|
410 |
|
eec7639c7be9
Feldregistrierung: NULL als data_ptr m?glich, field_count 0 = 1.
Florian Pose <fp@igh-essen.com>
parents:
108
diff
changeset
|
411 |
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
|
412 |
orig_field_index = field_index; |
dc3d56151d07
Bugfix: Registrieren von mehreren Feldern gleichzeitig geht jetzt.
Florian Pose <fp@igh-essen.com>
parents:
105
diff
changeset
|
413 |
orig_field_count = field_count; |
dc3d56151d07
Bugfix: Registrieren von mehreren Feldern gleichzeitig geht jetzt.
Florian Pose <fp@igh-essen.com>
parents:
105
diff
changeset
|
414 |
|
dc3d56151d07
Bugfix: Registrieren von mehreren Feldern gleichzeitig geht jetzt.
Florian Pose <fp@igh-essen.com>
parents:
105
diff
changeset
|
415 |
field_counter = 0; |
76 | 416 |
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
|
417 |
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
|
418 |
field_offset = 0; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
419 |
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
|
420 |
field = sync->fields[j]; |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
421 |
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
|
422 |
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
|
423 |
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
|
424 |
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
|
425 |
data_ptr++); |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
426 |
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
|
427 |
field_index++; |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
428 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
429 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
430 |
field_offset += field->size; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
431 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
432 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
433 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
434 |
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
|
435 |
" 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
|
436 |
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
|
437 |
return NULL; |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
438 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
439 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
440 |
/*****************************************************************************/ |
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 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
443 |
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
|
444 |
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
|
445 |
\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
|
446 |
\ingroup RealtimeInterface |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
447 |
*/ |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
448 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
449 |
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
|
450 |
/**< EtherCAT domain */ |
150
36530399236b
Plugfest: domain_process mit const-Zeiger.
Florian Pose <fp@igh-essen.com>
parents:
144
diff
changeset
|
451 |
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
|
452 |
/**< array of data field registrations */ |
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
453 |
) |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
454 |
{ |
150
36530399236b
Plugfest: domain_process mit const-Zeiger.
Florian Pose <fp@igh-essen.com>
parents:
144
diff
changeset
|
455 |
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
|
456 |
|
112
eec7639c7be9
Feldregistrierung: NULL als data_ptr m?glich, field_count 0 = 1.
Florian Pose <fp@igh-essen.com>
parents:
108
diff
changeset
|
457 |
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
|
458 |
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
|
459 |
field->vendor_name, |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
460 |
field->product_name, field->data_ptr, |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
461 |
field->field_name, field->field_index, |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
462 |
field->field_count)) |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
463 |
return -1; |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
464 |
|
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
465 |
return 0; |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
466 |
} |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
467 |
|
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
468 |
/*****************************************************************************/ |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
469 |
|
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
470 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
471 |
Places all process data commands in the masters command queue. |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
472 |
\ingroup RealtimeInterface |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
473 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
474 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
475 |
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
|
476 |
{ |
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
477 |
ec_command_t *command; |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
478 |
|
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
479 |
list_for_each_entry(command, &domain->commands, list) { |
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
480 |
ec_master_queue_command(domain->master, command); |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
481 |
} |
98
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 |
|
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
484 |
/*****************************************************************************/ |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
485 |
|
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
486 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
487 |
Processes received process data. |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
488 |
\ingroup RealtimeInterface |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
489 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
490 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
491 |
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
|
492 |
{ |
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
493 |
unsigned int working_counter_sum; |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
494 |
ec_command_t *command; |
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 |
working_counter_sum = 0; |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
497 |
|
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
498 |
list_for_each_entry(command, &domain->commands, list) { |
98
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
499 |
if (command->state == EC_CMD_RECEIVED) { |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
500 |
working_counter_sum += command->working_counter; |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
501 |
} |
f564d0929292
MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents:
97
diff
changeset
|
502 |
} |
73
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
503 |
|
97
e6264685dd7b
Link-Down-Verhalten verbessert.
Florian Pose <fp@igh-essen.com>
parents:
96
diff
changeset
|
504 |
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
|
505 |
} |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
506 |
|
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
507 |
/*****************************************************************************/ |
9f4ea66d89a3
Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents:
58
diff
changeset
|
508 |
|
105
fad6709a526f
Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
509 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
510 |
Returns the state of a domain. |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
511 |
\return 0 if all commands were received, else -1. |
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
512 |
\ingroup RealtimeInterface |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
513 |
*/ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
514 |
|
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
515 |
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
|
516 |
{ |
fad6709a526f
Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
517 |
ec_command_t *command; |
fad6709a526f
Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
518 |
|
144
fdc24bf62f80
Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents:
138
diff
changeset
|
519 |
list_for_each_entry(command, &domain->commands, list) { |
105
fad6709a526f
Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
520 |
if (command->state != EC_CMD_RECEIVED) return -1; |
fad6709a526f
Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
521 |
} |
fad6709a526f
Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
522 |
|
fad6709a526f
Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
523 |
return 0; |
fad6709a526f
Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
524 |
} |
fad6709a526f
Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
525 |
|
fad6709a526f
Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
526 |
/*****************************************************************************/ |
fad6709a526f
Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents:
104
diff
changeset
|
527 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
528 |
/** \cond */ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
529 |
|
104
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
530 |
EXPORT_SYMBOL(ecrt_domain_register_field); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
531 |
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
|
532 |
EXPORT_SYMBOL(ecrt_domain_queue); |
052bc82d5442
MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents:
101
diff
changeset
|
533 |
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
|
534 |
EXPORT_SYMBOL(ecrt_domain_state); |
42
a22a202d0f42
Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
535 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
536 |
/** \endcond */ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
537 |
|
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
538 |
/*****************************************************************************/ |