aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/microblaze/lib/hal_io.c
diff options
context:
space:
mode:
authorNick Foster <nick@nerdnetworks.org>2010-08-13 12:09:28 -0700
committerNick Foster <nick@nerdnetworks.org>2010-08-13 12:09:28 -0700
commit6bde8e29eb28b746109531553d38fec91a89dc73 (patch)
tree6139aa459f519d6ffebdee858c8c8162be1526be /firmware/microblaze/lib/hal_io.c
parentf09d9820ed40371f552d3a910bc2d8170d290653 (diff)
downloaduhd-6bde8e29eb28b746109531553d38fec91a89dc73.tar.gz
uhd-6bde8e29eb28b746109531553d38fec91a89dc73.tar.bz2
uhd-6bde8e29eb28b746109531553d38fec91a89dc73.zip
Added timeout functionality for UART gets() calls. use fngets_timeout(). timeout defined in hal_uart.h.
Diffstat (limited to 'firmware/microblaze/lib/hal_io.c')
-rw-r--r--firmware/microblaze/lib/hal_io.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/firmware/microblaze/lib/hal_io.c b/firmware/microblaze/lib/hal_io.c
index 18cc34aaf..0e3754958 100644
--- a/firmware/microblaze/lib/hal_io.c
+++ b/firmware/microblaze/lib/hal_io.c
@@ -252,6 +252,15 @@ fngets(hal_uart_name_t u, char * const s, int len)
return (x-s)-1;
}
+int
+fngets_timeout(hal_uart_name_t u, char * const s, int len)
+{
+ char *x = s;
+ while(((*x=(char)hal_uart_getc_timeout(u)) != '\n') && ((x-s) < len)) x++;
+ *x = 0;
+ return (x-s)-1;
+}
+
char *
gets(char * const s)
{