public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] contents of the table " hal_interrupt_handlers" arm7 processor
@ 2012-09-08 15:56 Bob Brusa
       [not found] ` <CAOHvnTPZN=0gjfMKaVz9HXHN1u9sXA0Nn-dqEY+SJT7dJjF5aQ@mail.gmail.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Bob Brusa @ 2012-09-08 15:56 UTC (permalink / raw)
  To: ecos discuss

Hi,
my program generates "spurious interrupts" from time to time. This is 
not surprising, because I have several threads that access the data that 
are also used by my pwm_isr. And all these data accesses are embedded 
between mask/unmask calls as shown below:

cyg_interrupt_mask(CYGNUM_HAL_INTERRUPT_PWMC);
....access here...
cyg_interrupt_unmask(CYGNUM_HAL_INTERRUPT_PWMC);

The hardware-manual tells me that under such conditions, spurious 
interrupts are likely to occure (and can thus not be avoided - except 
one sacrifices data integrity - which is of course an unacceptable choice)

ECOS has a feature which should handle such "spurious interrupts" 
correctly - simply write to eoi and exit - but it does not work

In vectors.S I find the sequence:
---------------------------------------------------------------------
         cmp     r0,#CYGNUM_HAL_INTERRUPT_NONE   // spurious interrupt
         bne     10f

#ifdef  CYGIMP_HAL_COMMON_INTERRUPTS_IGNORE_SPURIOUS
         // Acknowledge the interrupt
         THUMB_CALL(r1,12,hal_interrupt_acknowledge)
#else
         mov     r0,v6                   // register frame
         THUMB_CALL(r1,12,hal_spurious_IRQ)
#endif // CYGIMP_HAL_COMMON_INTERRUPTS_IGNORE_SPURIOUS
         b       spurious_IRQ

10:     ldr     r1,.hal_interrupt_data
         ldr     r1,[r1,v1,lsl #2]       // handler data
         ldr     r2,.hal_interrupt_handlers
         ldr     v3,[r2,v1,lsl #2]       // handler (indexed by vector #)
-----------------------------------------------------------------------
I find, that the jump bne 10f is always executed and subsequently, the 
correct handler is fetched from the table hal_interrupt_handlers. But 
hellas - when I get my "spurious interrupt" I find that the interrupt 
source is correct (10 for pwm), the datapointer however is zero und all 
entries in the hal_interrupt_handlers table are filled with the address 
of the hal_default_isr.

I would expect the table hal_interrupt_handlers to be initialized during 
system startup. But obviously, this assumption is wrong. Which part of 
eCOS (dynamically) modifies this table and why??
Thanks for help and advice....Bob

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [ECOS] contents of the table " hal_interrupt_handlers" arm7 processor
       [not found] ` <CAOHvnTPZN=0gjfMKaVz9HXHN1u9sXA0Nn-dqEY+SJT7dJjF5aQ@mail.gmail.com>
@ 2012-09-12 20:11   ` Michael Bergandi
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Bergandi @ 2012-09-12 20:11 UTC (permalink / raw)
  To: Bob Brusa; +Cc: ecos discuss

Bob,

> I find, that the jump bne 10f is always executed and subsequently, the
> correct handler is fetched from the table hal_interrupt_handlers. But hellas
> - when I get my "spurious interrupt" I find that the interrupt source is
> correct (10 for pwm), the datapointer however is zero und all entries in the
> hal_interrupt_handlers table are filled with the address of the
> hal_default_isr.

 This sounds like it is working correctly. An interrupt occurred, it found
 the handler and called it.



> I would expect the table hal_interrupt_handlers to be initialized during
> system startup. But obviously, this assumption is wrong. Which part of eCOS
> (dynamically) modifies this table and why??
> Thanks for help and advice....Bob

hal_interrupt_handers is initialized at startup with hal_default_isr (which
does nothing).

A driver using interrupts would create an ISR and DSR (if required) and call
cyg_drv_interrupt_create(). The handle returned by
cyg_drv_interrupt_create() would then be used in the call to
cyg_drv_interrupt_attach()  to attach the interrupt to the hardware vector
which places it in the hal_interrupt_handers table.

--
Mike



-- 
Mike

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-09-12 20:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-08 15:56 [ECOS] contents of the table " hal_interrupt_handlers" arm7 processor Bob Brusa
     [not found] ` <CAOHvnTPZN=0gjfMKaVz9HXHN1u9sXA0Nn-dqEY+SJT7dJjF5aQ@mail.gmail.com>
2012-09-12 20:11   ` Michael Bergandi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).