master/domain.c
author Florian Pose <fp@igh-essen.com>
Tue, 13 Feb 2007 14:18:29 +0000
branchstable-1.2
changeset 1742 9195107c9441
parent 1739 5fcbd29151d2
child 1744 7bc131b92039
permissions -rw-r--r--
Removed unwanted label.
42
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
/******************************************************************************
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
 *
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     3
 *  $Id$
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     4
 *
197
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
     5
 *  Copyright (C) 2006  Florian Pose, Ingenieurgemeinschaft IgH
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
     6
 *
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
     7
 *  This file is part of the IgH EtherCAT Master.
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
     8
 *
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
     9
 *  The IgH EtherCAT Master is free software; you can redistribute it
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    10
 *  and/or modify it under the terms of the GNU General Public License
246
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 199
diff changeset
    11
 *  as published by the Free Software Foundation; either version 2 of the
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 199
diff changeset
    12
 *  License, or (at your option) any later version.
197
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    13
 *
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    14
 *  The IgH EtherCAT Master is distributed in the hope that it will be
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    15
 *  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    17
 *  GNU General Public License for more details.
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    18
 *
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    19
 *  You should have received a copy of the GNU General Public License
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    20
 *  along with the IgH EtherCAT Master; if not, write to the Free Software
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    21
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    22
 *
246
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 199
diff changeset
    23
 *  The right to use EtherCAT Technology is granted and comes free of
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 199
diff changeset
    24
 *  charge under condition of compatibility of product made by
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 199
diff changeset
    25
 *  Licensee. People intending to distribute/sell products based on the
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 199
diff changeset
    26
 *  code, have to sign an agreement to guarantee that products using
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 199
diff changeset
    27
 *  software based on IgH EtherCAT master stay compatible with the actual
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 199
diff changeset
    28
 *  EtherCAT specification (which are released themselves as an open
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 199
diff changeset
    29
 *  standard) as the (only) precondition to have the right to use EtherCAT
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 199
diff changeset
    30
 *  Technology, IP and trade marks.
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 199
diff changeset
    31
 *
42
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
 *****************************************************************************/
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    33
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    34
/**
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    35
   \file
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    36
   EtherCAT domain methods.
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    37
*/
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    38
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    39
/*****************************************************************************/
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    40
294
feea8d850c65 Applied include patch by M. Schwerin.
Florian Pose <fp@igh-essen.com>
parents: 293
diff changeset
    41
#include <linux/module.h>
feea8d850c65 Applied include patch by M. Schwerin.
Florian Pose <fp@igh-essen.com>
parents: 293
diff changeset
    42
54
7506e67dd122 Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents: 52
diff changeset
    43
#include "globals.h"
7506e67dd122 Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents: 52
diff changeset
    44
#include "domain.h"
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
    45
#include "master.h"
42
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    46
178
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
    47
/*****************************************************************************/
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
    48
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
    49
/**
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
    50
   Data registration type.
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
    51
*/
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
    52
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
    53
typedef struct
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
    54
{
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
    55
    struct list_head list; /**< list item */
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
    56
    ec_slave_t *slave; /**< slave */
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
    57
    const ec_sii_sync_t *sync; /**< sync manager */
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
    58
    off_t sync_offset; /**< pdo offset */
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
    59
    void **data_ptr; /**< pointer to process data pointer(s) */
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
    60
}
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
    61
ec_data_reg_t;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
    62
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
    63
/*****************************************************************************/
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
    64
1732
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
    65
void ec_domain_clear(struct kobject *);
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
    66
void ec_domain_clear_data_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
    67
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
    68
42
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    69
/*****************************************************************************/
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    70
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    71
/** \cond */
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    72
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
    73
EC_SYSFS_READ_ATTR(image_size);
178
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
    74
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
    75
static struct attribute *def_attrs[] = {
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
    76
    &attr_image_size,
178
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
    77
    NULL,
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
    78
};
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
    79
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
    80
static struct sysfs_ops sysfs_ops = {
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
    81
    .show = &ec_show_domain_attribute,
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
    82
    .store = NULL
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
    83
};
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
    84
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
    85
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
    86
    .release = ec_domain_clear,
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
    87
    .sysfs_ops = &sysfs_ops,
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
    88
    .default_attrs = def_attrs
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
    89
};
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
    90
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    91
/** \endcond */
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    92
178
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
42
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    95
/**
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
    96
   Domain constructor.
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
    97
   \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
    98
*/
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
    99
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   100
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
   101
                   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
   102
                   unsigned int index /**< domain index */
