[ECOS] AT91: FIQ patch proposal

Andrea Michelotti amichelotti@atmel.com
Wed Sep 15 12:49:00 GMT 2004


Thanks Andrew,
I missed to change CYGNUM_HAL_ISR_MIN in case of FIQ.
But I think the code
       if (irq_num < CYGNUM_HAL_ISR_MIN || irq_num > CYGNUM_HAL_ISR_MAX)
is wrong/unuseful to check spurius interrupts.
Because: irq_num is always a number between 0 (ISR return 0 when not IRQ)
and 31, almost all at91 portings don't have all irqs defined (I mean from
ISR_MIN to ISR_MAX), then I can't understand the utility of this check.
In the other hand  if we check only the condition irq_num == 0 we will
detect only spurious interrupts because an eventual fiq will be completly
handled by the code of the patch.

thanks

Andrea


> +#ifdef CYGHWR_HAL_ARM_AT91_FIQ
> +    cyg_uint32 ipr,imr;
> +    HAL_READ_UINT32(AT91_AIC+AT91_AIC_IPR, ipr);
> +    HAL_READ_UINT32(AT91_AIC+AT91_AIC_IMR, imr);
> +    if(imr&ipr&0x1){
> +      HAL_WRITE_UINT32(AT91_AIC+AT91_AIC_ICCR, 1);
> +      return CYGNUM_HAL_INTERRUPT_FIQ;
> +    }
> +#endif
>      // Calculate active interrupt (updates ISR)
>      HAL_READ_UINT32(AT91_AIC+AT91_AIC_IVR, ivr);
>
>      HAL_READ_UINT32(AT91_AIC+AT91_AIC_ISR, irq_num);
> -
> +
>      // No valid interrrupt source, treat as spurious interrupt
> -    if (irq_num < CYGNUM_HAL_ISR_MIN || irq_num > CYGNUM_HAL_ISR_MAX)
> +    // ISR return 0 in case of spurious interrupts,fiq or a valid IRQ
line betw
> een 1-31
> +    if (irq_num == 0)
>        irq_num = CYGNUM_HAL_INTERRUPT_NONE;
>
> I don't like this last part. Since the FIQ case is handled above,
> there should not be any need to change this.
>
> There is also another problem.
>
> void
> Cyg_Interrupt::attach(void)
> {
>     CYG_REPORT_FUNCTION();
>
>     CYG_ASSERT( vector >= CYGNUM_HAL_ISR_MIN, "Invalid vector");
>     CYG_ASSERT( vector <= CYGNUM_HAL_ISR_MAX, "Invalid vector");
>
> If CYGHWR_HAL_ARM_AT91_FIQ is enabled you need to set
> CYGNUM_HAL_ISR_MIN to zero or you will get assert failures when you
> install your interrupt handler.
>
>         Andrew
>


----------------------------------------------------------------------------
----


> -- 
> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list