<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt"><div>Hi Jerry. Not at all! I have optimization switched off but if not the compiler could easily <span id="misspell-1" class=""><span>miss understand</span></span> the code and "optimize" it. I have changed the interrupt handler definition from "void UARTInterruptHandler ()" to "rtems_isrUARTInterruptHandler(rtems_vector_number vector)" and made some other operations inside, but painfully this didn't solve the problem either. <br><br>I am currently using RTEMS 4.10.2 with LEON3 BSP. Do you think its possible that the interrupt controller driver is masking out my own interrupt handler?<br><br>Alberto.<br><br>PS: thanks Jerry for all your help and thoughts ... I am pretty stuck right now.<br></div> <div><span><br></span></div><div><br></div>  <div style="font-family: HelveticaNeue, Helvetica Neue,
 Helvetica, Arial, Lucida Grande, sans-serif; font-size: 10pt;"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1">  <font face="Arial" size="2"> <b><span style="font-weight:bold;">De:</span></b> Needell Gerald <jerry.needell@unh.edu><br> <b><span style="font-weight: bold;">Para:</span></b> Alberto Parnaso <pafbat00@yahoo.es> <br><b><span style="font-weight: bold;">CC:</span></b> Jerry Needell <jerry.needell@unh.edu>; RTEMS Send User List <rtems-users@rtems.org> <br> <b><span style="font-weight: bold;">Enviado:</span></b> Lunes 7 de abril de 2014 15:00<br> <b><span style="font-weight: bold;">Asunto:</span></b> Re: Installing interrupts for a custom driver<br> </font> </div> <div class=""><br><div id="yiv0586823897"><div>Alberto,<div>Sorry. Looks like more incorrect advice from me. The generated code looks fine to me. I should know
 better than to blame the compiler ;-)</div><div>I don’t see any obvious reasons why this should not work.</div><div>What BSP are you using? What version of RTEMS?</div><div><br clear="none"></div><div>- Jerry</div><div><br clear="none"></div><div class="" id="yiv0586823897yqt36711"><div> <br clear="none"><div><div>On Apr 7, 2014, at 7:49 AM, Needell Gerald <<a rel="nofollow" shape="rect" ymailto="mailto:jerry.needell@unh.edu" target="_blank" href="mailto:jerry.needell@unh.edu">jerry.needell@unh.edu</a>> wrote:</div><br class="" clear="none"><blockquote type="cite"></blockquote></div></div></div></div><div class="" id="yiv0586823897yqt99422"><div><div style="word-wrap:break-word;">Alberto,<div>One minor thing. </div><div>Your interrupt handler should begin:</div><div><div style="margin:0px;font-size:11px;font-family:Menlo;">rtems_isr UARTInterruptHandler(rtems_vector_number vector)</div><div
 style="margin:0px;font-size:11px;font-family:Menlo;">This is how RTEMS will call it.</div><div style="margin:0px;font-size:11px;font-family:Menlo;"><br clear="none"></div><div style="margin:0px;font-size:11px;font-family:Menlo;">Just a thought,</div><div style="margin:0px;font-size:11px;font-family:Menlo;">I wonder if you are having a problem since the compiler sees the global uc_intr_flag set to 0 then tested against ==1 without being accessed it may be “helping” you by not actually executing the loop as you have it written. You may want to examine the generated code to be sure it is doing what you think.</div><div style="margin:0px;font-size:11px;font-family:Menlo;"><br clear="none"></div><div style="margin:0px;font-size:11px;font-family:Menlo;">Try just incrementing a counter in your ISR and see if it gets incremented in your while(1) loop.</div><div style="margin:0px;font-size:11px;font-family:Menlo;"><br clear="none"></div><div
 style="margin:0px;font-size:11px;font-family:Menlo;"><br clear="none"></div><div style="margin:0px;font-size:11px;font-family:Menlo;"><br clear="none"></div><div style="margin:0px;font-size:11px;font-family:Menlo;">- Jerry</div><div><div>On Apr 7, 2014, at 6:58 AM, Alberto Parnaso <<a rel="nofollow" shape="rect" ymailto="mailto:pafbat00@yahoo.es" target="_blank" href="mailto:pafbat00@yahoo.es">pafbat00@yahoo.es</a>> wrote:</div><br class="" clear="none"><blockquote type="cite"><div style="background-color:rgb(255, 255, 255);font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:10pt;"><div>I have tried the set_vector functions and didn't work either. I though that Driver Manager may be interfering with the interrupt controller driver and I decided to avoid it by "#undef RTEMS_DRVMGR_STARTUP" and see if my handler was being called, but nothing at all. Then I wanted to know if the interrupt was being
 signaled in the interrupt controller so I went to the IRQ Pending register of the GAISLER_IRQMPIP Core, and as soon as I introduce any character from external terminal towards the APBUART, the Interrupt is shown in the register, but my handler is never called. <br clear="none"><br clear="none">It is quite disappointing, I have to say. Installing an interrupt should be something easy to do, or at least it has been when working with other OS ... I don't know. Any help will be
 welcome.<br clear="none"><br clear="none">Alberto.<br clear="none"></div> <div><span><br clear="none"></span></div><div><br clear="none"></div>  <div style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt;"> <div style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt;"> <div dir="ltr"> <hr size="1">  <font face="Arial" size="2"> <b><span style="font-weight:bold;">De:</span></b> Needell Gerald <<a rel="nofollow" shape="rect" ymailto="mailto:jerry.needell@unh.edu" target="_blank" href="mailto:jerry.needell@unh.edu">jerry.needell@unh.edu</a>><br clear="none"> <b><span style="font-weight:bold;">Para:</span></b> Alberto Parnaso <<a rel="nofollow" shape="rect" ymailto="mailto:pafbat00@yahoo.es" target="_blank" href="mailto:pafbat00@yahoo.es">pafbat00@yahoo.es</a>> <br clear="none"><b><span style="font-weight:bold;">CC:</span></b> Needell
 Gerald (Jerry) <<a rel="nofollow" shape="rect" ymailto="mailto:jerry.needell@unh.edu" target="_blank" href="mailto:jerry.needell@unh.edu">jerry.needell@unh.edu</a>>; RTEMS Send User List <<a rel="nofollow" shape="rect" ymailto="mailto:rtems-users@rtems.org" target="_blank" href="mailto:rtems-users@rtems.org">rtems-users@rtems.org</a>> <br clear="none"> <b><span style="font-weight:bold;">Enviado:</span></b> Viernes 4 de abril de 2014 18:09<br clear="none"> <b><span style="font-weight:bold;">Asunto:</span></b> Re: Installing interrupts for a custom driver<br clear="none"> </font>
 </div> <div class=""><br clear="none"><div id="yiv0586823897"><div>You should be able to just call:<div><span style="font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;background-color:rgb(255, 255, 255);">old_handler = setvector(</span><span style="font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;background-color:rgb(255, 255, 255);">(rtems_isr_entry)UARTInterruptHandler,</span><span style="font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;background-color:rgb(255, 255, 255);"> (rtems_vector_number)3, 1</span><span style="font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:13px;background-color:rgb(255, 255, 255);">);</span></div><div class="" id="yiv0586823897yqt62865"><font face="HelveticaNeue, Helvetica  Neue, Helvetica, Arial,
 Lucida Grande, sans-serif"><span style="font-size:13px;background-color:rgb(255, 255, 255);"><br clear="none"></span></font><div><div>On Apr 4, 2014, at 11:37 AM, Needell Gerald <<a rel="nofollow" shape="rect" ymailto="mailto:jerry.needell@unh.edu" target="_blank" href="mailto:jerry.needell@unh.edu">jerry.needell@unh.edu</a>> wrote:</div><br class="" clear="none"><blockquote type="cite"></blockquote></div></div></div><div class="" id="yiv0586823897yqt93869"><div><div>Alberto,</div><div>No. My suggestion is to use the rtems_interrupt_catch but then enable the interrupt as in the example .</div><div>-Jerry </div><div><br clear="none">On Apr 4, 2014, at 11:33, Alberto Parnaso <<a rel="nofollow" shape="rect" ymailto="mailto:pafbat00@yahoo.es" target="_blank" href="mailto:pafbat00@yahoo.es">pafbat00@yahoo.es</a>> wrote:<br clear="none"><br clear="none"></div><blockquote type="cite"><div style="background-color:rgb(255, 255,
 255);font-family:HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;font-size:10pt;"><div><span></span></div><div>Hi Jerry, thank you very much for your response. If I have understand correctly I may have to install the interrupt not with "rtems_interrupt_catch" but using "_CPU_ISR_install_raw_handler". Is that correct? I am out of work now but I will test it on Monday and come back with the results. Thanks indeed!</div><div><br clear="none"></div><div>Alberto.<br clear="none"></div>  <div style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt;"> <div style="font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12pt;"> <div dir="ltr"> <div class="" style="margin:5px 0px;padding:0px;border:1px solid rgb(204, 204, 204);height:0px;line-height:0;font-size:0px;"></div>  <font face="Arial" size="2"> <b><span
 style="font-weight:bold;">De:</span></b> Needell Gerald <<a rel="nofollow" shape="rect" ymailto="mailto:jerry.needell@unh.edu" target="_blank" href="mailto:jerry.needell@unh.edu">jerry.needell@unh.edu</a>><br clear="none"> <b><span style="font-weight:bold;">Para:</span></b> Alberto Parnaso <<a rel="nofollow" shape="rect" ymailto="mailto:pafbat00@yahoo.es" target="_blank" href="mailto:pafbat00@yahoo.es">pafbat00@yahoo.es</a>> <br clear="none"><b><span style="font-weight:bold;">CC:</span></b> Jerry Needell <<a rel="nofollow" shape="rect" ymailto="mailto:jerry.needell@unh.edu" target="_blank" href="mailto:jerry.needell@unh.edu">jerry.needell@unh.edu</a>>; RTEMS Send User List <<a rel="nofollow" shape="rect" ymailto="mailto:rtems-users@rtems.org" target="_blank" href="mailto:rtems-users@rtems.org">rtems-users@rtems.org</a>> <br clear="none"> <b><span style="font-weight:bold;">Enviado:</span></b>
 Viernes 4 de abril de 2014 16:25<br clear="none"> <b><span style="font-weight:bold;">Asunto:</span></b> Re: Installing interrupts for a custom driver<br clear="none"> </font> </div> <div class=""><br clear="none"><div id="yiv0586823897"><div>Alberto,<div>This may not have been correct- Take a look at the     <span style="font-family:Menlo;font-size:11px;">c/src/lib/libbsp/sparc/leon3/startup/</span>setec.c function from the LEON3 BSP (RTEMS 4.9.2) - attached:</div><div>After calling
 rtems_catch_interrupt the LEON3 interrupt is then enabled - I install my handlers as a type=1  RTEMS interrupt.</div><div><br clear="none"></div><div>I hope that helps</div><div>- Jerry</div><div><br clear="none"></div><div><div style="margin:0px;font-family:Menlo;font-size:11px;">/*  set_vector</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *  This routine installs an interrupt vector on the SPARC simulator.</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *  INPUT PARAMETERS:</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *    handler - interrupt handler entry point</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *   
 vector  - vector
 number</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *    type    - 0 indicates raw hardware connect</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *              1 indicates RTEMS interrupt connect</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *  OUTPUT PARAMETERS:  NONE</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *  RETURNS:</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *    address of previous interrupt handler</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *  COPYRIGHT (c)
 1989-1998.</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *  On-Line Applications Research Corporation (OAR).</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *  The license and distribution terms for this file may be</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *  found in the file LICENSE in this distribution or at</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *  <a rel="nofollow" shape="rect" target="_blank" href="http://www.rtems.com/license/LICENSE">http://www.rtems.com/license/LICENSE</a>.</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *  Ported to LEON implementation of the SPARC by On-Line
 Applications</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *  Research Corporation (OAR) under contract to the European Space </div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *  Agency (ESA).</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *  LEON modifications of respective RTEMS file: COPYRIGHT (c) 1995. </div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *  European Space Agency.</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> *  $Id: setvec.c,v 1.2 2006/01/09 10:41:21 ralf Exp $</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> */</div><div style="margin:0px;font-family:Menlo;font-size:11px;min-height:13px;"><br clear="none"></div><div
 style="margin:0px;font-family:Menlo;font-size:11px;">#include <bsp.h></div><div style="margin:0px;font-family:Menlo;font-size:11px;min-height:13px;"><br clear="none"></div><div style="margin:0px;font-family:Menlo;font-size:11px;">rtems_isr_entry set_vector(                   /* returns old vector */</div><div style="margin:0px;font-family:Menlo;font-size:11px;">  rtems_isr_entry     handler,                /* isr routine        */</div><div style="margin:0px;font-family:Menlo;font-size:11px;">  rtems_vector_number vector,                 /* vector number      */</div><div style="margin:0px;font-family:Menlo;font-size:11px;">  int                 type               
     /* RTEMS or RAW intr  */</div><div style="margin:0px;font-family:Menlo;font-size:11px;">)</div><div style="margin:0px;font-family:Menlo;font-size:11px;">{</div><div style="margin:0px;font-family:Menlo;font-size:11px;">  rtems_isr_entry previous_isr;</div><div style="margin:0px;font-family:Menlo;font-size:11px;">  uint32_t      real_trap;</div><div style="margin:0px;font-family:Menlo;font-size:11px;">  uint32_t      source;</div><div style="margin:0px;font-family:Menlo;font-size:11px;min-height:13px;"><br clear="none"></div><div style="margin:0px;font-family:Menlo;font-size:11px;">  if ( type )</div><div style="margin:0px;font-family:Menlo;font-size:11px;">    rtems_interrupt_catch( handler, vector, &previous_isr );</div><div style="margin:0px;font-family:Menlo;font-size:11px;"> 
 else </div><div style="margin:0px;font-family:Menlo;font-size:11px;">    _CPU_ISR_install_raw_handler( vector, handler, (void *)&previous_isr );</div><div style="margin:0px;font-family:Menlo;font-size:11px;min-height:13px;"><br clear="none"></div><div style="margin:0px;font-family:Menlo;font-size:11px;">  real_trap = SPARC_REAL_TRAP_NUMBER( vector );</div><div style="margin:0px;font-family:Menlo;font-size:11px;min-height:13px;"><br clear="none"></div><div style="margin:0px;font-family:Menlo;font-size:11px;">  if ( LEON_INT_TRAP( real_trap ) ) {</div><div style="margin:0px;font-family:Menlo;font-size:11px;min-height:13px;">    <br class="" clear="none"></div><div style="margin:0px;font-family:Menlo;font-size:11px;">    source = LEON_TRAP_SOURCE( real_trap );</div><div style="margin:0px;font-family:Menlo;font-size:11px;min-height:13px;"><br clear="none"></div><div
 style="margin:0px;font-family:Menlo;font-size:11px;">    LEON_Clear_interrupt( source );</div><div style="margin:0px;font-family:Menlo;font-size:11px;">    LEON_Unmask_interrupt( source );</div><div style="margin:0px;font-family:Menlo;font-size:11px;">  }</div><div style="margin:0px;font-family:Menlo;font-size:11px;min-height:13px;"><br clear="none"></div><div style="margin:0px;font-family:Menlo;font-size:11px;">  return previous_isr;</div><div style="margin:0px;font-family:Menlo;font-size:11px;">}</div><div style="margin:0px;font-family:Menlo;font-size:11px;min-height:13px;"><br clear="none"></div><div class="" id="yiv0586823897yqt21097"><div>On Apr 4, 2014, at 9:33 AM, Needell Gerald <<a rel="nofollow" shape="rect" ymailto="mailto:jerry.needell@unh.edu" target="_blank" href="mailto:jerry.needell@unh.edu">jerry.needell@unh.edu</a>> wrote:</div><br class="" clear="none"><blockquote
 type="cite"></blockquote></div></div></div><div class="" id="yiv0586823897yqt79739"><div style="">Alberto,<div>If I recall correctly, rtems_interrupt_catch  installs the new interrupt handler, but does not enable it. You will also need to call rtems_interrupt_enable.</div><div>Good luck!</div><div>Jerry</div><div><br clear="none"><div><div>On Apr 4, 2014, at 9:12 AM, Alberto Parnaso <<a rel="nofollow" shape="rect" ymailto="mailto:pafbat00@yahoo.es" target="_blank" href="mailto:pafbat00@yahoo.es">pafbat00@yahoo.es</a>> wrote:</div><br class="" clear="none"><blockquote type="cite"><div><div style="font-family:HelveticaNeue,;"><div class=""><div id="yiv0586823897"><div style="font-family:HelveticaNeue,;"><div class=""><div id="yiv0586823897"><div style="font-family:HelveticaNeue,;"><div class=""> <div class=""><div id="yiv0586823897"><div style="font-family:HelveticaNeue,;">Hi,
 I am newbie in RTEMS and I am trying to install an interrupt into the 
