diff options
author | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2013-04-01 00:45:38 +0000 |
---|---|---|
committer | Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> | 2013-04-01 00:45:38 +0000 |
commit | 00e1608501a0eb270df80a31f0dd0b327b202059 (patch) | |
tree | 42c1c49a92dcdfe9a406f31f9adc8ea50ac8c666 /programmer.h | |
parent | da5b17c0a2c648c60272f92c9ecbcd10f4af8348 (diff) | |
download | flashrom-00e1608501a0eb270df80a31f0dd0b327b202059.tar.gz flashrom-00e1608501a0eb270df80a31f0dd0b327b202059.tar.bz2 flashrom-00e1608501a0eb270df80a31f0dd0b327b202059.zip |
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>
Diffstat (limited to 'programmer.h')
-rw-r--r-- | programmer.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/programmer.h b/programmer.h index b10f56894..c36b452f1 100644 --- a/programmer.h +++ b/programmer.h @@ -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: |