master/slave.h
author Florian Pose <fp@igh-essen.com>
Mon, 23 Jul 2012 12:23:42 +0200
changeset 2396 d46f2668a409
parent 2045 ff2a13a4603c
child 2589 2b9c78543663
permissions -rw-r--r--
Applied ethtool patch from Jun Yuan.
39
6965c23a6826 likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents: 5
diff changeset
     1
/******************************************************************************
0
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
 *
39
6965c23a6826 likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents: 5
diff changeset
     3
 *  $Id$
0
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     4
 *
1326
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
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
 *
1326
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
     9
 *  The IgH EtherCAT Master is free software; you can redistribute it and/or
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
    10
 *  modify it under the terms of the GNU General Public License version 2, as
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
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
 *
1326
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
    13
 *  The IgH EtherCAT Master is distributed in the hope that it will be useful,
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
    14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
    15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
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
 *
1326
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
    18
 *  You should have received a copy of the GNU General Public License along
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
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
 *
1363
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1338
diff changeset
    22
 *  ---
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1338
diff changeset
    23
 *
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1338
diff changeset
    24
 *  The license mentioned above concerns the source code only. Using the
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1338
diff changeset
    25
 *  EtherCAT technology and brand is only permitted in compliance with the
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1338
diff changeset
    26
 *  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: 238
diff changeset
    27
 *
39
6965c23a6826 likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents: 5
diff changeset
    28
 *****************************************************************************/
0
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
199
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
   \file
791
3b81d074735c Fixed typo.
Florian Pose <fp@igh-essen.com>
parents: 758
diff changeset
    32
   EtherCAT slave structure.
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    33
*/
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
/*****************************************************************************/
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
    36
883
4963e22a267a Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents: 872
diff changeset
    37
#ifndef __EC_SLAVE_H__
4963e22a267a Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents: 872
diff changeset
    38
#define __EC_SLAVE_H__
0
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    39
145
11a82e4fd31b Mailbox-Interface ausgelagert, erster EOE-Ansatz.
Florian Pose <fp@igh-essen.com>
parents: 144
diff changeset
    40
#include <linux/list.h>
182
8c0bc99229a9 Slaves stored in list, slaves in SysFS
Florian Pose <fp@igh-essen.com>
parents: 175
diff changeset
    41
#include <linux/kobject.h>
145
11a82e4fd31b Mailbox-Interface ausgelagert, erster EOE-Ansatz.
Florian Pose <fp@igh-essen.com>
parents: 144
diff changeset
    42
11a82e4fd31b Mailbox-Interface ausgelagert, erster EOE-Ansatz.
Florian Pose <fp@igh-essen.com>
parents: 144
diff changeset
    43
#include "globals.h"
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 291
diff changeset
    44
#include "datagram.h"
627
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents: 626
diff changeset
    45
#include "pdo.h"
628
e94a16bc52ce Layed out sync manager structures and methods into own files.
Florian Pose <fp@igh-essen.com>
parents: 627
diff changeset
    46
#include "sync.h"
847
92266462d411 Saparated ec_sdo_t, ec_sdo_entry_t and ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents: 836
diff changeset
    47
#include "sdo.h"
1583
017fa8fd9ac1 Each slave got its own SDO state machine (faster handling of external SDO requests)
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1465
diff changeset
    48
#include "fsm_slave.h"
2045
ff2a13a4603c Reduced frame size when sending to mailbox, uses 2 datagrams. Enabled with configure option --enable-mboxframesize
Martin Troxler <ch1010277@ch10pc446>
parents: 2037
diff changeset
    49
#include "mailbox.h"
0
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    50
39
6965c23a6826 likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents: 5
diff changeset
    51
