rt/msr_module.c
changeset 138 7e743a61a991
parent 137 3fb18812871a
child 139 998215ab9b92
equal deleted inserted replaced
137:3fb18812871a 138:7e743a61a991
   184 int __init init_rt_module(void)
   184 int __init init_rt_module(void)
   185 {
   185 {
   186     struct ipipe_domain_attr attr; //ipipe
   186     struct ipipe_domain_attr attr; //ipipe
   187     uint8_t string[10];
   187     uint8_t string[10];
   188     size_t size;
   188     size_t size;
       
   189     ec_slave_t *slave;
   189 
   190 
   190     // Als allererstes die RT-Lib initialisieren
   191     // Als allererstes die RT-Lib initialisieren
   191     if (msr_rtlib_init(1, MSR_ABTASTFREQUENZ, 10, &msr_globals_register) < 0) {
   192     if (msr_rtlib_init(1, MSR_ABTASTFREQUENZ, 10, &msr_globals_register) < 0) {
   192         msr_print_warn("msr_modul: can't initialize rtlib!");
   193         msr_print_warn("msr_modul: can't initialize rtlib!");
   193         goto out_return;
   194         goto out_return;
   229     //ecrt_master_debug(master, 0);
   230     //ecrt_master_debug(master, 0);
   230 
   231 
   231     ecrt_master_print(master);
   232     ecrt_master_print(master);
   232 
   233 
   233 #ifdef BLOCK1
   234 #ifdef BLOCK1
       
   235     if (!(slave = ecrt_master_get_slave(master, "1"))) {
       
   236         printk(KERN_ERR "Failed to get slave 1!\n");
       
   237         goto out_deactivate;
       
   238     }
       
   239 
   234     size = 10;
   240     size = 10;
   235     if (ecrt_master_sdo_read(master, "1", 0x100A, 0, string, &size)) {
   241     if (ecrt_slave_sdo_read(slave, 0x100A, 0, string, &size)) {
   236         printk(KERN_ERR "Could not read SSI version!\n");
   242         printk(KERN_ERR "Could not read SSI version!\n");
   237         goto out_deactivate;
   243         goto out_deactivate;
   238     }
   244     }
   239     string[size] = 0;
   245     string[size] = 0;
   240     printk(KERN_INFO "Software-version 1: %s\n", string);
   246     printk(KERN_INFO "Software-version 1: %s\n", string);
   241 
   247 
       
   248     if (!(slave = ecrt_master_get_slave(master, "5"))) {
       
   249         printk(KERN_ERR "Failed to get slave 5!\n");
       
   250         goto out_deactivate;
       
   251     }
       
   252 
   242     size = 10;
   253     size = 10;
   243     if (ecrt_master_sdo_read(master, "5", 0x100A, 0, string, &size)) {
   254     if (ecrt_slave_sdo_read(slave, 0x100A, 0, string, &size)) {
   244         printk(KERN_ERR "Could not read SSI version!\n");
   255         printk(KERN_ERR "Could not read SSI version!\n");
   245         goto out_deactivate;
   256         goto out_deactivate;
   246     }
   257     }
   247     string[size] = 0;
   258     string[size] = 0;
   248     printk(KERN_INFO "Software-version 5: %s\n", string);
   259     printk(KERN_INFO "Software-version 5: %s\n", string);
   249 
   260 
   250     if (ecrt_master_sdo_exp_write(master, "5", 0x4061, 1,  0, 1) ||
   261     if (ecrt_slave_sdo_write_exp8(slave, 0x4061, 1,  0) ||
   251         ecrt_master_sdo_exp_write(master, "5", 0x4061, 2,  1, 1) ||
   262         ecrt_slave_sdo_write_exp8(slave, 0x4061, 2,  1) ||
   252         ecrt_master_sdo_exp_write(master, "5", 0x4061, 3,  1, 1) ||
   263         ecrt_slave_sdo_write_exp8(slave, 0x4061, 3,  1) ||
   253         ecrt_master_sdo_exp_write(master, "5", 0x4066, 0,  0, 1) ||
   264         ecrt_slave_sdo_write_exp8(slave, 0x4066, 0,  0) ||
   254         ecrt_master_sdo_exp_write(master, "5", 0x4067, 0,  4, 1) ||
   265         ecrt_slave_sdo_write_exp8(slave, 0x4067, 0,  4) ||
   255         ecrt_master_sdo_exp_write(master, "5", 0x4068, 0,  0, 1) ||
   266         ecrt_slave_sdo_write_exp8(slave, 0x4068, 0,  0) ||
   256         ecrt_master_sdo_exp_write(master, "5", 0x4069, 0, 25, 1) ||
   267         ecrt_slave_sdo_write_exp8(slave, 0x4069, 0, 25) ||
   257         ecrt_master_sdo_exp_write(master, "5", 0x406A, 0, 25, 1) ||
   268         ecrt_slave_sdo_write_exp8(slave, 0x406A, 0, 25) ||
   258         ecrt_master_sdo_exp_write(master, "5", 0x406B, 0, 50, 1)) {
   269         ecrt_slave_sdo_write_exp8(slave, 0x406B, 0, 50)) {
   259         printk(KERN_ERR "Failed to configure SSI slave!\n");
   270         printk(KERN_ERR "Failed to configure SSI slave!\n");
   260         goto out_deactivate;
   271         goto out_deactivate;
   261     }
   272     }
   262 #endif
   273 #endif
   263 
   274