This is the mail archive of the ecos-discuss@sourceware.cygnus.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Example ISR,DSR for ARM AEB-1


So, the creation of the ISR in the example you provide
below will not interfere with the other ISRs?
Maybe I'm confusing myself by reading the ARM chip
sheets, but don't all external interrupts cause the
same IRQ or FIQ to be activated?  And, then it's up
to the ISR to determine whether or not the external
interrupt was from ext0 or ext1 or whatever?  Maybe
the OS is doing more than I thought it was.
I thought I'd have to have my ISR poll the various
states to see if the reason for the interrupt was
ext0 and then somehow tell the OS to stage the DSR
for ext0.
If you can help clarify, it would be much appreciated.
I will try the code example, below.

Thanks,
keith

--- Jonathan Larmour <jlarmour@redhat.co.uk> wrote:
> k e wrote:
> > 
> > Can anyone recommend a source for a simple example
> > program for the AEB that shows how to create
> > an ISR and DSR?  I'd like to have a thread respond
> > to a low frequency external interrupt.  I'd like
> to
> > keep all of the other drivers on the board which
> > are being used by other threads running.  Is there
> > a means by which I can identify a specific
> external
> > interrupt to cause a specific DSR to be called
> > without having to figure out all of the other
> DSR's
> > that are being called by the default ISR?.
> > 
> > Here's the simple application that I'd like to
> code
> > up:
> >   external interrupt 0 (which is wired to a switch
> >      on the AEB-1) would cause a DSR that would
> toggle
> >      an LED.
> 
> I've attached something I quickly knocked up based
> on an old example of
> mine. I haven't compiled it, so expect any sort of
> problems with it :-).
> 
> It should give you an idea of what's going on.
> 
> Jifl
> -- 
> Red Hat, 35 Cambridge Place, Cambridge, UK. CB2 1NS 
> Tel: +44 (1223) 728762
> "Plan to be spontaneous tomorrow."  ||  These
> opinions are all my own fault> #include
<cyg/kernel/kapi.h>
> #include <stdio.h>
> #include <cyg/hal/hal_intr.h>
> 
> volatile int i=0;
> 
> /* this is the ISR for ext 0 interrupts */
> cyg_uint32 int_0_isr(cyg_vector_t vector,
> cyg_addrword_t data)
> {
>   /* ISRs must acknowledge the interrupt, or they
> might be invoked
>      again */
>   cyg_interrupt_acknowledge(vector);
>   return CYG_ISR_CALL_DSR;
> }
> 
> /* this is the DSR for ext 0 interrupts */
> void int_0_dsr(cyg_vector_t vector, cyg_ucount32
> count, cyg_addrword_t data)
> {
>     i += count;
> }
> 
> 
> 
> int main( int argc, char *argv[] )
> {
>   cyg_handle_t int_0_ISR_H;
>   cyg_interrupt intr;
>   int oldi = 0;
> 
>    /* create an interrupt handler with int_0_isr()
> as the ISR
>       and int_0_dsr() as the DSR. */
> 
>   cyg_interrupt_create(CYGNUM_HAL_INTERRUPT_EXT0, 0,
> 0, &int_0_isr, 
>                        &int_0_dsr, &int_0_ISR_H,
> &intr);
> 
>   cyg_interrupt_attach(int_0_ISR_H);
> 
> 
>   for (;;) {
>       if (i != oldi) {
>           printf("Now received %d interrupts\n", i);
>           oldi = i;
>       }
>   }
>   return 0;
> }
> 
__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]