36 Global definitions and macros. |
36 Global definitions and macros. |
37 */ |
37 */ |
38 |
38 |
39 /*****************************************************************************/ |
39 /*****************************************************************************/ |
40 |
40 |
41 #ifndef _EC_GLOBALS_ |
41 #ifndef _EC_MASTER_GLOBALS_ |
42 #define _EC_GLOBALS_ |
42 #define _EC_MASTER_GLOBALS_ |
43 |
43 |
44 #include <linux/types.h> |
44 #include <linux/types.h> |
45 |
45 |
46 #include "../config.h" |
46 #include "../globals.h" |
47 |
47 |
48 /****************************************************************************** |
48 /****************************************************************************** |
49 * EtherCAT master |
49 * EtherCAT master |
50 *****************************************************************************/ |
50 *****************************************************************************/ |
51 |
|
52 /** master main version */ |
|
53 #define EC_MASTER_VERSION_MAIN 1 |
|
54 |
|
55 /** master sub version (after the dot) */ |
|
56 #define EC_MASTER_VERSION_SUB 1 |
|
57 |
|
58 /** master extra version (just a string) */ |
|
59 #define EC_MASTER_VERSION_EXTRA "trunk" |
|
60 |
|
61 /** Compile version info. */ |
|
62 |
|
63 #define EC_MASTER_VERSION EC_STR(EC_MASTER_VERSION_MAIN) \ |
|
64 "." EC_STR(EC_MASTER_VERSION_SUB) \ |
|
65 " " EC_MASTER_VERSION_EXTRA \ |
|
66 " r" EC_STR(SVNREV) |
|
67 |
51 |
68 /** maximum number of FMMUs per slave */ |
52 /** maximum number of FMMUs per slave */ |
69 #define EC_MAX_FMMUS 16 |
53 #define EC_MAX_FMMUS 16 |
70 |
54 |
71 /** size of the EoE tx queue */ |
55 /** size of the EoE tx queue */ |
148 |
132 |
149 #define EC_DBG(fmt, args...) \ |
133 #define EC_DBG(fmt, args...) \ |
150 printk(KERN_DEBUG "EtherCAT DEBUG: " fmt, ##args) |
134 printk(KERN_DEBUG "EtherCAT DEBUG: " fmt, ##args) |
151 |
135 |
152 /** |
136 /** |
153 Helper macro for EC_STR(), literates a macro argument. |
|
154 \param X argument to literate. |
|
155 */ |
|
156 |
|
157 #define EC_LIT(X) #X |
|
158 |
|
159 /** |
|
160 Converts a macro argument to a string. |
|
161 \param X argument to stringify. |
|
162 */ |
|
163 |
|
164 #define EC_STR(X) EC_LIT(X) |
|
165 |
|
166 /** |
|
167 Convenience macro for defining read-only SysFS attributes. |
137 Convenience macro for defining read-only SysFS attributes. |
168 This results in creating a static variable called attr_\a NAME. The SysFS |
138 This results in creating a static variable called attr_\a NAME. The SysFS |
169 file will be world-readable. |
139 file will be world-readable. |
170 \param NAME name of the attribute to create. |
140 \param NAME name of the attribute to create. |
171 */ |
141 */ |
187 .name = EC_STR(NAME), .owner = THIS_MODULE, .mode = S_IRUGO | S_IWUSR \ |
157 .name = EC_STR(NAME), .owner = THIS_MODULE, .mode = S_IRUGO | S_IWUSR \ |
188 } |
158 } |
189 |
159 |
190 /*****************************************************************************/ |
160 /*****************************************************************************/ |
191 |
161 |
|
162 extern char *ec_master_version_str; |
|
163 |
|
164 /*****************************************************************************/ |
|
165 |
192 void ec_print_data(const uint8_t *, size_t); |
166 void ec_print_data(const uint8_t *, size_t); |
193 void ec_print_data_diff(const uint8_t *, const uint8_t *, size_t); |
167 void ec_print_data_diff(const uint8_t *, const uint8_t *, size_t); |
194 size_t ec_state_string(uint8_t, char *); |
168 size_t ec_state_string(uint8_t, char *); |
195 |
169 |
196 /*****************************************************************************/ |
170 /*****************************************************************************/ |