[En-Nut-Discussion] Bugs in Uart.c

Ole Reinhardt ole.reinhardt at embedded-it.de
Tue Mar 25 21:57:27 CET 2008


Hi Moritz,

> usart.c. Here are some things I think should be changed:
> 
> 1: UsartRead
> if (NutEventWait(&rbf->rbf_que, dcb->dcb_rtimeout)) {
> should be
> if (NutEventWait(&rbf->rbf_que, dcb->dcb_rtimeout) == -1) {
> 
> As NutEventWait returns 0 or -1 the if-statement will always be false. 

-1 evaluates to true!! In other words in C everything except 0 evaluates
to true! So "if (NutEventWait(&rbf->rbf_que, dcb->dcb_rtimeout))" works
correct. No changes needed!?

Bye,

Ole Reinhardt

-- 
 _____________________________________________________________
|                                                             |
| Embedded-IT          Hard- und Softwarelösungen             |
|                                                             |
| Ole Reinhardt        Tel. / Fax:        +49 (0)271  7420433 |
| Luisenstraße 29      Mobil:             +49 (0)177  7420433 |
| 57076 Siegen         eMail:    ole.reinhardt at embedded-it.de |
| Germany              Web:         http://www.embedded-it.de |
|                      UstID / VAT:       DE198944716         |
|_____________________________________________________________|




More information about the En-Nut-Discussion mailing list