2008/2/1, Gilles Chanteperdrix <[EMAIL PROTECTED]>:
>
> On Fri, Feb 1, 2008 at 10:08 AM, axel axel <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > i try to use rt_task_sleep( 10000000 ) in a user-space task under
> > round-robin scheduling but doesnt' work.
>
Do not forget that the number passed to rt_task_sleep is a count of
> ticks (and documented as such), so, if you want to sleep for 10ms, you
> should call:
> rt_task_sleep(rt_timer_ns2ticks(10000000))


i try also this but nothing is changed.

this is the code of task:

void taskMav1 (void *cookie)
{
    int err, i;

    float a, b, c;
    //const float res2 = 14.6;
    //const float res3 = 22.5;
    //

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



    if( rt_task_slice( NULL, 1 ) != 0 )
    {
        printf( "Error rt_task_slice on task1samePrio\n" );
        fflush( stdout );
        return;
    }

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


     for (;;) {

//      for( i = 0; i < 100; i++ )
//      {
//          a = 2.1;
//          b = a * 2.0;
//          c = b + 3.1;
//
//          if ( res1local != c )
//          {
//              /* Process interrupt. */
//              //  P9 on
//              *mapp_dout = *mapp_dout | 0x00000004;
//
//              //  P9 off
//              *mapp_dout = *mapp_dout & 0xFFFFFFFB;
//              rt_task_sleep( 100000000 );
//              continue;
//          }
//
//      }

        //rt_task_sleep( 100000000 );
         *mapp_dout = *mapp_dout | 0x00000004;
         err = rt_task_sleep(  rt_timer_ns2ticks(10000000) );
         if( err != 0 )
         {
             printf( "Error rt_task_sleep on taskMav1 %d\n", err );
             fflush( stdout );
             return;
         }
         *mapp_dout = *mapp_dout & 0xFFFFFFFB;
     }
 }

and this is the code of caller:

void testMaverickCrunch( 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_timer_set_mode( 5000000 );
     if( err != 0 )
     {
        printf( "Error on rt_timer_set_mode \n" );
        fflush( stdout );

        return;
     }

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

        rt_task_delete(&rtTaskMav1);

        return;
     }

     rt_sem_v( &rtSemStartAll );

}

>
> > It returns the value -11.
> >
> > Any idea ?
> >
> > Thanks a lot
> >
> > Roberto Bielli
> >
> > _______________________________________________
> >  Xenomai-core mailing list
> >  Xenomai-core@gna.org
> >  https://mail.gna.org/listinfo/xenomai-core
> >
> >
>
>
>
> --
>                                                Gilles Chanteperdrix
>
_______________________________________________
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core

Reply via email to