1 /****************************************************************************** |
1 /****************************************************************************** |
2 * |
|
3 * g l o b a l s . h |
|
4 * |
|
5 * Global definitions and macros. |
|
6 * |
2 * |
7 * $Id$ |
3 * $Id$ |
8 * |
4 * |
|
5 * Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH |
|
6 * |
|
7 * This file is part of the IgH EtherCAT Master. |
|
8 * |
|
9 * The IgH EtherCAT Master is free software; you can redistribute it |
|
10 * and/or modify it under the terms of the GNU General Public License |
|
11 * as published by the Free Software Foundation; version 2 of the License. |
|
12 * |
|
13 * The IgH EtherCAT Master is distributed in the hope that it will be |
|
14 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
16 * GNU General Public License for more details. |
|
17 * |
|
18 * You should have received a copy of the GNU General Public License |
|
19 * along with the IgH EtherCAT Master; if not, write to the Free Software |
|
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|
21 * |
9 *****************************************************************************/ |
22 *****************************************************************************/ |
|
23 |
|
24 /** |
|
25 \file |
|
26 Global definitions and macros. |
|
27 */ |
|
28 |
|
29 /*****************************************************************************/ |
10 |
30 |
11 #ifndef _EC_GLOBALS_ |
31 #ifndef _EC_GLOBALS_ |
12 #define _EC_GLOBALS_ |
32 #define _EC_GLOBALS_ |
13 |
33 |
14 #include <linux/types.h> |
34 #include <linux/types.h> |
15 |
35 |
16 /****************************************************************************** |
36 /****************************************************************************** |
17 * EtherCAT master |
37 * EtherCAT master |
18 *****************************************************************************/ |
38 *****************************************************************************/ |
19 |
39 |
|
40 /** master main version */ |
20 #define EC_MASTER_VERSION_MAIN 1 |
41 #define EC_MASTER_VERSION_MAIN 1 |
|
42 |
|
43 /** master sub version (after the dot) */ |
21 #define EC_MASTER_VERSION_SUB 0 |
44 #define EC_MASTER_VERSION_SUB 0 |
|
45 |
|
46 /** master extra version (just a string) */ |
22 #define EC_MASTER_VERSION_EXTRA "stable" |
47 #define EC_MASTER_VERSION_EXTRA "stable" |
23 |
48 |
24 /** maximum number of FMMUs per slave */ |
49 /** maximum number of FMMUs per slave */ |
25 #define EC_MAX_FMMUS 16 |
50 #define EC_MAX_FMMUS 16 |
26 |
51 |
29 *****************************************************************************/ |
54 *****************************************************************************/ |
30 |
55 |
31 /** maximum size of an EtherCAT frame (without header and CRC) */ |
56 /** maximum size of an EtherCAT frame (without header and CRC) */ |
32 #define EC_MAX_FRAME_SIZE 1500 |
57 #define EC_MAX_FRAME_SIZE 1500 |
33 |
58 |
34 /** ... minimum size */ |
59 /** minimum size of an EtherCAT frame (without header and CRC) */ |
35 #define EC_MIN_FRAME_SIZE 46 |
60 #define EC_MIN_FRAME_SIZE 46 |
36 |
61 |
37 /** size of an EtherCAT frame header */ |
62 /** size of an EtherCAT frame header */ |
38 #define EC_FRAME_HEADER_SIZE 2 |
63 #define EC_FRAME_HEADER_SIZE 2 |
39 |
64 |
65 printk(KERN_DEBUG "EtherCAT DEBUG: " fmt, ##args) |
90 printk(KERN_DEBUG "EtherCAT DEBUG: " fmt, ##args) |
66 |
91 |
67 #define EC_LIT(X) #X |
92 #define EC_LIT(X) #X |
68 #define EC_STR(X) EC_LIT(X) |
93 #define EC_STR(X) EC_LIT(X) |
69 |
94 |
|
95 /** |
|
96 Convenience macro for defining SysFS attributes. |
|
97 */ |
|
98 |
70 #define EC_SYSFS_READ_ATTR(NAME) \ |
99 #define EC_SYSFS_READ_ATTR(NAME) \ |
71 static struct attribute attr_##NAME = { \ |
100 static struct attribute attr_##NAME = { \ |
72 .name = EC_STR(NAME), .owner = THIS_MODULE, .mode = S_IRUGO \ |
101 .name = EC_STR(NAME), .owner = THIS_MODULE, .mode = S_IRUGO \ |
73 } |
102 } |
74 |
103 |