178
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
   103
                   )
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   104
{
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   105
    domain->master = master;
178
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
   106
    domain->index = index;
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   107
    domain->data_size = 0;
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   108
    domain->base_address = 0;
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   109
    domain->response_count = 0xFFFFFFFF;
1719
42ed27ae6785 MERGE trunk -r516:527 -> branches/stable-1.1 (jiffies, bugfixes, pdo defines)
Florian Pose <fp@igh-essen.com>
parents: 1717
diff changeset
   110
    domain->notify_jiffies = 0;
1716
9440f4ff25c7 MERGE trunk -r494:513 -> branches/stable-1.1 (SDO configuration, bugfixes, EoE frame rates)
Florian Pose <fp@igh-essen.com>
parents: 1715
diff changeset
   111
    domain->working_counter_changes = 0;
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   112
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   113
    INIT_LIST_HEAD(&domain->data_regs);
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   114
    INIT_LIST_HEAD(&domain->datagrams);
178
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
   115
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   116
    // 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
   117
    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
   118
    kobject_init(&domain->kobj);
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
   119
    domain->kobj.ktype = &ktype_ec_domain;
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
   120
    domain->kobj.parent = &master->kobj;
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
   121
    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
   122
        EC_ERR("Failed to set kobj name.\n");
1732
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   123
        kobject_put(&domain->kobj);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   124
        return -1;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   125
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   126
    if (kobject_add(&domain->kobj)) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   127
        EC_ERR("Failed to add domain kobject.\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   128
        kobject_put(&domain->kobj);
178
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
   129
        return -1;
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
   130
    }
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
   131
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
   132
    return 0;
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   133
}
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   134
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   135
/*****************************************************************************/
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   136
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   137
/**
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   138
   Domain destructor.
1732
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   139
   Clears and frees a domain object.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   140
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   141
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   142
void ec_domain_destroy(ec_domain_t *domain /**< EtherCAT domain */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   143
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   144
    ec_datagram_t *datagram;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   145
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   146
    // dequeue datagrams
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   147
    list_for_each_entry(datagram, &domain->datagrams, list) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   148
        if (!list_empty(&datagram->queue)) // datagram queued?
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   149
            list_del_init(&datagram->queue);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   150
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   151
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   152
    // destroy self
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   153
    kobject_del(&domain->kobj);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   154
    kobject_put(&domain->kobj);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   155
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   156
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   157
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   158
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   159
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   160
   Clear and free domain.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   161
   This method is called by the kobject,
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   162
   once there are no more references to it.
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   163
*/
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   164
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   165
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
   166
{
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   167
    ec_datagram_t *datagram, *next;
178
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
   168
    ec_domain_t *domain;
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
   169
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
   170
    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
   171
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   172
    list_for_each_entry_safe(datagram, next, &domain->datagrams, list) {
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   173
        ec_datagram_clear(datagram);
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   174
        kfree(datagram);
144
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 138
diff changeset
   175
    }
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 97
diff changeset
   176
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   177
    ec_domain_clear_data_regs(domain);
178
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
   178
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
   179
    kfree(domain);
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   180
}
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   181
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   182
/*****************************************************************************/
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   183
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   184
/**
1716
9440f4ff25c7 MERGE trunk -r494:513 -> branches/stable-1.1 (SDO configuration, bugfixes, EoE frame rates)
Florian Pose <fp@igh-essen.com>
parents: 1715
diff changeset
   185
   Registeres a PDO entry.
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   186
   \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
   187
*/
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   188
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   189
int ec_domain_reg_pdo_entry(ec_domain_t *domain, /**< EtherCAT domain */
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   190
                            ec_slave_t *slave, /**< slave */
1717
cc1ee18207d3 MERGE trunk -r513:515 -> branches/stable-1.1 (Missing code docs)
Florian Pose <fp@igh-essen.com>
parents: 1716
diff changeset
   191
                            const ec_sii_pdo_t *pdo, /**< PDO */
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   192
                            const ec_sii_pdo_entry_t *entry,
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   193
                            /**< PDO registration entry */
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   194
                            void **data_ptr /**< pointer to the process data
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   195
                                               pointer */
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   196
                            )
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   197
{
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   198
    ec_data_reg_t *data_reg;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   199
    const ec_sii_sync_t *sync;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   200
    const ec_sii_pdo_t *other_pdo;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   201
    const ec_sii_pdo_entry_t *other_entry;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   202
    unsigned int bit_offset, byte_offset, sync_found;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   203
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   204
    // Find sync manager for PDO
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   205
    sync_found = 0;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   206
    list_for_each_entry(sync, &slave->sii_syncs, list) {
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   207
        if (sync->index == pdo->sync_index) {
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   208
            sync_found = 1;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   209
            break;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   210
        }
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   211
    }
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   212
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   213
    if (!sync_found) {
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   214
        EC_ERR("No sync manager for PDO 0x%04X:%i.",
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   215
               pdo->index, entry->subindex);
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   216
        return -1;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   217
    }
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   218
1732
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   219
    // Calculate offset (in sync manager) for process data pointer
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   220
    bit_offset = 0;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   221
    byte_offset = 0;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   222
    list_for_each_entry(other_pdo, &slave->sii_pdos, list) {
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   223
        if (other_pdo->sync_index != sync->index) continue;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   224
1719
42ed27ae6785 MERGE trunk -r516:527 -> branches/stable-1.1 (jiffies, bugfixes, pdo defines)
Florian Pose <fp@igh-essen.com>
parents: 1717
diff changeset
   225
        list_for_each_entry(other_entry, &other_pdo->entries, list) {
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   226
            if (other_entry == entry) {
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   227
                byte_offset = bit_offset / 8;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   228
                break;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   229
            }
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   230
            bit_offset += other_entry->bit_length;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   231
        }
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   232
    }
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   233
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   234
    // Allocate memory for data registration object
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   235
    if (!(data_reg =
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   236
          (ec_data_reg_t *) kmalloc(sizeof(ec_data_reg_t), GFP_KERNEL))) {
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   237
        EC_ERR("Failed to allocate data registration.\n");
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   238
        return -1;
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   239
    }
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   240
160
7ddf8367196a Renamed slave_set_fmmu() to slave_prepare_fmmu().
Florian Pose <fp@igh-essen.com>
parents: 150
diff changeset
   241
    if (ec_slave_prepare_fmmu(slave, domain, sync)) {
84
b4ae98855cea printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents: 76
diff changeset
   242
        EC_ERR("FMMU configuration failed.\n");
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   243
        kfree(data_reg);
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   244
        return -1;
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   245
    }
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   246
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   247
    data_reg->slave = slave;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   248
    data_reg->sync = sync;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   249
    data_reg->sync_offset = byte_offset;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   250
    data_reg->data_ptr = data_ptr;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   251
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   252
    list_add_tail(&data_reg->list, &domain->data_regs);
1732
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   253
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   254
    ec_slave_request_state(slave, EC_SLAVE_STATE_OP);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   255
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   256
    return 0;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   257
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   258
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   259
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   260
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   261
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   262
   Registeres a PDO range.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   263
   \return 0 in case of success, else < 0
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   264
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   265
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   266
int ec_domain_reg_pdo_range(ec_domain_t *domain, /**< EtherCAT domain */
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   267
                            ec_slave_t *slave, /**< slave */
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   268
                            ec_direction_t dir, /**< data direction */
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   269
                            uint16_t offset, /**< offset */
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   270
                            uint16_t length, /**< length */
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   271
                            void **data_ptr /**< pointer to the process data
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   272
                                               pointer */
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   273
                            )
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   274
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   275
    ec_data_reg_t *data_reg;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   276
    ec_sii_sync_t *sync;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   277
    unsigned int sync_found, sync_index;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   278
    uint16_t sync_length;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   279
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   280
    switch (dir) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   281
        case EC_DIR_OUTPUT: sync_index = 2; break;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   282
        case EC_DIR_INPUT:  sync_index = 3; break;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   283
        default:
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   284
            EC_ERR("Invalid direction!\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   285
            return -1;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   286
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   287
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   288
    // Find sync manager
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   289
    sync_found = 0;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   290
    list_for_each_entry(sync, &slave->sii_syncs, list) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   291
        if (sync->index == sync_index) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   292
            sync_found = 1;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   293
            break;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   294
        }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   295
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   296
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   297
    if (!sync_found) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   298
        EC_ERR("No sync manager found for PDO range.\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   299
        return -1;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   300
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   301
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   302
     // Allocate memory for data registration object
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   303
    if (!(data_reg =
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   304
          (ec_data_reg_t *) kmalloc(sizeof(ec_data_reg_t), GFP_KERNEL))) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   305
        EC_ERR("Failed to allocate data registration.\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   306
        return -1;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   307
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   308
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   309
    if (ec_slave_prepare_fmmu(slave, domain, sync)) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   310
        EC_ERR("FMMU configuration failed.\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   311
        kfree(data_reg);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   312
        return -1;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   313
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   314
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   315
    data_reg->slave = slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   316
    data_reg->sync = sync;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   317
    data_reg->sync_offset = offset;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   318
    data_reg->data_ptr = data_ptr;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   319
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   320
    // estimate sync manager length
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   321
    sync_length = offset + length;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   322
    if (sync->est_length < sync_length) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   323
        sync->est_length = sync_length;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   324
        if (domain->master->debug_level) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   325
            EC_DBG("Estimating length of sync manager %i of slave %i to %i.\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   326
                   sync->index, slave->ring_position, sync_length);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   327
        }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   328
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   329
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   330
    list_add_tail(&data_reg->list, &domain->data_regs);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   331
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   332
    ec_slave_request_state(slave, EC_SLAVE_STATE_OP);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   333
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   334
    return 0;
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   335
}
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   336
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   337
/*****************************************************************************/
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   338
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   339
/**
1716
9440f4ff25c7 MERGE trunk -r494:513 -> branches/stable-1.1 (SDO configuration, bugfixes, EoE frame rates)
Florian Pose <fp@igh-essen.com>
parents: 1715
diff changeset
   340
   Clears the list of the data registrations.
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   341
*/
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   342
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   343
void ec_domain_clear_data_regs(ec_domain_t *domain /**< EtherCAT domain */)
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   344
{
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   345
    ec_data_reg_t *data_reg, *next;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   346
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   347
    list_for_each_entry_safe(data_reg, next, &domain->data_regs, list) {
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   348
        list_del(&data_reg->list);
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   349
        kfree(data_reg);
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 97
diff changeset
   350
    }
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 97
diff changeset
   351
}
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 97
diff changeset
   352
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 97
diff changeset
   353
/*****************************************************************************/
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 97
diff changeset
   354
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 97
diff changeset
   355
/**
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   356
   Allocates a process data datagram and appends it to the list.
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   357
   \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
   358
*/
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   359
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   360
int ec_domain_add_datagram(ec_domain_t *domain, /**< EtherCAT domain */
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   361
                           uint32_t offset, /**< logical offset */
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   362
                           size_t data_size /**< size of the datagram data */
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   363
                           )
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   364
{
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   365
    ec_datagram_t *datagram;
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   366
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   367
    if (!(datagram = kmalloc(sizeof(ec_datagram_t), GFP_KERNEL))) {
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   368
        EC_ERR("Failed to allocate domain datagram!\n");
144
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 138
diff changeset
   369
        return -1;
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 138
diff changeset
   370
    }
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 138
diff changeset
   371
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   372
    ec_datagram_init(datagram);
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   373
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   374
    if (ec_datagram_lrw(datagram, offset, data_size)) {
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   375
        kfree(datagram);
144
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 138
diff changeset
   376
        return -1;
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 138
diff changeset
   377
    }
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 138
diff changeset
   378
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   379
    list_add_tail(&datagram->list, &domain->datagrams);
144
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 138
diff changeset
   380
    return 0;
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 138
diff changeset
   381
}
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 138
diff changeset
   382
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 138
diff changeset
   383
/*****************************************************************************/
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 138
diff changeset
   384
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 138
diff changeset
   385
/**
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   386
   Creates a domain.
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   387
   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
   388
   corresponding FMMUs and sets the process data pointer of the registered
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   389
   process data.
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   390
   \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
   391
*/
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   392
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   393
int ec_domain_alloc(ec_domain_t *domain, /**< EtherCAT domain */
275
ba51285d4ef6 Variable-sized data fields, BK1120.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   394
                    uint32_t base_address /**< logical base address */
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   395
                    )
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   396
{
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   397
    ec_data_reg_t *data_reg;
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   398
    ec_slave_t *slave;
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   399
    ec_fmmu_t *fmmu;
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   400
    unsigned int i, j, datagram_count;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   401
    uint32_t pdo_off, pdo_off_datagram;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   402
    uint32_t datagram_offset;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   403
    size_t datagram_data_size, sync_size;
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   404
    ec_datagram_t *datagram;
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   405
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   406
    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
   407
275
ba51285d4ef6 Variable-sized data fields, BK1120.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   408
    // calculate size of process data and allocate memory
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   409
    domain->data_size = 0;
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   410
    datagram_offset = base_address;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   411
    datagram_data_size = 0;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   412
    datagram_count = 0;
182
8c0bc99229a9 Slaves stored in list, slaves in SysFS
Florian Pose <fp@igh-essen.com>
parents: 179
diff changeset
   413
    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
   414
        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
   415
            fmmu = &slave->fmmus[j];
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   416
            if (fmmu->domain == domain) {
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   417
                fmmu->logical_start_address = base_address + domain->data_size;
275
ba51285d4ef6 Variable-sized data fields, BK1120.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   418
                sync_size = ec_slave_calc_sync_size(slave, fmmu->sync);
ba51285d4ef6 Variable-sized data fields, BK1120.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   419
                domain->data_size += sync_size;
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   420
                if (datagram_data_size + sync_size > EC_MAX_DATA_SIZE) {
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   421
                    if (ec_domain_add_datagram(domain, datagram_offset,
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   422
                                               datagram_data_size)) return -1;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   423
                    datagram_offset += datagram_data_size;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   424
                    datagram_data_size = 0;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   425
                    datagram_count++;
144
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 138
diff changeset
   426
                }
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   427
                datagram_data_size += sync_size;
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   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
    }
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   431
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   432
    // allocate last datagram
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   433
    if (datagram_data_size) {
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   434
        if (ec_domain_add_datagram(domain, datagram_offset,
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   435
                                   datagram_data_size))
144
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 138
diff changeset
   436
            return -1;
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   437
        datagram_count++;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   438
    }
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   439
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   440
    if (!datagram_count) {
178
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
   441
        EC_WARN("Domain %i contains no data!\n", domain->index);
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   442
        ec_domain_clear_data_regs(domain);
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 97
diff changeset
   443
        return 0;
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 97
diff changeset
   444
    }
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 97
diff changeset
   445
275
ba51285d4ef6 Variable-sized data fields, BK1120.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
   446
    // set all process data pointers
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   447
    list_for_each_entry(data_reg, &domain->data_regs, list) {
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   448
        for (i = 0; i < data_reg->slave->fmmu_count; i++) {
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   449
            fmmu = &data_reg->slave->fmmus[i];
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   450
            if (fmmu->domain == domain && fmmu->sync == data_reg->sync) {
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   451
                pdo_off = fmmu->logical_start_address + data_reg->sync_offset;
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   452
                // search datagram
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   453
                list_for_each_entry(datagram, &domain->datagrams, list) {
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   454
                    pdo_off_datagram = pdo_off - datagram->address.logical;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   455
                    if (pdo_off >= datagram->address.logical &&
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   456
                        pdo_off_datagram < datagram->mem_size) {
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   457
                        *data_reg->data_ptr = datagram->data +
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   458
                            pdo_off_datagram;
144
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 138
diff changeset
   459
                    }
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 138
diff changeset
   460
                }
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   461
                if (!data_reg->data_ptr) {
144
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 138
diff changeset
   462
                    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
   463
                    return -1;
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 138
diff changeset
   464
                }
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 97
diff changeset
   465
                break;
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
1728
4cf9c3e9f0bd MERGE trunk -r564:568 -> branches/stable-1.1 (doc, master output, atomic flag)
Florian Pose <fp@igh-essen.com>
parents: 1724
diff changeset
   470
    EC_INFO("Domain %i - Allocated %i bytes in %i datagram%s.\n",
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   471
            domain->index, domain->data_size, datagram_count,
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   472
            datagram_count == 1 ? "" : "s");
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   473
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   474
    ec_domain_clear_data_regs(domain);
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   475
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   476
    return 0;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   477
}
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   478
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   479
/*****************************************************************************/
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   480
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   481
/**
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   482
   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
   483
   \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
   484
*/
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   485
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   486
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
   487
                                 struct attribute *attr, /**< attribute */
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   488
                                 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
   489
                                 )
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
   490
{
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
   491
    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
   492
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   493
    if (attr == &attr_image_size) {
178
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
   494
        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
   495
    }
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
   496
b84f69db8566 MERGE branches/sysfs -> trunk (whole SysFS implementation)
Florian Pose <fp@igh-essen.com>
parents: 166
diff changeset
   497
    return 0;
97
e6264685dd7b Link-Down-Verhalten verbessert.
Florian Pose <fp@igh-essen.com>
parents: 96
diff changeset
   498
}
e6264685dd7b Link-Down-Verhalten verbessert.
Florian Pose <fp@igh-essen.com>
parents: 96
diff changeset
   499
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   500
/******************************************************************************
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   501
 *  Realtime interface
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   502
 *****************************************************************************/
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   503
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   504
/**
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   505
   Registers a PDO in a domain.
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   506
   \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
   507
   \ingroup RealtimeInterface
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   508
*/
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   509
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   510
ec_slave_t *ecrt_domain_register_pdo(ec_domain_t *domain,
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   511
                                     /**< EtherCAT domain */
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   512
                                     const char *address,
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   513
                                     /**< ASCII address of the slave,
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   514
                                        see ecrt_master_get_slave() */
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   515
                                     uint32_t vendor_id,
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   516
                                     /**< vendor ID */
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   517
                                     uint32_t product_code,
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   518
                                     /**< product code */
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   519
                                     uint16_t pdo_index,
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   520
                                     /**< PDO index */
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   521
                                     uint8_t pdo_subindex,
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   522
                                     /**< PDO subindex */
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   523
                                     void **data_ptr
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   524
                                     /**< address of the process data
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   525
                                        pointer */
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   526
                                     )
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   527
{
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   528
    ec_slave_t *slave;
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   529
    ec_master_t *master;
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   530
    const ec_sii_pdo_t *pdo;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   531
    const ec_sii_pdo_entry_t *entry;
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   532
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   533
    master = domain->master;
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   534
1732
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   535
    // translate address and validate slave
138
7e743a61a991 SDO-Schnittstelle verbessert.
Florian Pose <fp@igh-essen.com>
parents: 112
diff changeset
   536
    if (!(slave = ecrt_master_get_slave(master, address))) return NULL;
1732
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   537
    if (ec_slave_validate(slave, vendor_id, product_code)) return NULL;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   538
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   539
    list_for_each_entry(pdo, &slave->sii_pdos, list) {
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   540
        list_for_each_entry(entry, &pdo->entries, list) {
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   541
            if (entry->index != pdo_index
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   542
                || entry->subindex != pdo_subindex) continue;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   543
1732
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   544
            if (ec_domain_reg_pdo_entry(domain, slave, pdo, entry, data_ptr)) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   545
                return NULL;
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   546
            }
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   547
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   548
            return slave;
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   549
        }
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   550
    }
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   551
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   552
    EC_ERR("Slave %i does not provide PDO 0x%04X:%i.\n",
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   553
           slave->ring_position, pdo_index, pdo_subindex);
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   554
    return NULL;
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   555
}
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   556
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   557
/*****************************************************************************/
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   558
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   559
/**
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   560
   Registeres a bunch of data fields.
1739
5fcbd29151d2 MERGE -r688:759 trunk -> branches/stable-1.2 (release 1.2, part one).
Florian Pose <fp@igh-essen.com>
parents: 1732
diff changeset
   561
   \attention The list has to be terminated with a NULL structure ({})!
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   562
   \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
   563
   \ingroup RealtimeInterface
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   564
*/
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   565
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   566
int ecrt_domain_register_pdo_list(ec_domain_t *domain,
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   567
                                  /**< EtherCAT domain */
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   568
                                  const ec_pdo_reg_t *pdos
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   569
                                  /**< array of PDO registrations */
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   570
                                  )
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   571
{
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   572
    const ec_pdo_reg_t *pdo;
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   573
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   574
    for (pdo = pdos; pdo->slave_address; pdo++)
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   575
        if (!ecrt_domain_register_pdo(domain, pdo->slave_address,
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   576
                                      pdo->vendor_id,
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   577
                                      pdo->product_code,
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   578
                                      pdo->pdo_index,
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   579
                                      pdo->pdo_subindex,
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   580
                                      pdo->data_ptr))
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 97
diff changeset
   581
            return -1;
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 97
diff changeset
   582
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 97
diff changeset
   583
    return 0;
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 97
diff changeset
   584
}
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 97
diff changeset
   585
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 97
diff changeset
   586
/*****************************************************************************/
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 97
diff changeset
   587
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 97
diff changeset
   588
/**
1732
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   589
   Registers a PDO range in a domain.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   590
   \return pointer to the slave on success, else NULL
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   591
   \ingroup RealtimeInterface
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   592
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   593
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   594
ec_slave_t *ecrt_domain_register_pdo_range(ec_domain_t *domain,
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   595
                                           /**< EtherCAT domain */
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   596
                                           const char *address,
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   597
                                           /**< ASCII address of the slave,
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   598
                                              see ecrt_master_get_slave() */
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   599
                                           uint32_t vendor_id,
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   600
                                           /**< vendor ID */
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   601
                                           uint32_t product_code,
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   602
                                           /**< product code */
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   603
                                           ec_direction_t direction,
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   604
                                           /**< data direction */
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   605
                                           uint16_t offset,
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   606
                                           /**< offset in slave's PDO range */
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   607
                                           uint16_t length,
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   608
                                           /**< length of this range */
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   609
                                           void **data_ptr
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   610
                                           /**< address of the process data
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   611
                                              pointer */
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   612
                                           )
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   613
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   614
    ec_slave_t *slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   615
    ec_master_t *master;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   616
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   617
    master = domain->master;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   618
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   619
    // translate address and validate slave
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   620
    if (!(slave = ecrt_master_get_slave(master, address))) return NULL;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   621
    if (ec_slave_validate(slave, vendor_id, product_code)) return NULL;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   622
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   623
    if (ec_domain_reg_pdo_range(domain, slave,
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   624
                                direction, offset, length, data_ptr)) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   625
        return NULL;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   626
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   627
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   628
    return slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   629
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   630
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   631
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   632
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   633
/**
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   634
   Processes received process data and requeues the domain datagram(s).
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   635
   \ingroup RealtimeInterface
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   636
*/
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   637
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   638
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
   639
{
144
fdc24bf62f80 Dynamischer Kommandospeicher, Domain-Kommandos als Liste.
Florian Pose <fp@igh-essen.com>
parents: 138
diff changeset
   640
    unsigned int working_counter_sum;
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   641
    ec_datagram_t *datagram;
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 97
diff changeset
   642
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 97
diff changeset
   643
    working_counter_sum = 0;
1724
07c82e520ddd MERGE trunk -r546:550 -> branches/stable-1.1 (Bugfix, Autotools, still w/o XML)
Florian Pose <fp@igh-essen.com>
parents: 1719
diff changeset
   644
    domain->state = 0;
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   645
    list_for_each_entry(datagram, &domain->datagrams, list) {
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   646
        if (datagram->state == EC_DATAGRAM_RECEIVED) {
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   647
            working_counter_sum += datagram->working_counter;
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 97
diff changeset
   648
        }
1724
07c82e520ddd MERGE trunk -r546:550 -> branches/stable-1.1 (Bugfix, Autotools, still w/o XML)
Florian Pose <fp@igh-essen.com>
parents: 1719
diff changeset
   649
        else {
07c82e520ddd MERGE trunk -r546:550 -> branches/stable-1.1 (Bugfix, Autotools, still w/o XML)
Florian Pose <fp@igh-essen.com>
parents: 1719
diff changeset
   650
            domain->state = -1;
07c82e520ddd MERGE trunk -r546:550 -> branches/stable-1.1 (Bugfix, Autotools, still w/o XML)
Florian Pose <fp@igh-essen.com>
parents: 1719
diff changeset
   651
        }
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 97
diff changeset
   652
    }
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   653
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   654
    if (working_counter_sum != domain->response_count) {
1716
9440f4ff25c7 MERGE trunk -r494:513 -> branches/stable-1.1 (SDO configuration, bugfixes, EoE frame rates)
Florian Pose <fp@igh-essen.com>
parents: 1715
diff changeset
   655
        domain->working_counter_changes++;
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   656
        domain->response_count = working_counter_sum;
1716
9440f4ff25c7 MERGE trunk -r494:513 -> branches/stable-1.1 (SDO configuration, bugfixes, EoE frame rates)
Florian Pose <fp@igh-essen.com>
parents: 1715
diff changeset
   657
    }
9440f4ff25c7 MERGE trunk -r494:513 -> branches/stable-1.1 (SDO configuration, bugfixes, EoE frame rates)
Florian Pose <fp@igh-essen.com>
parents: 1715
diff changeset
   658
9440f4ff25c7 MERGE trunk -r494:513 -> branches/stable-1.1 (SDO configuration, bugfixes, EoE frame rates)
Florian Pose <fp@igh-essen.com>
parents: 1715
diff changeset
   659
    if (domain->working_counter_changes &&
1719
42ed27ae6785 MERGE trunk -r516:527 -> branches/stable-1.1 (jiffies, bugfixes, pdo defines)
Florian Pose <fp@igh-essen.com>
parents: 1717
diff changeset
   660
        jiffies - domain->notify_jiffies > HZ) {
42ed27ae6785 MERGE trunk -r516:527 -> branches/stable-1.1 (jiffies, bugfixes, pdo defines)
Florian Pose <fp@igh-essen.com>
parents: 1717
diff changeset
   661
        domain->notify_jiffies = jiffies;
1716
9440f4ff25c7 MERGE trunk -r494:513 -> branches/stable-1.1 (SDO configuration, bugfixes, EoE frame rates)
Florian Pose <fp@igh-essen.com>
parents: 1715
diff changeset
   662
        if (domain->working_counter_changes == 1) {
9440f4ff25c7 MERGE trunk -r494:513 -> branches/stable-1.1 (SDO configuration, bugfixes, EoE frame rates)
Florian Pose <fp@igh-essen.com>
parents: 1715
diff changeset
   663
            EC_INFO("Domain %i working counter change: %i\n", domain->index,
9440f4ff25c7 MERGE trunk -r494:513 -> branches/stable-1.1 (SDO configuration, bugfixes, EoE frame rates)
Florian Pose <fp@igh-essen.com>
parents: 1715
diff changeset
   664
                    domain->response_count);
9440f4ff25c7 MERGE trunk -r494:513 -> branches/stable-1.1 (SDO configuration, bugfixes, EoE frame rates)
Florian Pose <fp@igh-essen.com>
parents: 1715
diff changeset
   665
        }
9440f4ff25c7 MERGE trunk -r494:513 -> branches/stable-1.1 (SDO configuration, bugfixes, EoE frame rates)
Florian Pose <fp@igh-essen.com>
parents: 1715
diff changeset
   666
        else {
9440f4ff25c7 MERGE trunk -r494:513 -> branches/stable-1.1 (SDO configuration, bugfixes, EoE frame rates)
Florian Pose <fp@igh-essen.com>
parents: 1715
diff changeset
   667
            EC_INFO("Domain %i: %u WC changes. Current response count: %i\n",
9440f4ff25c7 MERGE trunk -r494:513 -> branches/stable-1.1 (SDO configuration, bugfixes, EoE frame rates)
Florian Pose <fp@igh-essen.com>
parents: 1715
diff changeset
   668
                    domain->index, domain->working_counter_changes,
9440f4ff25c7 MERGE trunk -r494:513 -> branches/stable-1.1 (SDO configuration, bugfixes, EoE frame rates)
Florian Pose <fp@igh-essen.com>
parents: 1715
diff changeset
   669
                    domain->response_count);
9440f4ff25c7 MERGE trunk -r494:513 -> branches/stable-1.1 (SDO configuration, bugfixes, EoE frame rates)
Florian Pose <fp@igh-essen.com>
parents: 1715
diff changeset
   670
        }
9440f4ff25c7 MERGE trunk -r494:513 -> branches/stable-1.1 (SDO configuration, bugfixes, EoE frame rates)
Florian Pose <fp@igh-essen.com>
parents: 1715
diff changeset
   671
        domain->working_counter_changes = 0;
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   672
    }
1739
5fcbd29151d2 MERGE -r688:759 trunk -> branches/stable-1.2 (release 1.2, part one).
Florian Pose <fp@igh-essen.com>
parents: 1732
diff changeset
   673
}
5fcbd29151d2 MERGE -r688:759 trunk -> branches/stable-1.2 (release 1.2, part one).
Florian Pose <fp@igh-essen.com>
parents: 1732
diff changeset
   674
5fcbd29151d2 MERGE -r688:759 trunk -> branches/stable-1.2 (release 1.2, part one).
Florian Pose <fp@igh-essen.com>
parents: 1732
diff changeset
   675
/*****************************************************************************/
5fcbd29151d2 MERGE -r688:759 trunk -> branches/stable-1.2 (release 1.2, part one).
Florian Pose <fp@igh-essen.com>
parents: 1732
diff changeset
   676
5fcbd29151d2 MERGE -r688:759 trunk -> branches/stable-1.2 (release 1.2, part one).
Florian Pose <fp@igh-essen.com>
parents: 1732
diff changeset
   677
/**
5fcbd29151d2 MERGE -r688:759 trunk -> branches/stable-1.2 (release 1.2, part one).
Florian Pose <fp@igh-essen.com>
parents: 1732
diff changeset
   678
   Places all process data datagrams in the masters datagram queue.
5fcbd29151d2 MERGE -r688:759 trunk -> branches/stable-1.2 (release 1.2, part one).
Florian Pose <fp@igh-essen.com>
parents: 1732
diff changeset
   679
   \ingroup RealtimeInterface
5fcbd29151d2 MERGE -r688:759 trunk -> branches/stable-1.2 (release 1.2, part one).
Florian Pose <fp@igh-essen.com>
parents: 1732
diff changeset
   680
*/
5fcbd29151d2 MERGE -r688:759 trunk -> branches/stable-1.2 (release 1.2, part one).
Florian Pose <fp@igh-essen.com>
parents: 1732
diff changeset
   681
5fcbd29151d2 MERGE -r688:759 trunk -> branches/stable-1.2 (release 1.2, part one).
Florian Pose <fp@igh-essen.com>
parents: 1732
diff changeset
   682
void ecrt_domain_queue(ec_domain_t *domain /**< EtherCAT domain */)
5fcbd29151d2 MERGE -r688:759 trunk -> branches/stable-1.2 (release 1.2, part one).
Florian Pose <fp@igh-essen.com>
parents: 1732
diff changeset
   683
{
5fcbd29151d2 MERGE -r688:759 trunk -> branches/stable-1.2 (release 1.2, part one).
Florian Pose <fp@igh-essen.com>
parents: 1732
diff changeset
   684
    ec_datagram_t *datagram;
5fcbd29151d2 MERGE -r688:759 trunk -> branches/stable-1.2 (release 1.2, part one).
Florian Pose <fp@igh-essen.com>
parents: 1732
diff changeset
   685
5fcbd29151d2 MERGE -r688:759 trunk -> branches/stable-1.2 (release 1.2, part one).
Florian Pose <fp@igh-essen.com>
parents: 1732
diff changeset
   686
    list_for_each_entry(datagram, &domain->datagrams, list) {
5fcbd29151d2 MERGE -r688:759 trunk -> branches/stable-1.2 (release 1.2, part one).
Florian Pose <fp@igh-essen.com>
parents: 1732
diff changeset
   687
        ec_master_queue_datagram(domain->master, datagram);
5fcbd29151d2 MERGE -r688:759 trunk -> branches/stable-1.2 (release 1.2, part one).
Florian Pose <fp@igh-essen.com>
parents: 1732
diff changeset
   688
    }
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   689
}
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   690
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   691
/*****************************************************************************/
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 58
diff changeset
   692
105
fad6709a526f Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
   693
/**
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   694
   Returns the state of a domain.
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 275
diff changeset
   695
   \return 0 if all datagrams were received, else -1.
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   696
   \ingroup RealtimeInterface
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   697
*/
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   698
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   699
int ecrt_domain_state(const 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
   700
{
1724
07c82e520ddd MERGE trunk -r546:550 -> branches/stable-1.1 (Bugfix, Autotools, still w/o XML)
Florian Pose <fp@igh-essen.com>
parents: 1719
diff changeset
   701
    return domain->state;
105
fad6709a526f Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
   702
}
fad6709a526f Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
   703
fad6709a526f Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
   704
/*****************************************************************************/
fad6709a526f Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
   705
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   706
/** \cond */
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   707
1715
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   708
EXPORT_SYMBOL(ecrt_domain_register_pdo);
e675450f2174 MERGE trunk -r463:494 -> branches/stable-1.1 (Version 1.1)
Florian Pose <fp@igh-essen.com>
parents: 294
diff changeset
   709
EXPORT_SYMBOL(ecrt_domain_register_pdo_list);
1732
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents: 1728
diff changeset
   710
EXPORT_SYMBOL(ecrt_domain_register_pdo_range);
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 101
diff changeset
   711
EXPORT_SYMBOL(ecrt_domain_process);
1739
5fcbd29151d2 MERGE -r688:759 trunk -> branches/stable-1.2 (release 1.2, part one).
Florian Pose <fp@igh-essen.com>
parents: 1732
diff changeset
   712
EXPORT_SYMBOL(ecrt_domain_queue);
105
fad6709a526f Dom?nen-Status (ecrt_domain_state) hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
   713
EXPORT_SYMBOL(ecrt_domain_state);
42
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   714
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   715
/** \endcond */
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   716
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   717
/*****************************************************************************/