master/globals.h
author Florian Pose <fp@igh-essen.com>
Wed, 03 Oct 2007 08:53:00 +0000
changeset 760 ff09257b2c0f
parent 758 8fa6f825eb7d
child 773 6c4646a03d68
permissions -rw-r--r--
Release 1.3.2.
39
6965c23a6826 likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents: 19
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: 19
diff changeset
     3
 *  $Id$
0
05c992bf5847 trunk, tags und branches
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: 196
diff changeset
     5
 *  Copyright (C) 2006  Florian Pose, Ingenieurgemeinschaft IgH
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 196
diff changeset
     6
 *
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 196
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: 196
diff changeset
     8
 *
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 196
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: 196
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: 228
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: 228
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: 196
diff changeset
    13
 *
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 196
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: 196
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: 196
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: 196
diff changeset
    17
 *  GNU General Public License for more details.
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 196
diff changeset
    18
 *
b9a6e2c22745 GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents: 196
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: 196
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: 196
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: 196
diff changeset
    22
 *
246
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 228
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: 228
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: 228
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: 228
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: 228
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: 228
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: 228
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: 228
diff changeset
    30
 *  Technology, IP and trade marks.
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 228
diff changeset
    31
 *
39
6965c23a6826 likely/unlikely, Fehlermeldungen in zyklischem Code begrenzt und Kommentare ge??ndert.
Florian Pose <fp@igh-essen.com>
parents: 19
diff changeset
    32
 *****************************************************************************/
0
05c992bf5847 trunk, tags und branches
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
   Global definitions and macros.
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
444
31223539fc00 Compiler flag -DSVNREV only for module.c to avoid unnecessary recompiling.
Florian Pose <fp@igh-essen.com>
parents: 427
diff changeset
    41
#ifndef _EC_MASTER_GLOBALS_
31223539fc00 Compiler flag -DSVNREV only for module.c to avoid unnecessary recompiling.
Florian Pose <fp@igh-essen.com>
parents: 427
diff changeset
    42
#define _EC_MASTER_GLOBALS_
0
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    43
152
9654f3cf588d Plugfest: Globale Debug-Funktionen f?r Frame-Daten.
Florian Pose <fp@igh-essen.com>
parents: 141
diff changeset
    44
#include <linux/types.h>
9654f3cf588d Plugfest: Globale Debug-Funktionen f?r Frame-Daten.
Florian Pose <fp@igh-essen.com>
parents: 141
diff changeset
    45
444
31223539fc00 Compiler flag -DSVNREV only for module.c to avoid unnecessary recompiling.
Florian Pose <fp@igh-essen.com>
parents: 427
diff changeset
    46
#include "../globals.h"
392
eaee3c8d6ae0 Debug interfaces not compiled by default.
Florian Pose <fp@igh-essen.com>
parents: 382
diff changeset
    47
196
f8a1e9f364a3 Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    48
/******************************************************************************
f8a1e9f364a3 Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    49
 *  EtherCAT master
f8a1e9f364a3 Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    50
 *****************************************************************************/
41
42c66194c0c8 Schoenheitskorrekturen.
Florian Pose <fp@igh-essen.com>
parents: 39
diff changeset
    51
228
ec516cfa207e Added EC_EOE_FREQUENCY
Florian Pose <fp@igh-essen.com>
parents: 214
diff changeset
    52
/** clock frequency for the EoE state machines */
ec516cfa207e Added EC_EOE_FREQUENCY
Florian Pose <fp@igh-essen.com>
parents: 214
diff changeset
    53
#define EC_EOE_FREQUENCY 1000
ec516cfa207e Added EC_EOE_FREQUENCY
Florian Pose <fp@igh-essen.com>
parents: 214
diff changeset
    54
325
7833cf70c4f2 VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents: 293
diff changeset
    55
/** datagram timeout in microseconds */
7833cf70c4f2 VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents: 293
diff changeset
    56
#define EC_IO_TIMEOUT 500
7833cf70c4f2 VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents: 293
diff changeset
    57
505
bc443ca0077f State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents: 453
diff changeset
    58
/** number of state machine retries on datagram timeout */
bc443ca0077f State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents: 453
diff changeset
    59
#define EC_FSM_RETRIES 3
bc443ca0077f State machines re-send datagrams on timeout.
Florian Pose <fp@igh-essen.com>
parents: 453
diff changeset
    60
