equal
deleted
inserted
replaced
33 |
33 |
34 #include <linux/module.h> |
34 #include <linux/module.h> |
35 #include <linux/timer.h> |
35 #include <linux/timer.h> |
36 #include <linux/spinlock.h> |
36 #include <linux/spinlock.h> |
37 #include <linux/interrupt.h> |
37 #include <linux/interrupt.h> |
|
38 #include <linux/err.h> |
38 |
39 |
39 #include "../../include/ecrt.h" // EtherCAT realtime interface |
40 #include "../../include/ecrt.h" // EtherCAT realtime interface |
40 |
41 |
41 /*****************************************************************************/ |
42 /*****************************************************************************/ |
42 |
43 |
366 |
367 |
367 /*****************************************************************************/ |
368 /*****************************************************************************/ |
368 |
369 |
369 int __init init_mini_module(void) |
370 int __init init_mini_module(void) |
370 { |
371 { |
|
372 int ret = -1; |
371 #if CONFIGURE_PDOS |
373 #if CONFIGURE_PDOS |
372 ec_slave_config_t *sc; |
374 ec_slave_config_t *sc; |
373 #endif |
375 #endif |
374 #if EXTERNAL_MEMORY |
376 #if EXTERNAL_MEMORY |
375 unsigned int size; |
377 unsigned int size; |
376 #endif |
378 #endif |
377 |
379 |
378 printk(KERN_INFO PFX "Starting...\n"); |
380 printk(KERN_INFO PFX "Starting...\n"); |
379 |
381 |
380 if (!(master = ecrt_request_master(0))) { |
382 master = ecrt_request_master(0); |
381 printk(KERN_ERR PFX "Requesting master 0 failed!\n"); |
383 if (IS_ERR(master)) { |
|
384 ret = PTR_ERR(master); |
|
385 printk(KERN_ERR PFX "Requesting master 0 failed.\n"); |
382 goto out_return; |
386 goto out_return; |
383 } |
387 } |
384 |
388 |
385 ecrt_master_callbacks(master, request_lock, release_lock, NULL); |
389 ecrt_master_callbacks(master, request_lock, release_lock, NULL); |
386 |
390 |
491 out_release_master: |
495 out_release_master: |
492 printk(KERN_ERR PFX "Releasing master...\n"); |
496 printk(KERN_ERR PFX "Releasing master...\n"); |
493 ecrt_release_master(master); |
497 ecrt_release_master(master); |
494 out_return: |
498 out_return: |
495 printk(KERN_ERR PFX "Failed to load. Aborting.\n"); |
499 printk(KERN_ERR PFX "Failed to load. Aborting.\n"); |
496 return -1; |
500 return ret; |
497 } |
501 } |
498 |
502 |
499 /*****************************************************************************/ |
503 /*****************************************************************************/ |
500 |
504 |
501 void __exit cleanup_mini_module(void) |
505 void __exit cleanup_mini_module(void) |