master/globals.h
author Florian Pose <fp@igh-essen.com>
Mon, 26 Jun 2006 15:04:06 +0000
branchstable-1.0
changeset 1621 4bbe090553f7
parent 1619 0d4119024f55
child 1624 9dc190591c0f
permissions -rw-r--r--
MERGE trunk -r428:447 -> branches/stable-1.0 (Complete EEPROM data, unloading buxfix, variable data, bridging)
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
 *
1618
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
     5
 *  Copyright (C) 2006  Florian Pose, Ingenieurgemeinschaft IgH
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
     6
 *
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
     7
 *  This file is part of the IgH EtherCAT Master.
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
     8
 *
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
     9
 *  The IgH EtherCAT Master is free software; you can redistribute it
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
    10
 *  and/or modify it under the terms of the GNU General Public License
1619
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
    11
 *  as published by the Free Software Foundation; either version 2 of the
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
    12
 *  License, or (at your option) any later version.
1618
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
    13
 *
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
    14
 *  The IgH EtherCAT Master is distributed in the hope that it will be
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
    15
 *  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
    16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
    17
 *  GNU General Public License for more details.
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
    18
 *
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
    19
 *  You should have received a copy of the GNU General Public License
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
    20
 *  along with the IgH EtherCAT Master; if not, write to the Free Software
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
    21
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
    22
 *
1619
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
    23
 *  The right to use EtherCAT Technology is granted and comes free of
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
    24
 *  charge under condition of compatibility of product made by
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
    25
 *  Licensee. People intending to distribute/sell products based on the
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
    26
 *  code, have to sign an agreement to guarantee that products using
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
    27
 *  software based on IgH EtherCAT master stay compatible with the actual
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
    28
 *  EtherCAT specification (which are released themselves as an open
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
    29
 *  standard) as the (only) precondition to have the right to use EtherCAT
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
    30
 *  Technology, IP and trade marks.
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
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
1618
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
    34
/**
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
    35
   \file
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
    36
   Global definitions and macros.
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
    37
*/
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
    38
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
    39
/*****************************************************************************/
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
    40
0
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    41
#ifndef _EC_GLOBALS_
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    42
#define _EC_GLOBALS_
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
1617
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    46
/******************************************************************************
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    47
 *  EtherCAT master
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    48
 *****************************************************************************/
41
42c66194c0c8 Schoenheitskorrekturen.
Florian Pose <fp@igh-essen.com>
parents: 39
diff changeset
    49
1618
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
    50
/** master main version */
1617
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    51
#define EC_MASTER_VERSION_MAIN  1
1618
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
    52
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
    53
/** master sub version (after the dot) */
1617
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    54
#define EC_MASTER_VERSION_SUB   0
1618
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
    55
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
    56
/** master extra version (just a string) */
1617
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    57
#define EC_MASTER_VERSION_EXTRA "stable"
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    58
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    59
/** maximum number of FMMUs per slave */
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    60
#define EC_MAX_FMMUS 16
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    61
1619
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
    62
/** size of the EoE tx queue */
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
    63
#define EC_EOE_TX_QUEUE_SIZE 100
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
    64
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
    65
/** clock frequency for the EoE state machines */
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
    66
#define EC_EOE_FREQUENCY 1000
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
    67
1617
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    68
/******************************************************************************
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    69
 *  EtherCAT protocol
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    70
 *****************************************************************************/
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    71
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    72
/** size of an EtherCAT frame header */
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    73
#define EC_FRAME_HEADER_SIZE 2
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    74
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    75
/** size of an EtherCAT command header */
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    76
#define EC_COMMAND_HEADER_SIZE 10
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    77
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    78
/** size of an EtherCAT command footer */
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    79
#define EC_COMMAND_FOOTER_SIZE 2
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    80
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    81
/** size of a sync manager configuration page */
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    82
#define EC_SYNC_SIZE 8
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    83
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    84
/** size of an FMMU configuration page */
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    85
#define EC_FMMU_SIZE 16
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    86
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    87
/** resulting maximum data size of a single command in a frame */
1619
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
    88
