master/domain.h
author Florian Pose <fp@igh-essen.com>
Wed, 18 Jun 2008 11:16:30 +0000
changeset 1025 ae175095f09a
parent 993 8c32564252fd
child 1326 ef907b0b5125
permissions -rw-r--r--
Output attachment failure messages only when debugging.
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 structure.
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
883
4963e22a267a Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
    41
#ifndef __EC_DOMAIN_H__
4963e22a267a Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
    42
#define __EC_DOMAIN_H__
42
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    43
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 56
diff changeset
    44
#include <linux/list.h>
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 56
diff changeset
    45
54
7506e67dd122 Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents: 52
diff changeset
    46
#include "globals.h"
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 246
diff changeset
    47
#include "datagram.h"
325
7833cf70c4f2 VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents: 293
diff changeset
    48
#include "master.h"
818
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 809
diff changeset
    49
#include "fmmu_config.h"
42
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    50
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    51
/*****************************************************************************/
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    52
993
8c32564252fd Removed kobject from domain.
Florian Pose <fp@igh-essen.com>
parents: 985
diff changeset
    53
/** EtherCAT domain.
8c32564252fd Removed kobject from domain.
Florian Pose <fp@igh-essen.com>
parents: 985
diff changeset
    54
 *
8c32564252fd Removed kobject from domain.
Florian Pose <fp@igh-essen.com>
parents: 985
diff changeset
    55
 * 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
    56
 * group of slaves.
8c32564252fd Removed kobject from domain.
Florian Pose <fp@igh-essen.com>
parents: 985
diff changeset
    57
 */
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 56
diff changeset
    58
struct ec_domain
42
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    59
{
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 495
diff changeset
    60
    struct list_head list; /**< List item. */
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 792
diff changeset
    61
    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
    62
    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
    63
90bcaf9ce3d5 Fixed calculation of expected working counter.
Florian Pose <fp@igh-essen.com>
parents: 950
diff changeset
    64
    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
    65
    size_t data_size; /**< Size of the process data. */
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 792
diff changeset
    66
    uint8_t *data; /**< Memory for the process data. */
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 792
diff changeset
    67
    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
    68
    uint32_t logical_base_address; /**< Logical offset address of the
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 792
diff changeset
    69
                                     process data. */
985
90bcaf9ce3d5 Fixed calculation of expected working counter.
Florian Pose <fp@igh-essen.com>
parents: 950
diff changeset
    70
    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
    71
944
3da464db1784 Working counter as uint16_t.
Florian Pose <fp@igh-essen.com>
parents: 885
diff changeset
    72
    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
    73
    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
    74
    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
    75
                                             since last notification. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 495
diff changeset
    76
    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
    77
};
42
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    78
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    79
/*****************************************************************************/
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    80
993
8c32564252fd Removed kobject from domain.
Florian Pose <fp@igh-essen.com>
parents: 985
diff changeset
    81
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
    82
void ec_domain_clear(ec_domain_t *);
446
8fede404c01f Persistent slave lists.
Florian Pose <fp@igh-essen.com>
parents: 404
diff changeset
    83
818
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 809
diff changeset
    84
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
    85
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
    86
950
8b00e63fff90 'ethercat domain' shows domain contents and process data.
Florian Pose <fp@igh-essen.com>
parents: 944
diff changeset
    87
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
    88
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
    89
42
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    90
/*****************************************************************************/
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    91
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    92
#endif