This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/UCD3138: About softwear interrupt

Part Number: UCD3138


Tool/software: Code Composer Studio

Is the method of registering the software interrupt() in the interrupt vector(0x00000008) as follows?

#pragma INTERRUPT(software_interrupt,SWI)

void software_interrupt(UNIT32 arg1, UNIT32 arg2, UNIT32 arg3, UNIT8 swi_number)

{

~

}

  • I think that would be all you need if you were using the standard c_init code which comes with the ARM7 compiler.  However, we found that this code used too much program flash because it automatically included things like C++ constructors, and initialization for heap.  We have a cut down version of the initialization code as load.asm.  In load.asm, you will see a B _software_interrupt that ends up at location 8 and acts as the vector.  There's probably something similar in the default initialization.  

    You do still need the pragma, though.  

  •  Currently using the code of this URL.

          https://www.tij.co.jp/tool/jp/UCD3138FW-PSFB

    Does this code enable interrupts 25 and 27 of Interrupt Priority Table in interrupt.c?
    The following if statement is added. Once it was true. Has a diseneble interrupt ever worked?

        if((fir_index != 28) && (fir_index != 26))
        {
          ~
        }

  • If you look at init_timer_interrupt in the init_miscellaneous.c file, you will see the code for enabling the interrupts:

    disable_fast_interrupt(); //make sure fast interrupt is disabled
    disable_interrupt();
    write_firqpr (0x0A000000); //make them all irqs except FAULT_INT, DPWM2
    write_reqmask(0x0A020000); //enable FAULT_INT and PWM0_INT, DPWM2
    enable_interrupt();
    enable_fast_interrupt(); //make sure fast interrupt is enabled, enabled in Idle state

    Of course disenable interrupt works.

    You can either do it using the write_reqmask software interrupt, or you can disable the interrupt using the interrupt enable bits in the specific peripheral.

    Note that the bits in the interrupt request register cannot be cleared directly.  They just reflect the state of the bits in the specific peripherals.  You have to clear those bits to make the interrupt go away.