#define EC_MAX_DATA_SIZE (ETH_DATA_LEN - EC_FRAME_HEADER_SIZE \
1617
9f83a343ae75 MERGE trunk -r354:355 -> branches/stable-1.0 (version numbers)
Florian Pose <fp@igh-essen.com>
parents: 195
diff changeset
    89
                          - EC_COMMAND_HEADER_SIZE - EC_COMMAND_FOOTER_SIZE)
0
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    90
152
9654f3cf588d Plugfest: Globale Debug-Funktionen f?r Frame-Daten.
Florian Pose <fp@igh-essen.com>
parents: 141
diff changeset
    91
/*****************************************************************************/
9654f3cf588d Plugfest: Globale Debug-Funktionen f?r Frame-Daten.
Florian Pose <fp@igh-essen.com>
parents: 141
diff changeset
    92
1619
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
    93
/**
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
    94
   Convenience macro for printing EtherCAT-specific information to syslog.
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
    95
   This will print the message in \a fmt with a prefixed "EtherCAT: ".
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
    96
   \param fmt format string (like in printf())
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
    97
   \param args arguments (optional)
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
    98
*/
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
    99
84
b4ae98855cea printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents: 73
diff changeset
   100
#define EC_INFO(fmt, args...) \
b4ae98855cea printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents: 73
diff changeset
   101
    printk(KERN_INFO "EtherCAT: " fmt, ##args)
1619
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   102
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   103
/**
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   104
   Convenience macro for printing EtherCAT-specific errors to syslog.
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   105
   This will print the message in \a fmt with a prefixed "EtherCAT ERROR: ".
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   106
   \param fmt format string (like in printf())
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   107
   \param args arguments (optional)
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   108
*/
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   109
84
b4ae98855cea printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents: 73
diff changeset
   110
#define EC_ERR(fmt, args...) \
b4ae98855cea printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents: 73
diff changeset
   111
    printk(KERN_ERR "EtherCAT ERROR: " fmt, ##args)
1619
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   112
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   113
/**
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   114
   Convenience macro for printing EtherCAT-specific warnings to syslog.
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   115
   This will print the message in \a fmt with a prefixed "EtherCAT WARNING: ".
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   116
   \param fmt format string (like in printf())
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   117
   \param args arguments (optional)
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   118
*/
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   119
84
b4ae98855cea printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents: 73
diff changeset
   120
#define EC_WARN(fmt, args...) \
b4ae98855cea printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents: 73
diff changeset
   121
    printk(KERN_WARNING "EtherCAT WARNING: " fmt, ##args)
1619
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   122
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   123
/**
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   124
   Convenience macro for printing EtherCAT debug messages to syslog.
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   125
   This will print the message in \a fmt with a prefixed "EtherCAT DEBUG: ".
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   126
   \param fmt format string (like in printf())
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   127
   \param args arguments (optional)
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   128
*/
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   129
84
b4ae98855cea printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents: 73
diff changeset
   130
#define EC_DBG(fmt, args...) \
b4ae98855cea printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents: 73
diff changeset
   131
    printk(KERN_DEBUG "EtherCAT DEBUG: " fmt, ##args)
b4ae98855cea printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents: 73
diff changeset
   132
1619
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   133
/**
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   134
   Helper macro for EC_STR(), literates a macro argument.
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   135
   \param X argument to literate.
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   136
*/
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   137
184
2fc86cec12df Macro for SysFS attribute definition
Florian Pose <fp@igh-essen.com>
parents: 164
diff changeset
   138
#define EC_LIT(X) #X
1619
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   139
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   140
/**
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   141
   Converts a macro argument to a string.
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   142
   \param X argument to stringify.
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   143
*/
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   144
184
2fc86cec12df Macro for SysFS attribute definition
Florian Pose <fp@igh-essen.com>
parents: 164
diff changeset
   145
#define EC_STR(X) EC_LIT(X)
2fc86cec12df Macro for SysFS attribute definition
Florian Pose <fp@igh-essen.com>
parents: 164
diff changeset
   146
1618
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
   147
/**
1619
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   148
   Convenience macro for defining read-only SysFS attributes.
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   149
   This results in creating a static variable called attr_\a NAME. The SysFS
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   150
   file will be world-readable.
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   151
   \param NAME name of the attribute to create.
1618
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
   152
*/
5cff10efb927 MERGE trunk -r355:360 -> branches/stable-1.0 (Doxygen, INSTALL, and GPLv2)
Florian Pose <fp@igh-essen.com>
parents: 1617
diff changeset
   153
184
2fc86cec12df Macro for SysFS attribute definition
Florian Pose <fp@igh-essen.com>
parents: 164
diff changeset
   154
#define EC_SYSFS_READ_ATTR(NAME) \
2fc86cec12df Macro for SysFS attribute definition
Florian Pose <fp@igh-essen.com>
parents: 164
diff changeset
   155
    static struct attribute attr_##NAME = { \
2fc86cec12df Macro for SysFS attribute definition
Florian Pose <fp@igh-essen.com>
parents: 164
diff changeset
   156
        .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
   157
    }
2fc86cec12df Macro for SysFS attribute definition
Florian Pose <fp@igh-essen.com>
parents: 164
diff changeset
   158
1619
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   159
/**
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   160
   Convenience macro for defining read-write SysFS attributes.
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   161
   This results in creating a static variable called attr_\a NAME. The SysFS
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   162
   file will be word-readable plus owner-writable.
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   163
   \param NAME name of the attribute to create.
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   164
*/
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   165
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   166
#define EC_SYSFS_READ_WRITE_ATTR(NAME) \
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   167
    static struct attribute attr_##NAME = { \
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   168
        .name = EC_STR(NAME), .owner = THIS_MODULE, .mode = S_IRUGO | S_IWUSR \
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   169
    }
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   170
41
42c66194c0c8 Schoenheitskorrekturen.
Florian Pose <fp@igh-essen.com>
parents: 39
diff changeset
   171
/*****************************************************************************/
42c66194c0c8 Schoenheitskorrekturen.
Florian Pose <fp@igh-essen.com>
parents: 39
diff changeset
   172
152
9654f3cf588d Plugfest: Globale Debug-Funktionen f?r Frame-Daten.
Florian Pose <fp@igh-essen.com>
parents: 141
diff changeset
   173
extern void ec_print_data(const uint8_t *, size_t);
9654f3cf588d Plugfest: Globale Debug-Funktionen f?r Frame-Daten.
Florian Pose <fp@igh-essen.com>
parents: 141
diff changeset
   174
extern void ec_print_data_diff(const uint8_t *, const uint8_t *, size_t);
1619
0d4119024f55 MERGE -r361:425 trunk -> branches/stable-1.0: EoE, License, State machines.
Florian Pose <fp@igh-essen.com>
parents: 1618
diff changeset
   175
extern void ec_print_states(uint8_t);
152
9654f3cf588d Plugfest: Globale Debug-Funktionen f?r Frame-Daten.
Florian Pose <fp@igh-essen.com>
parents: 141
diff changeset
   176
9654f3cf588d Plugfest: Globale Debug-Funktionen f?r Frame-Daten.
Florian Pose <fp@igh-essen.com>
parents: 141
diff changeset
   177
/*****************************************************************************/
9654f3cf588d Plugfest: Globale Debug-Funktionen f?r Frame-Daten.
Florian Pose <fp@igh-essen.com>
parents: 141
diff changeset
   178
164
ed85368b2b2e AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents: 152
diff changeset
   179
/**
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   180
   Code - Message pair.
164
ed85368b2b2e AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents: 152
diff changeset
   181
   Some EtherCAT commands support reading a status code to display a certain
ed85368b2b2e AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents: 152
diff changeset
   182
   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
   183
*/
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
typedef struct
ed85368b2b2e AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents: 152
diff changeset
   186
{
195
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   187
    uint32_t code; /**< code */
674071846ee3 Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents: 184
diff changeset
   188
    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
   189
}
ed85368b2b2e AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents: 152
diff changeset
   190
ec_code_msg_t;
ed85368b2b2e AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents: 152
diff changeset
   191
ed85368b2b2e AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents: 152
diff changeset
   192
/*****************************************************************************/
ed85368b2b2e AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents: 152
diff changeset
   193
0
05c992bf5847 trunk, tags und branches
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   194
#endif
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 54
diff changeset
   195