427
f70c7c6db7f4 Added EC_WAIT_SDO_DICT define.
Florian Pose <fp@igh-essen.com>
parents: 403
diff changeset
    61
/** Seconds to wait before fetching SDO dictionary
f70c7c6db7f4 Added EC_WAIT_SDO_DICT define.
Florian Pose <fp@igh-essen.com>
parents: 403
diff changeset
    62
    after slave entered PREOP state. */
f70c7c6db7f4 Added EC_WAIT_SDO_DICT define.
Florian Pose <fp@igh-essen.com>
parents: 403
diff changeset
    63
#define EC_WAIT_SDO_DICT 3
f70c7c6db7f4 Added EC_WAIT_SDO_DICT define.
Florian Pose <fp@igh-essen.com>
parents: 403
diff changeset
    64
403
7bb931deccd9 Added EC_SLAVE_STATE_ACK_ERR to ec_state_string(); added EC_STATE_STRING_SIZE
Florian Pose <fp@igh-essen.com>
parents: 392
diff changeset
    65
/** minimum size of a buffer used with ec_state_string() */
453
2ecaa53c6291 Changed output of ec_state_string() for error flag to "+ ERROR".
Florian Pose <fp@igh-essen.com>
parents: 444
diff changeset
    66
#define EC_STATE_STRING_SIZE 32
403
7bb931deccd9 Added EC_SLAVE_STATE_ACK_ERR to ec_state_string(); added EC_STATE_STRING_SIZE
Florian Pose <fp@igh-essen.com>
parents: 392
diff changeset
    67
696
24fac09b5b26 Limited EEPROM reading; added EC_FIRST_EEPROM_CATEGORY_HEADER define.
Florian Pose <fp@igh-essen.com>
parents: 649
diff changeset
    68
/** maximum EEPROM size in words, to avoid infinite reading. */
24fac09b5b26 Limited EEPROM reading; added EC_FIRST_EEPROM_CATEGORY_HEADER define.
Florian Pose <fp@igh-essen.com>
parents: 649
diff changeset
    69
#define EC_MAX_EEPROM_SIZE 512
24fac09b5b26 Limited EEPROM reading; added EC_FIRST_EEPROM_CATEGORY_HEADER define.
Florian Pose <fp@igh-essen.com>
parents: 649
diff changeset
    70
196
f8a1e9f364a3 Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    71
/******************************************************************************
f8a1e9f364a3 Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    72
 *  EtherCAT protocol
f8a1e9f364a3 Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    73
 *****************************************************************************/
f8a1e9f364a3 Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    74
f8a1e9f364a3 Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    75
/** size of an EtherCAT frame header */
f8a1e9f364a3 Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    76
#define EC_FRAME_HEADER_SIZE 2
f8a1e9f364a3 Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    77
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 259
diff changeset
    78
/** size of an EtherCAT datagram header */
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 259
diff changeset
    79
#define EC_DATAGRAM_HEADER_SIZE 10
196
f8a1e9f364a3 Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    80
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 259
diff changeset
    81
/** size of an EtherCAT datagram footer */
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 259
diff changeset
    82
#define EC_DATAGRAM_FOOTER_SIZE 2
196
f8a1e9f364a3 Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    83
708
90bdb315f560 Fixed EtherCAT addressing problem on big-endian systems. The slaves
Florian Pose <fp@igh-essen.com>
parents: 696
diff changeset
    84
/** size of the EtherCAT address field */
90bdb315f560 Fixed EtherCAT addressing problem on big-endian systems. The slaves
Florian Pose <fp@igh-essen.com>
parents: 696
diff changeset
    85
#define EC_ADDR_LEN 4
90bdb315f560 Fixed EtherCAT addressing problem on big-endian systems. The slaves
Florian Pose <fp@igh-essen.com>
parents: 696
diff changeset
    86
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 259
diff changeset
    87
/** resulting maximum data size of a single datagram in a frame */
211
c684b6b7adaf Using kernel Ethernet constants.
Florian Pose <fp@igh-essen.com>
parents: 199
diff changeset
    88
#define EC_MAX_DATA_SIZE (ETH_DATA_LEN - EC_FRAME_HEADER_SIZE \
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 259
diff changeset
    89
                          - EC_DATAGRAM_HEADER_SIZE - EC_DATAGRAM_FOOTER_SIZE)
0
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    90
696
24fac09b5b26 Limited EEPROM reading; added EC_FIRST_EEPROM_CATEGORY_HEADER define.
Florian Pose <fp@igh-essen.com>
parents: 649
diff changeset
    91