interrupt controller to be capable of using an APBUART peripheral within
 a LEON3 based embedded processor. I configure the system so driver 
manager configures at BSP Start the console and the timer. I do have two
 APBUART configured in the system and my intention is to use the first 
one with console/termios driver and the second one with my own driver. 
Here is a copy the output of "info sys" command:<br clear="none"><br clear="none"><br clear="none"><div><<</div><div>grmon2> info sys<br clear="none">          cpu0          Aeroflex Gaisler  LEON3 SPARC V8 Processor    <br clear="none">                  AHB Master
 0<br clear="none">          ahbjtag0  Aeroflex Gaisler  JTAG Debug Link    <br clear="none">                      AHB Master 1<br clear="none">          mctrl0    European Space Agency  LEON2 Memory Controller    <br clear="none">                      AHB: 00000000 - 20000000<br clear="none">                      AHB: 20000000 - 40000000<br clear="none">                      AHB: 40000000 - 80000000<br clear="none">       
               APB: 80000000 -
 80000100<br clear="none">                      32-bit prom @ 0x00000000<br clear="none">                      32-bit static ram: 2 * 512 kbyte @ 0x40000000<br clear="none">          apbmst0   Aeroflex Gaisler  AHB/APB Bridge    <br clear="none">                  AHB: 80000000 - 80100000<br clear="none">          dsu0      Aeroflex Gaisler  LEON3 Debug Support Unit    <br clear="none">                   AHB: 90000000 - A0000000<br clear="none">       
   CPU0:  win 8, hwbp 2, V8 mul/div, lddel 1, GRFPU-lite<br clear="none">   
               stack pointer 0x400ffff0<br clear="none">                          icache 1 * 4 kB, 32 B/line <br clear="none">                  dcache 1 * 4 kB, 32 B/line <br clear="none">          uart0        Aeroflex Gaisler  Generic UART    <br clear="none">                  APB: 80000100 - 80000200<br clear="none">                  IRQ: 2<br clear="none">                  Baudrate 38343<br
 clear="none">          irqmp0    Aeroflex Gaisler  Multi-processor
 Interrupt Ctrl.    <br clear="none">                  APB: 80000200 - 80000300<br clear="none">          gptimer0  Aeroflex Gaisler  Modular Timer Unit    <br clear="none">                  APB: 80000300 - 80000400<br clear="none">                  IRQ: 8<br clear="none">                  8-bit scalar, 2 * 32-bit timers, divisor 50<br clear="none">          uart1     Aeroflex Gaisler  Generic UART    <br clear="none">                  APB: 80000900 - 80000A00<br
 clear="none">                 
 IRQ: 3<br clear="none">                  Baudrate 38343<br clear="none">          gpio0     Aeroflex Gaisler  General Purpose I/O port    <br clear="none">                  APB: 80000B00 - 80000C00</div><div style="font-family:HelveticaNeue,;">>><br clear="none"></div><div><br clear="none"></div><div style="font-family:HelveticaNeue,;">I
 have wrote a testing app to check if both UARTs work and also to try to
 install a handler for RX on the second UART. Here is my code:</div><div style="font-family:HelveticaNeue,;"><br clear="none"></div><div style="font-family:HelveticaNeue,;"><<</div><div style="font-family:HelveticaNeue,;">#include <rtems.h><br clear="none"><br clear="none">rtems_task Init( rtems_task_argument argument);    /* forward declaration needed */<br clear="none"><br clear="none">/* configuration information */<br clear="none">#define CONFIGURE_INIT<br clear="none">#include <bsp.h> /* for device driver prototypes
 */<br clear="none"><br clear="none"><br clear="none">#define
 CONFIGURE_RTEMS_INIT_TASKS_TABLE<br clear="none">#define
 CONFIGURE_MAXIMUM_TASKS             4<br clear="none">#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER<br clear="none">#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER<br clear="none">#include <rtems/confdefs.h><br clear="none"><br clear="none">#include <stdio.h><br clear="none">#include <stdlib.h><br clear="none"><br clear="none">#include <sys/types.h><br clear="none">#include <sys/stat.h><br clear="none">#include <unistd.h><br clear="none">#include <errno.h><br clear="none">#include <apbuart.h><br clear="none"><br clear="none">// Global Variable to check if Interrupt has been signaled.<br clear="none">unsigned char uc_intr_flag;<br clear="none"><br clear="none">// Interrupt handler for APBUART peripheral <br clear="none">void UARTInterruptHandler ()<br clear="none">{<br clear="none">    uc_intr_flag = 1;<br clear="none">}<br
 clear="none"><br clear="none">rtems_task Init (rtems_task_argument ignored)<br clear="none">{<br clear="none"><br clear="none">    int i;<br clear="none">    rtems_status_code ret_status;<br clear="none">    rtems_isr_entry old_handler;<br clear="none">    volatile int *apbuart1 =
 (int*)0x80000900;<br clear="none">    volatile int aux;<br clear="none"><br clear="none">    // Reset Interrupt Flag<br clear="none">    uc_intr_flag = 0;<br clear="none"><br clear="none">    printf("APB UART TEST with Interrupts\n");<br clear="none"><br clear="none">    aux = apbuart1[1];<br clear="none">    printf("APBUART1 STATUS: 0x%08X\n", aux);<br clear="none">    aux = apbuart1[2];<br clear="none">    printf("APBUART1 CONTROL: 0x%08X\n", aux);<br clear="none">    <br clear="none">    // Install UARTInterruptHandler at vector number 3 <br clear="none">    ret_status = rtems_interrupt_catch(<br clear="none">            (rtems_isr_entry)UARTInterruptHandler,<br clear="none">           
 (rtems_vector_number)3,<br clear="none">            &old_handler);<br clear="none">    switch (ret_status)<br clear="none">    {<br clear="none">   
        case RTEMS_SUCCESSFUL :<br clear="none">              printf("rtems_interrupt_catch: OK. New Interrupt installed for IRQ 3 - APBUART 2.\n");<br clear="none">          break ;<br clear="none"><br clear="none">           case RTEMS_INVALID_NUMBER :<br clear="none">              printf("rtems_interrupt_catch: RTEMS_INVALID_NUMBER.\n");<br clear="none">              break ;<br clear="none"><br clear="none">           case RTEMS_INVALID_ADDRESS :<br clear="none">               printf("rtems_interrupt_catch: RTEMS_INVALID_ADDRESS.\n");<br clear="none">   
            break ;<br clear="none"><br clear="none">        default
 :<br clear="none">              printf("rtems_interrupt_catch: Unknown error.\n");<br clear="none">              break ;<br clear="none">    }<br clear="none"><br clear="none">    // Tell uart hardware to initialize directly<br clear="none">    /* Enable receiver (with interrupts) & Transmitter */<br clear="none">    apbuart1[2] = APBUART_CTRL_RE | APBUART_CTRL_TE | APBUART_CTRL_RI;<br clear="none">    aux = apbuart1[1];<br clear="none">    printf("UART1 STATUS: 0x%02X\n", aux);<br clear="none">    aux = apbuart1[2];<br clear="none">    printf("UART1 CONTROL: 0x%08X\n", aux);<br clear="none"><br clear="none">    // Write a character though APBUART1 to test it<br clear="none">    apbuart1[0] =
 0xD8;<br clear="none"><br clear="none">    while (1)<br clear="none">    {       // Perform some active wait time<br clear="none">        for (i
 = 2000000; i > 0; i--);<br clear="none"><br clear="none">        printf("Hello World\n");<br clear="none">        apbuart1[0] = 0xD8;<br clear="none">        // If interrupt received, read from APBUART<br clear="none">        if (uc_intr_flag == 1)<br clear="none">        {<br clear="none">            uc_intr_flag = 0;<br clear="none">            aux = apbuart1[0];<br clear="none">            printf("Interrupt received from UART: data = %X\n", aux);<br clear="none">        }<br clear="none">    }<br clear="none"><br clear="none">    exit (0);<br clear="none">}<br clear="none">>></div><div
 style="font-family:HelveticaNeue,;"><br clear="none"></div><div style="font-family:HelveticaNeue,;">First
 UART (ie. debug UART) works fine and output data through STDOUT 
