[U-Boot] [Question of dm serial] Is pending handler optional?
Masahiro YAMADA
yamada.m at jp.panasonic.com
Thu Oct 23 17:29:57 CEST 2014
Hi Simon,
I have questions of driver model serial.
The comment block in include/serial.h states .pending is optional
---------------------------->8-------------------------------
* pending() - Check if input/output characters are waiting
*
* This can be used to return an indication of the number of waiting
* characters if the driver knows this (e.g. by looking at the FIFO
* level). It is acceptable to return 1 if an indeterminant number
* of characters is waiting.
*
* This method is optional.
----------------------------8<-------------------------------
When I was testing my driver model conversion patch,
I noticed ctrlc() function would not work without .pending handler.
The function ctrlc() calls tstc()
and if it returns non-zero value, it also calls getc().
If .pending handler is not implemented,
tstc() function always return 1,
even if no input character is available in UART FIFO;
As a result, getc() function will get stuck in
do {
err = ops->getc(cur_dev);
} while (err == -EAGAIN);
loop.
For example, "help" command does not work.
So, .pending is mandatory, isn't it?
One more question.
The comment says .pending is:
Check if input/output characters are waiting
Should .pending check output buffer? or input only?
--
Best Regards
Masahiro Yamada
More information about the U-Boot
mailing list