[etherlab-users] Re:Re: xenomai context switch

yang.min at sibonac.com yang.min at sibonac.com
Mon Jan 21 10:50:26 CET 2013


Hi Florian,

I also have the same problem as Alessio even with the latest version(etherlabmaster-9cdd7669dc0b) in sourceforge. My configuration is: linux2.6.37.6+xenomai2.6.0+e1000e device driver.
 
my xenomai task code is shown below:

void cycle_task(void *arg)
 

{
 

        int i,toggle = 0;
 

        struct timespec time;
 

        rt_task_set_periodic(NULL, TM_NOW, 1000000);
 




        while(run) {


                rt_task_set_mode(0, T_WARNSW,NULL);   //It causes the SIGXCPU signal to be sent to the current user-space task whenever it switches to the secondary mode 
 

                rt_task_wait_period(NULL);


 


                 // receive process data
 

                ecrt_master_receive(master);
 

                ecrt_domain_process(domain1);


 
 

                clock_gettime(CLOCK_TO_USE, &time);
 

                ecrt_master_application_time(master, TIMESPEC2NS(time));


 
 

                ecrt_master_sync_slave_clocks(master);
 

                ecrt_master_sync_reference_clock(master);


                 if(toggle == 0){
 

                        EC_WRITE_U16(domain1_pd + off_drive_mcw[0], 0xE000);
 

                        EC_WRITE_U16(domain1_pd + off_drive_mcw[0] + 6, 0xE000);
 

                        EC_WRITE_U16(domain1_pd + off_drive_mcw[1], 0xE000);
 

                        EC_WRITE_U16(domain1_pd + off_drive_mcw[1] + 6, 0xE000);
 

                        toggle = 1;
 

                }
 

                else if(toggle == 1){
 

                       EC_WRITE_U16(domain1_pd + off_drive_mcw[0], 0xE400);
 

                       EC_WRITE_U16(domain1_pd + off_drive_mcw[0] + 6, 0xE400);
 

                       EC_WRITE_U16(domain1_pd + off_drive_mcw[1], 0xE400);
 

                       EC_WRITE_U16(domain1_pd + off_drive_mcw[1] + 6, 0xE400);
 

                       toggle = 0;
 

                }
 

               // send process data
 

               ecrt_domain_queue(domain1);
 

               ecrt_master_send(master);
 

        }
 

}





The result indicates that there is mode switch happened, the reason is 'invoke syscall'.
Why I got such result? Did I miss something during the whole process? 
 
Best wishes!
Maggie
      


------------------------------------------------------------------
发件人:Florian Pose<fp at igh-essen.com>
发送日期:2013年01月15日 19:04
收件人:etherlab-users at etherlab.org;
主题:Re: [etherlab-users] xenomai context switch
 Hello,

Am 14.01.2013 12:28, schrieb Alessio Margan @ IIT:
> so this means I'm loosing data ?
> why I have rt context switch ?
> Am I missiing something configuring ethercat ?

please use the most recent version inside th stable-1.5 branch of the
master repository.

-- 
Viele Grüße,
Florian
_______________________________________________
etherlab-users mailing list
etherlab-users at etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-users 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20130121/1382b0b7/attachment-0002.htm>


More information about the Etherlab-users mailing list