/*****************************************************************************/
0
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    52
1921
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    53
/** Convenience macro for printing slave-specific information to syslog.
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    54
 *
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    55
 * This will print the message in \a fmt with a prefixed
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    56
 * "EtherCAT <INDEX>-<POSITION>: ", where INDEX is the master index and
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    57
 * POSITION is the slave's ring position.
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    58
 *
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    59
 * \param slave EtherCAT slave
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    60
 * \param fmt format string (like in printf())
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    61
 * \param args arguments (optional)
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    62
 */
2037
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
    63
#ifdef USE_TRACE_PRINTK
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
    64
#define EC_SLAVE_INFO(slave, fmt, args...) \
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
    65
    do { \
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
    66
        __trace_printk(_THIS_IP_,"EtherCAT %u-%u: " fmt, slave->master->index, \
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
    67
                slave->ring_position, ##args); \
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
    68
        printk(KERN_INFO "EtherCAT %u-%u: " fmt, slave->master->index, \
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
    69
                slave->ring_position, ##args);  \
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
    70
    } while (0)
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
    71
#else
1921
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    72
#define EC_SLAVE_INFO(slave, fmt, args...) \
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    73
    printk(KERN_INFO "EtherCAT %u-%u: " fmt, slave->master->index, \
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    74
            slave->ring_position, ##args)
2037
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
    75
#endif
1921
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    76
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    77
/** Convenience macro for printing slave-specific errors to syslog.
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    78
 *
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    79
 * This will print the message in \a fmt with a prefixed
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    80
 * "EtherCAT <INDEX>-<POSITION>: ", where INDEX is the master index and
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    81
 * POSITION is the slave's ring position.
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    82
 *
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    83
 * \param slave EtherCAT slave
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    84
 * \param fmt format string (like in printf())
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    85
 * \param args arguments (optional)
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    86
 */
2037
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
    87
#ifdef USE_TRACE_PRINTK
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
    88
#define EC_SLAVE_ERR(slave, fmt, args...) \
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
    89
    do { \
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
    90
        __trace_printk(_THIS_IP_,"EtherCAT ERROR %u-%u: " fmt, slave->master->index, \
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
    91
                slave->ring_position, ##args); \
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
    92
        printk(KERN_ERR "EtherCAT ERROR %u-%u: " fmt, slave->master->index, \
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
    93
                slave->ring_position, ##args);  \
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
    94
    } while (0)
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
    95
#else
1921
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    96
#define EC_SLAVE_ERR(slave, fmt, args...) \
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    97
    printk(KERN_ERR "EtherCAT ERROR %u-%u: " fmt, slave->master->index, \
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
    98
            slave->ring_position, ##args)
2037
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
    99
#endif
1921
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   100
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   101
/** Convenience macro for printing slave-specific warnings to syslog.
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   102
 *
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   103
 * This will print the message in \a fmt with a prefixed
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   104
 * "EtherCAT <INDEX>-<POSITION>: ", where INDEX is the master index and
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   105
 * POSITION is the slave's ring position.
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   106
 *
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   107
 * \param slave EtherCAT slave
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   108
 * \param fmt format string (like in printf())
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   109
 * \param args arguments (optional)
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   110
 */
2037
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
   111
#ifdef USE_TRACE_PRINTK
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
   112
#define EC_SLAVE_WARN(slave, fmt, args...) \
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
   113
    do { \
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
   114
        __trace_printk(_THIS_IP_,"EtherCAT WARNING %u-%u: " fmt, \
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
   115
                slave->master->index, slave->ring_position, ##args); \
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
   116
        printk(KERN_WARNING "EtherCAT WARNING %u-%u: " fmt, \
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
   117
                slave->master->index, slave->ring_position, ##args);    \
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
   118
    } while (0)
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
   119
#else
1921
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   120
#define EC_SLAVE_WARN(slave, fmt, args...) \
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   121
    printk(KERN_WARNING "EtherCAT WARNING %u-%u: " fmt, \
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   122
            slave->master->index, slave->ring_position, ##args)
2037
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
   123
#endif
1921
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   124
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   125
/** Convenience macro for printing slave-specific debug messages to syslog.
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   126
 *
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   127
 * This will print the message in \a fmt with a prefixed
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   128
 * "EtherCAT <INDEX>-<POSITION>: ", where INDEX is the master index and
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   129
 * POSITION is the slave's ring position.
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   130
 *
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   131
 * \param slave EtherCAT slave
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   132
 * \param fmt format string (like in printf())
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   133
 * \param args arguments (optional)
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   134
 */
2037
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
   135
#ifdef USE_TRACE_PRINTK
1921
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   136
#define EC_SLAVE_DBG(slave, level, fmt, args...) \
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   137
    do { \
2037
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
   138
        __trace_printk(_THIS_IP_,"EtherCAT DEBUG%u %u-%u: " fmt, \
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
   139
            level,slave->master->index, slave->ring_position, ##args); \
1921
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   140
        if (slave->master->debug_level >= level) { \
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   141
            printk(KERN_DEBUG "EtherCAT DEBUG %u-%u: " fmt, \
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   142
                    slave->master->index, slave->ring_position, ##args); \
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   143
        } \
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   144
    } while (0)
2037
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
   145
#else
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
   146
#define EC_SLAVE_DBG(slave, level, fmt, args...) \
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
   147
    do { \
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
   148
        if (slave->master->debug_level >= level) { \
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
   149
            printk(KERN_DEBUG "EtherCAT DEBUG %u-%u: " fmt, \
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
   150
                    slave->master->index, slave->ring_position, ##args); \
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
   151
        } \
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
   152
    } while (0)
ea0319750e13 Optionally compile with trace_printk support
Martin Troxler <ch1010277@ch10pc446>
parents: 1921
diff changeset
   153
#endif
1921
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   154
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   155
/*****************************************************************************/
d9cf40facbc4 Improved syslog macros.
Florian Pose <fp@igh-essen.com>
parents: 1909
diff changeset
   156
1425
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   157
/** Slave port.
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   158
 */
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   159
typedef struct {
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   160
    ec_slave_port_desc_t desc; /**< Port descriptors. */
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   161
    ec_slave_port_link_t link; /**< Port link status. */
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   162
    ec_slave_t *next_slave; /**< Connected slaves. */
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   163
    uint32_t receive_time; /**< Port receive times for delay
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   164
                                            measurement. */
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   165
    uint32_t delay_to_next_dc; /**< Delay to next slave with DC support behind
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   166
                                 this port [ns]. */
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   167
} ec_slave_port_t;
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   168
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   169
/*****************************************************************************/
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   170
834
0791aac03180 Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents: 831
diff changeset
   171
/** Slave information interface data.
0791aac03180 Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents: 831
diff changeset
   172
 */
0791aac03180 Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents: 831
diff changeset
   173
typedef struct {
0791aac03180 Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents: 831
diff changeset
   174
    // Non-category data 
0791aac03180 Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents: 831
diff changeset
   175
    uint16_t alias; /**< Configured station alias. */
0791aac03180 Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents: 831
diff changeset
   176
    uint32_t vendor_id; /**< Vendor ID. */
0791aac03180 Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents: 831
diff changeset
   177
    uint32_t product_code; /**< Vendor-specific product code. */
0791aac03180 Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents: 831
diff changeset
   178
    uint32_t revision_number; /**< Revision number. */
0791aac03180 Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents: 831
diff changeset
   179
    uint32_t serial_number; /**< Serial number. */
1337
0253c74d0940 merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   180
    uint16_t boot_rx_mailbox_offset; /**< Bootstrap receive mailbox address. */
0253c74d0940 merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   181
    uint16_t boot_rx_mailbox_size; /**< Bootstrap receive mailbox size. */
0253c74d0940 merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   182
    uint16_t boot_tx_mailbox_offset; /**< Bootstrap transmit mailbox address. */
0253c74d0940 merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   183
    uint16_t boot_tx_mailbox_size; /**< Bootstrap transmit mailbox size. */
0253c74d0940 merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   184
    uint16_t std_rx_mailbox_offset; /**< Standard receive mailbox address. */
0253c74d0940 merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   185
    uint16_t std_rx_mailbox_size; /**< Standard receive mailbox size. */
0253c74d0940 merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   186
    uint16_t std_tx_mailbox_offset; /**< Standard transmit mailbox address. */
0253c74d0940 merge -c1619 branches/1.4-foe: Implemented going to bootstrap state BOOT.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
   187
    uint16_t std_tx_mailbox_size; /**< Standard transmit mailbox size. */
834
0791aac03180 Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents: 831
diff changeset
   188
    uint16_t mailbox_protocols; /**< Supported mailbox protocols. */
0791aac03180 Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents: 831
diff changeset
   189
0791aac03180 Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents: 831
diff changeset
   190
    // Strings
872
d4e0380d63b3 Renamed EEPROM to SII.
Florian Pose <fp@igh-essen.com>
parents: 870
diff changeset
   191
    char **strings; /**< Strings in SII categories. */
1000
5746fdd1ca2e Store slaves in an array instead of a list.
Florian Pose <fp@igh-essen.com>
parents: 992
diff changeset
   192
    unsigned int string_count; /**< Number of SII strings. */
834
0791aac03180 Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents: 831
diff changeset
   193
0791aac03180 Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents: 831
diff changeset
   194
    // General
835
23fd8b510803 Evaluate CoE details from general category; moved current consumption
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   195
    unsigned int has_general; /**< General category present. */
1000
5746fdd1ca2e Store slaves in an array instead of a list.
Florian Pose <fp@igh-essen.com>
parents: 992
diff changeset
   196
    char *group; /**< Group name. */
5746fdd1ca2e Store slaves in an array instead of a list.
Florian Pose <fp@igh-essen.com>
parents: 992
diff changeset
   197
    char *image; /**< Image name. */
5746fdd1ca2e Store slaves in an array instead of a list.
Florian Pose <fp@igh-essen.com>
parents: 992
diff changeset
   198
    char *order; /**< Order number. */
5746fdd1ca2e Store slaves in an array instead of a list.
Florian Pose <fp@igh-essen.com>
parents: 992
diff changeset
   199
    char *name; /**< Slave name. */
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1000
diff changeset
   200
    uint8_t physical_layer[EC_MAX_PORTS]; /**< Port media. */
835
23fd8b510803 Evaluate CoE details from general category; moved current consumption
Florian Pose <fp@igh-essen.com>
parents: 834
diff changeset
   201
    ec_sii_coe_details_t coe_details; /**< CoE detail flags. */
836
860a5bacea6a Display notLRW flag.
Florian Pose <fp@igh-essen.com>
parents: 835
diff changeset
   202
    ec_sii_general_flags_t general_flags; /**< General flags. */
1000
5746fdd1ca2e Store slaves in an array instead of a list.
Florian Pose <fp@igh-essen.com>
parents: 992
diff changeset
   203
    int16_t current_on_ebus; /**< Power consumption in mA. */
834
0791aac03180 Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents: 831
diff changeset
   204
0791aac03180 Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents: 831
diff changeset
   205
    // SyncM
1000
5746fdd1ca2e Store slaves in an array instead of a list.
Florian Pose <fp@igh-essen.com>
parents: 992
diff changeset
   206
    ec_sync_t *syncs; /**< SYNC MANAGER categories. */
5746fdd1ca2e Store slaves in an array instead of a list.
Florian Pose <fp@igh-essen.com>
parents: 992
diff changeset
   207
    unsigned int sync_count; /**< Number of sync managers. */
834
0791aac03180 Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents: 831
diff changeset
   208
0791aac03180 Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents: 831
diff changeset
   209
    // [RT]XPDO
1000
5746fdd1ca2e Store slaves in an array instead of a list.
Florian Pose <fp@igh-essen.com>
parents: 992
diff changeset
   210
    struct list_head pdos; /**< SII [RT]XPDO categories. */
834
0791aac03180 Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents: 831
diff changeset
   211
} ec_sii_t;
0791aac03180 Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents: 831
diff changeset
   212
0791aac03180 Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents: 831
diff changeset
   213
/*****************************************************************************/
0791aac03180 Separated SII data from slave.
Florian Pose <fp@igh-essen.com>
parents: 831
diff changeset
   214
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 791
diff changeset
   215
/** EtherCAT slave.
635
d304ef4af542 Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents: 630
diff changeset
   216
 */
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 55
diff changeset
   217
struct ec_slave
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 55
diff changeset
   218
{
1000
5746fdd1ca2e Store slaves in an array instead of a list.
Florian Pose <fp@igh-essen.com>
parents: 992
diff changeset
   219
    ec_master_t *master; /**< Master owning the slave. */
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 190
diff changeset
   220
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 190
diff changeset
   221
    // addresses
1000
5746fdd1ca2e Store slaves in an array instead of a list.
Florian Pose <fp@igh-essen.com>
parents: 992
diff changeset
   222
    uint16_t ring_position; /**< Ring position. */
5746fdd1ca2e Store slaves in an array instead of a list.
Florian Pose <fp@igh-essen.com>
parents: 992
diff changeset
   223
    uint16_t station_address; /**< Configured station address. */
1909
ea3eb4c74c1b Introduced effective_alias variable to separate reg12 alias from SII alias.
Florian Pose <fp@igh-essen.com>
parents: 1831
diff changeset
   224
    uint16_t effective_alias; /**< Effective alias address. */
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 190
diff changeset
   225
1425
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   226
    ec_slave_port_t ports[EC_MAX_PORTS]; /**< Ports. */
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   227
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 791
diff changeset
   228
    // configuration
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 791
diff changeset
   229
    ec_slave_config_t *config; /**< Current configuration. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 791
diff changeset
   230
    ec_slave_state_t requested_state; /**< Requested application state. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 791
diff changeset
   231
    ec_slave_state_t current_state; /**< Current application state. */
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 791
diff changeset
   232
    unsigned int error_flag; /**< Stop processing after an error. */
908
386b908033be Replaced self_configured flag with force_config flag.
Florian Pose <fp@igh-essen.com>
parents: 906
diff changeset
   233
    unsigned int force_config; /**< Force (re-)configuration. */
1465
3099d78343ea Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 1426
diff changeset
   234
    uint16_t configured_rx_mailbox_offset; /**< Configured receive mailbox
3099d78343ea Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 1426
diff changeset
   235
                                             offset. */
3099d78343ea Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 1426
diff changeset
   236
    uint16_t configured_rx_mailbox_size; /**< Configured receive mailbox size.
3099d78343ea Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 1426
diff changeset
   237
                                          */
3099d78343ea Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 1426
diff changeset
   238
    uint16_t configured_tx_mailbox_offset; /**< Configured send mailbox
3099d78343ea Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 1426
diff changeset
   239
                                             offset. */
3099d78343ea Added documentation.
Florian Pose <fp@igh-essen.com>
parents: 1426
diff changeset
   240
    uint16_t configured_tx_mailbox_size; /**< Configured send mailbox size. */
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 791
diff changeset
   241
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 190
diff changeset
   242
    // base data
1000
5746fdd1ca2e Store slaves in an array instead of a list.
Florian Pose <fp@igh-essen.com>
parents: 992
diff changeset
   243
    uint8_t base_type; /**< Slave type. */
5746fdd1ca2e Store slaves in an array instead of a list.
Florian Pose <fp@igh-essen.com>
parents: 992
diff changeset
   244
    uint8_t base_revision; /**< Revision. */
5746fdd1ca2e Store slaves in an array instead of a list.
Florian Pose <fp@igh-essen.com>
parents: 992
diff changeset
   245
    uint16_t base_build; /**< Build number. */
1379
cbceb0e2f2a0 Reading more base information (incl. whether DC supported).
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
   246
    uint8_t base_fmmu_count; /**< Number of supported FMMUs. */
cbceb0e2f2a0 Reading more base information (incl. whether DC supported).
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
   247
    uint8_t base_sync_count; /**< Number of supported sync managers. */
cbceb0e2f2a0 Reading more base information (incl. whether DC supported).
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
   248
    uint8_t base_fmmu_bit_operation; /**< FMMU bit operation is supported. */
cbceb0e2f2a0 Reading more base information (incl. whether DC supported).
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
   249
    uint8_t base_dc_supported; /**< Distributed clocks are supported. */
cbceb0e2f2a0 Reading more base information (incl. whether DC supported).
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
   250
    ec_slave_dc_range_t base_dc_range; /**< DC range. */
1419
8fc38c37d86e Determine type of DC implementation (full or delay meas. only); update scan FSM graph.
Florian Pose <fp@igh-essen.com>
parents: 1379
diff changeset
   251
    uint8_t has_dc_system_time; /**< The slave supports the DC system time
8fc38c37d86e Determine type of DC implementation (full or delay meas. only); update scan FSM graph.
Florian Pose <fp@igh-essen.com>
parents: 1379
diff changeset
   252
                                  register. Otherwise it can only be used for
8fc38c37d86e Determine type of DC implementation (full or delay meas. only); update scan FSM graph.
Florian Pose <fp@igh-essen.com>
parents: 1379
diff changeset
   253
                                  delay measurement. */
1426
af45bba80d85 Transition->Transmission.
Florian Pose <fp@igh-essen.com>
parents: 1425
diff changeset
   254
    uint32_t transmission_delay; /**< DC system time transmission delay
af45bba80d85 Transition->Transmission.
Florian Pose <fp@igh-essen.com>
parents: 1425
diff changeset
   255
                                   (offset from reference clock). */
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 190
diff changeset
   256
872
d4e0380d63b3 Renamed EEPROM to SII.
Florian Pose <fp@igh-essen.com>
parents: 870
diff changeset
   257
    // SII
977
167ae3e76cc7 Moved sii to words.
Florian Pose <fp@igh-essen.com>
parents: 967
diff changeset
   258
    uint16_t *sii_words; /**< Complete SII image. */
167ae3e76cc7 Moved sii to words.
Florian Pose <fp@igh-essen.com>
parents: 967
diff changeset
   259
    size_t sii_nwords; /**< Size of the SII contents in words. */
325
7833cf70c4f2 VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents: 298
diff changeset
   260
1000
5746fdd1ca2e Store slaves in an array instead of a list.
Florian Pose <fp@igh-essen.com>
parents: 992
diff changeset
   261
    // Slave information interface
5746fdd1ca2e Store slaves in an array instead of a list.
Florian Pose <fp@igh-essen.com>
parents: 992
diff changeset
   262
    ec_sii_t sii; /**< Extracted SII data. */
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 190
diff changeset
   263
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
   264
    struct list_head sdo_dictionary; /**< SDO dictionary list */
1000
5746fdd1ca2e Store slaves in an array instead of a list.
Florian Pose <fp@igh-essen.com>
parents: 992
diff changeset
   265
    uint8_t sdo_dictionary_fetched; /**< Dictionary has been fetched. */
5746fdd1ca2e Store slaves in an array instead of a list.
Florian Pose <fp@igh-essen.com>
parents: 992
diff changeset
   266
    unsigned long jiffies_preop; /**< Time, the slave went to PREOP. */
1583
017fa8fd9ac1 Each slave got its own SDO state machine (faster handling of external SDO requests)
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1465
diff changeset
   267
1596
ea8d2b4ee742 Moved sdo request queue to slaves
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1583
diff changeset
   268
    struct list_head slave_sdo_requests; /**< SDO access requests. */
ea8d2b4ee742 Moved sdo request queue to slaves
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1583
diff changeset
   269
    wait_queue_head_t sdo_queue; /**< Wait queue for SDO access requests
ea8d2b4ee742 Moved sdo request queue to slaves
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1583
diff changeset
   270
                                   from user space. */
1597
491dea6f4fd7 Moved FOE request queue and fsm into slaves
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1596
diff changeset
   271
    struct list_head foe_requests; /**< FoE write requests. */
1831
1875b9fea0ba Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents: 1597
diff changeset
   272
    wait_queue_head_t foe_queue; /**< Wait queue for FoE requests from user
1875b9fea0ba Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents: 1597
diff changeset
   273
                                   space. */
1875b9fea0ba Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents: 1597
diff changeset
   274
    struct list_head soe_requests; /**< FoE write requests. */
1875b9fea0ba Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents: 1597
diff changeset
   275
    wait_queue_head_t soe_queue; /**< Wait queue for SoE requests from user
1875b9fea0ba Implemented reading Sercos-over-EtherCAT services. To be continued...
Florian Pose <fp@igh-essen.com>
parents: 1597
diff changeset
   276
                                   space. */
1583
017fa8fd9ac1 Each slave got its own SDO state machine (faster handling of external SDO requests)
Martin Troxler <martin.troxler@komaxgroup.com>
parents: 1465
diff changeset
   277
    ec_fsm_slave_t fsm; /**< Slave state machine. */
2045
ff2a13a4603c Reduced frame size when sending to mailbox, uses 2 datagrams. Enabled with configure option --enable-mboxframesize
Martin Troxler <ch1010277@ch10pc446>
parents: 2037
diff changeset
   278
    ec_datagram_t datagram; /** Datagram used for data transfers */
ff2a13a4603c Reduced frame size when sending to mailbox, uses 2 datagrams. Enabled with configure option --enable-mboxframesize
Martin Troxler <ch1010277@ch10pc446>
parents: 2037
diff changeset
   279
    ec_mailbox_t mbox; /**< Mailbox used for data transfers. */
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 55
diff changeset
   280
};
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 55
diff changeset
   281
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 55
diff changeset
   282
/*****************************************************************************/
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 55
diff changeset
   283
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 190
diff changeset
   284
// slave construction/destruction
992
50a44cbd30af Removed kobjects from sdo and slave.
Florian Pose <fp@igh-essen.com>
parents: 989
diff changeset
   285
void ec_slave_init(ec_slave_t *, ec_master_t *, uint16_t, uint16_t);
50a44cbd30af Removed kobjects from sdo and slave.
Florian Pose <fp@igh-essen.com>
parents: 989
diff changeset
   286
void ec_slave_clear(ec_slave_t *);
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 55
diff changeset
   287
870
fbd5924690ee Allow multiple sync manager categories.
Florian Pose <fp@igh-essen.com>
parents: 847
diff changeset
   288
void ec_slave_clear_sync_managers(ec_slave_t *);
fbd5924690ee Allow multiple sync manager categories.
Florian Pose <fp@igh-essen.com>
parents: 847
diff changeset
   289
446
8fede404c01f Persistent slave lists.
Florian Pose <fp@igh-essen.com>
parents: 423
diff changeset
   290
void ec_slave_request_state(ec_slave_t *, ec_slave_state_t);
610
29489a43ecee Introduced ec_slave_online_state_t, ec_slave_set_online_state(), renamed
Florian Pose <fp@igh-essen.com>
parents: 601
diff changeset
   291
void ec_slave_set_state(ec_slave_t *, ec_slave_state_t);
446
8fede404c01f Persistent slave lists.
Florian Pose <fp@igh-essen.com>
parents: 423
diff changeset
   292
325
7833cf70c4f2 VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents: 298
diff changeset
   293
// SII categories
742
03d2fe3d4a93 Improved checking of EEPROM data while reading.
Florian Pose <fp@igh-essen.com>
parents: 741
diff changeset
   294
int ec_slave_fetch_sii_strings(ec_slave_t *, const uint8_t *, size_t);
03d2fe3d4a93 Improved checking of EEPROM data while reading.
Florian Pose <fp@igh-essen.com>
parents: 741
diff changeset
   295
int ec_slave_fetch_sii_general(ec_slave_t *, const uint8_t *, size_t);
620
4f76acbf54a0 Renamed SII fetching functions (non-functional).
Florian Pose <fp@igh-essen.com>
parents: 619
diff changeset
   296
int ec_slave_fetch_sii_syncs(ec_slave_t *, const uint8_t *, size_t);
4f76acbf54a0 Renamed SII fetching functions (non-functional).
Florian Pose <fp@igh-essen.com>
parents: 619
diff changeset
   297
int ec_slave_fetch_sii_pdos(ec_slave_t *, const uint8_t *, size_t,
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 791
diff changeset
   298
        ec_direction_t);
238
b4960499098f Added finite state machine (FSM) processing.
Florian Pose <fp@igh-essen.com>
parents: 199
diff changeset
   299
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 190
diff changeset
   300
// misc.
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1000
diff changeset
   301
ec_sync_t *ec_slave_get_sync(ec_slave_t *, uint8_t); 
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 1000
diff changeset
   302
423
862ff892cf18 Better debugging output for SDO dictionaries.
Florian Pose <fp@igh-essen.com>
parents: 421
diff changeset
   303
void ec_slave_sdo_dict_info(const ec_slave_t *,
635
d304ef4af542 Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents: 630
diff changeset
   304
        unsigned int *, unsigned int *);
740
68d83b45dfa2 Added ec_slave_get_sdo() and ec_sdo_get_entry().
Florian Pose <fp@igh-essen.com>
parents: 643
diff changeset
   305
ec_sdo_t *ec_slave_get_sdo(ec_slave_t *, uint16_t);
967
93807963b906 Added ec_slave_get_sdo_const().
Florian Pose <fp@igh-essen.com>
parents: 964
diff changeset
   306
const ec_sdo_t *ec_slave_get_sdo_const(const ec_slave_t *, uint16_t);
964
957f21465052 Added ec_slave_get_sdo_by_pos_const() and ec_slave_sdo_count().
Florian Pose <fp@igh-essen.com>
parents: 928
diff changeset
   307
const ec_sdo_t *ec_slave_get_sdo_by_pos_const(const ec_slave_t *, uint16_t);
957f21465052 Added ec_slave_get_sdo_by_pos_const() and ec_slave_sdo_count().
Florian Pose <fp@igh-essen.com>
parents: 928
diff changeset
   308
uint16_t ec_slave_sdo_count(const ec_slave_t *);
799
068a58b96965 Pdo configuration.
Florian Pose <fp@igh-essen.com>
parents: 792
diff changeset
   309
const ec_pdo_t *ec_slave_find_pdo(const ec_slave_t *, uint16_t);
1186
ff481f097c97 Attach Pdo names from dictionary.
Florian Pose <fp@igh-essen.com>
parents: 1092
diff changeset
   310
void ec_slave_attach_pdo_names(ec_slave_t *);
423
862ff892cf18 Better debugging output for SDO dictionaries.
Florian Pose <fp@igh-essen.com>
parents: 421
diff changeset
   311
1425
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   312
void ec_slave_calc_port_delays(ec_slave_t *);
1426
af45bba80d85 Transition->Transmission.
Florian Pose <fp@igh-essen.com>
parents: 1425
diff changeset
   313
void ec_slave_calc_transmission_delays_rec(ec_slave_t *, uint32_t *);
1425
c1322a8793c0 Transition delay calculation. TBC...
Florian Pose <fp@igh-essen.com>
parents: 1421
diff changeset
   314
39
6965c23a6826 likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents: 5
diff changeset
   315
/*****************************************************************************/
0
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   316
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   317
#endif