rt/msr_module.c
changeset 158 363412c9304e
parent 156 43d7d714679f
child 170 357dd6f677fd
equal deleted inserted replaced
157:37c6dd0ff0b1 158:363412c9304e
    58 
    58 
    59 // Kanˇäle
    59 // Kanˇäle
    60 uint32_t k_pos;
    60 uint32_t k_pos;
    61 
    61 
    62 ec_field_init_t domain1_fields[] = {
    62 ec_field_init_t domain1_fields[] = {
    63     {&r_ssi, "1", "Beckhoff", "EL5001", "InputValue", 0},
    63     {&r_ssi, "5", "Beckhoff", "EL5001", "InputValue", 0},
    64     {}
    64     {}
    65 };
    65 };
    66 
    66 
    67 /*****************************************************************************/
    67 /*****************************************************************************/
    68 
    68 
   141         msr_print_warn("msr_modul: can't initialize rtlib!");
   141         msr_print_warn("msr_modul: can't initialize rtlib!");
   142         goto out_return;
   142         goto out_return;
   143     }
   143     }
   144 
   144 
   145     if ((master = ecrt_request_master(0)) == NULL) {
   145     if ((master = ecrt_request_master(0)) == NULL) {
   146         printk(KERN_ERR "Error requesting master 0!\n");
   146         printk(KERN_ERR "Failed to request master 0!\n");
   147         goto out_msr_cleanup;
   147         goto out_msr_cleanup;
   148     }
   148     }
   149 
   149 
   150     //ecrt_master_print(master, 2);
   150     //ecrt_master_print(master, 2);
   151 
   151 
   152     printk(KERN_INFO "Registering domains...\n");
   152     printk(KERN_INFO "Creating domains...\n");
   153     if (!(domain1 = ecrt_master_create_domain(master))) {
   153     if (!(domain1 = ecrt_master_create_domain(master))) {
   154         printk(KERN_ERR "Could not register domain!\n");
   154         printk(KERN_ERR "Failed to create domains!\n");
   155         goto out_release_master;
   155         goto out_release_master;
   156     }
   156     }
   157 
   157 
   158     printk(KERN_INFO "Registering domain fields...\n");
   158     printk(KERN_INFO "Registering domain fields...\n");
   159     if (ecrt_domain_register_field_list(domain1, domain1_fields)) {
   159     if (ecrt_domain_register_field_list(domain1, domain1_fields)) {
   165     if (ecrt_master_activate(master)) {
   165     if (ecrt_master_activate(master)) {
   166         printk(KERN_ERR "Could not activate master!\n");
   166         printk(KERN_ERR "Could not activate master!\n");
   167         goto out_release_master;
   167         goto out_release_master;
   168     }
   168     }
   169 
   169 
   170 #if 1
   170 #if 0
   171     if (ecrt_master_fetch_sdo_lists(master)) {
   171     if (ecrt_master_fetch_sdo_lists(master)) {
   172         printk(KERN_ERR "Failed to fetch SDO lists!\n");
   172         printk(KERN_ERR "Failed to fetch SDO lists!\n");
   173         goto out_deactivate;
   173         goto out_deactivate;
   174     }
   174     }
   175     ecrt_master_print(master, 2);
   175     ecrt_master_print(master, 2);
   207     attr.priority = IPIPE_ROOT_PRIO + 1;
   207     attr.priority = IPIPE_ROOT_PRIO + 1;
   208     attr.entry = &domain_entry;
   208     attr.entry = &domain_entry;
   209     ipipe_register_domain(&this_domain, &attr);
   209     ipipe_register_domain(&this_domain, &attr);
   210     return 0;
   210     return 0;
   211 
   211 
   212 #if 1
   212 #if 0
   213  out_deactivate:
   213  out_deactivate:
   214     ecrt_master_deactivate(master);
   214     ecrt_master_deactivate(master);
   215 #endif
   215 #endif
   216  out_release_master:
   216  out_release_master:
   217     ecrt_release_master(master);
   217     ecrt_release_master(master);