Hi,

i'm testing xenomai but i have a problem:

i try to run 2 TASKS with the same PRIORITY that never exit out of the cycle
( down there is the code of task )
and never SLEEP but i see with the oscilloscope that the second task never
execute.

I set also round robin mode for the task, with rt_task_set_mode( 0,T_RRB,0
), and xnpod_activate_rr( LATCH ) kernel side.

Which is the problem for you ?

Thanks a lot in advance.

Roberto Bielli

--------------CODE---------------------------------------------------------------------------------------

void task1samePrio (void *cookie)
{
    if( rt_task_set_mode( 0,T_RRB,0 ) != 0 )
    {
        printf( "Error rt_task_set_mode on task3samePrio\n" );
        fflush( stdout );
        return;
    }

     rt_sem_p( &rtSemStartAll, TM_INFINITE );
     rt_sem_v( &rtSemStartAll );


     for (;;) {


        //    P9 on
        *mapp_dout = *mapp_dout | 0x00000004;

        //    P9 off
        *mapp_dout = *mapp_dout & 0xFFFFFFFB;
     }
 }

void task2samePrio (void *cookie)
{

    int err;
    if( rt_task_set_mode( 0,T_RRB,0 ) != 0 )
    {
        printf( "Error rt_task_set_mode on task2samePrio\n" );
        fflush( stdout );
        return;
    }

    rt_sem_p( &rtSemStartAll, TM_INFINITE );
    rt_sem_v( &rtSemStartAll );

     for (;;) {


        //    P8 on
        *mapp_dout = *mapp_dout | 0x00000008;

        //    P8 off
        *mapp_dout = *mapp_dout & 0xFFFFFFF7;

     }
 }

void task3samePrio (void *cookie)
{
    if( rt_task_set_mode( 0,T_RRB,0 ) != 0 )
    {
        printf( "Error rt_task_set_mode on task3samePrio\n" );
        fflush( stdout );
        return;
    }

    rt_sem_p( &rtSemStartAll, TM_INFINITE );
    rt_sem_v( &rtSemStartAll );

     for (;;) {

        //    P7 on
        *mapp_dout = *mapp_dout | 0x00000010;

        //    P7 off
        *mapp_dout = *mapp_dout & 0xFFFFFFEF;

     }
 }


void testPriority( void )
{
     int err;

     err = rt_sem_create( &rtSemStartAll, "rtSemStartAll", 0, S_FIFO );

     if( err != 0 )
     {
        printf( "Error on rt_sem_create rtSemStartAll \n" );
        fflush( stdout );

        return;
     }

     err = rt_task_spawn( &rtTask1prio, "task1prio", 0, 1, 0,
task1samePrio,NULL );
     if( err != 0 )
     {
        printf( "Error on rt_task_spawn rtTask1prio\n" );
        fflush( stdout );

        rt_task_delete(&rtTask1prio);

        return;
     }

     err = rt_task_spawn( &rtTask2prio, "task2prio", 0, 1, 0,
task2samePrio,NULL );
     if( err != 0 )
     {
        printf( "Error on rt_task_spawn rtTask2prio\n" );
        fflush( stdout );

        rt_task_delete(&rtTask2prio);

        return;
     }

     err = rt_task_spawn( &rtTask3prio, "task3prio", 0, 1, 0,
task3samePrio,NULL );
     if( err != 0 )
     {
        printf( "Error on rt_task_spawn rtTask3prio\n" );
        fflush( stdout );

        rt_task_delete(&rtTask3prio);

        return;
     }

     rt_sem_v( &rtSemStartAll );


}
_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to