16 #include "../include/EtherCAT_si.h" // Slave-Interface-Makros |
16 #include "../include/EtherCAT_si.h" // Slave-Interface-Makros |
17 |
17 |
18 /*****************************************************************************/ |
18 /*****************************************************************************/ |
19 |
19 |
20 ec_master_t *master = NULL; |
20 ec_master_t *master = NULL; |
21 ec_slave_t *s_in, *s_out; |
21 ec_slave_t *s_in, *s_out, *s_ssi; |
22 |
22 |
23 struct timer_list timer; |
23 struct timer_list timer; |
24 |
24 |
25 ec_slave_init_t slaves[] = { |
25 ec_slave_init_t slaves[] = { |
26 // Zeiger, Index, Herstellername, Produktname, Domäne |
26 // Zeiger, Index, Herstellername, Produktname, Domäne |
27 { &s_out, 9, "Beckhoff", "EL2004", 1 }, |
27 { &s_out, 2, "Beckhoff", "EL2004", 1 }, |
28 { &s_in, 1, "Beckhoff", "EL3102", 1 } |
28 { &s_in, 1, "Beckhoff", "EL3102", 1 }, |
|
29 { &s_ssi, 7, "Beckhoff", "EL5001", 1 } |
29 }; |
30 }; |
30 |
31 |
31 #define SLAVE_COUNT (sizeof(slaves) / sizeof(ec_slave_init_t)) |
32 #define SLAVE_COUNT (sizeof(slaves) / sizeof(ec_slave_init_t)) |
32 |
33 |
33 /*****************************************************************************/ |
34 /*****************************************************************************/ |
65 |
66 |
66 if (EtherCAT_rt_activate_slaves(master)) { |
67 if (EtherCAT_rt_activate_slaves(master)) { |
67 printk(KERN_ERR "EtherCAT: Could not activate slaves!\n"); |
68 printk(KERN_ERR "EtherCAT: Could not activate slaves!\n"); |
68 goto out_release_master; |
69 goto out_release_master; |
69 } |
70 } |
|
71 |
|
72 printk("Configuring EtherCAT slaves.\n"); |
|
73 |
|
74 EtherCAT_rt_debug_level(master, 2); |
|
75 |
|
76 if (EtherCAT_rt_canopen_sdo_write(master, s_ssi, 0x4067, 2, 2)) { |
|
77 printk(KERN_ERR "EtherCAT: Could not set SSI baud rate!\n"); |
|
78 goto out_release_master; |
|
79 } |
|
80 |
|
81 EtherCAT_rt_debug_level(master, 0); |
70 |
82 |
71 printk("Starting cyclic sample thread.\n"); |
83 printk("Starting cyclic sample thread.\n"); |
72 |
84 |
73 init_timer(&timer); |
85 init_timer(&timer); |
74 |
86 |