Re: [Xenomai-core] TASK SCHEDULING E PRIORITY

2008-01-24 Thread Gilles Chanteperdrix
On Jan 24, 2008 5:19 PM, axel axel <[EMAIL PROTECTED]> wrote:
> Hi,
>
> you answer me this:
>
> > 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
>
> 1. This will not work. Xenomai relies on Linux, so Xenomai tasks must let
> Linux run from time to time.
>
> 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 ?
>
>  2. If you use Xenomai in one-shot mode, round-robin is not implemented.
>  You have to switch Xenomai timer to periodic mode.
>
>
> But if i use periodic mode ( second point ) i can do the first point or it's
> the same impossibile ?

When you reply to a mail, please hit the "reply" button, so that mail
clients (as well as the mailing list archive) nicely put the reply in
the same thread as the mail you reply to.

And since you are at it, please avoid uppercase, uppercase is
equivalent to shouting on usenet. We hear you, there is no need to
shout.

Now, to answer your question, independently on the timer mode, your
system will not run if you never let Linux run.

-- 
   Gilles Chanteperdrix

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


[Xenomai-core] TASK SCHEDULING E PRIORITY

2008-01-24 Thread axel axel
Hi,

you answer me this:

> 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

1. This will not work. Xenomai relies on Linux, so Xenomai tasks must let
Linux run from time to time.

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 ?

2. If you use Xenomai in one-shot mode, round-robin is not implemented.
You have to switch Xenomai timer to periodic mode.


But if i use periodic mode ( second point ) i can do the first point or it's
the same impossibile ?

Thanks


Roberto Bielli
___
Xenomai-core mailing list
Xenomai-core@gna.org
https://mail.gna.org/listinfo/xenomai-core


Re: [Xenomai-core] TASK SCHEDULING E PRIORITY

2008-01-23 Thread Gilles Chanteperdrix
On Jan 23, 2008 10:20 AM, axel axel <[EMAIL PROTECTED]> wrote:
> 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

This will not work. Xenomai relies on Linux, so Xenomai tasks must let
Linux run from time to time.

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 ?

If you use Xenomai in one-shot mode, round-robin is not implemented.
You have to switch Xenomai timer to periodic mode.

-- 
   Gilles Chanteperdrix

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


[Xenomai-core] TASK SCHEDULING E PRIORITY

2008-01-23 Thread axel axel
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 | 0x0004;

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

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 | 0x0008;

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

 }
 }

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 | 0x0010;

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

 }
 }


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