/** word offset of first EEPROM category. */
24fac09b5b26 Limited EEPROM reading; added EC_FIRST_EEPROM_CATEGORY_HEADER define.
Florian Pose <fp@igh-essen.com>
parents: 649
diff changeset
    92
#define EC_FIRST_EEPROM_CATEGORY_OFFSET 0x40
24fac09b5b26 Limited EEPROM reading; added EC_FIRST_EEPROM_CATEGORY_HEADER define.
Florian Pose <fp@igh-essen.com>
parents: 649
diff changeset
    93
152
9654f3cf588d Plugfest: Globale Debug-Funktionen f?r Frame-Daten.
Florian Pose <fp@igh-essen.com>
parents: 141
diff changeset
    94
/*****************************************************************************/
9654f3cf588d Plugfest: Globale Debug-Funktionen f?r Frame-Daten.
Florian Pose <fp@igh-essen.com>
parents: 141
diff changeset
    95
259
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
    96
/**
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
    97
   Convenience macro for printing EtherCAT-specific information to syslog.
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
    98
   This will print the message in \a fmt with a prefixed "EtherCAT: ".
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
    99
   \param fmt format string (like in printf())
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   100
   \param args arguments (optional)
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   101
*/
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   102
84
b4ae98855cea printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents: 73
diff changeset
   103
