- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
NOTE: This is not a question, but an information
************************************ The call to read for a /dev/uart returns a wrong value when non-blocking and no data available. This is due to a bug in ip\altera\sopc_builder_ip\altera_avalon_uart\HAL\src\altera_avalon_uart_read.c#241 Instead of return ~EWOULDBLOCK; it should be return -EWOULDBLOCK; otherwise the calling program will receive errno 12 (ENOMEM, "Not enough space") instead of the correct number, 11 (EAGAIN, "No more processes"). (I tried to enter a service request, but was unable to; please forward to the due department in Altera) Seen in Quartus 11.1 and Quartus 12; did not exist in Quartus 9.0sp2.Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you. I am suing 9.1 SP2. I have following lines in the .c file
if (!block) { /* Set errno to indicate the reason we're not returning any data */ ALT_ERRNO = EWOULDBLOCK; break; } else ... ... Is this right?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, that is correct and was not changed. Quartus 9 returns 0 (no chars received):
return count; while Quartus 11 and 12 (and maybe 10) replaced that line by: if(read_would_block) { return ~EWOULDBLOCK; } else { return count; } The bug appears in Quartus 11 and 12 (and maybe 10 also; I don't have it installed).- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm facing the same problem with Quartus Prime 16.0 Lite edition. I have made the following changes to make the fgets function Non Blocking : _serialPort = fopen("/dev/uart_0", "r+"); fd = fileno(_serialPort); fcntl(fd, F_SETFL, O_NONBLOCK); After this it's been set to Non-Blocking, but inside the while loop when I'm passing a "STOP" command (should break out of the while loop) it's not reading the command and goes on continuously. I've tried your method but it's still not working. I've also checked that with getc(_serialPort) "-1" is being returned. Can you please kindly help me with this issue ?
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page