diff options
author | Sean Anderson | 2022-05-17 13:55:07 -0400 |
---|---|---|
committer | Tom Rini | 2022-06-06 18:01:21 -0400 |
commit | fb84517d52aa24b5b8bad6abc228459a146b6ba5 (patch) | |
tree | 6294a1802f0032cdd031dbd58ea5c466f13406a6 /lib/Kconfig | |
parent | bc8e09811e248287d1964ec6bba60c56235a23f2 (diff) |
serial: smh: Fake tstc
ARM semihosting provides no provisions for determining if there is
pending input. The only way to determine if there is console input is to
do a read (and block until the user types something). For this reason,
we always return true for tstc (since you will always get input if you
try). However, this behavior can cause problems for code which expects
tstc to eventually be empty. In query_console_serial, there is the
following construct:
/* empty input buffer */
while (tstc())
getchar();
with the current implementation, this effectively turns into an infinite
loop. To avoid this, fake tstc by returning false half of the time. This
is generally OK because the other common construct looks like
do {
if (tstc())
process(getchar());
} while (!timeout());
so it's fine if we only read a new character every other loop. This will
break things like CYGACC_COMM_IF_GETC_TIMEOUT, but that could be
reworked to test on the timeout instead of calling tstc again (and
ymodem over semihosted serial is not that useful in the first place).
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Diffstat (limited to 'lib/Kconfig')
0 files changed, 0 insertions, 0 deletions