Interrupts Disabled After First Context Switch

Joel Sherrill <> joel.sherrill at
Thu Jan 5 16:20:00 UTC 2006

Kirspel, Kevin {Engineering - Osmetech CCD} wrote:
> Upon entering a task, the interrupts at the hardware level are enabled.
> After a call to rtems_task_wake_after() the interrupts are disabled and
> remain disabled while the task is running.  What part of the code should
> I look at to diagnose this issue? It seems that interrupts get disabled
> before the task switch is performed.
> The code sample below illustrates what I am doing. At the first
> printf(), the interrupts are enabled.  After the second printf(), the
> interrupts are disabled.
> rtems_task GUITask ( rtems_task_argument ignored )
> {
>   //Local Varaibles
>   rtems_interrupt_level level;
>   /* Wait 100ms til everyone is up and running */
>   rtems_interrupt_disable(level);
>   rtems_interrupt_enable(level);
>   printf( "\r\nINT BEFORE: %08lX", level );
>   rtems_task_wake_after( 10 );
>   rtems_interrupt_disable(level);
>   rtems_interrupt_enable(level);
>   printf ( "\r\nINT AFTER: %08lX", level );
> }

I have more questions than answers.

rtems_interrupt_enable/disable are implemented as inline assembly 
language routines.  They are port specific which leads to

(1) Which CPU are you using?

There is no guarantee on the contents of level after calling enable

(2) are you sure they are really off?

(3) can you print out the status register or whatever it is on this CPU 
and we really check?

> Kevin Kirspel
> Osmetech 
> 235 Hembree Park Drive
> Roswell GA, 30076
> 770-510-4444 x4568

Joel Sherrill, Ph.D.             Director of Research & Development
joel at                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
    Support Available             (256) 722-9985

More information about the users mailing list