Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
19 years ago

How to write HAL ISRs for custom components

Hi experts,

I created a custom component in the Component Editor and added it in a system containing only the Nios II and the component. I can write data from the Nios to my component; this is working. Now I want my component to interrupt the CPU so that it reads from the component.

How can I access the Nios registers containing the information about interrupts? I read in Ch. 5 of the Nios SW Handbook about developing HAL drivers but couldnt get any information on how to register an interrupt.

Any help or hints would be appreciated...

Thanks in advance!

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hello,

    I also encounter problems with hardware custom components interrupts. Could someone help us ?

    Thanks !

    Regards.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Basically, to register your ISR you do

    alt_irq_init // enable irqs in control register 3 (nios proc ref book, chapter 3)

    alt_irq_register // tie your ISR

    alt_irq_enable // enable your IRQ

    That should work.

    __________

    If you want to access CPU registers, you can use functions like:

    alt_irq_pending (or NIOS2_READ_IPENDING),

    alt_irq_enabled, alt_irq_enable, alt_irq_disable etc

    Check the alt_irq.h for the reference.

    Good luck