Forum Discussion
Altera_Forum
Honored Contributor
15 years agoIntegrating a custom component in SOPC [+IRQ]
Hello i made a custom component and integrated it on SOPC, my problem is the IRQ signal... i am using Linux in my NIOS2 and i need to make a device driver to control my custom component, however i have no control signals like :
-enable_irq -irq_reg signal to clear when a irq happens and etc. The PIO has more signals than the IRQ Avalon interface... When i export my IRQ as a conduit in my custom component and then import it as an input std_logic port /PIO to the NIOS2 i have all these control registers... any suggestions?12 Replies
- Altera_Forum
Honored Contributor
Thanks for your help Daixiwen.
- Altera_Forum
Honored Contributor
Those functionalities (IRQ enable and clear) need to be done in your custom component, using additional registers. What I usually do in a custom component is to create two registers: a status register and a mask register.
Each bit in the status register represents an event that can trigger an interrupt. When the corresponding event occurs, the bit is set to '1' inside the component. The software can then read this status register to know what happened, and clear the status bits to say it has handled the event (write '1' to a bit to clear it). The mask register can be used to enable/disable the IRQ, and decide what events should trigger an interrupt. What I do is an AND between the mask and the status register, and activate the IRQ signal to the CPU if the result is non-zero. This is a pretty standard way of handling interrupts, but it needs to be done in each individual custom component.