Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12603 Discussions

How to write jtag uart interrupt code ?

Altera_Forum
Honored Contributor II
1,931 Views

I made a Nios II embedded system, which the jtag uart module interrupt connects with the inner interrupt controller inside the Nios II.  

I try to write a c program to implement the interrupt, so I checked but it looks like there are no demo code. Then I checked jtag uart driver and wrote code as following: 

# include "..\ddr3_test_bsp\HAL\inc\sys\alt_irq.h"# include "..\ddr3_test_bsp\drivers\inc\altera_avalon_jtag_uart.h" 

 

int main() 

 

altera_avalon_jtag_uart_state jtag_strc; // create the structure 

jtag_strc.base = JTAG_UART_BASE;  

altera_avalon_jtag_uart_init(&jtag_strc,JTAG_UART_IRQ_INTERRUPT_CONTROLLER_ID,JTAG_UART_IRQ); 

 

 

....... 

 

 

My question is: inside the function "altera_avalon_jtag_uart_init()": 

 

alt_ic_isr_register(irq_controller_id, irq, altera_avalon_jtag_uart_irq, sp, NULL); 

 

But interrupt handler altera_avalon_jtag_uart_irq() is a fixed function. If when the interrupt happens, I want to call the custom function which I create by myself (e.g.: I want to light up a led or print something in console), how should I do?  

 

If someone can provide the reference code, it will be great. 

 

Thanks in advance.
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
1,076 Views

There is nothing special about the JTAG UART and writing an interrupt handler for it would be the same as for any other device. 

 

It's a bit old, but this example is as good a starting point as any if you've never done that before: 

http://www.altera.com/support/examples/nios2/exm-developing-hal-drivers.html 

 

If you are trying to avoid cascading from your own ISR to the Altera HAL driver one, probably the easiest thing would be to clone the Altera HAL driver locally and modify it how you see fit.
0 Kudos
Reply