author | Florian Pose <fp@igh-essen.com> |
Wed, 18 Oct 2006 12:04:24 +0000 | |
changeset 413 | a7144fdf14f5 |
parent 403 | 7bb931deccd9 |
child 427 | f70c7c6db7f4 |
permissions | -rw-r--r-- |
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 | 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 | 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 | 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 |
|
0 | 41 |
#ifndef _EC_GLOBALS_ |
42 |
#define _EC_GLOBALS_ |
|
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 |
|
392
eaee3c8d6ae0
Debug interfaces not compiled by default.
Florian Pose <fp@igh-essen.com>
parents:
382
diff
changeset
|
46 |
#include "../config.h" |
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 | 51 |
|
197
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
196
diff
changeset
|
52 |
/** master main version */ |
196
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
53 |
#define EC_MASTER_VERSION_MAIN 1 |
197
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
196
diff
changeset
|
54 |
|
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
196
diff
changeset
|
55 |
/** master sub version (after the dot) */ |
325
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
293
diff
changeset
|
56 |
#define EC_MASTER_VERSION_SUB 1 |
197
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
196
diff
changeset
|
57 |
|
b9a6e2c22745
GPLv2 License and enhanced Doxygen output.
Florian Pose <fp@igh-essen.com>
parents:
196
diff
changeset
|
58 |
/** master extra version (just a string) */ |
196
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
59 |
#define EC_MASTER_VERSION_EXTRA "trunk" |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
60 |
|
356
4bdc4f2e1a93
Compile/Version info in sysconfig master info file.
Florian Pose <fp@igh-essen.com>
parents:
325
diff
changeset
|
61 |
/** Compile version info. */ |
4bdc4f2e1a93
Compile/Version info in sysconfig master info file.
Florian Pose <fp@igh-essen.com>
parents:
325
diff
changeset
|
62 |
|
382
72500991bcc3
Altered master version string.
Florian Pose <fp@igh-essen.com>
parents:
356
diff
changeset
|
63 |
#define EC_MASTER_VERSION EC_STR(EC_MASTER_VERSION_MAIN) \ |
72500991bcc3
Altered master version string.
Florian Pose <fp@igh-essen.com>
parents:
356
diff
changeset
|
64 |
"." EC_STR(EC_MASTER_VERSION_SUB) \ |
72500991bcc3
Altered master version string.
Florian Pose <fp@igh-essen.com>
parents:
356
diff
changeset
|
65 |
" " EC_MASTER_VERSION_EXTRA \ |
72500991bcc3
Altered master version string.
Florian Pose <fp@igh-essen.com>
parents:
356
diff
changeset
|
66 |
" r" EC_STR(SVNREV) |
356
4bdc4f2e1a93
Compile/Version info in sysconfig master info file.
Florian Pose <fp@igh-essen.com>
parents:
325
diff
changeset
|
67 |
|
196
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
68 |
/** maximum number of FMMUs per slave */ |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
69 |
#define EC_MAX_FMMUS 16 |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
70 |
|
212
82980deb8b00
moved stats into eoe struct; persistent rx-skb; tx queue.
Florian Pose <fp@igh-essen.com>
parents:
211
diff
changeset
|
71 |
/** size of the EoE tx queue */ |
214
8beb86af5ed0
EoE frame queuing, receiving of fragmented frames; no TCP possible yet.
Florian Pose <fp@igh-essen.com>
parents:
212
diff
changeset
|
72 |
#define EC_EOE_TX_QUEUE_SIZE 100 |
212
82980deb8b00
moved stats into eoe struct; persistent rx-skb; tx queue.
Florian Pose <fp@igh-essen.com>
parents:
211
diff
changeset
|
73 |
|
228 | 74 |
/** clock frequency for the EoE state machines */ |
75 |
#define EC_EOE_FREQUENCY 1000 |
|
76 |
||
325
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
293
diff
changeset
|
77 |
/** datagram timeout in microseconds */ |
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
293
diff
changeset
|
78 |
#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
|
79 |
|
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
|
80 |
/** minimum size of a buffer used with ec_state_string() */ |
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
|
81 |
#define EC_STATE_STRING_SIZE 30 |
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
|
82 |
|
196
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
83 |
/****************************************************************************** |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
84 |
* EtherCAT protocol |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
85 |
*****************************************************************************/ |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
86 |
|
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
87 |
/** size of an EtherCAT frame header */ |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
88 |
#define EC_FRAME_HEADER_SIZE 2 |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
89 |
|
293
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
259
diff
changeset
|
90 |
/** size of an EtherCAT datagram header */ |
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
259
diff
changeset
|
91 |
#define EC_DATAGRAM_HEADER_SIZE 10 |
196
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
92 |
|
293
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
259
diff
changeset
|
93 |
/** size of an EtherCAT datagram footer */ |
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
259
diff
changeset
|
94 |
#define EC_DATAGRAM_FOOTER_SIZE 2 |
196
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
95 |
|
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
96 |
/** size of a sync manager configuration page */ |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
97 |
#define EC_SYNC_SIZE 8 |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
98 |
|
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
99 |
/** size of an FMMU configuration page */ |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
100 |
#define EC_FMMU_SIZE 16 |
f8a1e9f364a3
Introduced version number define.
Florian Pose <fp@igh-essen.com>
parents:
195
diff
changeset
|
101 |
|
293
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
259
diff
changeset
|
102 |
/** 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
|
103 |
#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
|
104 |
- EC_DATAGRAM_HEADER_SIZE - EC_DATAGRAM_FOOTER_SIZE) |
0 | 105 |
|
152
9654f3cf588d
Plugfest: Globale Debug-Funktionen f?r Frame-Daten.
Florian Pose <fp@igh-essen.com>
parents:
141
diff
changeset
|
106 |
/*****************************************************************************/ |
9654f3cf588d
Plugfest: Globale Debug-Funktionen f?r Frame-Daten.
Florian Pose <fp@igh-essen.com>
parents:
141
diff
changeset
|
107 |
|
259 | 108 |
/** |
109 |
Convenience macro for printing EtherCAT-specific information to syslog. |
|
110 |
This will print the message in \a fmt with a prefixed "EtherCAT: ". |
|
111 |
\param fmt format string (like in printf()) |
|
112 |
\param args arguments (optional) |
|
113 |
*/ |
|
114 |
||
84
b4ae98855cea
printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
115 |
#define EC_INFO(fmt, args...) \ |
b4ae98855cea
printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
116 |
printk(KERN_INFO "EtherCAT: " fmt, ##args) |
259 | 117 |
|
118 |
/** |
|
119 |
Convenience macro for printing EtherCAT-specific errors to syslog. |
|
120 |
This will print the message in \a fmt with a prefixed "EtherCAT ERROR: ". |
|
121 |
\param fmt format string (like in printf()) |
|
122 |
\param args arguments (optional) |
|
123 |
*/ |
|
124 |
||
84
b4ae98855cea
printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
125 |
#define EC_ERR(fmt, args...) \ |
b4ae98855cea
printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
126 |
printk(KERN_ERR "EtherCAT ERROR: " fmt, ##args) |
259 | 127 |
|
128 |
/** |
|
129 |
Convenience macro for printing EtherCAT-specific warnings to syslog. |
|
130 |
This will print the message in \a fmt with a prefixed "EtherCAT WARNING: ". |
|
131 |
\param fmt format string (like in printf()) |
|
132 |
\param args arguments (optional) |
|
133 |
*/ |
|
134 |
||
84
b4ae98855cea
printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
135 |
#define EC_WARN(fmt, args...) \ |
b4ae98855cea
printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
136 |
printk(KERN_WARNING "EtherCAT WARNING: " fmt, ##args) |
259 | 137 |
|
138 |
/** |
|
139 |
Convenience macro for printing EtherCAT debug messages to syslog. |
|
140 |
This will print the message in \a fmt with a prefixed "EtherCAT DEBUG: ". |
|
141 |
\param fmt format string (like in printf()) |
|
142 |
\param args arguments (optional) |
|
143 |
*/ |
|
144 |
||
84
b4ae98855cea
printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
145 |
#define EC_DBG(fmt, args...) \ |
b4ae98855cea
printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
146 |
printk(KERN_DEBUG "EtherCAT DEBUG: " fmt, ##args) |
b4ae98855cea
printk durch Makros ersetzt.
Florian Pose <fp@igh-essen.com>
parents:
73
diff
changeset
|
147 |
|
259 | 148 |
/** |
149 |
Helper macro for EC_STR(), literates a macro argument. |
|
150 |
\param X argument to literate. |
|
151 |
*/ |
|
152 |
||
184
2fc86cec12df
Macro for SysFS attribute definition
Florian Pose <fp@igh-essen.com>
parents:
164
diff
changeset
|
153 |
#define EC_LIT(X) #X |
259 | 154 |
|
155 |
/** |
|
156 |
Converts a macro argument to a string. |
|
157 |
\param X argument to stringify. |
|
158 |
*/ |
|
159 |
||
184
2fc86cec12df
Macro for SysFS attribute definition
Florian Pose <fp@igh-essen.com>
parents:
164
diff
changeset
|
160 |
#define EC_STR(X) EC_LIT(X) |
2fc86cec12df
Macro for SysFS attribute definition
Florian Pose <fp@igh-essen.com>
parents:
164
diff
changeset
|
161 |
|
199
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
162 |
/** |
259 | 163 |
Convenience macro for defining read-only SysFS attributes. |
164 |
This results in creating a static variable called attr_\a NAME. The SysFS |
|
165 |
file will be world-readable. |
|
166 |
\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
|
167 |
*/ |
04ecf40fc2e9
Doxygen added interface modules and file documentation.
Florian Pose <fp@igh-essen.com>
parents:
197
diff
changeset
|
168 |
|
184
2fc86cec12df
Macro for SysFS attribute definition
Florian Pose <fp@igh-essen.com>
parents:
164
diff
changeset
|
169 |
#define EC_SYSFS_READ_ATTR(NAME) \ |
2fc86cec12df
Macro for SysFS attribute definition
Florian Pose <fp@igh-essen.com>
parents:
164
diff
changeset
|
170 |
static struct attribute attr_##NAME = { \ |
2fc86cec12df
Macro for SysFS attribute definition
Florian Pose <fp@igh-essen.com>
parents:
164
diff
changeset
|
171 |
.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
|
172 |
} |
2fc86cec12df
Macro for SysFS attribute definition
Florian Pose <fp@igh-essen.com>
parents:
164
diff
changeset
|
173 |
|
259 | 174 |
/** |
175 |
Convenience macro for defining read-write SysFS attributes. |
|
176 |
This results in creating a static variable called attr_\a NAME. The SysFS |
|
177 |
file will be word-readable plus owner-writable. |
|
178 |
\param NAME name of the attribute to create. |
|
179 |
*/ |
|
180 |
||
256
dc71aee17f8a
SysFS write access for slave state.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
181 |
#define EC_SYSFS_READ_WRITE_ATTR(NAME) \ |
dc71aee17f8a
SysFS write access for slave state.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
182 |
static struct attribute attr_##NAME = { \ |
dc71aee17f8a
SysFS write access for slave state.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
183 |
.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
|
184 |
} |
dc71aee17f8a
SysFS write access for slave state.
Florian Pose <fp@igh-essen.com>
parents:
251
diff
changeset
|
185 |
|
41 | 186 |
/*****************************************************************************/ |
187 |
||
325
7833cf70c4f2
VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents:
293
diff
changeset
|
188 |
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
|
189 |
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
|
190 |
size_t ec_state_string(uint8_t, char *); |
152
9654f3cf588d
Plugfest: Globale Debug-Funktionen f?r Frame-Daten.
Florian Pose <fp@igh-essen.com>
parents:
141
diff
changeset
|
191 |
|
9654f3cf588d
Plugfest: Globale Debug-Funktionen f?r Frame-Daten.
Florian Pose <fp@igh-essen.com>
parents:
141
diff
changeset
|
192 |
/*****************************************************************************/ |
9654f3cf588d
Plugfest: Globale Debug-Funktionen f?r Frame-Daten.
Florian Pose <fp@igh-essen.com>
parents:
141
diff
changeset
|
193 |
|
164
ed85368b2b2e
AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents:
152
diff
changeset
|
194 |
/** |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
195 |
Code - Message pair. |
293
14aeb79aa992
Renamed command structure to datagram.
Florian Pose <fp@igh-essen.com>
parents:
259
diff
changeset
|
196 |
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
|
197 |
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
|
198 |
*/ |
ed85368b2b2e
AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents:
152
diff
changeset
|
199 |
|
ed85368b2b2e
AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents:
152
diff
changeset
|
200 |
typedef struct |
ed85368b2b2e
AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents:
152
diff
changeset
|
201 |
{ |
195
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
202 |
uint32_t code; /**< code */ |
674071846ee3
Translated all comments and documentation to english language.
Florian Pose <fp@igh-essen.com>
parents:
184
diff
changeset
|
203 |
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
|
204 |
} |
ed85368b2b2e
AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents:
152
diff
changeset
|
205 |
ec_code_msg_t; |
ed85368b2b2e
AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents:
152
diff
changeset
|
206 |
|
ed85368b2b2e
AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents:
152
diff
changeset
|
207 |
/*****************************************************************************/ |
ed85368b2b2e
AL status code reading after failed state transition.
Florian Pose <fp@igh-essen.com>
parents:
152
diff
changeset
|
208 |
|
0 | 209 |
#endif |