<div dir="ltr">Ok thank you , <div><br></div><div>i succeeded to implement the interrupt on leon 3 ,thats what i added if some one want to update the rtems-irq.c in sample file and add also: </div><div><div>...</div><div>...</div><div>#elif defined(LEON3)</div><div><div>    *(unsigned long *) (0x80000240) = 0xc; // for leon 3</div><div>    *(unsigned long *) (0x80000208) = 0xc; // for leon 3 </div></div><div>#endif</div></div><div>...</div><div>...</div><div>in edition the printk instead of printf works for me either!</div><div><br></div><div><br></div><div>but still something missing for me and if some have an enswre it will be great , the question is why 0xc ?</div><div>i cant find anything that relate to the 0x12 (rtems_vector_number in the rtems_interrupt_catch ). </div><div><br></div><div>thanks again to all </div><div>Yaron</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 23, 2017 at 12:29 PM,  <span dir="ltr"><<a href="mailto:Jan.Sommer@dlr.de" target="_blank">Jan.Sommer@dlr.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Yaron,<br>
<span class=""><br>
> -----Original Message-----<br>
> From: users [mailto:<a href="mailto:users-bounces@rtems.org">users-bounces@rtems.<wbr>org</a>] On Behalf Of yaron o<br>
> Sent: Monday, October 23, 2017 10:21 AM<br>
> To: <a href="mailto:users@rtems.org">users@rtems.org</a><br>
> Subject: interrupt example leon3<br>
><br>
> Hello all<br>
><br>
> I want to add a new interrupt in my program , i check the rtems sample folder in<br>
> order to see how to add one ,i found the rtems-irq.c file and i did as the file says<br>
> but im using a leon 3 and theirs it says: error Example not intended for LEON3<br>
> CPU.<br>
> my question's are:<br>
> firs how to call an interrupt in leon3 after i put it inside the ISR table, (i know that<br>
> in some OS you just write asm {INT #} in order to invoke the interrupt).<br>
><br>
<br>
</span>In rtems the low level interrupts are handled by the OS and forwarded to the function you<br>
registered with rtems_interrupt_catch.<br>
<span class=""><br>
> second i need some explain for the lines :<br>
> *(unsigned long *) (0x80000090) = 0xc;<br>
><br>
> *(unsigned long *) (0x80000098) = 0xc;<br>
><br>
<br>
</span>Checking the processor manual of the Leon2 these appear to be the registers of the interrupt controller (interrupt mask and interrupt force register).<br>
You might have to setup the interrupt controller of your Leon3 in a similar manner for the example to work.<br>
<span class=""><br>
> in code below  because i don't quit understand it ( maybe it's invoke the interrupt<br>
> but how does it relate to the handleExternalIrq) .<br>
><br>
<br>
</span>As far as I see it first registers the function handleExternalIrq to the interrupts with id 0x12 and 0x13 using rtems_interrupt_catch.<br>
Then it enables those interrupts in the interrupt controller (write to 0x80000090).<br>
Finally it triggers the interrupts by writing to the interrupt force register (0x80000098).<br>
The interrupt should occur, being noticed by rtems and the handleExternalIrq-function should be called to handle the interrupt.<br>
I had some problems with calling printf from within ISRs. I would replace it with printk just to be sure.<br>
<br>
One hint regarding the Leon3: In the gr712rc user manual the interrupt numbers defined there are mapped in RTEMS to ids starting with 0x10 + irq#.<br>
Meaning e.g. the AHBSTAT interrupt (number #1) will have the id 0x11 in RTEMS and so on.<br>
<br>
Cheers,<br>
<br>
   Jan<br>
<div><div class="h5"><br>
> i add the rtems-irq.c bellow"<br>
> ------------------------------<wbr>------------------------------<wbr>--------------<br>
> #include <rtems.h><br>
> /* configuration information */<br>
><br>
> #define CONFIGURE_INIT<br>
><br>
> #include <bsp.h> /* for device driver prototypes */<br>
><br>
> rtems_task Init (rtems_task_argument argument); rtems_isr handleExternalIrq<br>
> (rtems_vector_number vector);<br>
><br>
> #define CONFIGURE_APPLICATION_NEEDS_<wbr>CONSOLE_DRIVER<br>
> #define CONFIGURE_APPLICATION_NEEDS_<wbr>CLOCK_DRIVER<br>
><br>
> #define CONFIGURE_MAXIMUM_TASKS             4<br>
><br>
> #define CONFIGURE_RTEMS_INIT_TASKS_<wbr>TABLE<br>
><br>
> #define CONFIGURE_EXTRA_TASK_STACKS         (3 *<br>
> RTEMS_MINIMUM_STACK_SIZE)<br>
><br>
> #include <rtems/confdefs.h><br>
><br>
> #include <stdlib.h><br>
> #include <stdio.h><br>
><br>
> rtems_task<br>
> Init<br>
> (<br>
>     rtems_task_argument argument<br>
> )<br>
> {<br>
>     rtems_status_code status;<br>
>     rtems_isr_entry old_handle;<br>
><br>
>     status = rtems_interrupt_catch (handleExternalIrq, 0x12, &old_handle);<br>
>     status = rtems_interrupt_catch (handleExternalIrq, 0x13, &old_handle);<br>
><br>
> #ifdef __erc32__<br>
>     *(unsigned long *) (0x1f8004c) = 0x7ff0;<br>
>     *(unsigned long *) (0x1f800d0) = 0x80000;<br>
>     *(unsigned long *) (0x1f80054) = 0x0c;<br>
> #elif defined(LEON2)<br>
>     *(unsigned long *) (0x80000090) = 0xc;<br>
>     *(unsigned long *) (0x80000098) = 0xc;<br>
> #elif defined(LEON3) #error Example<br>
> not intended for LEON3 CPU #endif<br>
>     exit(0);<br>
> }<br>
><br>
> rtems_isr<br>
> handleExternalIrq<br>
> (<br>
>     rtems_vector_number vector<br>
> )<br>
> {<br>
>     printf ("External interrupt received with vector 0x%x\n", vector); }<br>
><br>
><br>
> ------------------------------<wbr>------------------------------<wbr>----<br>
><br>
> thanks a lot for the helpers !<br>
><br>
> Yaron .<br>
><br>
><br>
><br>
> --<br>
</div></div>>  signature-<br>
> 1.gif<<a href="https://lh4.googleusercontent.com/MAmpk4C_PMWbT3zd0qdOSQrjc8Z10" rel="noreferrer" target="_blank">https://lh4.<wbr>googleusercontent.com/MAmpk4C_<wbr>PMWbT3zd0qdOSQrjc8Z10</a><br>
> rviGbNXOwcwHaQsEZMoMiIycSLYS_<wbr>mSXnOqfEy2QkNLP1y-0gO-<br>
> 6yHBGUZLK1jtiiU6IpMMOJT-<wbr>bAVizgbQcyOwKWpJ6DM5a1K9PnjXrk<wbr>v8><br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><span><br><div dir="ltr" style="margin-left:0pt"><table style="border:none;border-collapse:collapse"><colgroup><col width="278"><col width="322"></colgroup><tbody><tr style="height:0px"><td style="border-left:solid #000000 0px;border-right:solid #000000 1px;border-bottom:solid #000000 0px;border-top:solid #000000 0px;vertical-align:top;padding:7px 7px 7px 7px"><br><br><br><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:14.666666666666666px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap"><img src="https://lh5.googleusercontent.com/mvnvpjRk0V7YY2ytSv-y6263lhcKNN8mo7oZh_AmOWv25C_NiqCenkt7ocEc31sS5igDg-yAk3YHorpAjkJQ7JkO60P6hsHWQz0F-jSGGx-7BhPQOlGCz3n9WlLjbcK1-ob1cud2" width="257" height="83" style="border:none" alt="website-17_1.png"></span></p><br><br></td><td style="border-left:solid #000000 1px;border-right:solid #000000 0px;border-bottom:solid #000000 0px;border-top:solid #000000 0px;vertical-align:top;padding:7px 7px 7px 7px"><br><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:14.666666666666666px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">Yaron Oz </span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:14.666666666666666px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">R&D Software developer</span></p><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><a href="https://www.linkedin.com/profile/view?id=ADEAABf570IBz6vxnaUuFRd4vWcYkiAOQPP-fJc&authType=NAME_SEARCH&authToken=9WSX&locale=en_US&srchid=4022556821483907804041&srchindex=1&srchtotal=8&trk=vsrp_people_res_name&trkInfo=VSRPsearchId%3A4022556821483907804041%2CVSRPtargetId%3A402255682%2CVSRPcmpt%3Aprimary%2CVSRPnm%3Atrue%2CauthType%3ANAME_SEARCH" style="text-decoration:none" target="_blank"><span style="font-size:14.666666666666666px;font-family:Arial;color:rgb(17,85,204);background-color:transparent;text-decoration:underline;vertical-align:baseline;white-space:pre-wrap"><img src="https://lh3.googleusercontent.com/s-VhsIs-PkT0i_dQrS_MzL_uDcWgfuKpwDsJANnww6cCYwVnKnB1Abrlb4KcDjalz2AmFncLINk0iNwTWlqO9kdjjD0gGFKeajlkAFlablbShRQOYWcPiqT88Nryf6wIQRnKfL7q" width="44" height="44" style="border:none" alt="LinkedIn.png"></span></a></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13.333333333333332px;font-family:'Times New Roman';color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">Asher Space Research Institute</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13.333333333333332px;font-family:'Times New Roman';color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">Technion – Institute of Technology</span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13.333333333333332px;font-family:'Times New Roman';color:rgb(0,0,0);background-color:transparent;vertical-align:baseline;white-space:pre-wrap">Technion City, Haifa 32000, Israel</span></p><br><br></td></tr><tr style="height:27px"><td colspan="2" style="border-left:solid #000000 0px;border-right:solid #000000 0px;border-bottom:solid #000000 0px;border-top:solid #000000 0px;vertical-align:top;padding:7px 7px 7px 7px"><p dir="ltr" style="line-height:1.2;margin-top:0pt;margin-bottom:0pt"><span style="font-size:13.333333333333332px;font-family:'Courier New';color:rgb(34,139,34);background-color:transparent;font-weight:700;vertical-align:baseline;white-space:pre-wrap"><img src="https://lh4.googleusercontent.com/MAmpk4C_PMWbT3zd0qdOSQrjc8Z10rviGbNXOwcwHaQsEZMoMiIycSLYS_mSXnOqfEy2QkNLP1y-0gO-6yHBGUZLK1jtiiU6IpMMOJT-bAVizgbQcyOwKWpJ6DM5a1K9PnjXrkv8" width="384" height="20" style="border:none" alt="signature-1.gif"></span></p></td></tr></tbody></table></div></span></div></div></div></div>
</div>