73 |
73 |
74 #define Beckhoff_EL2004 0x00000002, 0x07D43052 |
74 #define Beckhoff_EL2004 0x00000002, 0x07D43052 |
75 #define Beckhoff_EL3152 0x00000002, 0x0c503052 |
75 #define Beckhoff_EL3152 0x00000002, 0x0c503052 |
76 #define Beckhoff_EL4102 0x00000002, 0x10063052 |
76 #define Beckhoff_EL4102 0x00000002, 0x10063052 |
77 |
77 |
78 // offsets for Pdo entries |
78 // offsets for PDO entries |
79 static unsigned int off_ana_in; |
79 static unsigned int off_ana_in; |
80 static unsigned int off_ana_out; |
80 static unsigned int off_ana_out; |
81 static unsigned int off_dig_out; |
81 static unsigned int off_dig_out; |
82 |
82 |
83 const static ec_pdo_entry_reg_t domain1_regs[] = { |
83 const static ec_pdo_entry_reg_t domain1_regs[] = { |
253 break; |
253 break; |
254 case EC_REQUEST_BUSY: |
254 case EC_REQUEST_BUSY: |
255 printk(KERN_INFO PFX "Still busy...\n"); |
255 printk(KERN_INFO PFX "Still busy...\n"); |
256 break; |
256 break; |
257 case EC_REQUEST_SUCCESS: |
257 case EC_REQUEST_SUCCESS: |
258 printk(KERN_INFO PFX "Sdo value: 0x%04X\n", |
258 printk(KERN_INFO PFX "SDO value: 0x%04X\n", |
259 EC_READ_U16(ecrt_sdo_request_data(sdo))); |
259 EC_READ_U16(ecrt_sdo_request_data(sdo))); |
260 ecrt_sdo_request_read(sdo); // trigger next read |
260 ecrt_sdo_request_read(sdo); // trigger next read |
261 break; |
261 break; |
262 case EC_REQUEST_ERROR: |
262 case EC_REQUEST_ERROR: |
263 printk(KERN_INFO PFX "Failed to read Sdo!\n"); |
263 printk(KERN_INFO PFX "Failed to read SDO!\n"); |
264 ecrt_sdo_request_read(sdo); // retry reading |
264 ecrt_sdo_request_read(sdo); // retry reading |
265 break; |
265 break; |
266 } |
266 } |
267 } |
267 } |
268 #endif |
268 #endif |
392 printk(KERN_ERR PFX "Failed to get slave configuration.\n"); |
392 printk(KERN_ERR PFX "Failed to get slave configuration.\n"); |
393 goto out_release_master; |
393 goto out_release_master; |
394 } |
394 } |
395 |
395 |
396 #if CONFIGURE_PDOS |
396 #if CONFIGURE_PDOS |
397 printk(KERN_INFO PFX "Configuring Pdos...\n"); |
397 printk(KERN_INFO PFX "Configuring PDOs...\n"); |
398 if (ecrt_slave_config_pdos(sc_ana_in, EC_END, el3152_syncs)) { |
398 if (ecrt_slave_config_pdos(sc_ana_in, EC_END, el3152_syncs)) { |
399 printk(KERN_ERR PFX "Failed to configure Pdos.\n"); |
399 printk(KERN_ERR PFX "Failed to configure PDOs.\n"); |
400 goto out_release_master; |
400 goto out_release_master; |
401 } |
401 } |
402 |
402 |
403 if (!(sc = ecrt_master_slave_config( |
403 if (!(sc = ecrt_master_slave_config( |
404 master, AnaOutSlavePos, Beckhoff_EL4102))) { |
404 master, AnaOutSlavePos, Beckhoff_EL4102))) { |
405 printk(KERN_ERR PFX "Failed to get slave configuration.\n"); |
405 printk(KERN_ERR PFX "Failed to get slave configuration.\n"); |
406 goto out_release_master; |
406 goto out_release_master; |
407 } |
407 } |
408 |
408 |
409 if (ecrt_slave_config_pdos(sc, EC_END, el4102_syncs)) { |
409 if (ecrt_slave_config_pdos(sc, EC_END, el4102_syncs)) { |
410 printk(KERN_ERR PFX "Failed to configure Pdos.\n"); |
410 printk(KERN_ERR PFX "Failed to configure PDOs.\n"); |
411 goto out_release_master; |
411 goto out_release_master; |
412 } |
412 } |
413 |
413 |
414 if (!(sc = ecrt_master_slave_config( |
414 if (!(sc = ecrt_master_slave_config( |
415 master, DigOutSlavePos, Beckhoff_EL2004))) { |
415 master, DigOutSlavePos, Beckhoff_EL2004))) { |
416 printk(KERN_ERR PFX "Failed to get slave configuration.\n"); |
416 printk(KERN_ERR PFX "Failed to get slave configuration.\n"); |
417 goto out_release_master; |
417 goto out_release_master; |
418 } |
418 } |
419 |
419 |
420 if (ecrt_slave_config_pdos(sc, EC_END, el2004_syncs)) { |
420 if (ecrt_slave_config_pdos(sc, EC_END, el2004_syncs)) { |
421 printk(KERN_ERR PFX "Failed to configure Pdos.\n"); |
421 printk(KERN_ERR PFX "Failed to configure PDOs.\n"); |
422 goto out_release_master; |
422 goto out_release_master; |
423 } |
423 } |
424 #endif |
424 #endif |
425 |
425 |
426 #if SDO_ACCESS |
426 #if SDO_ACCESS |
427 printk(KERN_INFO PFX "Creating Sdo requests...\n"); |
427 printk(KERN_INFO PFX "Creating SDO requests...\n"); |
428 if (!(sdo = ecrt_slave_config_create_sdo_request(sc_ana_in, 0x3102, 2, 2))) { |
428 if (!(sdo = ecrt_slave_config_create_sdo_request(sc_ana_in, 0x3102, 2, 2))) { |
429 printk(KERN_ERR PFX "Failed to create Sdo request.\n"); |
429 printk(KERN_ERR PFX "Failed to create SDO request.\n"); |
430 goto out_release_master; |
430 goto out_release_master; |
431 } |
431 } |
432 ecrt_sdo_request_timeout(sdo, 500); // ms |
432 ecrt_sdo_request_timeout(sdo, 500); // ms |
433 #endif |
433 #endif |
434 |
434 |
438 printk(KERN_ERR PFX "Failed to create VoE handler.\n"); |
438 printk(KERN_ERR PFX "Failed to create VoE handler.\n"); |
439 goto out_release_master; |
439 goto out_release_master; |
440 } |
440 } |
441 #endif |
441 #endif |
442 |
442 |
443 printk(KERN_INFO PFX "Registering Pdo entries...\n"); |
443 printk(KERN_INFO PFX "Registering PDO entries...\n"); |
444 if (ecrt_domain_reg_pdo_entry_list(domain1, domain1_regs)) { |
444 if (ecrt_domain_reg_pdo_entry_list(domain1, domain1_regs)) { |
445 printk(KERN_ERR PFX "Pdo entry registration failed!\n"); |
445 printk(KERN_ERR PFX "PDO entry registration failed!\n"); |
446 goto out_release_master; |
446 goto out_release_master; |
447 } |
447 } |
448 |
448 |
449 #if EXTERNAL_MEMORY |
449 #if EXTERNAL_MEMORY |
450 if ((size = ecrt_domain_size(domain1))) { |
450 if ((size = ecrt_domain_size(domain1))) { |