<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Thank you Wendell, that's exactly what
      I mean. I have two question for you. <br>
      <b><br>
        1)</b> In<br>
      <br>
      <p class="MsoNormal"><b><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">rtems_task
            mytask(rtems_task_argument arg)<o:p></o:p></span></b></p>
      <p class="MsoNormal"><b><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">{<o:p></o:p></span></b></p>
      <p class="MsoNormal"><b><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">   struct
            complex_task_parameters* p;<o:p></o:p></span></b></p>
      <p class="MsoNormal"><b><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US"><o:p> </o:p></span></b></p>
      <p class="MsoNormal"><b><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">   p =
            (complex_task_parameters *)arg;<o:p></o:p></span></b></p>
      <p class="MsoNormal"><b><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US"><o:p> </o:p></span></b></p>
      <p class="MsoNormal"><b><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">   while(true)<o:p></o:p></span></b></p>
      <p class="MsoNormal"><b><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">   {<o:p></o:p></span></b></p>
      <p class="MsoNormal"><b><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">      //use parameters
            in p<o:p></o:p></span></b></p>
      <p class="MsoNormal"><b><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">      //....<o:p></o:p></span></b></p>
      <p class="MsoNormal"><b><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">   }<o:p></o:p></span></b></p>
      <b><span style="font-size:11.0pt;font-family:"Courier
          New";color:#1F497D" lang="EN-US">}</span></b><br>
      <br>
      I have a type error in <b><span
          style="font-size:11.0pt;font-family:"Courier
          New";color:#1F497D" lang="EN-US">p =
          (complex_task_parameters *)arg; <br>
        </span></b>Is complex_task_parameters type correct?<br>
      <br>
      <b>2)</b> How can I use parameters in while cycle? How can I refer
      to "foo" for example?<br>
      <br>
           Thanks a lot again!<br>
      <br>
          Luca<br>
      <br>
      <br>
      Il 17/09/2012 14.35, Wendell Pereira da Silva ha scritto:<br>
    </div>
    <blockquote
cite="mid:8F0C6606140B8146B6ABCC062597420101EDDE71FE2F@ADEXC07A.intranet.local"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <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;}
span.EstiloDeEmail17
        {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">Hi
            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">Mathew, please, may I post an example?<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>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">rtems_task
            mytask(rtems_task_argument arg);<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"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">struct
            complex_task_parameters<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">   uint32_t ui;  //
            first parameter...<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">   uint16_t usi; //
            second parameter...<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">   const char* foo; 
            // another parameter...<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">rtems_task
            Init(rtems_task_argument arg)<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_id tid;<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">   struct
            complex_task_parameters* p_task_param;<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">   // allocate and
            initialize parameters<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">   p_task_param =
            calloc(1, sizeof(*p_task_param));<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">   p_task_param->ui
            = 1;<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">  
            p_task_param->usi = 0x1000;<o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">  
            p_task_param->foo = "test...";<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">   // create the task
            as usual<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(..., &tid);<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">   // now pass the
            parameter to the task; <o:p></o:p></span></p>
        <p class="MsoNormal"><span
            style="font-size:11.0pt;font-family:"Courier
            New";color:#1F497D" lang="EN-US">   // use typecast to
            make the compiler happy.<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(tid, mytask,
            (rtems_task_argument)p_task_param);<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">}<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">rtems_task
            mytask(rtems_task_argument arg)<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">   struct
            complex_task_parameters* p;<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">   p =
            (complex_task_parameters *)arg;<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(true)<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">      //use parameters
            in p<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">}<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">Hope it helps.<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">--Wendell.<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">
                <a class="moz-txt-link-abbreviated" href="mailto:rtems-users-bounces@rtems.org">rtems-users-bounces@rtems.org</a>
                [<a class="moz-txt-link-freetext" 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> segunda-feira, 17 de setembro de 2012
                07:20<br>
                <b>Para:</b> Mathew Benson<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: passing parameters to task<o:p></o:p></span></p>
          </div>
        </div>
        <p class="MsoNormal"><o:p> </o:p></p>
        <div>
          <p class="MsoNormal">I understand your suggestion... is there
            any example I could view?<br>
            <br>
                Luca<br>
            <br>
            Il 17/09/2012 12.18, Mathew Benson ha scritto:<o:p></o:p></p>
        </div>
        <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
          <div>
            <p class="MsoNormal">The same way you would with a POSIX
              pthread create call.  Just malloc a struct with your
              multiple parameters, set your parameters, and pass the
              reference of your struct to the function.  In your task
              entry point, cast the argument to a pointer to your struct
              and pull your parameters out.<br>
              <br>
              Sent from my Amiga 1000<o:p></o:p></p>
          </div>
          <div>
            <p class="MsoNormal" style="margin-bottom:12.0pt"><br>
              On Sep 17, 2012, at 4:35 AM, Luca Cinquepalmi <<a
                moz-do-not-send="true"
                href="mailto:cinquepalmi@planetek.it">cinquepalmi@planetek.it</a>>
              wrote:<o:p></o:p></p>
          </div>
          <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
            <div>
              <p class="MsoNormal" style="margin-bottom:12.0pt">Hi all,<br>
                I would like to know if is it possible to pass more than
                one argument to a single task...<br>
                At the moment I only use this syntax when I define a
                task<br>
                <br>
                <b><span style="font-size:10.0pt">rtems_task
                    Test_task(rtems_task_argument unused)</span></b><br>
                <br>
                How can I declare and define a more parameters dependent
                task?<br>
                Thanks a lot.<br>
                <br>
                    Luca<br>
                <br>
                <br>
                <o:p></o:p></p>
            </div>
          </blockquote>
          <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
            <div>
              <p class="MsoNormal">_______________________________________________<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>
            </div>
          </blockquote>
        </blockquote>
        <p class="MsoNormal"><o:p> </o:p></p>
      </div>
    </blockquote>
    <br>
  </body>
</html>