1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-07-01 22:21:16 +02:00

Replace sp_sync_read_timeout() with serialport_read_nonblock()

It seems useful to have a generic and platform-independent method to
read and write to a serial port without blocking. This is the read part.

It stores the current blocking properties before disabling blocking and
restores them after reading. The timeout is implemented as previously
by retrying every millisecond until the timeout is reached or enough
characters are available.

Corresponding to flashrom svn r1661.

Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
This commit is contained in:
Stefan Tauner
2013-04-01 00:45:38 +00:00
parent da5b17c0a2
commit 00e1608501
3 changed files with 75 additions and 24 deletions

View File

@ -661,6 +661,7 @@ extern fdtype sp_fd;
int serialport_shutdown(void *data);
int serialport_write(unsigned char *buf, unsigned int writecnt);
int serialport_read(unsigned char *buf, unsigned int readcnt);
int serialport_read_nonblock(unsigned char *c, unsigned int readcnt, unsigned int timeout, unsigned int *really_read);
/* Serial port/pin mapping: