Re: Problems with pistachio

Ashford Nichols <[email protected]> Sat, 11 Jun 2011 15:35:55 -0700
Newsgroups gmane.comp.micro-kernel.l4.l4ka.general
Message-ID <[email protected]>
--001636e0ad6f30a1f804a5774f90
Content-Type: text/plain; charset=ISO-8859-1

sorry about the mistake, the slightly modified code has the error check, so
it looks like this:


> #include <l4io.h>
> #include <l4/ipc.h>
> #include <l4/schedule.h>
> #include <l4/thread.h>
>
> int main(int argc, char** argv){
> printf("application started\n");
>
           L4_MsgTag_t tag;

> L4_ThreadId_t root = L4_MyGlobalId(); //roottask
>  L4_ThreadId_t irq1 = L4_GlobalId(1, 1); //keyboard interrupt
> L4_Time_t one_sec = L4_TimePeriod(1000000);
>  L4_ThreadId_t from;
> L4_AssociateInterrupt(irq1, root);
> while(1){
>  L4_Wait(&from);
> if(from == irq1){
> printf("interrupt received\n");
>  L4_LoadMR(0, 0);
> tag= L4_Send(from, one_sec); //here I'm assuming that 1 second is enough
> time
>
                           if(L4_IpcFailed(tag)) printf("ipc failed\n");

>  }
> }
> return 0;
> }
>

--001636e0ad6f30a1f804a5774f90
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<div class=3D"gmail_quote"><div>sorry about the mistake, the slightly modif=
ied code has the error check, so it looks like this:</div><div>=A0</div><bl=
ockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #=
ccc solid;padding-left:1ex;">
<div><span style=3D"border-collapse:collapse;font-family:arial, sans-serif;=
font-size:13px"><div class=3D"im"><div><div>#include &lt;l4io.h&gt;</div><d=
iv>#include &lt;l4/ipc.h&gt;</div><div>#include &lt;l4/schedule.h&gt;</div>

<div>#include &lt;l4/thread.h&gt;</div><div><br></div><div>int main(int arg=
c, char** argv){</div><div><span style=3D"white-space:pre-wrap">	</span>pri=
ntf(&quot;application started\n&quot;);</div></div></div></span></div></blo=
ckquote>
<div>=A0 =A0 =A0 =A0 =A0 =A0L4_MsgTag_t tag;=A0</div><blockquote class=3D"g=
mail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-l=
eft:1ex;"><div><span style=3D"border-collapse:collapse;font-family:arial, s=
ans-serif;font-size:13px"><div class=3D"im">
<div><span style=3D"white-space:pre-wrap">	</span>L4_ThreadId_t root =3D L4=
_MyGlobalId(); //roottask</div>
<div><div><span style=3D"white-space:pre-wrap">	</span>L4_ThreadId_t irq1 =
=3D L4_GlobalId(1, 1); //keyboard interrupt</div></div><div><span style=3D"=
white-space:pre-wrap">	</span>L4_Time_t one_sec =3D L4_TimePeriod(1000000);=
</div>

<div><span style=3D"white-space:pre-wrap">	</span>L4_ThreadId_t from;</div>=
<div><div><span style=3D"white-space:pre-wrap">	</span>L4_AssociateInterrup=
t(irq1, root);</div><div><span style=3D"white-space:pre-wrap">	</span>while=
(1){</div>

</div><div><span style=3D"white-space:pre-wrap">		</span>L4_Wait(&amp;from)=
;</div><div><span style=3D"white-space:pre-wrap">		</span>if(from =3D=3D ir=
q1){</div><div><div><span style=3D"white-space:pre-wrap">			</span>printf(&=
quot;interrupt received\n&quot;);</div>

<div><span style=3D"white-space:pre-wrap">			</span>L4_LoadMR(0, 0);</div><=
/div></div><div class=3D"im"><div><span style=3D"white-space:pre-wrap">			t=
ag=3D </span>L4_Send(from, one_sec); //here I&#39;m assuming that 1 second =
is enough time</div>
</div></span></div></blockquote><div>=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0if(L4_IpcFailed(tag)) printf(&quot;ipc failed\n&quot;);=
=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;borde=
r-left:1px #ccc solid;padding-left:1ex;">
<div><span style=3D"border-collapse:collapse;font-family:arial, sans-serif;=
font-size:13px"><div class=3D"im"><div>
<span style=3D"white-space:pre-wrap">		</span>}</div><div><span style=3D"wh=
ite-space:pre-wrap">	</span>}</div></div><div><span style=3D"white-space:pr=
e-wrap">	</span>return 0;</div><div>}</div></span></div>
</blockquote></div><br>

--001636e0ad6f30a1f804a5774f90--