Forum Discussion

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

Elegant way to replace your standard uart isr's ?

Hello,

I know that the avalon uart component has its HAL routines (driver) sitting in the module altera_avalon_uart.c and using header file altera_avalon_uart.h.

So if I want my own driver behave differently than the standard one (for example: I want it to wake a background task only if received character matches the one stored in EOP register) I would need to include my version of the functions alt_avalon_uart_init() and alt_avalon_uart_irq(). This way the linker will see my functions first and will not link the standard library...

The problem I have is that I would like to change some stuff located in the header, too:

- I would like to increase the size of the receiver ring buffer

- I want to add some members to the alt_avalon_uart_dev struct to keep an address of my device and wake my background task only when EOP arrives AND the packet is addressed to my device...

I could call a different header file from my project, but unfortunatelly the auto-generated module alt_sys_init.c will still call the standard header file altera_avalon_uart.h...

I could of course change the standard header file altera_avalon_uart.h but then I would have to remember to change it every time I upgrade quartus/nios SDK.

I feel this is not a very elegant way to replace library modules...

Do you know any more elegant way to re-do the UART driver ?
No RepliesBe the first to reply