master/domain.h
author Florian Pose <fp@igh-essen.com>
Wed, 13 Jan 2010 00:04:47 +0100
branchstable-1.4
changeset 1769 5c317e78a5ef
parent 1685 399ef727bf62
child 1363 11c0b2caa253
permissions -rw-r--r--
merge
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
 *
1685
399ef727bf62 Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 993
diff changeset
     5
 *  Copyright (C) 2006-2008  Florian Pose, Ingenieurgemeinschaft IgH
197
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 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
 *
1685
399ef727bf62 Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 993
diff changeset
     9
 *  The IgH EtherCAT Master is free software; you can redistribute it and/or
399ef727bf62 Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 993
diff changeset
    10
 *  modify it under the terms of the GNU General Public License version 2, as
399ef727bf62 Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 993
diff changeset
    11
 *  published by the Free Software Foundation.
197
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    12
 *
1685
399ef727bf62 Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 993
diff changeset
    13
 *  The IgH EtherCAT Master is distributed in the hope that it will be useful,
399ef727bf62 Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 993
diff changeset
    14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
399ef727bf62 Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 993
diff changeset
    15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
399ef727bf62 Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 993
diff changeset
    16
 *  Public License for more details.
197
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    17
 *
1685
399ef727bf62 Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 993
diff changeset
    18
 *  You should have received a copy of the GNU General Public License along
399ef727bf62 Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 993
diff changeset
    19
 *  with the IgH EtherCAT Master; if not, write to the Free Software
197
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    20
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    21
 *
1685
399ef727bf62 Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 993
diff changeset
    22
 *  Using the EtherCAT technology and brand is permitted in compliance with
399ef727bf62 Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 993
diff changeset
    23
 *  the industrial property and similar rights of Beckhoff Automation GmbH.
246
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 199
diff changeset
    24
 *
42
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    25
 *****************************************************************************/
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    26
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    27
/**
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    28
   \file
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    29
   EtherCAT domain structure.
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    30
*/
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    31
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    32
/*****************************************************************************/
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    33
883
4963e22a267a Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
    34
#ifndef __EC_DOMAIN_H__
4963e22a267a Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
    35
#define __EC_DOMAIN_H__
42
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    36
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 56
diff changeset
    37
#include <linux/list.h>
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 56
diff changeset
    38
54
7506e67dd122 Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents: 52
diff changeset
    39
#include "globals.h"
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    40
#include "datagram.h"
325
7833cf70c4f2 VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents: 293
diff changeset
    41
#include "master.h"
818
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 809
diff changeset
    42
#include "fmmu_config.h"
42
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    43
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    44
/*****************************************************************************/
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    45
993
8c32564252fd Removed kobject from domain.
Florian Pose <fp@igh-essen.com>
parents: 985
diff changeset
    46
/** EtherCAT domain.
8c32564252fd Removed kobject from domain.
Florian Pose <fp@igh-essen.com>
parents: 985
diff changeset
    47
 *
8c32564252fd Removed kobject from domain.
Florian Pose <fp@igh-essen.com>
parents: 985
diff changeset
    48
 * Handles the process data and the therefore needed datagrams of a certain
8c32564252fd Removed kobject from domain.
Florian Pose <fp@igh-essen.com>
parents: 985
diff changeset
    49
 * group of slaves.
8c32564252fd Removed kobject from domain.
Florian Pose <fp@igh-essen.com>
parents: 985
diff changeset
    50
 */
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 56
diff changeset
    51
struct ec_domain
42
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    52
{
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 495
diff changeset
    53
    struct list_head list; /**< List item. */
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 792
diff changeset
    54
    ec_master_t *master; /**< EtherCAT master owning the domain. */
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 495
diff changeset
    55
    unsigned int index; /**< Index (just a number). */
985
90bcaf9ce3d5 Fixed calculation of expected working counter.
Florian Pose <fp@igh-essen.com>
parents: 950
diff changeset
    56
90bcaf9ce3d5 Fixed calculation of expected working counter.
Florian Pose <fp@igh-essen.com>
parents: 950
diff changeset
    57
    struct list_head fmmu_configs; /**< FMMU configurations contained. */
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 495
diff changeset
    58
    size_t data_size; /**< Size of the process data. */
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 792
diff changeset
    59
    uint8_t *data; /**< Memory for the process data. */
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 792
diff changeset
    60
    ec_origin_t data_origin; /**< Origin of the \a data memory. */
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 792
diff changeset
    61
    uint32_t logical_base_address; /**< Logical offset address of the
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 792
diff changeset
    62
                                     process data. */
985
90bcaf9ce3d5 Fixed calculation of expected working counter.
Florian Pose <fp@igh-essen.com>
parents: 950
diff changeset
    63
    struct list_head datagrams; /**< Datagrams for process data exchange. */
90bcaf9ce3d5 Fixed calculation of expected working counter.
Florian Pose <fp@igh-essen.com>
parents: 950
diff changeset
    64
944
3da464db1784 Working counter as uint16_t.
Florian Pose <fp@igh-essen.com>
parents: 885
diff changeset
    65
    uint16_t working_counter; /**< Last working counter value. */
985
90bcaf9ce3d5 Fixed calculation of expected working counter.
Florian Pose <fp@igh-essen.com>
parents: 950
diff changeset
    66
    uint16_t expected_working_counter; /**< Expected working counter. */
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 495
diff changeset
    67
    unsigned int working_counter_changes; /**< Working counter changes
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 495
diff changeset
    68
                                             since last notification. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 495
diff changeset
    69
    unsigned long notify_jiffies; /**< Time of last notification. */
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 56
diff changeset
    70
};
42
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    71
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    72
/*****************************************************************************/
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    73
993
8c32564252fd Removed kobject from domain.
Florian Pose <fp@igh-essen.com>
parents: 985
diff changeset
    74
void ec_domain_init(ec_domain_t *, ec_master_t *, unsigned int);
8c32564252fd Removed kobject from domain.
Florian Pose <fp@igh-essen.com>
parents: 985
diff changeset
    75
void ec_domain_clear(ec_domain_t *);
446
8fede404c01f Persistent slave lists.
Florian Pose <fp@igh-essen.com>
parents: 404
diff changeset
    76
818
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 809
diff changeset
    77
void ec_domain_add_fmmu_config(ec_domain_t *, ec_fmmu_config_t *);
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 495
diff changeset
    78
int ec_domain_finish(ec_domain_t *, uint32_t);
42
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    79
950
8b00e63fff90 'ethercat domain' shows domain contents and process data.
Florian Pose <fp@igh-essen.com>
parents: 944
diff changeset
    80
unsigned int ec_domain_fmmu_count(const ec_domain_t *);
8b00e63fff90 'ethercat domain' shows domain contents and process data.
Florian Pose <fp@igh-essen.com>
parents: 944
diff changeset
    81
const ec_fmmu_config_t *ec_domain_find_fmmu(const ec_domain_t *, unsigned int);
8b00e63fff90 'ethercat domain' shows domain contents and process data.
Florian Pose <fp@igh-essen.com>
parents: 944
diff changeset
    82
42
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    83
/*****************************************************************************/
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    84
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    85
#endif