31 int __init ec_init_module(void); |
31 int __init ec_init_module(void); |
32 void __exit ec_cleanup_module(void); |
32 void __exit ec_cleanup_module(void); |
33 |
33 |
34 /*****************************************************************************/ |
34 /*****************************************************************************/ |
35 |
35 |
36 #define COMPILE_INFO "Revision " EC_STR(SVNREV) \ |
36 #define COMPILE_INFO EC_STR(EC_MASTER_VERSION_MAIN) \ |
|
37 "." EC_STR(EC_MASTER_VERSION_SUB) \ |
|
38 " (" EC_MASTER_VERSION_EXTRA ")" \ |
|
39 " - rev. " EC_STR(SVNREV) \ |
37 ", compiled by " EC_STR(USER) \ |
40 ", compiled by " EC_STR(USER) \ |
38 " at " __DATE__ " " __TIME__ |
41 " at " __DATE__ " " __TIME__ |
39 |
42 |
40 /*****************************************************************************/ |
43 /*****************************************************************************/ |
41 |
44 |
145 if (master->index == master_index) return master; |
148 if (master->index == master_index) return master; |
146 } |
149 } |
147 |
150 |
148 EC_ERR("Master %i does not exist!\n", master_index); |
151 EC_ERR("Master %i does not exist!\n", master_index); |
149 return NULL; |
152 return NULL; |
|
153 } |
|
154 |
|
155 /*****************************************************************************/ |
|
156 |
|
157 /** |
|
158 Outputs frame contents for debugging purposes. |
|
159 */ |
|
160 |
|
161 void ec_print_data(const uint8_t *data, /**< pointer to data */ |
|
162 size_t size /**< number of bytes to output */ |
|
163 ) |
|
164 { |
|
165 unsigned int i; |
|
166 |
|
167 EC_DBG(""); |
|
168 for (i = 0; i < size; i++) { |
|
169 printk("%02X ", data[i]); |
|
170 if ((i + 1) % 16 == 0) { |
|
171 printk("\n"); |
|
172 EC_DBG(""); |
|
173 } |
|
174 } |
|
175 printk("\n"); |
|
176 } |
|
177 |
|
178 /*****************************************************************************/ |
|
179 |
|
180 /** |
|
181 Outputs frame contents and differences for debugging purposes. |
|
182 */ |
|
183 |
|
184 void ec_print_data_diff(const uint8_t *d1, /**< first data */ |
|
185 const uint8_t *d2, /**< second data */ |
|
186 size_t size /** number of bytes to output */ |
|
187 ) |
|
188 { |
|
189 unsigned int i; |
|
190 |
|
191 EC_DBG(""); |
|
192 for (i = 0; i < size; i++) { |
|
193 if (d1[i] == d2[i]) printk(".. "); |
|
194 else printk("%02X ", d2[i]); |
|
195 if ((i + 1) % 16 == 0) { |
|
196 printk("\n"); |
|
197 EC_DBG(""); |
|
198 } |
|
199 } |
|
200 printk("\n"); |
150 } |
201 } |
151 |
202 |
152 /****************************************************************************** |
203 /****************************************************************************** |
153 * Device interface |
204 * Device interface |
154 *****************************************************************************/ |
205 *****************************************************************************/ |
352 return; |
403 return; |
353 } |
404 } |
354 |
405 |
355 /*****************************************************************************/ |
406 /*****************************************************************************/ |
356 |
407 |
357 /** |
|
358 Outputs frame contents for debugging purposes. |
|
359 */ |
|
360 |
|
361 void ec_print_data(const uint8_t *data, /**< pointer to data */ |
|
362 size_t size /**< number of bytes to output */ |
|
363 ) |
|
364 { |
|
365 unsigned int i; |
|
366 |
|
367 EC_DBG(""); |
|
368 for (i = 0; i < size; i++) { |
|
369 printk("%02X ", data[i]); |
|
370 if ((i + 1) % 16 == 0) { |
|
371 printk("\n"); |
|
372 EC_DBG(""); |
|
373 } |
|
374 } |
|
375 printk("\n"); |
|
376 } |
|
377 |
|
378 /*****************************************************************************/ |
|
379 |
|
380 /** |
|
381 Outputs frame contents and differences for debugging purposes. |
|
382 */ |
|
383 |
|
384 void ec_print_data_diff(const uint8_t *d1, /**< first data */ |
|
385 const uint8_t *d2, /**< second data */ |
|
386 size_t size /** number of bytes to output */ |
|
387 ) |
|
388 { |
|
389 unsigned int i; |
|
390 |
|
391 EC_DBG(""); |
|
392 for (i = 0; i < size; i++) { |
|
393 if (d1[i] == d2[i]) printk(".. "); |
|
394 else printk("%02X ", d2[i]); |
|
395 if ((i + 1) % 16 == 0) { |
|
396 printk("\n"); |
|
397 EC_DBG(""); |
|
398 } |
|
399 } |
|
400 printk("\n"); |
|
401 } |
|
402 |
|
403 /*****************************************************************************/ |
|
404 |
|
405 module_init(ec_init_module); |
408 module_init(ec_init_module); |
406 module_exit(ec_cleanup_module); |
409 module_exit(ec_cleanup_module); |
407 |
410 |
408 EXPORT_SYMBOL(ecdev_register); |
411 EXPORT_SYMBOL(ecdev_register); |
409 EXPORT_SYMBOL(ecdev_unregister); |
412 EXPORT_SYMBOL(ecdev_unregister); |