This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: Nonblocking UART driver using _write_r - error if no data was written?
- From: Freddie Chopin <freddie_chopin at op dot pl>
- To: newlib at sourceware dot org
- Date: Wed, 26 Feb 2014 08:57:35 +0100
- Subject: Re: Nonblocking UART driver using _write_r - error if no data was written?
- Authentication-results: sourceware.org; auth=none
- References: <CAMym-+z-1ABKQnJaR_eKDTxqk_+0ZgeGdnq_++efJGTBy6o2yA at mail dot gmail dot com>
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