RES: RES: testing multitasking rtems
Luca Cinquepalmi
cinquepalmi at planetek.it
Thu Sep 20 08:17:36 UTC 2012
Thank you Wendell, your suggestion works perfectly! That is exactly what
I wanted!
Thank you again!
Hope I can mail you if I have any problem...
Have a nice day!
Luca
Il 19/09/2012 18.45, Wendell Pereira da Silva ha scritto:
>
> OK, Luca.
>
> Try to adjust your tasks as the following pseudo-code and see what
> happens.
>
> Let know if you have more doubts.
>
> Global:
>
> volatile bool quit = false;
>
> Task1:
>
> while(!quit)
>
> {
>
> led_on();
>
> rtems_task_wake_after(RTEMS_MILLISECONDS_TO_TICKS(100);
>
> led_off();
>
> rtems_task_wake_after(RTEMS_MILLISECONDS_TO_TICKS(100);
>
> }
>
> printk("task 1 exiting...\n");
>
> rtems_task_delete(rtems_task_self());
>
> Task2:
>
> while(!quit)
>
> {
>
> printf("hello world!\n");
>
> rtems_task_wake_after(RTEMS_MILLISECONDS_TO_TICKS(1000);
>
> }
>
> printk("task 2 exiting...\n");
>
> rtems_task_delete(rtems_task_self());
>
> Init:
>
> int i = 0;
>
> rtems_task_create(Task1);
>
> rtems_task_create(Task2);
>
> rtems_task_start(Task1);
>
> rtems_task_start(Task2);
>
> while(i < 120) // Let tasks run for aprox 2 minutes.
>
> {
>
> rtems_task_wake_after(RTEMS_MILLISECONDS_TO_TICKS(1000);
>
> i++;
>
> }
>
> quit = true; // Let the tasks delete themselfs
>
> printk("Task init: end of test\n");
>
> rtems_task_delete(rtems_task_self()); // Say "Addio, mondo crudele."
>
> *De:*Luca Cinquepalmi [mailto:cinquepalmi at planetek.it]
> *Enviada em:* quarta-feira, 19 de setembro de 2012 13:24
> *Para:* Wendell Pereira da Silva
> *Cc:* rtems-users at rtems.org
> *Assunto:* Re: RES: testing multitasking rtems
>
> Wendell, thank you for your answer... I try to explain better:
> - task1 makes a led blinking (in a while cycle)
> - task2 print a simple "hello world"
>
> I want "hello world" to be printed while led is blinking. How can I
> share CPU with these two tasks?
> Shall I delete task at the end? Shall I define a semaphore?
> I tried to modify task priority but it has no effects...
> Even if led blinking (task 1) start, task 2 doesn't...
>
> Hope now it's clearer...
>
> Luca
>
>
>
> Il 19/09/2012 17.18, Wendell Pereira da Silva ha scritto:
>
> Luca,
>
> Unless you have two CPUs (or a dual core CPU) and SMP support for
> your BSP, it's impossible to get two tasks running at the same
> time (if I understood what you mean "... a second task running
> when one is still running).
>
> In most cases, on single core (or single processor) BSP's tasks
> share the same CPU being droved by any scheduling policy
> implemented in the RTOS.
>
> If you want your tasks sharing the CPU, please, check the tasks
> priority, attributes and execution mode.
>
> Probably task one has higher priority than task two, and task one
> never blocks.
>
> A good reference is the RTEMS Users Guide
> <http://www.rtems.org/onlinedocs/releases/rtemsdocs-4.10.2/share/rtems/pdf/c_user.pdf>,
> topic 5.2.
>
> Hope it helps.
>
> --Wendell
>
> *De:*rtems-users-bounces at rtems.org
> <mailto:rtems-users-bounces at rtems.org>
> [mailto:rtems-users-bounces at rtems.org] *Em nome de *Luca Cinquepalmi
> *Enviada em:* quarta-feira, 19 de setembro de 2012 11:16
> *Para:* Joel Sherrill
> *Cc:* rtems-users at rtems.org <mailto:rtems-users at rtems.org>
> *Assunto:* Re: testing multitasking rtems
>
> How can I run Two tasks in the same time? Evey task ends with
> delete_task so the next task starts
> when the previous is finished. How can I make a second task
> running when task one is still running?
>
> Example:
>
> rtems_task Init(rtems_task_argument ignored)
> {
>
> ...
> rtems_task_start(task_id1...)
> rtems_task_start(task_id2...)
> ...
> }
>
>
> I want that task 2 starts while task1 is still running? How can I
> do this?
> Thank you
>
> Luca
>
>
>
> Il 18/09/2012 13.12, Joel Sherrill ha scritto:
>
> On 09/18/2012 06:07 AM, Luca Cinquepalmi wrote:
>
>
> Hi all,
> is there on line or in rtems documentaion any exmaple (c
> source code) of
> how testing multitasking?
>
> Nearly every test is multitasking. All are if you consider
> there is
> at least an application task/thread and an idle task.
>
> The most basic tests for a BSP are hello and ticker. Ticker has
> 3 user tasks which run at different intervals.
>
>
> I'm not able to find any suggestion. Thank you
>
> Luca
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.org <mailto:rtems-users at rtems.org>
> http://www.rtems.org/mailman/listinfo/rtems-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20120920/4c487a21/attachment-0001.html>
More information about the users
mailing list