This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Triggering a SWI while in IRQ

Hello,

I need to force an OS context switch immediately after some IRQ is handled (power failure detection) - I cannot allow any other task to run after the IRQ except the highest priority task that is waiting for a signal. But I cannot allow the task that was interrupted to finish its time slice, thus I'm trying to induce a SWI by this code

VICSoftInt = (1<<4) ; // the constant used to address the proper hardware time is placed in "RTX_cofig.c"

However, I see that the IRQ is repeatably triggered (even if the matching register is reset!), and the SWI function is never executed (at least, in a test program that is running on the simulator). This is clearly something in the architecture (ARM7) I'm not aware of, but I did not find anything in the documentation prohibiting this. Can you enlighten me...?

Parents
  • Doesn't it work with a normal isr_xx() call to force a task switch?

    As soon as your ISR ends, the RTX will then do a timer tick interrupt, allowing it to switch to a high-prio task that doesn't give any CPU time to any other tasks.

    An alternative - if this is the end of the game for you - is to use the ISR to turn off interrupts (in case you allow nested interrupts) and then do what you need to do before the power is lost.

Reply
  • Doesn't it work with a normal isr_xx() call to force a task switch?

    As soon as your ISR ends, the RTX will then do a timer tick interrupt, allowing it to switch to a high-prio task that doesn't give any CPU time to any other tasks.

    An alternative - if this is the end of the game for you - is to use the ISR to turn off interrupts (in case you allow nested interrupts) and then do what you need to do before the power is lost.

Children