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

How do I disable interrupt (IRQ) on my Atmel SAM7X?

Hi.

How can I simply disable interrupts (IRQ) on my ATSAM7X application?
I simply want to prevent some critical HW-timing from beeing interrupted by "other stuff".
Something like:
...
disable_irq();
"PA1=0" // set 0 to a port
"do some time-consuming instruction to ensure a fixed duration"
"PA1=1" // set 1 to the port
enable_irq()

I tried to include "core_cm3.h" and use NVIC_DisableIRQ(1), but it gave me 30 ERRORS and messages like "...error: #1114: this feature not supported on target architecture/processor".

How can I simply disable/enable IRQ's for my SAM7X (which C-procedures to use)?
I'll appreciate comments to this isse.

Best Regards
Terje Bohler

Parents
  • ARM7 != Cortex-M3 (cm3), a thus isn't going to have an NVIC

    static __inline unsigned long disable_irq(void)
    {
      register unsigned long ret, rx;
      __asm
      {
        mrs ret, CPSR;
        orr rx, ret, #0x80;
        msr CPSR_c, rx
      }
      return ret;
    }
    
    
    static __inline unsigned long enable_irq(void)
    {
      register unsigned long ret, rx;
      __asm
      {
        mrs ret, CPSR;
        bic rx, ret, #0x80;
        msr CPSR_c, rx
      }
      return ret;
    }
    

Reply
  • ARM7 != Cortex-M3 (cm3), a thus isn't going to have an NVIC

    static __inline unsigned long disable_irq(void)
    {
      register unsigned long ret, rx;
      __asm
      {
        mrs ret, CPSR;
        orr rx, ret, #0x80;
        msr CPSR_c, rx
      }
      return ret;
    }
    
    
    static __inline unsigned long enable_irq(void)
    {
      register unsigned long ret, rx;
      __asm
      {
        mrs ret, CPSR;
        bic rx, ret, #0x80;
        msr CPSR_c, rx
      }
      return ret;
    }
    

Children
  • Thanks again Pier.

    It compiles OK, and the compiler does not give any Warnings either.
    But, a "yellow warning triangle" is shown to the left of the "__asm" statement in the C-code-window, and when my mouse hovers over it, the following text is shown:
    "warning: MS-style inline assembly is not supported".

    Hmmm... It sounds spooky...
    Should I simply disregard this message?
    Do you know what it means?

    Best Regards
    Terje Bohler