Forum Discussion

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

enhanced API + alt_ic_isr_register() function

Hello all,

I'm working on the cyclone IV GX dev board and using Quartus v11.1 sp2. For my project, I have to use interruptions. I'm using the internal interrupt controller of the NIOSII processor to manage the interuption. It works perfectly.

But, I have read in altera docs that the internal interrupt controller is very bad for the performance of the system. Now, I'm trying to switch from internal controller to external controller to have better performance.

In Qsys, I changed the interrupt controller of the NIOSII (from internal to external) and added 5 shadow registers. Then I added a Vectored Interrupt Controller. And I have connected them together. (see attached)Then I have generated the QSYS and compiled my design on Quartus. So far no problem.

Then, in Ecplise, I have generated the .bsp without errors. But when I try to use the alt_ic_isr_register() function, I have this error:

--- Quote Start ---

undefined reference to `alt_ic_isr_register'

--- Quote End ---

In system.h, I can read that I'm working with enhanced API interrupt:

--- Quote Start ---

/*

* System configuration

*

*/

# define ALT_DEVICE_FAMILY "Cyclone IV GX"# define ALT_ENHANCED_INTERRUPT_API_PRESENT# define ALT_IRQ_BASE NULL# define ALT_LOG_PORT "/dev/null"# define ALT_LOG_PORT_BASE 0x0# define ALT_LOG_PORT_DEV null# define ALT_LOG_PORT_TYPE ""# define ALT_NUM_EXTERNAL_INTERRUPT_CONTROLLERS 1# define ALT_NUM_INTERNAL_INTERRUPT_CONTROLLERS 0# define ALT_NUM_INTERRUPT_CONTROLLERS 1# define ALT_STDERR "/dev/jtag_uart"# define ALT_STDERR_BASE 0x40623a0# define ALT_STDERR_DEV jtag_uart# define ALT_STDERR_IS_JTAG_UART# define ALT_STDERR_PRESENT# define ALT_STDERR_TYPE "altera_avalon_jtag_uart"# define ALT_STDIN "/dev/jtag_uart"# define ALT_STDIN_BASE 0x40623a0# define ALT_STDIN_DEV jtag_uart# define ALT_STDIN_IS_JTAG_UART# define ALT_STDIN_PRESENT# define ALT_STDIN_TYPE "altera_avalon_jtag_uart"# define ALT_STDOUT "/dev/jtag_uart"# define ALT_STDOUT_BASE 0x40623a0# define ALT_STDOUT_DEV jtag_uart# define ALT_STDOUT_IS_JTAG_UART# define ALT_STDOUT_PRESENT# define ALT_STDOUT_TYPE "altera_avalon_jtag_uart"# define ALT_SYSTEM_NAME "SOPC_2Dcam"

--- Quote End ---

In my code, I have included the "sys/alt_irq.h".

I have read in NIOS II software developers's handbook:

--- Quote Start ---

The BSP implements the

enhanced API if all drivers support it.

--- Quote End ---

Does anyone know why I have this error?

Is it possible that's coming from the bsp? Not all modules need drivers (see attached)

Could anybody help me?

Thanks a lot.

3 Replies

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

    Use these:

    # include <sys/alt_irq.h># include <priv/alt_legacy_irq.h>
    

    And then alt_irq_register();
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks for your reply!

    I'm not understand why I have to use alt_irq_register() function. Because, in NIOSII software developer's handbook, I have read that I have to use alt_ic_isr_register when I'm using external interrupt controller (see attached).

    And in HAP API Reference:

    --- Quote Start ---

    alt_ic_isr_register()

    Prototype: int alt_ic_isr_register (alt_u32 ic_id,

    alt_u32 irq,

    alt_isr_func isr,

    void*isr_context,

    void*flags)

    Commonly called by: Device drivers

    Thread-safe: Yes.

    Available from ISR: No.

    Include: <sys/alt_irq.h>

    Description: The alt_ic_isr_register() function registers an ISR. If the function is successful, the requested interrupt is enabled on return, and isr and isr_context are inserted in the vector table.

    The function arguments are as follows:

    &#9632; ic_id is the interrupt controller ID as defined in system.h, identifying the external interrupt controller in the daisy chain. This argument is ignored if the external interrupt controller interface is not implemented.

    &#9632; irq is the IRQ number, as defined in system.h, identifying the interrupt to register.

    &#9632; isr is the function that is called when the interrupt is accepted.

    &#9632; isr_context is the input argument to isr. isr_context points to a data structure associated with the device driver instance.

    &#9632; flags is reserved.

    The ISR function prototype is defined as follows: typedef void (*alt_isr_func) (void* isr_context); Calls to alt_ic_isr_register() replace previously registered handlers for interrupt irq. If isr is set to null, the interrupt is disabled.

    &#9632; A driver for an EIC must implement this function.

    Return: This function returns zero if successful, or nonzero otherwise. The function fails if the irq parameter is greater than the maximum interrupt port number supported by the external interrupt controller.

    --- Quote End ---

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

    I don't know, maybe it's required when used with vectored interrupt controller core... I just use the one I've posted before and it works fine.