Altera_Forum
Honored Contributor
11 years agoHow to write jtag uart interrupt code ?
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.