Forum Discussion

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

Bug in altera_16550_uart_init.c (altera_16550_uart_init function)

Hello,

I had a problem with interrupt handling with the 16550 core.

Presumably a programming error in the C code of the component:

The uart did not process receive interrupts properly from the start.

What follows is an exact copy of the nios code for the uart:

altera_16550_uart_init.c line 439:

/* enable interrupts at the device */

regs = iord_altera_16550_uart_ier(sp->base);

regs |= altera_16550_uart_ier_erbfi_msk | altera_16550_uart_ier_etbei_msk;

iowr_altera_16550_uart_ier(base, sp->ctrl);

}

Should be:

altera_16550_uart_init.c line 439:

/* enable interrupts at the device */

sp->ctrl = iord_altera_16550_uart_ier(sp->base);

sp->ctrl |= altera_16550_uart_ier_erbfi_msk | altera_16550_uart_ier_etbei_msk;

iowr_altera_16550_uart_ier(base, sp->ctrl);

}

=> reading the interrupt enable register, modifying the read contents and then writing the result back using a different value does not make sense.

Best Regards,

Johi.
No RepliesBe the first to reply