Forum Discussion
Altera_Forum
Honored Contributor
16 years agoHi,
Here's how I have solved it: 1) Copy altera_avalon_uart_read.c file (from C:\Altera\91\ip\altera\sopc_builder_ip\altera_avalon_uart\HAL\src directory) to your local project directory (so that it's compiled with your sources and thus will override the Altera's version). 2) Modify the altera_avalon_uart_read() function's (the FAST DRIVER version at the end of the file) last line return count; to if (!block && count == 0 ) return -EWOULDBLOCK; else return count; This way getc() call will not block if O_NONBLOCK is used. I remember reporting this to Altera several years ago as a bug because the JTAG UART does it like this and can handle O_NONBLOCK correctly, but the normal UART can't. But it has not been fixed yet ... Jari