[ECOS] Interrupt handling and Device Drivers.

Satish Nayak nayak@sasi.com
Tue Apr 4 01:10:00 GMT 2000


I have following questions.

It was clear from the documentation that with every device driver there
exists an init function which possibly might do the following things :
1. Initialize the device
2. perform h/w setup
3 Create interrupt
4. Hook an interrupt handler.
and so on.

Is there any cleanup function associated with device driver ? How does
any device gets de-initialized ?

My second query is about interrupt handling.
When more than one isr exists for a given vector (I hope this is done
through interrupt chaining ), what part of the kernel code calls those
isrs? It is understandable that in vectors.s the IRQ handler will call
the first handler in the chain. Correct me if I am incorrect.

My third query is about the handling of IRQ exception handler.
During handling of IRQ I observed the following steps in vectors.s

1 In handle_IRQ_or_FIQ switch mode to supervisor and disable irq and
2 Switch the stack if required based on irq_level.
3 Lock the scheduler
4 Decode the interrupt source using hal_IRQ_handler.
5 Call the interrupt handler pertaining to the above decoded vector.
6 Call interrupt_end.

Now why do we need to disable the irq and fiq again before following two


 ldr lr,[ip,#armreg_lr]
 ldr sp,[sp,#armreg_sp]

Are not they disabled in step 1 above?

And next few instructions will bring the processor back into the IRQ

bic r0,r0,#CPSR_MODE_BITS
orr r0,r0,#CPSR_IRQ_MODE
msr cpsr,r0

Thanks In advance,

More information about the Ecos-discuss mailing list