Nonblocking UART driver using _write_r - error if no data was written?

Freddie Chopin freddie_chopin@op.pl
Wed Feb 26 07:57:00 GMT 2014


Just a guess - if you want it to be non-blocking, did you open() it with 
appropriate flag (O_NONBLOCK)? You cannot use fopen() for that - you 
have to act on fd, as only open() accespts it... Maybe try to reopen 
your stream with the flag and then use fdopen()?

Another thing - if the driver is non-blocking I think (I'm not sure) 
that there will be no loop to send everything - the functions you use 
(printf, flush, ...) would probably set errno to EBUSY (or EAGAIN) and 
"fail"...

If you have two "threads" anyway (main loop and interrupts) it's very 
easy to turn that into a simpler case of blocking.

Regards,
FCh



More information about the Newlib mailing list