[ECOS] Please clear me about ISR,DSR

m mariga ma_ariga@yahoo.co.jp
Sat Jan 23 00:25:00 GMT 2010


Hello,

I have ported eCos 3.0 into SH7705 target,and developing USB drivers.
But I am encountered a unclear question about interrup ISR/DSR,so would you 
please enlighten me.

SH7705's USB-module has Interrupt Status Register(IFR0) and Interrupt Enable 
Register(IER0).
When both bits are '1', generates Interrupt signal USI0.

First I coded ISR and DSR like (1) below.
In that case when I inserted USB cable into host PC, only ISR was breaked 
repeatedly and never entered DSR.
Next I deliberately added the codes to disable Interrupt signal like (2) 
below into ISR, then went to DSR after ISR.

My question is whether it is necessary I deliberately disable interrupt in 
ISR.
My image is that when ISR returned to VSR, then soon DSR is called so not 
necessary to disable Interrupt in ISR.
The point that is making the matter more fathomable is that when I developed 
ethernet ISR/DSR I did not need to disable interrupt in ISR.
I checked when cyg_drv_interrupt_mask is executed ,SR Register's mask bit4 
to bit7 became '1111'.

Would you please teach me what is right ?

Relating to the matter, I am perplexed to find two ways of returning ISR.
    return (CYG_ISR_HANDLED|CYG_ISR_CALL_DSR);
    return CYG_ISR_CALL_DSR;
Would you enlighten me the difference ?

--- (1) ISR,DSR not included deliberate disable
static cyg_uint32
usbs_sh7705mod_isr(cyg_vector_t vector, cyg_addrword_t data)
{
    CYG_ASSERT(SH7705MOD_IRQ_USB_SERVICE_REQUEST == vector, "USB ISR should 
only be invoked for USB interrupts" );
    CYG_ASSERT(0 == data, "The SH7705MOD USB ISR needs no global data 
pointer" );

    cyg_drv_interrupt_mask(SH7705MOD_IRQ_USB_SERVICE_REQUEST);
    cyg_drv_interrupt_acknowledge(SH7705MOD_IRQ_USB_SERVICE_REQUEST);

    return (CYG_ISR_HANDLED|CYG_ISR_CALL_DSR);
}

static void
usbs_sh7705mod_dsr(cyg_vector_t vector, cyg_ucount32 count, cyg_addrword_t 
data)
{
    CYG_ASSERT(SH7705MOD_IRQ_USB_SERVICE_REQUEST == vector, "USB DSR should 
only be invoked for USB interrupts" );
    CYG_ASSERT(0 == data, "The SH7705MOD USB DSR needs no global data 
pointer");

    BranchOfInt();

    // This unmask is likely to cause another interrupt immediately
    cyg_drv_interrupt_unmask(vector);
}
--- (1) end

--- (2) ISR include deliberate disabling
static cyg_uint32
usbs_sh7705mod_isr(cyg_vector_t vector, cyg_addrword_t data)
{
    CYG_ASSERT(SH7705MOD_IRQ_USB_SERVICE_REQUEST == vector, "USB ISR should 
only be invoked for USB interrupts" );
    CYG_ASSERT(0 == data, "The SH7705MOD USB ISR needs no global data 
pointer" );

 volatile char *ifr0=(char *)0xa4480018;
 volatile char *ier0=(char *)0xa4480034;
 char ifr0val;

 /* disable interrupt */
 ifr0val = *ifr0;
 *ier0 &= ~ifr0val;

    cyg_drv_interrupt_mask(SH7705MOD_IRQ_USB_SERVICE_REQUEST);
    cyg_drv_interrupt_acknowledge(SH7705MOD_IRQ_USB_SERVICE_REQUEST);

    return (CYG_ISR_HANDLED|CYG_ISR_CALL_DSR);
}

I am very much obliged your help.

m mariga




-- 
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