76 #define Beckhoff_EL2004 0x00000002, 0x07d43052 |
76 #define Beckhoff_EL2004 0x00000002, 0x07d43052 |
77 #define Beckhoff_EL2032 0x00000002, 0x07f03052 |
77 #define Beckhoff_EL2032 0x00000002, 0x07f03052 |
78 #define Beckhoff_EL3152 0x00000002, 0x0c503052 |
78 #define Beckhoff_EL3152 0x00000002, 0x0c503052 |
79 #define Beckhoff_EL4102 0x00000002, 0x10063052 |
79 #define Beckhoff_EL4102 0x00000002, 0x10063052 |
80 |
80 |
81 // offsets for Pdo entries |
81 // offsets for PDO entries |
82 static unsigned int off_ana_in_status; |
82 static unsigned int off_ana_in_status; |
83 static unsigned int off_ana_in_value; |
83 static unsigned int off_ana_in_value; |
84 static unsigned int off_ana_out; |
84 static unsigned int off_ana_out; |
85 static unsigned int off_dig_out; |
85 static unsigned int off_dig_out; |
86 |
86 |
291 fprintf(stderr, "Failed to get slave configuration.\n"); |
291 fprintf(stderr, "Failed to get slave configuration.\n"); |
292 return -1; |
292 return -1; |
293 } |
293 } |
294 |
294 |
295 #if CONFIGURE_PDOS |
295 #if CONFIGURE_PDOS |
296 printf("Configuring Pdos...\n"); |
296 printf("Configuring PDOs...\n"); |
297 if (ecrt_slave_config_pdos(sc_ana_in, EC_END, el3152_syncs)) { |
297 if (ecrt_slave_config_pdos(sc_ana_in, EC_END, el3152_syncs)) { |
298 fprintf(stderr, "Failed to configure Pdos.\n"); |
298 fprintf(stderr, "Failed to configure PDOs.\n"); |
299 return -1; |
299 return -1; |
300 } |
300 } |
301 |
301 |
302 if (!(sc = ecrt_master_slave_config( |
302 if (!(sc = ecrt_master_slave_config( |
303 master, AnaOutSlavePos, Beckhoff_EL4102))) { |
303 master, AnaOutSlavePos, Beckhoff_EL4102))) { |
304 fprintf(stderr, "Failed to get slave configuration.\n"); |
304 fprintf(stderr, "Failed to get slave configuration.\n"); |
305 return -1; |
305 return -1; |
306 } |
306 } |
307 |
307 |
308 if (ecrt_slave_config_pdos(sc, EC_END, el4102_syncs)) { |
308 if (ecrt_slave_config_pdos(sc, EC_END, el4102_syncs)) { |
309 fprintf(stderr, "Failed to configure Pdos.\n"); |
309 fprintf(stderr, "Failed to configure PDOs.\n"); |
310 return -1; |
310 return -1; |
311 } |
311 } |
312 |
312 |
313 if (!(sc = ecrt_master_slave_config( |
313 if (!(sc = ecrt_master_slave_config( |
314 master, DigOutSlavePos, Beckhoff_EL2032))) { |
314 master, DigOutSlavePos, Beckhoff_EL2032))) { |
315 fprintf(stderr, "Failed to get slave configuration.\n"); |
315 fprintf(stderr, "Failed to get slave configuration.\n"); |
316 return -1; |
316 return -1; |
317 } |
317 } |
318 |
318 |
319 if (ecrt_slave_config_pdos(sc, EC_END, el2004_syncs)) { |
319 if (ecrt_slave_config_pdos(sc, EC_END, el2004_syncs)) { |
320 fprintf(stderr, "Failed to configure Pdos.\n"); |
320 fprintf(stderr, "Failed to configure PDOs.\n"); |
321 return -1; |
321 return -1; |
322 } |
322 } |
323 #endif |
323 #endif |
324 |
324 |
325 // Create configuration for bus coupler |
325 // Create configuration for bus coupler |
326 sc = ecrt_master_slave_config(master, BusCouplerPos, Beckhoff_EK1100); |
326 sc = ecrt_master_slave_config(master, BusCouplerPos, Beckhoff_EK1100); |
327 if (!sc) |
327 if (!sc) |
328 return -1; |
328 return -1; |
329 |
329 |
330 if (ecrt_domain_reg_pdo_entry_list(domain1, domain1_regs)) { |
330 if (ecrt_domain_reg_pdo_entry_list(domain1, domain1_regs)) { |
331 fprintf(stderr, "Pdo entry registration failed!\n"); |
331 fprintf(stderr, "PDO entry registration failed!\n"); |
332 return -1; |
332 return -1; |
333 } |
333 } |
334 |
334 |
335 printf("Activating master...\n"); |
335 printf("Activating master...\n"); |
336 if (ecrt_master_activate(master)) |
336 if (ecrt_master_activate(master)) |