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

FIQ intterupt Function

I want to write function for fiq interrupt on LPC2378,
Here the program which I have try to run. But it gives error.

void T0isr(void) __fiq //__irq
{

T0IR = 1; /* clear interrupt flag */

T0TCR = 0;

Enable_Timer1();

T0TCR = 1;

VICVectAddr=0xff;
}

void Timer0_Init(int interval)
{ /*Load prescaler for 1mSec*/

T0PR=PRESCALER; /** * T0TCR: Timer 0 Control Register * 2: reset counters (both timer and prescaler) **/

T0TCR=2; /* * interrupt and clear when counter=match */

T0MCR=3; /* * interrupt every ms */

T0MR0=interval;

/** * T0TCR: Timer 0 Control Register * 1: enable counting **/

T0TCR=1;

// VICVectAddr4= (unsigned)T0isr; // Set the timer ISR address
// VICVectCntl4= 0x00000020 | 4;

VICIntSelect = 0x00000010; VICIntEnable= 0x00000010;
}

this program give error

freq.c(184): error: #130: expected a "{"

This program is running for irq but not for fiq.......
If anyone know the method of writing a fiq ...
please reply to me

Parents
  • Hello Ani --,

    The address of the FIQ_Handler does not matter. But you need to store the FIQ_Handler address at the correct vector location. In the Keil examples this is done in the startup file LPC2300.s. Please see example below:

    Vectors         LDR     PC, Reset_Addr
                    LDR     PC, Undef_Addr
                    LDR     PC, SWI_Addr
                    LDR     PC, PAbt_Addr
                    LDR     PC, DAbt_Addr
                    NOP                            ; Reserved Vector
    ;               LDR     PC, IRQ_Addr
                    LDR     PC, [PC, #-0x0120]     ; Vector from VicVectAddr
                    LDR     PC, FIQ_Addr
    
    Reset_Addr      DCD     Reset_Handler
    Undef_Addr      DCD     Undef_Handler
    SWI_Addr        DCD     SWI_Handler
    PAbt_Addr       DCD     PAbt_Handler
    DAbt_Addr       DCD     DAbt_Handler
                    DCD     0                  ; Reserved Address
    IRQ_Addr        DCD     IRQ_Handler
    FIQ_Addr        DCD     FIQ_Handler
    
    
                            IMPORT  FIQ_Handler
    
    Undef_Handler   B       Undef_Handler
    SWI_Handler     B       SWI_Handler
    PAbt_Handler    B       PAbt_Handler
    DAbt_Handler    B       DAbt_Handler
    IRQ_Handler     B       IRQ_Handler
    ;FIQ_Handler    B       FIQ_Handler        ; see Handler code
    

    Please read also Chapter 6: LPC23XX Vectored Interrupt Controller (VIC) in user manual.

    There is written:
    If more than one request is assigned to FIQ, the VIC ORs the requests to produce the FIQ signal to the ARM processor. The fastest possible FIQ latency is chieved when only one request is classified as FIQ, because then the FIQ service routine can simply start dealing with that device. But if more than one request is assigned to the FIQ class, the FIQ service routine can read a word from the VIC that identifies which FIQ source(s) is (are) requesting an interrupt.

    Best Regards, Martin Guenther

Reply
  • Hello Ani --,

    The address of the FIQ_Handler does not matter. But you need to store the FIQ_Handler address at the correct vector location. In the Keil examples this is done in the startup file LPC2300.s. Please see example below:

    Vectors         LDR     PC, Reset_Addr
                    LDR     PC, Undef_Addr
                    LDR     PC, SWI_Addr
                    LDR     PC, PAbt_Addr
                    LDR     PC, DAbt_Addr
                    NOP                            ; Reserved Vector
    ;               LDR     PC, IRQ_Addr
                    LDR     PC, [PC, #-0x0120]     ; Vector from VicVectAddr
                    LDR     PC, FIQ_Addr
    
    Reset_Addr      DCD     Reset_Handler
    Undef_Addr      DCD     Undef_Handler
    SWI_Addr        DCD     SWI_Handler
    PAbt_Addr       DCD     PAbt_Handler
    DAbt_Addr       DCD     DAbt_Handler
                    DCD     0                  ; Reserved Address
    IRQ_Addr        DCD     IRQ_Handler
    FIQ_Addr        DCD     FIQ_Handler
    
    
                            IMPORT  FIQ_Handler
    
    Undef_Handler   B       Undef_Handler
    SWI_Handler     B       SWI_Handler
    PAbt_Handler    B       PAbt_Handler
    DAbt_Handler    B       DAbt_Handler
    IRQ_Handler     B       IRQ_Handler
    ;FIQ_Handler    B       FIQ_Handler        ; see Handler code
    

    Please read also Chapter 6: LPC23XX Vectored Interrupt Controller (VIC) in user manual.

    There is written:
    If more than one request is assigned to FIQ, the VIC ORs the requests to produce the FIQ signal to the ARM processor. The fastest possible FIQ latency is chieved when only one request is classified as FIQ, because then the FIQ service routine can simply start dealing with that device. But if more than one request is assigned to the FIQ class, the FIQ service routine can read a word from the VIC that identifies which FIQ source(s) is (are) requesting an interrupt.

    Best Regards, Martin Guenther

Children