Forum Discussion

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

Handling interrupt under eCos

Hi,

I am evaluating eCos 2.0 on NIOS II 5.0 (on Windows 2000). For it I am using the port 'nios2ecos50.exe', obtained from download section of this forum.

I wanted to measure the interrupt latency, but not able to handle the interrupt. I have tried it with clock and PIO buttons. But, the similar program is running on NIOS without eCos, there I am able to handle the corresponding interrupts generated by clock and buttons.

Can anyone please clarify what may be the problem, and how can I rectify it?

With regards,

Sanjay

6 Replies

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

    --- Quote Start ---

    originally posted by sanjay822@Dec 21 2005, 07:20 AM

    hi,

    i am evaluating ecos 2.0 on nios ii 5.0 (on windows 2000). for it i am using the port 'nios2ecos50.exe', obtained from download section of this forum.

    i wanted to measure the interrupt latency, but not able to handle the interrupt. i have tried it with clock and pio buttons. but, the similar program is running on nios without ecos, there i am able to handle the corresponding interrupts generated by clock and buttons.

    can anyone please clarify what may be the problem, and how can i rectify it?

    with regards,

    sanjay

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=11691)

    --- quote end ---

    --- Quote End ---

    Your program will need re-writing to run under eCos I am surprised that your program compiled and linked! The API&#39;s for registerring an ISR are different i.e. alt_irq_register is replaced by HAL_INTERRUPT_ATTACH. For more information you need to read the eCos documentation which is found in altera\kits\nios2\components\ecos\doc\html\index.html
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi rugbybloke,

    The file hal_intr.h, which contains all the protypes of interrupt handlers API, doesn&#39;t define the vector no.s for the interrupts. i have used TIMER_0_IRQ = 1 for the vector no. in cyg_interrupt_create for timer, but of no use.

    Can you tell the vector no.s corresponding to interrupts?

    If I want to test the clock interrupt, then I have to access the timer register. Then the code for timer register access can&#39;t be normally compiled under eCos?

    Thanks & regards,

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

    --- Quote Start ---

    originally posted by sanjay822@Dec 22 2005, 06:42 AM

    hi rugbybloke,

    the file hal_intr.h, which contains all the protypes of interrupt handlers api, doesn&#39;t define the vector no.s for the interrupts. i have used timer_0_irq = 1 for the vector no. in cyg_interrupt_create for timer, but of no use.

    can you tell the vector no.s corresponding to interrupts?

    if i want to test the clock interrupt, then i have to access the timer register. then the code for timer register access can&#39;t be normally compiled under ecos?

    thanks & regards,

    sanjay

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=11730)

    --- quote end ---

    --- Quote End ---

    I assume by vector no.s you mean the IRQ number. This is configurable you should launch SOPC Builder to look at the system you&#39;re using this will have the interrupt number. There are also# defines for each of these, look in the system.h file.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi,

    Thanks rugbybloke for your point.

    But I want to stress out some more points on it. While registering interrupt in NIOS, we use alt_irq_register (), which requires IRQ nos., which are defined in system.h. But, the corresponding interrupt registration in ecos is done by using cyg_interrupt_create () & cyg_interrupt_attach (). cyg_interrupt_create () requires interrupt vector nos. (analogous to IRQ nos. in alt_irq_register, i think). For other architectures which support ecos, i have seen these vector nos. are defined in hal_intr.h (altera\kits\nios2\components\ecos\ecos-current\packages\hal\ARCHITECURE\arch\current\include), but didn&#39;t find in case of nios.

    And the other thing was that if we want to use the clock api of ecos, then the hardware timer has to be accessed. Then how can we compile such a code normally under ecos?

    Thanks & regards,

    Sanjay