#define EC_INFO(fmt, args...) \
b4ae98855cea printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents: 73
diff changeset
   104
    printk(KERN_INFO "EtherCAT: " fmt, ##args)
259
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   105
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   106
/**
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   107
   Convenience macro for printing EtherCAT-specific errors to syslog.
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   108
   This will print the message in \a fmt with a prefixed "EtherCAT ERROR: ".
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   109
   \param fmt format string (like in printf())
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   110
   \param args arguments (optional)
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   111
*/
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   112
84
b4ae98855cea printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents: 73
diff changeset
   113
#define EC_ERR(fmt, args...) \
b4ae98855cea printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents: 73
diff changeset
   114
    printk(KERN_ERR "EtherCAT ERROR: " fmt, ##args)
259
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   115
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   116
/**
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   117
   Convenience macro for printing EtherCAT-specific warnings to syslog.
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   118
   This will print the message in \a fmt with a prefixed "EtherCAT WARNING: ".
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   119
   \param fmt format string (like in printf())
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   120
   \param args arguments (optional)
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   121
*/
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   122
84
b4ae98855cea printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents: 73
diff changeset
   123
#define EC_WARN(fmt, args...) \
b4ae98855cea printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents: 73
diff changeset
   124
    printk(KERN_WARNING "EtherCAT WARNING: " fmt, ##args)
259
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   125
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   126
/**
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   127
   Convenience macro for printing EtherCAT debug messages to syslog.
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   128
   This will print the message in \a fmt with a prefixed "EtherCAT DEBUG: ".
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   129
   \param fmt format string (like in printf())
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   130
   \param args arguments (optional)
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   131
*/
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   132
84
b4ae98855cea printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents: 73
diff changeset
   133
#define EC_DBG(fmt, args...) \
b4ae98855cea printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents: 73
diff changeset
   134
    printk(KERN_DEBUG "EtherCAT DEBUG: " fmt, ##args)
b4ae98855cea printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents: 73
diff changeset
   135
259
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   136
/**
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   137
   Convenience macro for defining read-only SysFS attributes.
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   138
   This results in creating a static variable called attr_\a NAME. The SysFS
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   139
   file will be world-readable.
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   140
   \param NAME name of the attribute to create.
199
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   141
*/
04ecf40fc2e9 Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents: 197
diff changeset
   142
184
2fc86cec12df Macro for SysFS attribute definition
Florian Pose <fp@igh-essen.com>
parents: 164
diff changeset
   143
#define EC_SYSFS_READ_ATTR(NAME) \
2fc86cec12df Macro for SysFS attribute definition
Florian Pose <fp@igh-essen.com>
parents: 164
diff changeset
   144
    static struct attribute attr_##NAME = { \
2fc86cec12df Macro for SysFS attribute definition
Florian Pose <fp@igh-essen.com>
parents: 164
diff changeset
   145
        .name = EC_STR(NAME), .owner = THIS_MODULE, .mode = S_IRUGO \
2fc86cec12df Macro for SysFS attribute definition
Florian Pose <fp@igh-essen.com>
parents: 164
diff changeset
   146
    }
2fc86cec12df Macro for SysFS attribute definition
Florian Pose <fp@igh-essen.com>
parents: 164
diff changeset
   147
259
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   148
/**
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   149
   Convenience macro for defining read-write SysFS attributes.
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   150
   This results in creating a static variable called attr_\a NAME. The SysFS
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   151
   file will be word-readable plus owner-writable.
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   152
   \param NAME name of the attribute to create.
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   153
*/
87b20532872b Added some documentation.
Florian Pose <fp@igh-essen.com>
parents: 256
diff changeset
   154
256
dc71aee17f8a SysFS write access for slave state.
Florian Pose <fp@igh-essen.com>
parents: 251
diff changeset
   155
#define EC_SYSFS_READ_WRITE_ATTR(NAME) \
dc71aee17f8a SysFS write access for slave state.
Florian Pose <fp@igh-essen.com>
parents: 251
diff changeset
   156
    static struct attribute attr_##NAME = { \
dc71aee17f8a SysFS write access for slave state.
Florian Pose <fp@igh-essen.com>
parents: 251
diff changeset
   157
        .name = EC_STR(NAME), .owner = THIS_MODULE, .mode = S_IRUGO | S_IWUSR \
dc71aee17f8a SysFS write access for slave state.
Florian Pose <fp@igh-essen.com>
parents: 251
diff changeset
   158
    }
dc71aee17f8a SysFS write access for slave state.
Florian Pose <fp@igh-essen.com>
parents: 251
diff changeset
   159
41
42c66194c0c8 Schoenheitskorrekturen.
Florian Pose <fp@igh-essen.com>
parents: 39
diff changeset
   160
/*****************************************************************************/
42c66194c0c8 Schoenheitskorrekturen.
Florian Pose <fp@igh-essen.com>
parents: 39
diff changeset
   161
444
31223539fc00 Compiler flag -DSVNREV only for module.c to avoid unnecessary recompiling.
Florian Pose <fp@igh-essen.com>
parents: 427
diff changeset
   162
extern char *ec_master_version_str;
31223539fc00 Compiler flag -DSVNREV only for module.c to avoid unnecessary recompiling.
Florian Pose <fp@igh-essen.com>
parents: 427
diff changeset
   163
31223539fc00 Compiler flag -DSVNREV only for module.c to avoid unnecessary recompiling.
Florian Pose <fp@igh-essen.com>
parents: 427
diff changeset
   164
/*****************************************************************************/
31223539fc00 Compiler flag -DSVNREV only for module.c to avoid unnecessary recompiling.
Florian Pose <fp@igh-essen.com>
parents: 427
diff changeset
   165
325
7833cf70c4f2 VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents: 293
diff changeset
   166
void ec_print_data(const uint8_t *, size_t);
7833cf70c4f2 VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents: 293
diff changeset
   167
void ec_print_data_diff(const uint8_t *, const uint8_t *, size_t);
7833cf70c4f2 VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents: 293
diff changeset
   168
size_t ec_state_string(uint8_t, char *);
639
aa23c48dca2d Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents: 630
diff changeset
   169
ssize_t ec_mac_print(const uint8_t *, char *);
aa23c48dca2d Allow only MAC addresses as device identifiers; replaced master list by
Florian Pose <fp@igh-essen.com>
parents: 630
diff changeset
   170
int ec_mac_is_zero(const uint8_t *);
152
9654f3cf588d Plugfest: Globale Debug-Funktionen f?r Frame-Daten.
Florian Pose <fp@igh-essen.com>
parents: 141
diff changeset
   171
9654f3cf588d Plugfest: Globale Debug-Funktionen f?r Frame-Daten.
Florian Pose <fp@igh-essen.com>
parents: 141
diff changeset
   172
/*****************************************************************************/
9654f3cf588d Plugfest: Globale Debug-Funktionen f?r Frame-Daten.
Florian Pose <fp@igh-essen.com>
parents: 141
diff changeset
   173
164
ed85368b2b2e AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents: 152
diff changeset
   174
/**
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   175
   Code - Message pair.
293
14aeb79aa992 Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents: 259
diff changeset
   176
   Some EtherCAT datagrams support reading a status code to display a certain
164
ed85368b2b2e AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents: 152
diff changeset
   177
   message. This type allows to map a code to a message string.
ed85368b2b2e AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents: 152
diff changeset
   178
*/
ed85368b2b2e AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents: 152
diff changeset
   179
ed85368b2b2e AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents: 152
diff changeset
   180
typedef struct
ed85368b2b2e AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents: 152
diff changeset
   181
{
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   182
    uint32_t code; /**< code */
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   183
    const char *message; /**< message belonging to \a code */
164
ed85368b2b2e AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents: 152
diff changeset
   184
}
ed85368b2b2e AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents: 152
diff changeset
   185
ec_code_msg_t;
ed85368b2b2e AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents: 152
diff changeset
   186
ed85368b2b2e AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents: 152
diff changeset
   187
/*****************************************************************************/
ed85368b2b2e AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents: 152
diff changeset
   188
645
473ec2246ec1 Renamed ec_eeprom_request_state_t enum to ec_request_state_t and made it
Florian Pose <fp@igh-essen.com>
parents: 639
diff changeset
   189
/**
473ec2246ec1 Renamed ec_eeprom_request_state_t enum to ec_request_state_t and made it
Florian Pose <fp@igh-essen.com>
parents: 639
diff changeset
   190
 * Master request state.
473ec2246ec1 Renamed ec_eeprom_request_state_t enum to ec_request_state_t and made it
Florian Pose <fp@igh-essen.com>
parents: 639
diff changeset
   191
 */
473ec2246ec1 Renamed ec_eeprom_request_state_t enum to ec_request_state_t and made it
Florian Pose <fp@igh-essen.com>
parents: 639
diff changeset
   192
473ec2246ec1 Renamed ec_eeprom_request_state_t enum to ec_request_state_t and made it
Florian Pose <fp@igh-essen.com>
parents: 639
diff changeset
   193
typedef enum
473ec2246ec1 Renamed ec_eeprom_request_state_t enum to ec_request_state_t and made it
Florian Pose <fp@igh-essen.com>
parents: 639
diff changeset
   194
{
649
a4d3fffdaed7 Renamed names of enum type ec_request_state_t.
Florian Pose <fp@igh-essen.com>
parents: 645
diff changeset
   195
    EC_REQUEST_QUEUED,
a4d3fffdaed7 Renamed names of enum type ec_request_state_t.
Florian Pose <fp@igh-essen.com>
parents: 645
diff changeset
   196
    EC_REQUEST_IN_PROGRESS,
a4d3fffdaed7 Renamed names of enum type ec_request_state_t.
Florian Pose <fp@igh-essen.com>
parents: 645
diff changeset
   197
    EC_REQUEST_COMPLETE,
a4d3fffdaed7 Renamed names of enum type ec_request_state_t.
Florian Pose <fp@igh-essen.com>
parents: 645
diff changeset
   198
    EC_REQUEST_FAILURE
645
473ec2246ec1 Renamed ec_eeprom_request_state_t enum to ec_request_state_t and made it
Florian Pose <fp@igh-essen.com>
parents: 639
diff changeset
   199
}
473ec2246ec1 Renamed ec_eeprom_request_state_t enum to ec_request_state_t and made it
Florian Pose <fp@igh-essen.com>
parents: 639
diff changeset
   200
ec_request_state_t;
473ec2246ec1 Renamed ec_eeprom_request_state_t enum to ec_request_state_t and made it
Florian Pose <fp@igh-essen.com>
parents: 639
diff changeset
   201
473ec2246ec1 Renamed ec_eeprom_request_state_t enum to ec_request_state_t and made it
Florian Pose <fp@igh-essen.com>
parents: 639
diff changeset
   202
/*****************************************************************************/
473ec2246ec1 Renamed ec_eeprom_request_state_t enum to ec_request_state_t and made it
Florian Pose <fp@igh-essen.com>
parents: 639
diff changeset
   203
758
8fa6f825eb7d Updated Doxygen documentation.
Florian Pose <fp@igh-essen.com>
parents: 740
diff changeset
   204
typedef struct ec_sdo ec_sdo_t; /**< \see ec_sdo */
740
68d83b45dfa2 Added ec_slave_get_sdo() and ec_sdo_get_entry().
Florian Pose <fp@igh-essen.com>
parents: 708
diff changeset
   205
68d83b45dfa2 Added ec_slave_get_sdo() and ec_sdo_get_entry().
Florian Pose <fp@igh-essen.com>
parents: 708
diff changeset
   206
/*****************************************************************************/
68d83b45dfa2 Added ec_slave_get_sdo() and ec_sdo_get_entry().
Florian Pose <fp@igh-essen.com>
parents: 708
diff changeset
   207
0
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   208
#endif