properly. Data sent through second UART is received also by another 
external terminal, and in other test I have been capable of receiving 
too. However UARTInterruptHandler is never signaled, thus I guess I am 
missing something with the interrupt instalation. <br clear="none"></div><div style="font-family:HelveticaNeue,;"><br clear="none"></div><div style="font-family:HelveticaNeue,;">Could any one see anything missing in this code? I
 would very much appreciate some help. Any clue on how to properly use interrupts will help me a lot!</div><div style="font-family:HelveticaNeue,;"><br clear="none"></div><div style="font-family:HelveticaNeue,;">Thanks!</div><div style="font-family:HelveticaNeue,;">Alberto.<br clear="none"></div></div></div></div>   </div> 
 </div></div></div></div></div></div><div><br clear="none"></div></div></div>_______________________________________________<br clear="none">rtems-users mailing list<br clear="none"><a rel="nofollow" shape="rect" ymailto="mailto:rtems-users@rtems.org" target="_blank" href="mailto:rtems-users@rtems.org">rtems-users@rtems.org</a><br clear="none"><a rel="nofollow" shape="rect" target="_blank" href="http://www.rtems.org/mailman/listinfo/rtems-users">http://www.rtems.org/mailman/listinfo/rtems-users</a><br clear="none"></blockquote></div><br clear="none"></div></div><br clear="none"></div></div><br clear="none"><br clear="none"></div> </div> </div>  </div></blockquote></div>_______________________________________________<br clear="none">rtems-users mailing list<br clear="none"><a rel="nofollow" shape="rect" ymailto="mailto:rtems-users@rtems.org" target="_blank" href="mailto:rtems-users@rtems.org">rtems-users@rtems.org</a><br clear="none"><a rel="nofollow"
 shape="rect" target="_blank" href="http://www.rtems.org/mailman/listinfo/rtems-users">http://www.rtems.org/mailman/listinfo/rtems-users</a><br clear="none"><br clear="none"></div></div><br clear="none"><br clear="none"></div> </div> </div>  </div></blockquote></div><br clear="none"></div></div><br clear="none"></div></div></div><br><br></div> </div> </div>  </div></body></html>