Forum Discussion
Altera_Forum
Honored Contributor
13 years agoI think the altera_avalon_uart_read.c module has a bug in the handling of read in the high-speed driver.
the very end of altera_avalon_uart_read() is ... /* Return the number of bytes read */ if(read_would_block) { return ~EWOULDBLOCK; } else { return count; } I think that instead of the 1's compliment of EWOULDBLOCK that it should be returning the 2's compliment (negative) value. The return value of this function (if negative) gets negated (made positive) and stuffed in ALT_ERRNO. The result of retuning ~EWOULDBLOCK is that ALT_ERRNO gets 12 or ENOMEM and not EWOULDBLOCK.