<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Thank you Wendell, your suggestion
      works perfectly! That is exactly what I wanted!<br>
      Thank you again!<br>
      Hope I can mail you if I have any problem...<br>
      Have a nice day!<br>
      <br>
          Luca<br>
      <br>
      Il 19/09/2012 18.45, Wendell Pereira da Silva ha scritto:<br>
    </div>
    <blockquote
cite="mid:8F0C6606140B8146B6ABCC062597420101EDDE71FF8C@ADEXC07A.intranet.local"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <meta name="Generator" content="Microsoft Word 12 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Texto de bal\00E3o Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
span.EstiloDeEmail18
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.TextodebaloChar
        {mso-style-name:"Texto de bal\00E3o Char";
        mso-style-priority:99;
        mso-style-link:"Texto de bal\00E3o";
        font-family:"Tahoma","sans-serif";
        color:black;}
span.EstiloDeEmail21
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">OK,
            Luca.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
            lang="EN-US">Try to adjust your tasks as the following
            pseudo-code and see what happens. <o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
            lang="EN-US">Let know if you have more doubts.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">Global:<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">  volatile bool quit =
            false;<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">Task1:<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">  while(!quit)<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">  {<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">      led_on();<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">     
            rtems_task_wake_after(RTEMS_MILLISECONDS_TO_TICKS(100);<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">      led_off();<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">     
            rtems_task_wake_after(RTEMS_MILLISECONDS_TO_TICKS(100);<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">  }<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">  printk("task 1
            exiting...\n");<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US"> 
            rtems_task_delete(rtems_task_self());<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">Task2:<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">  while(!quit)<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">  {<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">      printf("hello
            world!\n");<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">     
            rtems_task_wake_after(RTEMS_MILLISECONDS_TO_TICKS(1000);<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">  }<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">  printk("task 2
            exiting...\n");<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US"> 
            rtems_task_delete(rtems_task_self());<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">Init:<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">  int i = 0;<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US"> 
            rtems_task_create(Task1);<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US"> 
            rtems_task_create(Task2);<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US"> 
            rtems_task_start(Task1);<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US"> 
            rtems_task_start(Task2);<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">  while(i < 120) //
            Let tasks run for aprox 2 minutes.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">  {<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">     
            rtems_task_wake_after(RTEMS_MILLISECONDS_TO_TICKS(1000);<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">      i++;<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">  }<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">  quit = true; // Let
            the tasks delete themselfs<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">  printk("Task init:
            end of test\n");<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US"> 
            rtems_task_delete(rtems_task_self()); // Say “Addio, mondo
            crudele.”<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
            lang="EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
            lang="EN-US"><o:p> </o:p></span></p>
        <div>
          <div style="border:none;border-top:solid #B5C4DF
            1.0pt;padding:3.0pt 0cm 0cm 0cm">
            <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">De:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">
                Luca Cinquepalmi [<a class="moz-txt-link-freetext" href="mailto:cinquepalmi@planetek.it">mailto:cinquepalmi@planetek.it</a>] <br>
                <b>Enviada em:</b> quarta-feira, 19 de setembro de 2012
                13:24<br>
                <b>Para:</b> Wendell Pereira da Silva<br>
                <b>Cc:</b> <a class="moz-txt-link-abbreviated" href="mailto:rtems-users@rtems.org">rtems-users@rtems.org</a><br>
                <b>Assunto:</b> Re: RES: testing multitasking rtems<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <div>
          <p class="MsoNormal">Wendell, thank you for your answer... I
            try to explain better:<br>
            - task1 makes a led blinking (in a while cycle)<br>
            - task2 print a simple "hello world"<br>
            <br>
            I want "hello world" to be printed while led is blinking.
            How can I share CPU with these two tasks?<br>
            Shall I delete task at the end? Shall I define a semaphore?
            <br>
            I tried to modify task priority but it has no effects...<br>
            Even if led blinking (task 1) start, task 2 doesn't...  <br>
            <br>
            Hope now it's clearer...<br>
            <br>
                Luca<br>
            <br>
                <br>
            <br>
            Il 19/09/2012 17.18, Wendell Pereira da Silva ha scritto:<o:p></o:p></p>
        </div>
        <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Luca,</span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
              lang="EN-US">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).</span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
              lang="EN-US">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.</span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
              lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
              lang="EN-US">If you want your tasks sharing the CPU,
              please, check the tasks priority, attributes and execution
              mode.</span><o:p></o:p></p>
          <p class="MsoNormal" style="margin-left:6.75pt"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
              lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
              lang="EN-US">Probably task one has higher priority than
              task two, and task one never blocks.</span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
              lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
              lang="EN-US">A good reference is the <a
                moz-do-not-send="true"
href="http://www.rtems.org/onlinedocs/releases/rtemsdocs-4.10.2/share/rtems/pdf/c_user.pdf">RTEMS
                Users Guide</a>, topic 5.2.</span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
              lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
              lang="EN-US">Hope it helps.</span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
              lang="EN-US"> </span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
              lang="EN-US">--Wendell</span><o:p></o:p></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"
              lang="EN-US"> </span><o:p></o:p></p>
          <div>
            <div style="border:none;border-top:solid #B5C4DF
              1.0pt;padding:3.0pt 0cm 0cm 0cm">
              <p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">De:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">
                  <a moz-do-not-send="true"
                    href="mailto:rtems-users-bounces@rtems.org">rtems-users-bounces@rtems.org</a>
                  [<a moz-do-not-send="true"
                    href="mailto:rtems-users-bounces@rtems.org">mailto:rtems-users-bounces@rtems.org</a>]
                  <b>Em nome de </b>Luca Cinquepalmi<br>
                  <b>Enviada em:</b> quarta-feira, 19 de setembro de
                  2012 11:16<br>
                  <b>Para:</b> Joel Sherrill<br>
                  <b>Cc:</b> <a moz-do-not-send="true"
                    href="mailto:rtems-users@rtems.org">rtems-users@rtems.org</a><br>
                  <b>Assunto:</b> Re: testing multitasking rtems</span><o:p></o:p></p>
            </div>
          </div>
          <p class="MsoNormal"> <o:p></o:p></p>
          <div>
            <p class="MsoNormal">How can I run Two tasks in the same
              time? Evey task ends with delete_task so the next task
              starts<br>
              when the previous is finished. How can I make a second
              task running when task one is still running?<br>
              <br>
              Example:<br>
              <br>
              <span style="font-size:10.0pt">rtems_task
                Init(rtems_task_argument ignored)<br>
                {<br>
                    <br>
                    ...<br>
                    rtems_task_start(task_id1...)<br>
                    rtems_task_start(task_id2...)<br>
                    ...<br>
                }</span><br>
              <br>
              <br>
              I want that task 2 starts while task1 is still running?
              How can I do this?<br>
              Thank you<br>
              <br>
                  Luca<br>
              <br>
              <br>
              <br>
              Il 18/09/2012 13.12, Joel Sherrill ha scritto:<o:p></o:p></p>
          </div>
          <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
            <p class="MsoNormal">On 09/18/2012 06:07 AM, Luca
              Cinquepalmi wrote: <br>
              <br>
              <br>
              <o:p></o:p></p>
            <p class="MsoNormal">Hi all, <br>
              is there on line or in rtems documentaion any exmaple (c
              source code) of <br>
              how testing multitasking? <o:p></o:p></p>
            <p class="MsoNormal">Nearly every test is multitasking. All
              are if you consider there is <br>
              at least an application task/thread and an idle task. <br>
              <br>
              The most basic tests for a BSP are hello and ticker.
              Ticker has <br>
              3 user tasks which run at different intervals. <br>
              <br>
              <br>
              <o:p></o:p></p>
            <p class="MsoNormal">I'm not able to find any suggestion.
              Thank you <br>
              <br>
                    Luca <br>
              _______________________________________________ <br>
              rtems-users mailing list <br>
              <a moz-do-not-send="true"
                href="mailto:rtems-users@rtems.org">rtems-users@rtems.org</a>
              <br>
              <a moz-do-not-send="true"
                href="http://www.rtems.org/mailman/listinfo/rtems-users">http://www.rtems.org/mailman/listinfo/rtems-users</a>
              <o:p></o:p></p>
            <p class="MsoNormal" style="margin-bottom:12.0pt"> <o:p></o:p></p>
          </blockquote>
          <p class="MsoNormal"> <o:p></o:p></p>
        </blockquote>
        <p class="MsoNormal"><o:p> </o:p></p>
      </div>
    </blockquote>
    <br>
  </body>
</html>