examples/mini/mini.c
branchstable-1.5
changeset 2696 2b072c95b34c
parent 2421 bc2d4bf9cbe5
equal deleted inserted replaced
2695:ad58465e75ca 2696:2b072c95b34c
   305 }
   305 }
   306 #endif
   306 #endif
   307 
   307 
   308 /*****************************************************************************/
   308 /*****************************************************************************/
   309 
   309 
       
   310 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
       
   311 void cyclic_task(struct timer_list *t)
       
   312 #else
   310 void cyclic_task(unsigned long data)
   313 void cyclic_task(unsigned long data)
       
   314 #endif
   311 {
   315 {
   312     // receive process data
   316     // receive process data
   313     down(&master_sem);
   317     down(&master_sem);
   314     ecrt_master_receive(master);
   318     ecrt_master_receive(master);
   315     ecrt_domain_process(domain1);
   319     ecrt_domain_process(domain1);
   490     // Get internal process data for domain
   494     // Get internal process data for domain
   491     domain1_pd = ecrt_domain_data(domain1);
   495     domain1_pd = ecrt_domain_data(domain1);
   492 #endif
   496 #endif
   493 
   497 
   494     printk(KERN_INFO PFX "Starting cyclic sample thread.\n");
   498     printk(KERN_INFO PFX "Starting cyclic sample thread.\n");
       
   499 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
       
   500     timer_setup(&timer, cyclic_task, 0);
       
   501 #else
   495     init_timer(&timer);
   502     init_timer(&timer);
   496     timer.function = cyclic_task;
   503     timer.function = cyclic_task;
       
   504 #endif
   497     timer.expires = jiffies + 10;
   505     timer.expires = jiffies + 10;
   498     add_timer(&timer);
   506     add_timer(&timer);
   499 
   507 
   500     printk(KERN_INFO PFX "Started.\n");
   508     printk(KERN_INFO PFX "Started.\n");
   501     return 0;
   509     return 0;